Jump to content

Website Login Error


Recommended Posts

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

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

  • Bronze

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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



  • Similar Content

  • Activity

    1. 0

      I just implemented some costumes and they are not visible

    2. 0

      Skill Tree Problem

    3. 97

      Ulthar SF V2 (TMP4 Base)

    4. 5

      Client Crashes through Offline Shop (Ikarus)

    5. 5

      VIVY-WORLD2 - FARM TO THE TOP

    6. 0

      ToolTip Bug?

    7. 0

      Skill tree build erorr

    8. 0

      Visual Bug | How to fix this visual bug inside the Special Storage feature?

  • Recently Browsing

    • No registered users viewing this page.
×
×
  • 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.