[No mysql]login script

Page 2 of 2 FirstFirst 12
Results 16 to 26 of 26
  1. #16
    The Omega Superfun is offline
    MemberRank
    Dec 2006 Join Date
    The NetherlandsLocation
    5,227Posts

    Re: [No mysql]login script

    Quote Originally Posted by passie View Post
    i maked a basic login script PHP/HTML
    no mysql requested rate it please

    sample : Untitled Document (delete if not allowed).

    id:test
    pw:1234

    Code:
    <html>
    <head>
    <title>Untitled Document</title>
    </head>
    <body>
    <form id="form1" name="form1" method="post" action="login.php">
      <label>
      Username 
      <input type="text" name="id" id="id" />
      </label>
      <p>
        Password
        <input type="password" name="pw" id="pw" />
      </p>
      <p>
        <label>
        <input type="submit" name="button" id="button" value="Login" />
        </label>
      </p>
    </form>
    </body>
    </html>
    PHP Code:
    <?php
    if($_POST['id'] == 'test' AND $_POST['pw'] == '1234'){
    echo 
    "welcome ";
    echo 
    $_POST['id'];
    }
    elseif(empty(
    $_POST['id']))
    {
    echo 
    "You left username field empty, Go back.";

    elseif(empty(
    $_POST['pw']))
    {
    echo 
    "You left password field empty, Go back.";

    else 
    {
    echo 
    "You dont have right to login";
    }
    ?>
    PHP Code:
    echo "You left username field empty, Go back.";
    exit()

    Otherwise you get the page that you wanted to protect

  2. #17
    Account Upgraded | Title Enabled! passie is offline
    MemberRank
    Jan 2005 Join Date
    The NetherlandsLocation
    710Posts

    Re: [No mysql]login script

    oh yea ty superfun i did forget that !

  3. #18
    Enthusiast Nortie is offline
    MemberRank
    Aug 2007 Join Date
    49Posts

    Re: [No mysql]login script

    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

  4. #19
    Proficient Member Maitokahvi is offline
    MemberRank
    Sep 2007 Join Date
    In Zoo :PLocation
    155Posts
    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

  5. #20
    Gamma Daevius is offline
    MemberRank
    Jun 2007 Join Date
    NetherlandsLocation
    3,252Posts

    Re: [No mysql]login script

    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

  6. #21
    Proficient Member Maitokahvi is offline
    MemberRank
    Sep 2007 Join Date
    In Zoo :PLocation
    155Posts

    Re: [No mysql]login script

    Quote Originally Posted by Daevius View 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

  7. #22
    Account Upgraded | Title Enabled! passie is offline
    MemberRank
    Jan 2005 Join Date
    The NetherlandsLocation
    710Posts

    Re: [No mysql]login script

    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.

  8. #23
    Apprentice Hurricane is offline
    MemberRank
    Oct 2007 Join Date
    Sofia,BulgariaLocation
    12Posts

    Re: [No mysql]login script

    thanks for sharing guys.

  9. #24
    Account Upgraded | Title Enabled! passie is offline
    MemberRank
    Jan 2005 Join Date
    The NetherlandsLocation
    710Posts

    Re: [No mysql]login script

    your welcome Hurricane if you need more help just pm me !

  10. #25
    Account Upgraded | Title Enabled! bored292 is offline
    MemberRank
    Sep 2006 Join Date
    ...Location
    188Posts

    Re: [No mysql]login script

    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 :)

  11. #26
    Account Upgraded | Title Enabled! kip0130 is offline
    MemberRank
    Nov 2006 Join Date
    937Posts

    Re: [No mysql]login script

    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.



Page 2 of 2 FirstFirst 12

Advertisement