Page 1 of 1

login not working

Posted: Thu Sep 18, 2008 1:47 pm
by pagegen

Code: Select all

<?php
 
 
include("session.php");
include("connect.php");
            
    
    if (isset($_POST['txtName']) && isset($_POST['txtPass'])){
     
        $uname = strip_tags($_POST['txtName']);
        $upass = strip_tags($_POST['txtPass']);
          
     if(!is_resource($dbc)) {
            header ("Location: login.php?e=1");
         echo "Failed to connect to the server\n";
     }
     else {
       $queryL = sprintf("SELECT * FROM users WHERE username='$uname' AND password='$upass'", mysql_real_escape_string($uname, $dbc), mysql_real_escape_string($upass, $dbc));
        $resultL = mysql_query ($queryL);
    
        while($row = mysql_fetch_array($resultL,MYSQL_ASSOC))
 
         if (mysql_affected_rows($dbc) > 0) {
             
            setcookie ('username', $uname );
    setcookie ('userType', $row[userType] );
             
            header ("Location: default.php");
            //echo "do all the login stuff here now"; 
         }
         else {
                    header ("Location: login.php?e=2"); 
             //echo "the user has input incorrect details";
            }
        }
    }
  ?>
 
its very strand because it worked yesterday but sum reason it wont work now

any ideas guys

Re: login not working

Posted: Thu Sep 18, 2008 3:04 pm
by pagegen
can no1 help?