Jump to content

Make suspended user unable to login?


djfox

Recommended Posts

  • Replies 71
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Alright, check if you are closing the brackets correctly...

 

 

<?php

  if($numRows == 1){
                                   if($row[6] == '1'){
                                         die('Your account is suspended');
                                   } else{
                                       if ($rows=mysql_fetch_row($res)) {
		   $_SESSION['sess_name'] = $username;
			$_SESSION['pass'] = $password;
			$_SESSION['gal'] = $rows[0];
			$_SESSION['mail'] = $rows[2];
			$_SESSION['level2'] = $rows[1];	
			$_SESSION['echos'] = $rows[3];
			$_SESSION['status'] = $rows[4];
		   $_SESSION['magic'] = SESSION_MAGIC;
		   $_SESSION['rows'] = $rows; /* stupid stupid hack */
		   $nmsg = CountMessages($rows[0]);
		   $ok=true;
	  } else {
		  include('login_failed.php');
	  }
	  mysql_free_result($res);
	  }
  return($ok);
                                   }
                             }


?>

Link to comment
Share on other sites

It logs in successfully...

 

It`s not really logging in successfully. Log in with an account, the message "Login Failed" will appear along with what looks like a successful log (sorry this confusion comes up, the other programmer guy who originally made all this made things weird and for years afterwards I`ve been trying to fix his errors [lost contact with him long ago so I can`t ask him to fix it] but log in stuff is a world I know nothing off despite I was able to fix the other stuff he did). Then try navigating to another page. Your log in stuff is gone and back to having the log in form there instead.

Link to comment
Share on other sites

If u are passing the right arguments to the function($user, $pass) then the code should show login error if the username doesnt exist or password is wrong. Thats why i suggested counting the rows with mysql_num_rows(). There no point to me, really. It should work the way it is as we dont have rocket science here, just two nested if statements.

Link to comment
Share on other sites

I wish I can just jump over to your site, and take over that keyboard lol.

 

haha i pretty have this feeling too.

 

Well, if one of ya`s willing to re-code the log in entirely that could still function with what I`ve got with my site...;)

Link to comment
Share on other sites


<?php
   	
$query=mysql_query("SELECT * FROM userdata WHERE login='$username' AND password='$password'");

$row=mysql_fetch_array($query);

if(($row['login']==$username)&&($row['password'])){
     if($row['isHold'] == '1'){
              die('Your account is suspended');
		  }
             elseif($row['isHold']!= '1'){
               
		    $_SESSION['sess_name'] = $username;
			$_SESSION['pass'] = $password;
			$_SESSION['gal'] = $row['']; /////////////////CHANGE
			$_SESSION['mail'] = $row['']; /////////////////CHANGE
			$_SESSION['level2'] = $row[''];	 /////////////////CHANGE
			$_SESSION['echos'] = $row['']; /////////////////CHANGE
			$_SESSION['status'] = $row['']; /////////////////CHANGE
		    $_SESSION['magic'] = SESSION_MAGIC;
		    $_SESSION['rows'] = $row; /* stupid stupid hack */
		    $nmsg = CountMessages($row['']);/////////////////CHANGE
		    $ok=true;
	   } 
   
	   ///////////If login is not correct, we include this..
	   else {
		   include('login_failed.php');
	   }
	   mysql_free_result($res);
		   return($ok);
	   
  
   }

?>

 

change all the fields marked in the quote...

 

this works perfectly for me.

Link to comment
Share on other sites

if(($row['login']==$username)&&($row['password'])){

 

mysql_num_rows() is a way better alternative to me. If u make a query where u select username and password, whats the need for then checking if those are equal. Its just overdone.

Link to comment
Share on other sites

It still wants to say this:

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/secrett1/public_html/auth.php on line 100

 

But going to another page still keeps me logged in (and keeps the suspended account from logging in). The error goes away after moving to another page (and some pages it looks like I gotta re-code because I`m getting new error messages, I`m assuming is due to the change in how the log in works).

Link to comment
Share on other sites

phpSensei, u mean mysql_free_result($query) ?? :)

 

djfox try debuging code a bit by yourself. It was an obvious mistake...

 

I think im passing this thread over. This is the fifth page and we havent resolved nothing. Djfox as i said before, u really need to learn php & mysql before starting a real script.

Link to comment
Share on other sites

try chaning the $row to $result...

 

then we will fix the suspended user...I think i found the problem.

 

-Change the isHold  - > to suspend

 

-Now change this line  if($row['isHold'] == '1'){ to  if($row['access'] == "YES"){

 

 

also, go to browse in your phpmyadmin, and change the coloumn suspend coloumn to YES

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.