I'm working on a flat file login script and I would like to add a sign-up feature to it with a email confirmation process.
Here is my code :
Line number On/Off | Expand/Contract <?php//sessions must be initialized prior to any output if output buffering if offsession_start(); //the list of files containing passwords$files = array( "pass.txt", "test/pass2.txt", "admin/pass3.txt"); //if list of users not set create a new arrayif(!isset($_SESSION['users'])) $_SESSION['users'] = array(); if(isset($_POST['username']) && isset($_POST['password'])){ //need to remove slashes from POST if magic_quotes are on if(get_magic_quotes_gpc()){ $_POST['username'] = stripslashes($_POST['username']); $_POST['password'] = stripslashes($_POST['password']); } $userFound = false; //we need this to exit the loops foreach($files as $file){ //loop every file in the $files array if($fh = fopen($file, "r")){ while(!feof($fh) && !$userFound){ //while not the end of the current file or the user was not found list($username, $password, $url) = explode(",", fgets($fh,1024)); if(($username == $_POST['username']) && ($password = $_POST['password'])){ $_SESSION['username'] = $username; $_SESSION['present'] = true; $_SESSION['legal'] = true; $_SESSION['profile'] = $username.".txt"; array_push($_SESSION['users'], $username); //add the current user to the list of users header("Location: ".$url); $userFound = true; //confirm that the user was found } } fclose($fh); //we need to use break to exit the foreach loop if the user is found in one of the files if($userFound) break; } else echo "Unable to complete"; } if(!$userFound) login('Invalid Member name or Password.<br />');} else { login();}?><?php function login($response='Welcome visitor !') {?>
the user, password and redirection path are listed like the following in the files :
user, pass, path
user, pass, path
How can I add this sign in feature, user would click on sign in, fill a form with his/her full name as user, no space, choose a password, an email would be send and there would be an link to confirm, then the user would be added to the really list.
Thanks!
php web service error
hey guys,I'm working on a project requires the use of web services. I've been trying a few tutorials and I get this one persistent error. I've search the web for clues, even this forum and nothing
Access database inside of a validation class
Hello,For quite some time, I have been using functions to validate form input and access the databse. I have recently started using OOP, which is far faster and better when it comes to programming
SOAP Issue
Hi,I am facing some understanding problem with SOAP basic.kindly recommend some SOAP expert.Thanks
Preventing blank or already entered values
Im trying to learn how to place a read file line by line and prevent duplicate entries and also BLANK entries, into my process php script, using feof, I have failed many times and get so many errors
Bluetooth RSSI & VIsta
Okie I got 4 Bluetooth adapters, a DBT-120 by Dlink, A Zonet Microsoft Bluetooth which is what I used with 32Feet and another TOS Bluetooth Adapter, and I got a 1000HE by Asus which has Broadcom
Procedure with variable number of columns
Hi, I have a procedure that looks like this:
calendar dates and hours compare problem
i have a calendar in wordpress, everything works great except that i can make 2 meetings at the same date, time and room without receiving any error i don't know where to start to compare the days
Inter Company -- Resources Related Billing (Services Industry)
Hello,
Escaped characters
I have a script that allows you to post news to the home page of my site. Along with the news is the username of the person and a avatar type thing. When the script tries to send the avatar image to
how to configure ADS in ABAP instance
Hi All,