Jump to content

bad situation to my admin area


arn_php

Recommended Posts

I am moving a website to a new server which has a different setting here:

New server:

FreeBSD (linux?), PHP4.4.7, MySQL 4.1.21

 

Old server:

Ms. Windows, PHP4.3.9, MySQL 3.23.49

 

On both I have the register_globals ON but then this is the error I am gettingeach time I tried to login into the admin area

 

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /admin/functions.php on line 40

 

On the functions.php line 40, the coding

$result = mysql_query("SELECT * FROM Users WHERE login='".addslashes($username)."' AND password='".addslashes($password)."'");

 

if (mysql_num_rows($result)>0)

{

$clSession=new Session(0,$username);

return $clSession->seshid;

}

return 0;

 

I actually do not change any coding on the script while doing the transfer so far because I am expecting the site would be working just fine.  Is there any configuration on mysql and php that I miss here? Thanks, any help is welcome.

Link to comment
https://forums.phpfreaks.com/topic/94842-bad-situation-to-my-admin-area/
Share on other sites

try

 

 

$result = mysql_query("SELECT * FROM Users WHERE login='".addslashes($username)."' AND password='".addslashes($password)."'") or die(mysql_error());

 

Make sure the username and password are correct, maybe some field names arent right or got changed during the transfer or something.

Your code is not checking if the mysql_query() worked or not before blindly accessing the result resource.

 

Change your query to the following to get php/mysql to tell you why it is not working -

 

see the code in phpSensei's post above[code]

[/code]

to phpSensei :

That is right, I notice the table's name is users into the DB but then into the code it is Users.  So I changed the table's name from within the phpmyadmin to Users. And then the page is working, only now it takes me back to login page with this message: SESSION EXPIRED. Any other suggestion on this?

The lifetime of your sessions is defined in your php.ini file, you may want to look into that or search it up on google, because shared hosting is different. Also make sure you have session_start() on every page...

 

post where you are setting the sessions also please.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

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.