Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jul 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unexpected t_string!

    PHP Code:
    <?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?

  • #2
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,266
    Thanks
    6
    Thanked 48 Times in 48 Posts
    PHP Code:
    mysql_select_db($config[4],$con) or exit('Database dosen\'t exist') ; 
    or
    PHP Code:
    mysql_select_db($config[4],$con) or exit("Database dosen't exist") ; 

  • #3
    New to the CF scene
    Join Date
    Jul 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Now it's making even more fuss
    PHP Code:
    <?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.
    Last edited by Miles; 07-24-2007 at 03:59 PM.

  • #4
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,266
    Thanks
    6
    Thanked 48 Times in 48 Posts
    You'll need to use something like http://www.php.net/mysql_result


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •