I am lost..

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

I am lost..

Post 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..
TheBentinel.com
Forum Contributor
Posts: 282
Joined: Wed Mar 10, 2004 1:52 pm
Location: Columbus, Ohio

Re: I am lost..

Post 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?
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post by ol4pr0 »

Let me see if the case Sensitve does make a differance ..

edit: Thanks it did... never knew that lol...
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

How about posting error codes along with your topics next time? :roll:


Have a read at the first link in my signature.
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post 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.
Post Reply