+ Reply to Thread
Results 1 to 8 of 8

Thread: how do i make a simple login

  1. #1
    ballken is offline x10Hosting Member ballken is an unknown quantity at this point
    Join Date
    Nov 2007
    Posts
    1

    Question how do i make a simple login

    i want to make a login thing but i dont know how. does anybody here know how to?

  2. #2
    ctadmin is offline x10Hosting Member ctadmin is an unknown quantity at this point
    Join Date
    Dec 2007
    Posts
    55

    Re: how do i make a simple login

    go to w3schools.com it tells you how somewhere... :P

  3. #3
    sonicsshadow is offline x10 Sophmore sonicsshadow is an unknown quantity at this point
    Join Date
    Nov 2007
    Posts
    198

    Re: how do i make a simple login

    Make a sql database with the usernames / passwords (this is very basic) and do a sql query.
    Alternatively if you wanted it to be a basic (VERY BASIC) you could do this:
    login.html:
    <html>
    <head>
    <title>Login</title>
    </head>
    <body>
    <table>
    <form action="protectedarea.php" method="post">
    <tr><td>Username:</td><td><input type="text" name="username"></td></tr>
    <tr><td>Password:</td><td><input type="password" name="password"></td></tr>
    </form>
    </table>
    </body>
    </html>

    Then make a file called protectedarea.php and put this:
    <html>
    <head>
    <title>Protected area!</title>
    </head>
    <body>
    <?
    $password = $_POST['password']
    if ($password == "this is where you put the value of the password.")
    {
    echo "You have successfully logged in.";
    }
    else
    {
    echo "You have entered an invalid username / password!";
    }
    ?>
    </body>
    </html>

    What that does is check if the user entered the password you have set.
    NOTE:This only works on one page. If they go to another page they won't be prompted to login.
    protectedarea.php is the only page that is password protected.

    THIS DOES NOT USE SESSIONS AND IS REALLY BASIC!

    ~~~

    You could also just make a dictionary and use the CPanels function to password protect it.
    That way would be better..
    Last edited by sonicsshadow; 01-04-2008 at 09:24 PM.

  4. #4
    Join Date
    Oct 2007
    Location
    IN YOUR FACE
    Posts
    341

    Re: how do i make a simple login

    Login to cPanel and hit password protect directories

  5. #5
    coolv1994 is offline x10 Elder coolv1994 is an unknown quantity at this point
    Join Date
    Nov 2007
    Posts
    506

    Re: how do i make a simple login

    theres tutorials at webdesign.org

  6. #6
    fdbessjr is offline x10Hosting Member fdbessjr is an unknown quantity at this point
    Join Date
    Nov 2007
    Posts
    24

    Re: how do i make a simple login

    This would be the script for the login form

    <html>
    <title>Login</title>
    <body>
    <form action="userlogin.php">
    Username: <input type="text" name="username"><br>
    Password: <input type="password" name="password"><br>
    <input type="submit" value="login">
    </form>

    save that as login.html then make a file called userlogin.php
    and put this in it...

    <?php
    //Check for required forms in the fields
    if (empty($_POST["username"])) || (empty($_POST["password"])))
    {
    header("Location: login.html");
    exit;
    }
    //Connects to database
    $mysqli = mysqli_connect("Your Mysql server", "Databases Username", "Databases Password", "Database Name");
    //Create and issue the query
    $sql = "SELECT * FROM auth_users WHERE username = '".$_POST["username"]."' AND password = PASSWORD('".$_POST["password"]."')";
    $result = mysqli_query($mysqli, $sql) or die(mysqli_error($mysqli));
    //get the number of rows in the result set; should be 1 if a match
    if (mysqli_num_rows($result) == 1) {
    //Set Authorization Cookie
    setcookie("auth", "1", 0, "/", "Your Websites Name", 0);
    ?>
    <body>You Are Authorized!!!</body>
    <?
    } else {
    ?>
    <body>You are unauthorized </body>
    <?
    }
    ?>


    But you have to have a database for this one sorry if I made a stupid typo, I hope I didn't

  7. #7
    Black Ghost is offline x10Hosting Member Black Ghost is an unknown quantity at this point
    Join Date
    Dec 2007
    Posts
    3

    Re: how do i make a simple login

    use Front Page
    it's easy way to make login page:cool:

  8. #8
    tittat's Avatar
    tittat is offline x10 Spammer tittat is an unknown quantity at this point
    Join Date
    Sep 2007
    Location
    Kerala,India
    Posts
    2,479

    Re: how do i make a simple login

    try with an e107 website.
    www.e107.org
    PLAY ONLINE GAMES
    WWW.TMONDO.COM PlayFar Flash Games
    Former X10 Forum Senior Moderator(Retired)


+ Reply to Thread

Similar Threads

  1. The previous way of login?
    By halchalgroups in forum Free Hosting
    Replies: 1
    Last Post: 09-22-2007, 02:07 AM
  2. Simple Forum Sig Tutorial (Photoshop)
    By Veivei in forum Graphics & Webdesign
    Replies: 7
    Last Post: 09-05-2007, 09:34 PM
  3. Can anyone make me a banner or two
    By Kay in forum The Marketplace
    Replies: 12
    Last Post: 12-22-2005, 08:11 PM
  4. Make A Cool Advanced Brushed Sig
    By redtailblackshark in forum Tutorials
    Replies: 34
    Last Post: 10-22-2005, 07:20 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers