Basic Login Script

Go down

Basic Login Script

Post  cyberhunter on Sun May 25, 2008 10:34 pm

This is just an example of a basic login script: It doesnt use cookies or an SQL server.. its basic. Edit if ya want, nothing is stopping you. Hopefully someone might find it useful. (Shouldnt be used to hide classified information).
Code:

<?php

// Error handling
ini_set ('display_erros', 1);
error_reporting (E_ALL & ~E_NOTICE);

// variables
$username = $_POST['username'];
$phpself = $_SERVER['PHP_SELF'];

// Add some space
print "<br />";

// Check if form is sent
if ( isset ($_POST['submit'])) {

//Handles curves perfectly
if ( (!empty ($_POST['username'])) && (!empty ($_POST['password'])) ) {
if ( ($_POST['username'] == 'admin') && ($_POST['password'] == 'letmein') ) {

//choose your option
//echo "Hello, $username";
//require 'hidden/page/to/get.php';
echo "You forgot to select an option...";


    }else{ //tsk tsk
 
 print "<center><p></p><font color=\"black\"><b>No dice</b></center>";
 
 }
 
}else{
 
 print "<center><p></p><font color=\"black\"><b>You forgot to enter a username/password.</b></center>";
}
 
 }else{
 
print "<center><form action=\"$phpself\" method=\"POST\"><p>
 <input type=\"password\" name=\"username\" size=\"25\" /><br />
 <input type=\"password\" name=\"password\" size=\"25\" /><br />
 <input type=\"submit\" name=\"submit\"     
 value=\"Login\"></p></form></center>";


 }
 



?>
avatar
cyberhunter
Info Cracker
Info Cracker

Posts : 201
Join date : 2008-03-12
Age : 34
Location : In your computer

View user profile http://www.infofreakz.co.cc

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum