Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
PHP login suddenly not working - session problem?
Old 01-04-2008, 07:31 PM PHP login suddenly not working - session problem?
Skilled Talker

Posts: 61
Trades: 0
We've had teh same setup for over 2 years that has been working flawlessly - 2 days ago it suddenly stopped working. Host has upgraded to PHP 5.2.5, but says 4 should still function fine. Their tech support has been unable to help. All I can think of is that some of the login code is no longer functioning with the new PHP, but I'm not familiar enough with the stuff to figure it out after much searching and reading.

When a user tries to log in, it just returns the "invalid email/password" message (www.cathletics.com/subscribers/login.php).

auth.php is below. Any ideas or suggestions would be much appreciated. Thanks.

PHP Code:
<? session_start();

$this_page getenv("REQUEST_URI"); // gets full file path (/whatever/whatever.php)

require("connect.php");





// convert email and password from _POST or _SESSION

if($_POST["email"])
{
  
$email=$_POST["email"];
  
$pass=$_POST["pass"];  
}
elseif(
$_SESSION["email"])
{
  
$email=$_SESSION["email"];
  
$pass=$_SESSION["pass"];
}



// start and register session variables
$_SESSION['email'] = $email;
$_SESSION['pass'] = $pass;


// ATTEMPT TO VIEW PAGE NOT LOGGED IN

if($email=="" || $pass==""){
    
session_destroy();

    require(
"http://www.cathletics.com/_inc/section1.inc");
    
?><title>Subscriber Login</title><?
    
require("http://www.cathletics.com/_inc/section2.inc"); 
    
?><img src="/images/ptitles/ptitle-subscriberLogin.gif"><br><?
    
require("http://www.cathletics.com/_inc/section3.inc"); 
      
?>
    <table width="100%" cellpadding="20" cellspacing="0" border="0">    
    <tr>
        <td>
            <strong>You must log in to view this page.</strong>
            <br><br><a href="javascript:launch_forgotpword();">(Did you forget your password?)</a>
            <br><br><br>
        </td>
        <td ><? include("http://www.cathletics.com/_inc/login_form.inc");  ?></td>
    </tr>
    </table>
      <?
      
require("http://www.cathletics.com/_inc/section4.inc");
      exit;
    }
else{

$result=mysql_query("SELECT * FROM subscribers WHERE email='" $email "' and password='" $pass "'");
$num=mysql_numrows($result);

// print login form and exit if failed.
if($num 1){
      
session_destroy();
      require(
"http://www.cathletics.com/_inc/section1.inc");
    
?><title>Subscriber Login</title><?
    
require("http://www.cathletics.com/_inc/section2.inc"); 
    
?><img src="/images/ptitles/ptitle-subscriberLogin.gif"><br><?
    
require("http://www.cathletics.com/_inc/section3.inc"); 
      
?>
      <table width="100%" cellpadding="20" cellspacing="4" border="0">
      <tr>
            <td>
                Invalid email / password. Please try again.
                <br><br><a href="javascript:launch_forgotpword();">(Did you forget your password?)</a>
            </td>
            <td><? include("http://www.cathletics.com/_inc/login_form.inc");  ?></td>
      </tr>
      </table>
      <?
      
require("http://www.cathletics.com/_inc/section4.inc");
      exit;
    }
else{
    
$query_memberinfo "SELECT * FROM subscribers WHERE email='" $email "' and password='" $pass "'";
    
$result_memberinfo mysql_query($query_memberinfo);

        
$authID mysql_result($result_memberinfo,0,"subscriberID");
        
$authSubType mysql_result($result_memberinfo,0,"subType");
        
$authName mysql_result($result_memberinfo,0,"name");
        
$authFirst explode(" ",$authName);
        
$authFirstName $authFirst[0];
        
$authLastName $authFirst[1];
        
$authEmail mysql_result($result_memberinfo,0,"email");
        
$authPass mysql_result($result_memberinfo,0,"password");

        if(
$authSubType=='Subscriber'){
            
$authPhone mysql_result($result_memberinfo,0,"phone");
            
$authAddress mysql_result($result_memberinfo,0,"address");
            
$authCity mysql_result($result_memberinfo,0,"city");
            
$authState mysql_result($result_memberinfo,0,"state");
            
$authZip mysql_result($result_memberinfo,0,"zip");
            
$authCountry mysql_result($result_memberinfo,0,"country");
            
$authFirstIssue mysql_result($result_memberinfo,0,"firstIssue");
            
$authLastIssue mysql_result($result_memberinfo,0,"lastIssue");
            
$authSubDate mysql_result($result_memberinfo,0,"subDate");
            }

    
// LOG VISTS
    
mysql_query("INSERT INTO subscriberLogin VALUES ('', now(), '$authID')");
    }
    
    
    }
mysql_close();
?>
gregory is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-04-2008, 07:54 PM Re: PHP login suddenly not working - session problem?
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,918
Name: Keith Marshall
Location: Connecticut
Trades: 0
mysql_numrows($result) should be mysql_num_rows($result)
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Old 01-04-2008, 08:17 PM Re: PHP login suddenly not working - session problem?
Skilled Talker

Posts: 61
Trades: 0
Quote:
Originally Posted by mgraphic View Post
mysql_numrows($result) should be mysql_num_rows($result)
I have "numrows" throughout the site functioning fine. Still didn't work with "num_rows" - that's how it was when it first stopped working; i just changed it.
gregory is offline
Reply With Quote
View Public Profile
 
Old 01-04-2008, 08:44 PM Re: PHP login suddenly not working - session problem?
maxxximus's Avatar
Extreme Talker

Posts: 219
Name: Rob
Location: UK
Trades: 0
Mgraphic is right - mysql_numrows is a deprecated alias you should be using mysql_num_rows.

But if its still not working it would help if you had a error returned on that query.
PHP Code:
$result=mysql_query("SELECT * FROM subscribers WHERE email='" $email "' and password='" $pass "'") or die (mysql_error()); 
$num=mysql_num_rows($result); 
maxxximus is offline
Reply With Quote
View Public Profile
 
Old 01-04-2008, 10:00 PM Re: PHP login suddenly not working - session problem?
Skilled Talker

Posts: 61
Trades: 0
OK, thanks. Changed that.

It's logging the following error when I attempt to log in:

"[04-Jan-2008 19:58:33] PHP Warning: Zend Optimizer for PHP 5.2.x cannot be found (expected at '/usr/local/Zend/lib/Optimizer-2.5.10/php-5.2.x/ZendOptimizer.so') - try reinstalling the Zend Optimizer in Unknown on line 0"
gregory is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to PHP login suddenly not working - session problem?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.34365 seconds with 12 queries