Script issue
Hoping someone can help me out. On my linode I have mysql, php & apache, and im trying to write a script to pull info from my database, but I keep getting this error:
> PHP Parse error: syntax error, unexpected TLOGICALOR in /var/www/vhosts/xxx.net/httpdocs/Tim/dbconnect.php on line 24, referer:
Heres the script:
But I cant figure out the prob :/ Can anyone help?
Kind Regards,
Justin
Edit by Jed Smith: Removed database credentials.
12 Replies
if (empty($you)) OR (empty($others));
should be
if ((empty($you)) OR (empty($others)))
````
$firstname = $_POST['firstname'];
$middlename = $_POST['middlename'];
$lastname = $_POST['lastname'];
$sex = $_POST($sex);
$emailaddress = $_POST['emailaddress'];
.
.
$query = "INSERT INTO ifdbt0 (memberid, firstname, middlename, lastname, sex, emailaddress) VALUES ('', '$firstname', '$middlename', '$lastname',
I hope you're going to do some sanity checks
Also, that second to last semicolon in your insert statement should be a single quote.
~JW
@webc0der:
$query = "INSERT INTO ifdbt0 (memberid, firstname, middlename, lastname, sex, emailaddress) VALUES ('', '$firstname', '$middlename', '$lastname', '$sex', '$emailaddress;)";
Missing ' after $emailaddress (appears to have been replaced with a ; )
@BarkerJr:
Yeah, it's much better to not use database passwords and use IP-based authentication instead.
Woah, no way. IPs can be spoofed, although you'll have trouble getting return traffic unless you're on a LAN. Except Linodes are.
If you want to go the IP-auth route, use it in combination with a password; MySQL makes that easy, especially if you use phpMyAdmin to set it up (it's a dropdown on the create account page).
@webc0der:
$host='localhost';
Good luck trying to spoof that one from anywhere;)
@Stever:
@webc0der:$host='localhost';
Good luck trying to spoof that one from anywhere;)
You didn't pay enough attention to his post:
> PHP Parse error: syntax error, unexpected TLOGICALOR in /var/www/vhosts/xxx.net/httpdocs/Tim/dbconnect.php on line 24, referer:
Notice the hostname there
@Guspaz:
@Stever:
@webc0der:$host='localhost';
Good luck trying to spoof that one from anywhere;) You didn't pay enough attention to his post:
> PHP Parse error: syntax error, unexpected TLOGICALOR in /var/www/vhosts/xxx.net/httpdocs/Tim/dbconnect.php on line 24, referer:http://xxx.net/Tim/Registration.htm Notice the hostname there
:P
True 'nuff but look at the directory pathname – possible he had /etc/hosts entry like: 127.0.0.1 xxx.net localhost