Jump to content

[SOLVED] can anyone see anything wrong with this function ?.


jamesxg1

Recommended Posts

Hiya peeps,

 

Can anyone see a problem with this function because it is suppose to re-direct me but it isnt,

 

      function Login($lusername, $lpassword) {
                  
          $this->lusername = mysql_real_escape_string(addslashes($lusername));
          $this->lpassword = mysql_real_escape_string(addslashes(md5($lpassword)));
          
          $this->LoginQ = "SELECT * FROM `members` WHERE username = '$this->lusername' AND password = '$this->lpassword'";
          $this->LoginR = mysql_query($this->LoginQ) or die (mysql_error());


          if(mysql_num_rows($this->LoginR) == '1') {
           
              while($fetch =  mysql_fetch_array($this->LoginR)) { 
                  
                  if($fetch['sus'] == '0') {

                                     session_start();
                            $_SESSION['username'] = $this->lusername;
                            $_SESSION['id'] = $fetch['id'];
                            $_SESSION['firstname'] = $fetch['firstname'];

                             echo '<META HTTP-EQUIV="Refresh" CONTENT="5"; URL="html-redirect.html">';
                  } else {
                              echo "Sorry but the account you are trying to access is suspended, Please try again."; 
                                 
                             }          
              }
              
          } else {
              
          echo "Sorry but the account you are trying to access is non existant, Please try again."; 
              
          }
    
    
      }
        

Link to comment
Share on other sites

error_reporting(E_ALL);
ini_set('display_errors', 1);

 

Add that at the top of the script.

 

Why are you calling session start in every method?

If you need to make a call of more than one method per page then you are calling session_start() multiple times...

 

Also, you dont need to addslashes to an md5 encryption. Data is encrypted into alpha-numeric chars anyway with md5.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.