...

View Full Version : Unexpected t_string!



Miles
07-24-2007, 01:34 PM
<?php

unset($config) ;
$config[1] = ("127.0.0.1");
$config[2] = ("root");
$config[3] = ("removed") ;
$config[4] = ("invision") ;
$con = @mysql_connect($config[1],$config[2],$config[3]) or die(mysql_error()) ;
mysql_select_db($config[4],$con) or exit('Database dosen't exist') ;

?>
It says 'unexpected T_STRING on line 9', and I'm not sure what's rong! I've checked and it works on anohter script, but this dosen't!

EDIT:
Ah, I see. It dosen't like apostrophes. How can I add one without it messing it all up?

Nightfire
07-24-2007, 02:14 PM
mysql_select_db($config[4],$con) or exit('Database dosen\'t exist') ;

or


mysql_select_db($config[4],$con) or exit("Database dosen't exist") ;

Miles
07-24-2007, 04:48 PM
Now it's making even more fuss
<?php
include ("config.php");
$givenname = $_POST['name'];
$givenpass = $_POST['pass'];
$tmppass = mysql_query("SELECT password FROM users WHERE username='$givenname'") or die ("User $givenname dosen't exist!");
echo $tmppass;
if ($givenpass == $tmppass)
{
echo "login successful generating sso ticket for you now";
$rand1=mt_rand(100000,999999);
$rand2=mt_rand(10000,99999);
$rand3=mt_rand(10000,99999);
$rand4=mt_rand(10000,99999);
$rand5=mt_rand(10000,99999);
$rand6=mt_rand(0,9);
$ticket="ST-".$rand1."-".$rand2.$rand3.$rand4.$rand5."-es-fe".$rand6 ;
mysql_query("UPDATE users SET ssoticket='$ticket' WHERE username='$username'");
}
else
{
echo "bad pass or w/e";
}

?>

It always sayd that I entered bad pass. The pass that it echoes is 'Resource id #3'
Why oh why can't I get any peace from php.

Nightfire
07-24-2007, 05:27 PM
You'll need to use something like http://www.php.net/mysql_result :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum