Activity Stream
48,167 MEMBERS
61250 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Results 1 to 6 of 6
  1.     
    #1
    Member

    Default help about php.

    Hey ,
    I knw a lil php . and i wana knw how to make a basic login (username and pass )system using sql
    unique1801 Reviewed by unique1801 on . help about php. Hey , I knw a lil php . and i wana knw how to make a basic login (username and pass )system using sql Rating: 5

  2.   Sponsored Links

  3.     
    #2
    Member
    Website's:
    Pirateview.org Gfxs.org StarkWood.org
    This is the html part of the code for the layout of the login box.
    Code: 
    <html>
    <head><title>Login System By NucleA</title></head>
    <body>
    <form method=GET action="login.php">
    Username: <input type="TEXT" name="Username"><br/>
    Password: <input type="TEXT" name="Password"><br/>
    <input type="Submit" value="Login">
    </body></html>
    Code: 
     
    <?php
    session_start();
     
    mysql_connect("YOUR MYSQl SERVER", "MYSQL USERNAME", "MYSQL PASSWORD") or die(mysql_error());
    mysql_select_db("Mysql Database") or die(mysql_error());
     
    $username=$_GET['Username'];
    $password=$_GET['Password'];
    $ver=0;
     
    $result=mysql_query("SELECT * FROM table") or die(mysql_error());
     
    while($row = mysql_fetch_array( $result )) {
     
    if($username=$row['Username']){
        $ver=$ver+1;
    }
    else{
    echo "Invalid Username!";
    }
     
    if($password=$row['Password']){
    $ver=$ver+1;
    }
    else{
    echo "Invalid Password!";
    }
     
    if ($ver=2){
    echo "Successfull Login!";
    $_SESSION['User']=REGISTERED;
    }

  4.     
    #3
    Member
    Are you integrating this with an existing site or starting from scratch? If you're starting from scratch you might want to have a look at some of the different PHP frameworks available.

    As for your question, this may help. http://www.webstockbox.com/php/7-tut...-login-system/
    ...

  5.     
    #4
    Respected Member
    Quote Originally Posted by unique1801 View Post
    Hey ,
    I knw a lil php . and i wana knw how to make a basic login (username and pass )system using sql
    Learn a bit more, you'll put yourself at risk from SQL Injections if you make a login system at your level. You should check out & learn these functions before you even think about starting this project:

    mysql_real_escape_string
    stripslashes

    You should also learn about XSS attacks and how to protect your code from them.

  6.     
    #5
    Respected Developer
    Website's:
    wrzc.org
    I'd have to aggree with Loget on this one. The above one posted by NucleA is far from safe. It takes a lot of knowledge to write a secure safe login script.
    Instead of writing it from scratch why not download a pre-made script that you just modify. Their are some good ones like http://www.php-login-script.com/ which you just add your own skin to and modify it as you need. Very safe, easy to modify and lots of features.
    Tutorial How to SEO your Warez Site a guide to help you increase your organic traffic

    Huge list of Warez Sites and free Multiposter Templates

  7.     
    #6
    Banned
    To prevent XSS HTMLSPECIALCHAR all HTML output.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

BE SOCIAL