Jump to content

Loginbar.inc.php PROBLEM


Recommended Posts

If there is anyone to fix my Loginbar.inc,php 
The syserr is 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
And the script

<?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
  }
?>

Im even whealing to pay for it . 
just to get it fixed 
Thanks in advance,

Link to comment
Share on other sites

after <?php at the top of your file:

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());

and try again. Post the mysql error here.

Link to comment
Share on other sites

after <?php at the top of your file:

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());

and try again. Post the mysql error here.

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

It gives the same error 
There is the loginbar. edited with your fix

 

This is the hidden content, please

Edited by Bituse
Link to comment
Share on other sites

Cant be. mysql_num_rows() throws boolean -> "false" because no resource given from your query. If your query fails the "or" operator jump in with mysql_error(). If no mysql_error is given you did something wrong. do this and post the output:

after:

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

add

var_dump($sqlCmd);
var_dump($sqlServ);
var_dump($sqlQry);

dont forget do censor sensitiv data befor posting here ;)

Edited by Ayaka
Link to comment
Share on other sites

Hmm. in mysql_query, connect it bee first or no? so mysql_query($sqlServ,$sqlCmd)

nope thats not the way mysql_query works... first parameter query, secound link_identifier! Look here

@topic:The problem is that you dont override the edited file on your server! If you get the exactly same error after the changes like i said you HAVE TO get 3 new outputs! If not the file is not changed on your server

Edited by Ayaka
  • Love 1
Link to comment
Share on other sites

  • 1 month later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

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.