Page 1 of 1

I am lost..

Posted: Fri Apr 02, 2004 2:58 pm
by ol4pr0
Oke all works the db insert and all that.. however below i got 2 examples ..

AT the first i thought this had somehting to do with my db connecting but .. seems it didnt.

1st works fine ( without the if statements )
2nd doesnt anymore.. ( with the if .. )

Code: Select all

if (isset($_COOKIE['USERNAME']) && isset($_COOKIE['PASSWORD']))
    {
        // Get values from superglobal variables
        $USERNAME = $_COOKIE['USERNAME'];
        $PASSWORD = $_COOKIE['PASSWORD'];
                                                                                                                             
        $date = ("m.d.y");
        $host = "10.10.10.5:1433";
        $usr = "sa";
        $pwd = "sa";
        $msdb = "tms";
        $mstb = "upload";
                                                                                                                             
                                                                                                                             
        $connect = @mssql_connect($host, $usr, $pwd)
                or die ("Coudnt connect to the mssql, please contact the site administrator immediatly");
                                                                                                                             
        $select = @mssql_select_db($msdb, $connect)
                or die ("Couldnt select the ms db, please contact the site administrator immediatly");
                                                                                                                                                                                                                                                       
        $email = ('blah@blah.com');
        $codigo_operador = '1';
        $clave = '2';
                                                                                                                             
        $query = "INSERT INTO upload (username, email, codigo_operador, clave)
         VALUES ('$USERNAME', '$email', '$codigo_operador', '$clave')";
                                                                                                                             
        if (mssql_query ($query, $connect))
      {
                                                                                                                             
        echo ("");
                                                                                                                             
        }

                                                                                                                             
                                                                                                                             
        $CheckSecurity = new auth();
        $check = $CheckSecurity->page_check($USERNAME, $PASSWORD);
    }
    else
    {
        $check = false;
    }
                                                                                                                             
        if ($check == false)
        {
.. and a little more.. which works fine..
2nd with the if statement doesn work..

Code: Select all

if (isset($_COOKIE['USERNAME']) && isset($_COOKIE['PASSWORD']))
    {
        // Get values from superglobal variables
        $USERNAME = $_COOKIE['USERNAME'];
        $PASSWORD = $_COOKIE['PASSWORD'];
                                                                                                                             
        $date = ("m.d.y");
        $host = "10.10.10.5:1433";
        $usr = "sa";
        $pwd = "sa";
        $msdb = "tms";
        $mstb = "upload";
                                                                                                                             
                                                                                                                             
        $connect = @mssql_connect($host, $usr, $pwd)
                or die ("Coudnt connect to the mssql, please contact the site administrator immediatly");
                                                                                                                             
        $select = @mssql_select_db($msdb, $connect)
                or die ("Couldnt select the ms db, please contact the site administrator immediatly");
                                                                                                                                                                                                                                                       
         if ($username == 'test') {     
        $email = ('blah@blah.com');
        $codigo_operador = '1';
        $clave = '2';
                                                                                                                             
        $query = "INSERT INTO upload (username, email, codigo_operador, clave)
         VALUES ('$USERNAME', '$email', '$codigo_operador', '$clave')";
                                                                                                                             
        if (mssql_query ($query, $connect))
      {
                                                                                                                             
        echo ("");
                                                                                                                             
        }

 }                                                                                                                            
                                                                                
        if ($username == 'test1') {     
        $email = ('blah@blah2.com');
        $codigo_operador = '3';
        $clave = '3';
                                                                                                                             
        $query = "INSERT INTO upload (username, email, codigo_operador, clave)
         VALUES ('$USERNAME', '$email', '$codigo_operador', '$clave')";
                                                                                                                             
        if (mssql_query ($query, $connect))
      {
                                                                                                                             
        echo ("");
                                                                                                                             
        }

 }  

$CheckSecurity = new auth();
        $check = $CheckSecurity->page_check($USERNAME, $PASSWORD);
    }
    else
    {
        $check = false;
    }
                                                                                                                             
        if ($check == false)
        {

and all the other..

Re: I am lost..

Posted: Fri Apr 02, 2004 3:22 pm
by TheBentinel.com

Code: Select all

if (isset($_COOKIE['USERNAME']) && isset($_COOKIE['PASSWORD']))
    {
        // Get values from superglobal variables
        $USERNAME = $_COOKIE['USERNAME'];
        $PASSWORD = $_COOKIE['PASSWORD'];
...
         if ($username == 'test') {     
...
 }
Is the if statement meant to reference the $USERNAME variable, instead of the $username variable? If you change the if statement to use $USERNAME, does that do what you want?

Posted: Fri Apr 02, 2004 3:47 pm
by ol4pr0
Let me see if the case Sensitve does make a differance ..

edit: Thanks it did... never knew that lol...

Posted: Fri Apr 02, 2004 4:05 pm
by m3mn0n
How about posting error codes along with your topics next time? :roll:


Have a read at the first link in my signature.

Posted: Fri Apr 02, 2004 4:54 pm
by Illusionist
He might not ahve gotten an error code for that though. It would have only been a warning and he may have turned warning off....

But ya variable names are always case sensitive.