oh yea ty superfun i did forget that !
normally you'll use a MySQL or MSSQL database with information to get the PW and the Username..
password MD5 encrypted ofc for better secured passwords
too easy to hack.
ullaallala :D i gona release better
Last edited by Mario_Party; 13-10-07 at 12:13 PM. Reason: double post
Lol, you always post doubleposts ^^
I hope you're not posting it here in the showcase forum too, because than the forum gets sort of bad reputation (now it has lots of advertisements already). Reply it here :P
Okey i post it here.
There we go all know im finnish guy so i have typed this script in finnish language but i have transilaited it.
Info:
Just make users.txt and chmode it and whooo!
[PHP]<?php
session_start();
$userfilu = "users.txt"; // Where go all user.
$tunmin = "3";// Username min letters require
$pasmin = "3"; // password min letters require
if($_GET['act'] == "login"){
$u = $_POST['tunnus'];
$f = file("$userfilu");
for($a=0;$a<count($f);$a++){
$t = explode("|",$f[$a]);
if($u == $t[0]){
if($_POST['tunnus'] == $t[0]){
if($t[1] == sha1($_POST['salasana'])){
session_register("tun");
$_SESSION['tun'] = $_POST['tunnus'];
session_register("iposo");
$_SESSION['ipodo']= $_SERVER['REMOTE_ADDR'];
echo'Login<br><br>
<a href="'.$_SERVER['PHP_SELF'].'">Home</a><br><br>';
}
}
}
}
}
if($_GET['act'] == "logout"){
session_start();
session_unregister("tun");
session_unregister("iposo");
echo'You logged out<br><br>
<a href="'.$_SERVER['PHP_SELF'].'">Home</a><br><br>';
}
if($_GET['act'] == "rek"){
echo'<form method="post" action="'.$_SERVER['PHP_SELF'].'?act=send">
Username<br>
<input type="text" name="tunnari"><br>
password<br>
<input type="text" name="passu"><br>
password again<br>
<input type="password" name="passu2"><br><br>
<input type="submit" value="Register"><br><br>
</form>';
}
if($_GET['act'] == "send"){
if(!trim($_POST['tunnari']) or !trim($_POST['passu']) or !trim($_POST['passu2'])){
exit('You must fill all forms');
}
if($_POST['passu'] == $_POST['passu2']){
$tu = array();
$fi = file("$userfilu");
for($e=0;$e<count($fi);$e++){
$tt = explode("|",$fi[$e]);
$tu[$e] = $tt[0];
}
if(!in_array($_POST['tunnari'],$tu)){
if(strlen($_POST['tunnari'])< $tunmin) exit('Username is too short');
if(strlen($_POST['passu'])< $pasmin) exit('Password is too short');
$tunnari = $_POST['tunnari'];
$passu = sha1($_POST['passu']);
$tunnari = htmlspecialchars($tunnari);
$tunnari = stripslashes($tunnari);
$passu = htmlspecialchars($passu);
$passu = stripslashes($passu);
$f = fopen("$userfilu","a");
flock($f,2);
fwrite($f,"$tunnari|$passu|\n");
flock($f,3);
fclose($f);
echo'Registeration is complited!<br><br>
<a href="'.$_SERVER['PHP_SELF'].'">Login</a><br><br>';
} else {
exit('Username is already taked :(');
}
}else {
exit('Wrong username or password.');
}
}
if(empty($_SESSION['tun']) and empty($_SESSION['iposo'])){
echo'<form method="post" action="'.$_SERVER['PHP_SELF'].'?act=login">
Username<br>
<input type="text" name="tunnus"><br>
password<br>
<input type="password" name="salasana"><br><br>
<input type="submit" value="Login">
</form>
<a href="'.$_SERVER['PHP_SELF'].'?act=rek">Rekister
maybe you make better but i only did learn serieus for 1 week ^^
and a bit jealous :$
Last edited by passie; 05-10-07 at 08:03 PM.
thanks for sharing guys.
your welcome Hurricane if you need more help just pm me !
hhhmm i actually like it
not the securist thing going but does the job if you just want to add a simple login page to a pictures page or something
ty :)
lol i wrote a better script than that. it dosent use Sql nor Xml it stores it in a file called 3x4.txt and it hashes all the passwords. in Md5
ill post it in a minute.