Jump to content
Forgot your email address? ×
×
×
  • Create New...
  • 0

error site login


MORTE

Question

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/m2test036/public_html/site/inc/head.inc.php on line 37

help ?

 

head.inc.php

<?PHP
 
  if(isset($_POST['submit']) && ($_POST['submit']=="login" || $_POST['submit']=="LOGIN" || $_POST['submit']=="Login"))
  {
    if(!empty($_POST['userid']) && !empty($_POST['userpass']) && checkAnum($_POST['userid']) && checkAnum($_POST['userpass']))
    {
      $sqlCmd = "SELECT id,login,web_admin,email
      FROM account.account
      WHERE login
      LIKE '".mysql_real_escape_string($_POST['userid'])."'
      AND password=PASSWORD('".mysql_real_escape_string($_POST['userpass'])."')
      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_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);
        
      }
    }
  }

  if(empty($_SESSION['user_id']))
  {
    unset($_SESSION['user_id']);
    unset($_SESSION['user_name']);
    unset($_SESSION['user_admin']);
    unset($_SESSION['user_email']);
  }
  else {
    $sqlCmd = "SELECT id,login,web_admin,email FROM account.account WHERE web_ip='".mysql_real_escape_string($_SERVER['REMOTE_ADDR'])."' AND id='".mysql_real_escape_string($_SESSION['user_id'])."' 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_email'] = $getAdmin->email;
      
    }
    else
    {
        unset($_SESSION['user_id']);
        unset($_SESSION['user_name']);
        unset($_SESSION['user_admin']);
        unset($_SESSION['user_email']);
    }
  }
 

?>
Link to comment
  • Answers 2
  • Created
  • Last Reply

Top Posters For This Question

Top Posters For This Question

2 answers to this question

Recommended Posts

  • 0

I'm a little rusty with this but try this out..

 

Find this:

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

Replace with this:

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

Do the action again on the website, and a more informative error should appear.

Link to comment

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

Announcements

  • -15% Discount in Metin2 Dev Store (01/10/2021 => 31/12/2021) => Code => 15_PCT_OCT_TO_DEC_2021


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.