Nov 21, 2009

Complete Login And Registration System - doesn't use mysql!

free web hosting
Open Discussion > MODERATED AREA > Tutorials

Complete Login And Registration System - doesn't use mysql!

karlo
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]

 

 

 


Comment/Reply (w/o sign-up)

doom145
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

Comment/Reply (w/o sign-up)

karlo
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

Comment/Reply (w/o sign-up)

carrot
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

Comment/Reply (w/o sign-up)

karlo
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.

Comment/Reply (w/o sign-up)

doom145
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

Comment/Reply (w/o sign-up)

karlo
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.

Comment/Reply (w/o sign-up)

FeedBacker
HELP with code!!!
Complete Login And Registration System

Replying to karlo
Hey everyone I put that code in the notepad and uploaded it to my website
Everything was great, But when I loged in all it has is links 1-99 I don't get it? If anyone could help me I would be greatful. Oh yeah it also says
Welcome to the Authenticated and Secured Area! Does anyone know what to do?




Thanks

-reply by Josh

Comment/Reply (w/o sign-up)

FeedBacker
HELP with code
Complete Login And Registration System

Hey everyone I put that code in the notepad and uploaded it to my website
Everything was great, But when I loged in all it has is links 1-99 I don't get it? If anyone could help me I would be greatful. Oh yeah it also says
Welcome to the Authenticated and Secured Area! Does anyone know what to do?




Thanks

-reply by Josh

Comment/Reply (w/o sign-up)

ironchicken
It's a good script, but could be better.

Notice to mods/admins : The same post by the Trap Feedbacker as appeard twice.

Comment/Reply (w/o sign-up)



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)

Similar Topics

Keywords : complete, login, registration, system, dosent, mysql

  1. To Automatically Run Command When Login / Logoff
    (3)
  2. Simple Php Login And Registration System
    (19)
    Hello. This is my first web tutorial ever. This is basically a simple register and login script.
    Yes, I know it’s a bit rubbish but I’m quite new to PHP/MySQL. Here’s the register form. This can
    be any file extension you like. I’d recommend calling it register.html . CODE
    Register Register Username: Password: First Name:
    Last Name: Age: Now create a MySQL database. Then create a
    file that will be called CODE mysql-connect.php . Here is the file: CODE $co....
  3. Automatic Login
    in WinXP (6)
    Ever wanted to just turn on our computer and when you get back it's already on the desktop?
    (Rather then having to login at the welcome screen) Now some computer have this feature by default,
    but what if it gets broken, try this. On an Administrator account goto start >> Run, and type
    "control userpasswords2" (without the quotes) Uncheck the box that "Users must enter a Username and
    Password to use this computer", then press Ok. You will be prompted to enter a default user and
    their pasword, then next time you restart the computer it will automaticaly login to that....
  4. Simple Login In Visual Basic 6
    user interaction example trough login programm (9)
    First of all, I am NOT a programmer, this is something my friend taught me. It describes basic
    interaction with the user, while showing basic functionality of this simple programm. So, without
    further ado, we're off to the tutorial: First of all, start your visual basic, when prompted
    for new project, select Standard Exe . Next, we need to open code window, so we can start typing
    the program. This can be done in two ways, one is double clicking on the form, or selecting Code
    from View menu. If you double clicked on the form, you will see following text: CODE ....
  5. How To Put A Phpbb Login Box On Your Main Site.
    Code and .php included!!! (19)
    I have included my coded file with this... Ok here is the code. CODE // //Create login area,
    replace the phpBB2 in /phpBB2/login.php with your forum's //directory //   Prank Place
    Forum Index     Please enter your username and password to log in.        
                  Username:                   Password:      
                Log me on automatically each visit:                    
    I forgot my password         You can test this out on my....
  6. Php/mysql Login/register
    Tutorial for login with databases. (4)
    Start register code. Register.php CODE Username: Email: Pass: Verify
    Pass: //Login to your database. Make the fields of course..
    mysql_connect("localhost","user","pass"); mysql_select_db("database"); //end //if registering,
    check fields. if ($action == register) { if (!$user || !$pass || !$email || !$vpass) {  print
    "You must fill out all fields.";  exit; } $dupe1 = mysql_num_rows(mysql_query("select * from
    table where user='$user'")); if ($dupe1 > 0) {  print "Someone already has that
    username.";  exit....
  7. Multiple Admin Login (php)
    This is a script that doesnt requre SQL (3)
    first off make a login.html page Code: QUOTE Admin Login Username: Password:
    then make a check.php page Code: QUOTE $admin1 = "admin1"; // first
    admin username $adm_pass1 = "password1"; // first admin password $admin2 = "admin2"; // second
    admin username $adm_pass2 = "password2"; // second admin password if(($username == $admin1 &&
    $password == $adm_pass1) || ($username == $admin2 && $password == $adm_pass2)){ echo
    "Congratulations " . $_POST . " You may now proceed to the admin area !"; } else { echo "Userna....
  8. Php Simple Login Tutorial
    Learn how to make a simple login! (75)
    I have been quite busy lately, trying to design and code my site (far from done XD). And after
    having learned how to make a simple login, I will try to write my own tutorial, for you
    /smile.gif' border='0' style='vertical-align:middle' alt='smile.gif' /> the tutorial Step 1
    : The first step in designing a member system is to plan out exactly what you need. A common impulse
    among programmers is to jump right in and start coding. I'll be honest and admit that I'm
    guilty of this more so than anyone. However, since I'm in control of this conversation (y....
  9. Complete Login System
    With PHP + MYSQL (57)
    Its an complete login sistem made and tested by me and I think itwill be very usefull for people who
    are tryn to learn PHP. First, let's make register.php: CODE include("conn.php"); //
    create a file with all the database connections if($do_register){ // if the submit button were
    clicked if((!$name) || (!$email) || (!$age) || (!$login) || (!$password) || (!$password2)){ print
    "You can't let any fields in blank.\n"; // if the user did not put some field exit; } $name =
    stripslashes($name); $email = stripslashes($email); $age = stripslashes($age); $login = s....

    1. Looking for complete, login, registration, system, dosent, mysql

Searching Video's for complete, login, registration, system, dosent, mysql
See Also,
advertisement


Complete Login And Registration System - doesn't use mysql!

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com