Jump to content
×
×
  • Create New...
  • 0

Website Login Error


Bituse

Question

Hello Folks
i have a error from my website i dont know what to do about  it 
 

PHP Warning:  mysql_num_rows() expects parameter 1 to be resource, boolean given in /home4/bitusealokin/public_html/inc/loginbar.inc.php on line 30

<?PHP
  if(isset($_SESSION['user_admin']) && checkInt($_SESSION['user_admin']) && $_SESSION['user_admin']>=0) {
    ?>
					<table style="margin:20px auto;" id="loginnav">
						<tr> <td><?PHP echo ''.$_SESSION['user_coins'].''; ?> Coins</td>	</tr>						
						<tr><td><a href="?s=itemshop">Itemshop</a></td></tr>							
						<tr><td><a href="?s=voten">Vote 4 Us</a></td></tr>						
						<tr><td><a href="?s=spenden">Spenden</a></td></tr>	
						<tr><td><a href="?s=passwort">Daten</a></td></tr>											
						<tr><td><a href="?s=charaktere">Charaktere</a></td></tr>						
						<tr><td> <a href="?s=logout">Ausloggen</a></td></tr>	
					</table>
    <?PHP
  }
  else {
  
  
  if((isset($_POST['loginbtn']) && ($_POST['loginbtn']=="Login" || $_POST['loginbtn']=="login") )) 
  {
    if(!empty($_POST['userid']) && !empty($_POST['userpass']) && checkAnum($_POST['userid']) && checkAnum($_POST['userpass'])) 
    {
			$password = mysql_real_escape_string($_POST['userpass'])."fdmaklehg2l34";
		  $sqlCmd = "SELECT id,login,coins,web_admin,email
		  FROM account.account 
		  WHERE login 
		  LIKE '".mysql_real_escape_string($_POST['userid'])."' 
		  AND password=PASSWORD('".$password."') 
		  LIMIT 1";
		  $sqlQry = mysql_query($sqlCmd,$sqlServ);
		  if(mysql_num_rows($sqlQry)>0) 
			  {
			$getAdmin = mysql_fetch_object($sqlQry);
			$_SESSION['user_id'] = $getAdmin->id;
			$_SESSION['user_name'] = $getAdmin->login;
			$_SESSION['user_admin'] = $getAdmin->web_admin;
			$_SESSION['user_coins'] = $getAdmin->coins;
			$_SESSION['user_email'] = $getAdmin->email;
			$updateIP = mysql_query("UPDATE account.account SET web_ip='".mysql_real_escape_string($_SERVER['REMOTE_ADDR'])."' WHERE id='".mysql_real_escape_string($getAdmin->id)."'",$sqlServ);
			//echo SuccessMessage("Sie haben sich erfolgreich eingeloggt und werden nun weitergeleitet.");
			echo'<meta http-equiv="refresh" content="0; URL=index.php?s=login"> ';
		  }

    }
  }  
  
  ?>
			<form action="?s=login" method="POST">
				<input placeholder="Benutzername" class="input" name="userid" type="text" size="30" maxlength="30" />
				<input placeholder="Passwort" class="input" name="userpass" type="password" size="30" maxlength="40" />
				<input type="submit" value="Login" class="button" name="loginbtn">
				<input value="Reset" type="reset"/>
				<br/><br/>
				<a href="?s=lostpw">Passwort vergessen?</a><br/>
				<a href="?s=register">Du hast noch keinen Account?</a>
			</form>  			
  <?PHP
  }
?>

Thats the Login script .
 

Link to comment
Share on other sites

  • Answers 5
  • Created
  • Last Reply

Top Posters For This Question

Popular Days

Top Posters For This Question

5 answers to this question

Recommended Posts

  • 0

as metin2-factory said. mysql_query return FALSE on failure -> "boolean given".  if you debug you would knew that there is the misstep.

after <?php at the top of your file (if errors disabled):

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

then replace:

$sqlQry = mysql_query($sqlCmd,$sqlServ);

with:

$sqlQry = mysql_query($sqlCmd,$sqlServ) or die(mysql_error());

Read and try to understand the mysql error.

Just a Tip after reading the error:

In your index.php you should have a line like this:

 $sqlServ = mysql_connect(SQL_HOST, SQL_USER, SQL_PASS);

SQL_HOST, SQL_USER and SQL_PASS are defined in "inc/config.ini.php". In my estimation, you have specified wrong SQL Data there.

Edited by Ayaka
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


Important Information

Terms of Use / Privacy Policy / Guidelines / 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.