Bituse 61 Posted November 4, 2015 Share Posted November 4, 2015 Hello Folksi 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 More sharing options...
Bituse 61 Posted November 5, 2015 Author Share Posted November 5, 2015 #Push Link to comment Share on other sites More sharing options...
metin2-factory 1010 Posted November 5, 2015 Share Posted November 5, 2015 $sqlServ isn't defined in page. Link to comment Share on other sites More sharing options...
Bituse 61 Posted November 5, 2015 Author Share Posted November 5, 2015 Could u be more specific please ? Link to comment Share on other sites More sharing options...
Cabresto 0 Posted November 5, 2015 Share Posted November 5, 2015 Could u be more specific please ? You dont have that variable specified in that page u_u Normally, that variable it's in index.php Try to do a require of index.php Link to comment Share on other sites More sharing options...
Ayaka 300 Posted November 5, 2015 Share Posted November 5, 2015 (edited) 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 November 5, 2015 by Ayaka F E E L - T H E - A W E S O M E N E S S Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now