DeveloperCube - Custom Login Script
Webmasters and web developers, get your books at WebDevBooks.com
Username:    Password:
Remember Me?    
Custom Login Script

 
Post new topic   Reply to topic    DeveloperCube Forum Index -> Scripts and Programming
 See a User Guidelines violation? Please contact us.
Author Message

Radnut

Joined: 13 Oct 2006
Posts: 1

PostPosted: 10/13/2006, 4:21 pm    Post subject: Custom Login Script Reply with quote

Hey, I have been baffled by this problem for the last few days and need abit of outside intervention. I am making a site but don't want to work with mysql yet. I am using sessions and storing each of the user accounts within an individual text file.

Code:
<?php
   session_start();

$name = ($_POST['username']);
$pass = ($_POST['password']);

if($name != "")
{
   $user_account = file("./accounts/" . strtolower($name) . ".txt");

   for($i=0;$i<3;$i++)
   {
      rtrim($user_account[$i]);
   }
   
   $name = $user_account[0];
   $enc_pass = $user_account[1];
   $email = $user_account[2];
   
   $pass = md5($pass);
   
        // PROBLEM STARTS HERE, SEEMS TO SKIP THIS IF AND EXECUTES THE ELSE STATEMENT

   if($pass != "" && ($pass == $enc_pass))
   {
      echo "You have been logged in.";
         
                // Create the session variables etc...
   }
   else
   {
      echo "You have entered an incorrect username or password.";
   }
}
else
{
   echo "You have entered an incorrect username or password.";
}
       
?>


It basically won't recognise the passwords. I've printed out both the user's entered password and the password from the file and they are exactly the same. But it just won't work. Any ideas?
_________________
http://www.radicalnut.com
Back to top
Display posts from previous:   
Post new topic   Reply to topic    DeveloperCube Forum Index -> Scripts and Programming All times are GMT
Page 1 of 1
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Links: Writing Scene - Readers Unbound - Literature Vault - Chrispian - Webmaster's Weekly - Writing Prompts - Programming Forum - We Heart Pets - Anita Blake - Harry Dresden - Art Schools Online

Network: iFroggy Network Blog - iFroggy Hosting - SportsForums.net - KarateForums.com - YanksBlog.com - MarianoRivera.com - PhinsBlog.com - phpBBHacks.com - WebDevBooks.com - Managing Online Forums - ManagingCommunities.com - CommunityAdmins.com - CommunityPromotion.com - PhotoshopForums.com - MicrosoftBlog.com - DrGregHouse.com - Bad Boy Blog - BadBoyForums.com - SodaRatings.com - Patrick O'Keefe

We Support phpBBHacks.com. Forum Icons by Daz. Privacy Policy. Powered by phpBB © phpBB Group. phpBB SEO.
Copyright © 2003-2008. DeveloperCube, iFroggy Network. All Rights Reserved.

Advertising   Contact   Links   Link To Us   Staff   User Guidelines