Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Complete Login And Registration System, doesn't use mysql!
karlo
post Mar 12 2005, 05:59 AM
Post #1


Privileged Member
*********

Group: Members
Posts: 618
Joined: 30-October 04
From: Philippines
Member No.: 2,049



kLogin 0.1

QUOTE(readme.txt)
Readme file to kLogin 0.1

To use the internet explorer fix:

download the latest IE7 ZIP file (http://sourceforge.net/project/showfiles.php?group_id=109983&package_id=119707)

Extract the ie7 zip file to the root directory of your web server.
Example, if you are using a unix/linux server,
it's on "public_html/" or "home/public_html"

Open kLogin.php file with your editor and edit the $info_text or $info_txt variable.

Then, extract the kLogin.php file in to the root directory
of your web server also.

Just run kShoutBox.php

If you found some bugs, or any suggestions, e-mail me at 01karlo@gmail.com
My friendster: karlo@*BLEEP*it.com


Filename: kLogin.php

CODE
[SIZE=5][FONT=Courier]<?php header("Content-type: text/html; charset=utf-8"); //Send to browser that the charset is utf-8 ?>

<?php

/* ******************************

  kLogin 0.1

******************************
*/

/* ****************************************

This Login script was created by
Juan Karlo Aquino de Guzman

DO NOT MODIFY THIS CODE AND DISTRIBUTING
IT WITHOUT ANY PERMISSION. E-MAIL THE
AUTHOR FIRST. Email: 01karlo@gmail.com

DO NOT REMOVE THE "POWERED BY".

FOR SUGGESTIONS, COMMENTS, ETC, SEND AN
EMAIL TO 01karlo@gmail.com

HOPE THAT YOU ENJOY THIS SCRIPT!

MY FRIENDSTER: karlo@*BLEEP*it.com

****************************************
*/

/* ******************************

Make sure that your editor supports WordWrap

******************************
*/

$ver = "0.1"; // Version of this script.
$info_text = "info.txt"; // "info.txt" filename. You can change this for security purposes. Example, you can store this on a folder named "users" with the filename "info.qwerty". Use "users/info.qwerty". The default is "info.txt" means it's located on the same directory where the script is located.

/* ******************************

 Login Please wait Page

******************************
*/

if($_POST[act]==="login") { // Checks if "act" is equal to "login"
$forms = '<input type="hidden" name="act" value="login_verify"><input type="hidden" name="username" value="'.$_POST[username].'"><input type="hidden" name="password" value="'.$_POST[password].'"><input type="submit" value="Continue" style="width: 125px; border: 1px solid black; background: White; cursor: pointer;">'; // Outputs the forms

die('<script language="javascript" type="text/javascript">document.write(\'<title>Please wait</title><div align="center"><div align="center" style="font-family: Verdana; font-size: 14px; font-weight: bold; color: White; background: #6699FF; width: 50%; border: 1px solid black; padding: 4px;">Please wait</div><div align="center" style="font-family: Verdana; font-size: 12px; font-weight: bold; color: Black; background: #99CCFF; width: 50%; border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; padding: 8px;">Please wait. Your <span style="color: red;">username</span> and <span style="color: red;">password</span> is now being verified by our unique and expensive server.<br><form method="post" action="'.$_SERVER[SCRIPT_NAME].'">'.$forms.'</form></div></div>\');</script>'); // Outputs the entire layout of the page
}

/* ******************************

 Login Verify Page

******************************
*/

if($_POST[act]==="login_verify") { // Checks if "act" is equal to "login_verify"
if(!file_exists("info.txt")) { // Check if the file exists
 die("<b>There are no registered users.</b>");
}

$login_info = "$_POST[username]/$_POST[password]"; // Gets the username and password entered by the user
$file_info = file_get_contents("info.txt"); // Gets the contents of the "info" file

if(strlen($_POST[username]) < 5 && strlen($_POST[password]) < 5) { // Checks the length of the username and password
 die("<b>The username and password must not be<br>less than 5 characters.</b>");
}

if(preg_match('/\\W/',$_POST[username])) { // Checks if the username is only letters and numbers
 die("<b>Login error! <a href=\"$_SERVER[SCRIPT_NAME]\" style=\"color: black;\">Go back</a>");
}

if(preg_match('/\\W/',$_POST[password])) { // Checks if the password is only letters and numbers
 die("<b>Login error! <a href=\"$_SERVER[SCRIPT_NAME]\" style=\"color: black;\">Go back</a>");
}

if(!strstr($file_info,$login_info)) { // Checks if the username and password is correct
 die("<b>Username and Password error!</b>");
}

header("Location: $_SERVER[SCRIPT_NAME]?login=".urlencode(base64_encode("$_POST[username]/$_POST[password]"))); // Redirects the user to the authenticated page
}

/* ******************************

 Authenticated Page

******************************
*/

if(isset($_GET[login])) { // Checks if "login" is set or is not empty
$login_info = urldecode(base64_decode($_GET[login])); // Decodes the "login" info on the address bar
$file_info = file_get_contents("info.txt"); // Gets the "info.txt" file

if(!strstr($file_info,$login_info)) { // Checks if the username and password are correct
 die("<b>Username and Password error!</b>"); // Outputs the error page
}

if(!strstr($_SERVER[HTTP_REFERER],$_SERVER[SCRIPT_NAME])) { // Checks if the klogin.php exists or yourscript.php exists in the referer header
 die("<b>You are currently trying to hack this website.</b>");
}

if(isset($_GET[go])) { // Checks if "go" is not empty or if it is set
 die("<b>You have clicked $_GET[go] link!<br>If you saw this message, it means that you are still authenticated. <a href=\"$_SERVER[HTTP_REFERER]\" style=\"color: black;\">Go Back</a></b>"); // Outputs the success message if the user entered another authenticated page
}

$split_username = split("/",$login_info); // Gets the username only

echo("<title>Authenticated Page - $split_username[0]</title><h2>Welcome to the Authenticated and Secured Area!</h2>"); // Greeting

$authenticate = "?login=".urlencode(base64_encode($login_info)); // Decodes the login information from the "login=" on the address bar

for($i=1; $i<101; $i++) { // Outputs the links. You can check "101" to any number. Example, you want 500, use 501
echo("<b><a href=\"$authenticate&go=sample$i\" style=\"color: blue;\">Link$i</a></b><br>"); // Outputs the links
}
echo("<br><a href=\"$_SERVER[SCRIPT_NAME]\" style=\"color: red; font-weight: bold;\">Logout</a>");
exit; // Don't parse the existing script
}

/* ******************************

  Register Page

******************************
*/

if($_GET[act]==="register") { // Outputs the register page
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="generator" content="EditPlus">
<meta name="keywords" content="juan, karlo, aquino, de, guzman, roosevelt, cainta, lamuan, google, trap17, the real host, omega, kshoutbox, klogin">
<meta name="description" content="kLogin version <?=$ver;?>">
<meta name="Author" content="Juan Karlo Aquino de Guzman">
<title>User Registration</title>
<?if(preg_match("/MSIE/",$_SERVER[HTTP_USER_AGENT])){echo('<script src="/ie7/ie7-standard.js" type="text/javascript"></script>');} //checks if the user is using internet explorer, if the user is using it, then outputs the internet explorer script fix?>
<style type="text/css">
body { font-family: Verdana; font-size: 12px; font-weight: bold; color: Black; background: White; cursor: default; }
#banner { font-size: 14px; font-weight: bold; color: White; background: #6666CC; border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black; width: 50%; padding-left: 8px; padding-right: 8px; padding-top: 4px; padding-bottom: 4px; }
#message { background: #FFFFCC; border-left: 1px solid black; border-right: 1px solid black; border-bottom: 1px solid black; width: 50%; padding: 8px; }
submit { width: 25%; }
</style>
</head>

<body>
<div align="center">
<div id="banner">Register</div>
<div id="message">
<form method="post" action="<?=$_SERVER[SCRIPT_NAME];?>">
<input type="hidden" name="act" value="registration">
Username: <input type="text" name="username" size="25"><br>
Password: <input type="password" name="password" size="25"><br>
<input type="submit" value="Register">
</form>
</div>
</div>
</body>
</html>
<?php
exit;
}

/* ******************************

  Registeration

******************************
*/

if($_POST[act]==="registration") { // Checks if "act" is set to "registration"
$login_info = "$_POST[username]/$_POST[password]"; // Gets the user's username and password
$file_info = file_get_contents("info.txt"); // Gets the "info.txt" file

if(strlen($_POST[username]) < 5 && strlen($_POST[password]) < 5) { // Checks if the length of the username and password are greater than 5
 die("<b>The username and password must not be<br>less than 5 characters.</b>");
}

if(preg_match('/\\W/',$_POST[username])) { // Checks if the username's characters are only letters and numbers
 die("<b>Register error! <a href=\"$_SERVER[SCRIPT_NAME]?act=register\" style=\"color: black;\">Go back</a>");
}

if(preg_match('/\\W/',$_POST[password])) { // Checks if the password's characters are only letters and numbers
 die("<b>Register error! <a href=\"$_SERVER[SCRIPT_NAME]?act=register\" style=\"color: black;\">Go back</a>");
}

if(strstr($file_info,$login_info)) { // Check if the username and password are correct
 die("<b>Username and Password is already registered! <a href=\"$_SERVER[SCRIPT_NAME]?act=register\" style=\"color: black;\">Go back</a></b>");
}

if(strlen($file_info)<1) { // Checks the length of the file
 $f = fopen("info.txt","w+"); // Opens the file
 fwrite($f,"$_POST[username]/$_POST[password]"); // Writes the username and password
 fclose($f); // Closes the file
 chmod("info.txt",0666); // CHMOD the file
 die('<b>You are now registered! <a href="'.$_SERVER[SCRIPT_NAME].'?login='.urlencode(base64_encode("$_POST[username]/$_POST[password]")).'" style="color: blue;">Click here to login.</a></b>'); // Outputs the you are now registered message
}

else {
 $f = fopen("info.txt","a+"); // Opens the file
 fwrite($f,"\n$_POST[username]/$_POST[password]"); // Writes the username and password
 fclose($f); // Closes the file
 chmod("info.txt",0666); // CHMOD the file
 die('<b>You are now registered! <a href="'.$_SERVER[SCRIPT_NAME].'?login='.urlencode(base64_encode("$_POST[username]/$_POST[password]")).'" style="color: blue;">Click here to login.</a></b>'); // Outputs the you are now registered message
}

header("Location: $_SERVER[SCRIPT_NAME]?login=".urlencode(base64_encode("$_POST[username]/$_POST[password]"))); // Redirects the user to the authenticated page
}

?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="generator" content="EditPlus">
<meta name="keywords" content="juan, karlo, aquino, de, guzman, roosevelt, cainta, lamuan, google, trap17, the real host, omega, kshoutbox, klogin">
<meta name="description" content="kLogin version <?=$ver;?>">
<meta name="Author" content="Juan Karlo Aquino de Guzman">
<title>User Login</title>
<?if(preg_match("/MSIE/",$_SERVER[HTTP_USER_AGENT])){echo('<script src="/ie7/ie7-standard.js" type="text/javascript"></script>');} //checks if the user is using internet explorer, if the user is using it, then outputs the internet explorer script fix?>
<style type="text/css">
body { font-family: Verdana; font-size: 12px; font-weight: bold; color: Black; background: White; cursor: default; }
#banner { font-size: 14px; font-weight: bold; color: White; background: #6666CC; border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black; width: 50%; padding-left: 8px; padding-right: 8px; padding-top: 4px; padding-bottom: 4px; }
#message { background: #FFFFCC; border-left: 1px solid black; border-right: 1px solid black; border-bottom: 1px solid black; width: 50%; padding: 8px; }
submit { width: 25%; }
</style>
</head>

<body>
<div align="center">
<div id="banner">Login</div>
<div id="message">
<form method="post" action="<?=$_SERVER[SCRIPT_NAME];?>">
<input type="hidden" name="act" value="login">
Username: <input type="text" name="username" size="25"><br>
Password: <input type="password" name="password" size="25"><br>
<input type="submit" value="Login">
</form>
Don't have an account? <a href="?act=register" style="color: black;">Click here</a> to Register!
<?php
/* ******************************

 Number of Users

******************************
*/
$split_file = file_get_contents("info.txt"); // Gets the file "info.txt"
$split = split('\n',$split_file); // Find the "\n" and split it. If you don't know what "\n" means, go to http://www.google.com/search?q=What+is+\n?
$counter = count($split); // Counts the splitted string
if(count($split)===13) { // If it's 13
$counter = '<span style="color: red; font-weight: bold;" onmouseover="window.status=\'BAD LUCK!\';" onmouseout="window.status=\'\';">13</span>'; // Outputs that it is a BAD LUCK number
}
if(count($split) > 0) { // If the split is greater than zero
echo("<br><br><span style=\"font-size: 10px;\">There are currently ".$counter." registered users</span>");
}
?>
</div>
<!-- Do not remove this. Or else, you are violating the License Agreement -->
<br><b><a href="http://www.karlo.ph.tc" style="text-decoration: none; color: #EAEAEA; font-size: 10px;" target="_blank">Powered by kLogin 0.1<br>created by Juan Karlo Aquino de Guzman</a></b>
<!-- Do not remove this. Or else, you are violating the License Agreement -->
</div>
</body>
</html>[/FONT][/SIZE]
Go to the top of the page
 
+Quote Post
doom145
post Mar 12 2005, 08:47 AM
Post #2


Advanced Member
*******

Group: Members
Posts: 117
Joined: 11-March 05
Member No.: 4,380



this is very "interesting" lol.....u need to add a bit more info about it as some people dont like copying people's ideas so they use a guideline.....the way you have designed it is pretty basic and a person could understand it even if he didnt know php.....the only porblem is that you dont have other options like (: else or something like that so that the php file doesnt get confused on what to do if there is a problem
Go to the top of the page
 
+Quote Post
karlo
post Mar 12 2005, 02:20 PM
Post #3


Privileged Member
*********

Group: Members
Posts: 618
Joined: 30-October 04
From: Philippines
Member No.: 2,049



QUOTE(doom145 @ Mar 12 2005, 04:47 PM)
this is very "interesting" lol.....u need to add a bit more info about it as some people dont like copying people's ideas so they use a guideline.....the way you have designed it is pretty basic and a person could understand it even if he didnt know php.....the only porblem is that you dont have other options like (: else or something like that so that the php file doesnt get confused on what to do if there is a problem
*


i really do get confused with else() laugh.gif
Go to the top of the page
 
+Quote Post
carrot
post Mar 12 2005, 06:07 PM
Post #4


Newbie [Level 2]
**

Group: Members
Posts: 37
Joined: 5-February 05
Member No.: 3,602



what the friekin heck is all that syuff?! i dont even know what u are talking about. u really should explain more so that the regular schmoe (sp?) can understand it. cause i cant
Go to the top of the page
 
+Quote Post
karlo
post Mar 12 2005, 06:10 PM
Post #5


Privileged Member
*********

Group: Members
Posts: 618
Joined: 30-October 04
From: Philippines
Member No.: 2,049



QUOTE(carrot @ Mar 13 2005, 02:07 AM)
what the friekin heck is all that syuff?!  i dont even know what u are talking about. u really should explain more so that the regular schmoe (sp?) can understand it. cause i cant
*


Actually, the "//" means the comments. If you copy and paste the code in EditPlus, or any PHP Editor like PHP Expert Editor, you will see that the code is fully explained.
Go to the top of the page
 
+Quote Post
doom145
post Mar 12 2005, 07:19 PM
Post #6


Advanced Member
*******

Group: Members
Posts: 117
Joined: 11-March 05
Member No.: 4,380



Basically this php file....just copy and paste it into notepad....save it as a .php file and then upload to ur website...u will have a login/registeration form wherever you want. The problem is that you havent added any skins.....use a css skin or html skin maybe as white is eriously gay for logging in
Go to the top of the page
 
+Quote Post
karlo
post Mar 13 2005, 02:45 AM
Post #7


Privileged Member
*********

Group: Members
Posts: 618
Joined: 30-October 04
From: Philippines
Member No.: 2,049



QUOTE(doom145 @ Mar 13 2005, 03:19 AM)
Basically this php file....just copy and paste it into notepad....save it as a .php file and then upload to ur website...u will have a login/registeration form wherever you want. The problem is that you havent added any skins.....use a css skin or html skin maybe as white is eriously gay for logging in
*


Basically, skinning it is really easy. Just open your Editor, then find "background:" then you will see some words and digits (means the color) then change it.