Your Ad Here

Secure Login Script

Free scripts that Mofiki Software uses on our own site that we feel would be useful to others. Please feel free to leave interesting snippets. We have decided to allow all visitors to access these forums.

Secure Login Script

Postby Moki on Sun Jul 06, 2008 11:09 am

There are 3 parts to the secure login script:

First is the login form:
[code]<?php echo "<table border='1' CELLPADDING=0 CELLSPACING=0 STYLE='font-size:13px'>"; ?>
<tr>
<td>
<form action="verifylogin.php" method="post">
<div align="right">
Login ID: <input type="text" name="loginid" id="loginid"><br>
Password: <input type="password" name="pword" id="pword"><br>
<input type="submit" name="submit" value="Login" style="height: 25px; width: 65px">
</div>
</form>
</td>
</tr>
</table>[/code]

Second is the login verification page:
[code]<?php
$LoginID = $_POST['loginid'];
$Password = $_POST['pword'];
$g46690sgkiwdr54 = "g46690sgkiwdr54";


if($LoginID == "username" && $Password == "password")
{ include("memberpage.php"); }
else
{ echo "<center>Invalid Login ID or Password Please Try Again</center>";
include("login.php"); }
?>[/code]

Third is the page that is accessed if login and password is correct otherwise it returns to the login page. It also goes to the login page if you try to come to this page via bookmark or any direct link:
[code]<?php
if(isset($g46690sgkiwdr54)) {

// Stick your page in here
echo "<center>";
echo "Welcome to the Members Area";
echo "</center>";

} else {
include("login.php");
}
?>[/code]

This has been posted assuming that you have a little php experience if you have any questions about how to implement these scripts on your site please ask here.
Mofiki Software - Macro's and other Automation software and Utilities. - http://www.mofiki.com
Free Automatic Mouse Clicker - http://uploading.com/files/2E4SZ2WG/AutoMouseClicker.zip.html
iFriend Codes - http://iphone.mofiki.com
User avatar
Moki
Site Admin
 
Posts: 138
Joined: Tue Jun 24, 2008 2:17 pm
Location: North Carolina, USA

Re: Secure Login Script

Postby sane on Thu Aug 07, 2008 7:44 pm

If you put the log-in token in a session ver then it will be a bit more secure. ig. use $_SESSION['g46690sgkiwdr54'] = "g46690sgkiwdr54"; not $g46690sgkiwdr54 = "g46690sgkiwdr54";

exp.
<?php
$LoginID = $_POST['loginid'];
$Password = $_POST['pword'];
$_SESSION['g46690sgkiwdr54'] = "dlfdldafasf3e";


if($LoginID == "username" && $Password == "password")
{ include("memberpage.php"); }
else
{ echo "<center>Invalid Login ID or Password Please Try Again</center>";
include("login.php"); }
?>

Then change the next part to
<?php
if($_SESSION['g46690sgkiwdr54'] == "dlfdldafasf3e")
{

// Stick your page in here
echo "<center>";
echo "Welcome to the Members Area";
echo "</center>";

} else {
include("login.php");
}
?>
sane
 

Re: Secure Login Script

Postby Daworm on Thu Oct 30, 2008 8:48 am

Random reply...

Able to convert this to use either
A: flat-file storage for multiple user/pass?
B: sql storage for user/pass

and with that...

C: have a way to add/remove users to the user/pass storage? :)

I'm only a nub at PHP, but I stumbled on this after looking for a clicker program from a website game :)
Daworm
 
Posts: 1
Joined: Thu Oct 30, 2008 8:43 am


Return to Free PHP Scripts

Who is online

Users browsing this forum: No registered users and 1 guest

cron