-
Echo the name of a variable?
Date: 02/03/06
Keywords: no keywords
Let's say I'm passing a variable to a function.
Example:
function upload_data($array_name, $other_stuff)
{
magic code of wonder
}
Is there any way to echo the name of the array passed in as the argument for $array_name
?
Edited to add:
an echo statement on $array_name returns the text Array
. What I want is the name of the array that is passed into this function. For example, if I were to type:
upload_data($foo, $bar)
I would like to be able to echo "foo". Not the array contents, or the value of the variable, but the name of the variable itself.
Source: http://community.livejournal.com/php/407079.html
-
Help needed with login script..
Date: 02/03/06
Keywords: php, mysql, html, database, sql
I have the following login script when it logs in it just goes straight to back to the login page. Now I've worked out it's something to do with the else or if ( $num != 0) statement as when commented out it goes thru ish but it doesn't print the $msg variable which I have an echo statement calling on it in the html body..The session start/auth isn't being worked on atm hence why it's been commented out.
#set variables
$usr = $_POST['username'];
$pass = $_POST['password'];
$self = $_SERVER['PHP_SELF'];
/*#Start session and auth it
if (isset( $usr ) and isset( $pass ) )
{
session_start();
$_SESSION['authorized'] = 'ok';
$url = (isset($_GET['url'])) ? $_GET['url'] : 'index.php';
header("Location: $url");
}*/
#check form not empty
if ( (!$usr) or (!$pass) )
{
header ("Location:{$_SERVER['HTTP_REFERER']}");
exit();
}
#connect to sql db
$conn = @mysql_connect( "localhost", "xxx", "xxx" ) or die( "Could not connect to SQL" );
$rs = @mysql_select_db ( "xxx", $conn ) or die ( "Could not select database" );
#select db
$sql = 'select * from users where \'user_name\'=\'$username\' and \'password\'= password(\'$password\')';
#execute the query
$rs = mysql_query($sql, $conn) or die ( 'Could not execute query' );
#get no. of matching rows
$num = mysql_num_rows ( $rs );
#check for match
if ($num != 0 )
{
$msg = 'Welcome $usr - you are now logged in';
}
else
{
header ("Location:{$_SERVER['HTTP_REFERER']}");
exit ();
}
Source: http://community.livejournal.com/php/406868.html
-
Accurint/LexisNexis
Date: 02/03/06
Keywords: no keywords
I know this is a very long shot, but has anyone here had success implementing SOAP procedures with LexisNexis|Accurint? I'm working on a project with a 12 hour-from-now deadline, and LexisNexis tech support have all decided to go home.
If this is you;
[Exception] => stdClass Object
(
[Code] => 401
[Audience] => user
[Message] => [Moxie] Insufficient privilege to run the function
)
*scratches head*
Source: http://community.livejournal.com/php/406528.html
-
PHP5/Apache2/MySQL - Undefined Function mysql_connect
Date: 02/02/06
Keywords: php, mysql, sql, apache
Hi,
I'm trying to set up WAMP. I've got Apache and MySQL running. PHP installed into Apache.
PHPInfo() renders correctly, but there are no MySQL modules installed.
Apache's httpd.conf contains:
LoadModule php5_module /development/php/php5apache2.dll
addtype application/x-httpd-php .php .php4 .php5 .php3 .htm .inc
addtype application/x-httpd-php-source .phps
PHPIniDir "/development/php/php.ini"
Php.ini contains:
extension_dir = "./ext"
extension=php_mysql.dll
It's on windows, but on a USB key, so I'm using relative paths (/development is in the root of the USB drive and appears to correctly point to the right location whenever the usb key is mounted in any machine)
Any suggestions?
Source: http://community.livejournal.com/php/406456.html
-
First time here
Date: 02/01/06
Keywords: php, java, shopping
And so, I must ask the obligatory "Stupid question".
I have not been using PHP very long (which will become obvious here
shortly). I use an online shopping cart that is PHP and open source and
am having EXTREME difficulty trying to figure out where to place a
custom javascript just to simply make an image I have open up a smaller
window with a flash music player in it. To make a long story short,
here is the post I made in the (not very helpful at times) community
for the cart I use. Click here.
Source: http://community.livejournal.com/php/406130.html
-
Passing variables from JS to PHP
Date: 02/01/06
Keywords: php, java, google
Hi -- I ran into problem passing variables from Javascript to PHP server side.
Below is the relevant fragment of the code
"angle"form name="Form1" action=""angle"?php echo $PHP_SELF ?"angle" " method="post""angle"
"angle"input type="hidden" name="latctr" /"angle"
...
"angle"/form"angle"
JS:
var center = map.getCenterLatLng(); ---- Google Maps API ----
document.Form1.latctr.value = center.y;
alert (document.Form1.latctr.value); ---- displays the value all right ----
PHP:
$latctr = $_POST['document.Form1.latctr.value'];
-- or --
$latctr = $_POST['latctr'];
neither one works ($latctr is blank).
Any hints or relevant links are appreciated. I tried to search google groups and some other forums and I don't see what I'm doing different compared to suggested solution with hidden variables and _POST method.
Source: http://community.livejournal.com/php/405768.html
-
Adding text
Date: 02/01/06
Keywords: php
I'm a beginner when it comes to PHP coding so odds are these questions will be quite easy for some of you to answer as I know it can be done.
When posting form data using PHP, how do I make the PHP script add:
1) Add a
tag for every line break made in the post (LJ does this as do most blogs so I know this can be done)
2) Add http://www.mysite.com"> around links that are just typed as http://www.mysite.com
Thank you in advance!
Source: http://community.livejournal.com/php/405202.html
-
Little help please.
Date: 01/31/06
Keywords: php, html
Wondering if someone can give me a hand with this code I'm trying to use. I can't find my error so I'm hoping someone can be my second eyes and catch it. I used a tutorial as I'm quite a newbie to php so anyone that can help, I'll be grateful.
I get this error - "Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in /home/silveri/public_html/beta/index.php on line 7"
Here is the code from index.php that I'm trying to use:
require_once("lib/template.php");
$page = new Page("template.html");
$page->replace_tags(
array(
"title" => "HOME",
"descript" => "Welcome to my website!",
"main" => "dat/index.dat",
"menu" => "dat/menu.dat",
"left" => "dat/submenu.dat",
"right" => "dat/right.dat",
"footer" => "dat/footer.php"
);
);
$page->output();
?>
Is there something I missed?
Update After many hours and with some help, problem fixed.
Source: http://community.livejournal.com/php/404849.html
-
debugging/tracing
Date: 01/31/06
Keywords: cms, php
i've inherieted a project that isn't well-documented, and am having trouble figuring out what it's doing. the user will click through something like http://www.cms.net/manage.php?reset_id=900. manage.php makes no mention of reset_id, but there are several include files. those include files include other files, and all of them are big and messy. i need to change what's happening when the reset_id flag is sent, but i can't find where that's being handled. is there any way to trace this so i can figure out what file is actually doing the work?
Source: http://community.livejournal.com/php/404591.html
-
Folder Permissions
Date: 01/29/06
Keywords: php
I am trying to make an automated script that creates several directories and files. However, when I use mkdir(),
it makes the folders not able to be deleted by me because the ownership
is set to nobody and I cannot change their permissions once they are set using the mkdir() function.
I've tried using ftp_mkdir() also but I cannot find out how to change permissions on the folder through PHP's FTP functions so my script can't write files to the folders.
What can I do to make the folders deleteable and be able to change
their permissions or use FTP to change the permissions?
Thanks.
(I'm using PHP 4.4.1)
Source: http://community.livejournal.com/php/403484.html
-
PHP messing with HTML?
Date: 01/28/06
Keywords: php, html
I am definatly no where near as good as most of you with PHP, but I have been coding HTML for about 6 years and I like to think I'm pretty good at it. In my most recent project I was using php pages (eg ?p=whatever), and I have used this type of navigation before, however on this recent project it seems to be screwing with my tables. The weird thing is, If I click refresh the tables fix themselves, But whenever the page loads it ALWAYS messes them up (screws with the alignment)
to see what I mean check out saintsstudios.com.
If anyone here can tell me how to fix this it would be greatly appreciated.
Source: http://community.livejournal.com/php/403210.html
-
Little Help?
Date: 01/27/06
Keywords: php, html, web
I've got this mailing script, it's a work in progress, I'm getting this error:
Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/xxxx/public_html/mailer2.php on line 55
Line 55 is this: $form .= "
-
php and xml
Date: 01/27/06
Keywords: php, mysql, xml, sql
hi, i'm looking for any possible tips, i'd created some content which i've got in an xml file;
Welcome
spew of test1
Contact
spew of text2
and i'm wondering what's the best way of going about parsing it? my current method only returns the whole file, where as i'll only need of the two at any one time.
any tips, links, suggestions, tutorials?
x-posted to php and php_mysql
Source: http://community.livejournal.com/php/402765.html
-
PHP client for asp.net webServices
Date: 01/26/06
Keywords: php, web
Dear all,
I am not a major php programmer but need to connect a bit of php code
to my .net WebServices. I organized pretty much everything and it sort
of works. I am , though, having a problem with string[] that is
returned from the web services.
Basically, what I need is this:
connect to web service,
call a method (and pass params to it),
get the result.
it works. but the result is something I am having problems with. when it's a string or a number, it all works fine. when it is Array, ArrayList or string[] it's not working well for me.
I run a soap request with all the params that need to go with it and
the var_dump() for it will look like this:
$res = $client->GetSerialsPlainReq($params);
var_dump($res) :
object(stdClass)#5 (1) { ["GetSerialsPlainReqResult"]=>
object(stdClass)#4 (1) { ["string"]=> array(5) { [0]=> string(41)
"71ce347b-6780-4b91-95e1-462c24562bca" [1]=> string(41)
"eb26a8f3-5678-41b1-a55d-ca10c0775f55" [2]=> string(41)
"1c2c4e90-a3c8-47a2-9f31-41907f080f92" [3]=> string(41)
"cfbc4bdd-3371-4671-a8d2-f50b3807b020" [4]=> string(41)
"ba4e9628-0e55-4a0c-97f0-08e415cc3e5f" } } }
$xa = array($res->GetSerialsPlainReqResult);
var_dump($xa) :
array(1) { [0]=> object(stdClass)#4 (1) { ["string"]=> array(5) { [0]=>
string(41) "3ed8ed42-65b5-49ed-bb88-ebf5c1759f31" [1]=> string(41)
"609921ac-2360-46ad-a3df-c5a61a930a49" [2]=> string(41)
"609921ac-2360-46ad-a3df-c5a61a930a49" [3]=> string(41)
"609921ac-2360-46ad-a3df-c5a61a930a49" [4]=> string(41)
"609921ac-2360-46ad-a3df-c5a61a930a49" } } }
5 Guids - exactly what the web service needed to return.
What I can't do is "convert" the $res or $xa into something I will be
able to index with something like "foreach ($guid as $res){}" to print the
guids to the user.
Thanks for all of your answers.
P. S. Or, instead, shall I be returning something different then
string[] from my web services?
Source: http://community.livejournal.com/php/402460.html
-
If $variable contains....
Date: 01/26/06
Keywords: mysql, sql, spam
Can someone help me out with a spam protection?
How do I make a query like this:
if $blahblah CONTAINS (http:// || www. || something) { do something }
So, it's not an exact match, but something that matches anything of the submitted text. It's for a spam protection in a MySQL Guestbook, if that helps...
Thnx! :)
Source: http://community.livejournal.com/php/402335.html
-
CMS
Date: 01/25/06
Keywords: cms, php, mysql, asp, sql, web
Following up from my last post, are there any good CMSes out there for a really small site?
I mostly use my personal site as a support resource for online roleplaying games that I run, but I'm tired of needing to upload to the site by FTP whenever I want to change one little thing on a page. At the same time, I like have a visual basis for character sheets and so on... (http://www.patchwolf.com/phoenixcrusade/terpsichore.php for an example). I'd also like to give my players the chance to add stuff directly to the site -- kind of like a wiki.
Of particular concern are the character sheets, where I'd like to still be able to change one detail (like the current form aspect on the example sheet -- currently controlled by an in-page variable), which then affects several other aspects (strength, stamina, health, etc....)
A good mate of mine uses Qwikiwiki (http://www.qwikiwiki.com), which uses a flat-file system -- but if I want to have a hope of maintaining a visual basis on any part of the site, Qwikiwiki's not going to cut it. While I have PHP and MySQL on my web host, I don't actually
run the server myself, so that's also something to take into consideration.
Any ideas?
Source: http://community.livejournal.com/php/401978.html
-
Looking for testimonials
Date: 01/25/06
Keywords: cms
Has anyone used the TYPO3 (http://typo3.com) CMS?
I'm considering something like this for my site, and I wondered if anyone had some experience with it or some stories to share that would give me some more info?
Source: http://community.livejournal.com/php/401835.html
-
Download script for mp3s
Date: 01/24/06
Keywords: php, browser, database
I have mp3s from my album in a folder on the site. Then I have downloads.php?id=#, which reads the details of the id from the database and constructs the url of the file then sends that to the browser. It's definitely getting the right file...
Is it ok to use header location: to give out the file to the browser for a media file? I'm getting the code instead of the binary file when I try to download.
This was not happening on my WAMP dev server and is definitely happening on my LAMP production server. I'm wondering if it's a php thing or a server environment thing?
It's php 4.3.10, btw.
Any suggestions? My site is so close to being done!
Thanks!
Source: http://community.livejournal.com/php/401592.html
-
isset on multi-dimensional arrays
Date: 01/23/06
Keywords: no keywords
This may or may not be the best way to do this, but now I am curious.
I have this function call:
if(!auth_user($_SESSION['USER']['AUTH']['username'], $_SESSION['USER']['AUTH']['password']))
{
graceful_exit();
}
to verify a users username and password is stored. I am getting undefined index errors because some of those keys may not exist when calling the function. So how do I verify that 'USER', 'AUTH', 'username' and 'password' are present?
I cant do this:
if(!isset($_SESSION['USER']['AUTH']['username']))
{
graceful_exit();
}
because I get same errors.
Any advice would be appreciated.
Thanks
Source: http://community.livejournal.com/php/400681.html
-
UK PHP Programmer Job Ad
Date: 01/23/06
Keywords: php, programming, css, html, technology, database, sql, java, web, linux, apache
Dear PHP-UG,
I hope this is not too OT. But as far as I’m concerned, a good LAMP programmer worth his salt is also member of various PHP user groups, so while looking for one right now, this seemed very obvious to me.
JOB TITLE & LOCATION:
PHP Web Programmer based in Crawley, West Sussex RH10 9GA
COMPANY OVERVIEW:
ViewSonic is a leading worldwide provider of advanced display technology, including computer monitors, flat panel displays and projectors for today's business, education, entertainment, Internet and professional markets. The company employs more than 600 people worldwide. More than 400 are based at the company's headquarters in Walnut, California, and more than 100 employees within our 12 offices across Europe. Other affiliate offices can be found in Taiwan, China, Canada, Australia and Latin America.
SUMMARY:
This is a recently created position responsible to develop application code and take part in the application design process as member of a team dedicated to develop Web-based business applications which may subsequently be used by employee partners, business partners as well as the general public alike. The applicant must possess a wide range of web-related technical as well as interpersonal and time management skills with a very strong emphasis in experience in the scripting languages and architectures outlined below.
EDUCATION:
University degree not required, but any formal education related to web application development considered favourably. Any informal, yet related education will be considered as well.
LANGUAGE:
Excellent written and oral command of English.
Excellent written and oral command of further languages common in Europe considered a great plus.
EXPERIENCE:
Several years developing and designing web-based applications using the languages, architectures, programs and tools listed in the technical skills sub-section.
Technical Skills / Experience: (Essential / Desired)
• PHP5 including OOP (E)
• HTML & CSS1+2 (able to hand-code) (E)
• Usage of PHP programming IDE e.g. Zend Studio (D)
• JavaScript / DOM (E)
• SQL (E) and basic Database Design (D)
• Web Publishing Methodologies (FTP, SCP, CVS etc) (E)
• Smarty Templating Engine (D), Ajax libraries (D)
• Version Control (CVS, Subversion SourceSafe etc) (D)
• Apache Configuration and Administration (D), UTF-8 web setups (D)
• Comfortable with Linux BASH / Shell Console (D)
• Photoshop (D)
• Plaintext Editor with Syntax Highlighting (UltraEdit, Textpad, Vim etc) (E)
SALARY & TYPE
Negotiable, based upon experience. 12 months contract.
CONTACT
Please send your CVs (cover letter would be nice) to sue.pegrum@viewsoniceurope.com with the subject line "web programmer"
Thanks!
-Armin
Source: http://community.livejournal.com/php/400439.html