Advanced Search

Results 1 to 8 of 8

Thread: login in php

  1. #1
    Join Date
    Apr 2008
    Posts
    104
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default login in php

    Hi.. im thinking to built a login page in php for my website like each user should have their own pages in it after logging in where they can post thread which will only be viewable to admin and admin can comment it only and a page which shows user project demo.

  2. #2
    Join Date
    Feb 2009
    Posts
    73
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    use session for that palz.

    Steps :
    1. Make a login form (which form actions target to : your process_login page)
    2. Make a process_login.php (in this page, validate the user who want to login)
    3. Divide each user authentication (if admin, go to admin page, if user, go to user page, others, must not login)

    try this, so much fun ^^

  3. #3
    Join Date
    Apr 2008
    Posts
    104
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by sysout View Post
    use session for that palz.

    Steps :
    1. Make a login form (which form actions target to : your process_login page)
    2. Make a process_login.php (in this page, validate the user who want to login)
    3. Divide each user authentication (if admin, go to admin page, if user, go to user page, others, must not login)

    try this, so much fun ^^
    thanx is there any kind of script for this work in php.. anyone tried this before?

  4. #4
    Join Date
    Apr 2008
    Posts
    104
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    bump...

  5. #5
    Join Date
    Mar 2009
    Posts
    65
    Thanks
    13
    Thanked 4 Times in 4 Posts

    Default

    This is basically the kind of projects that is good for beginners to try. Either you try it yourself or learn PHP or...

    http://www.tutorialized.com/tutorial...thentication/1

    or you find a pre-package class that does it for you:

    http://www.phpclasses.org/browse/class/21.html

    It's also a topic covered by many PHP books.

  6. #6
    Join Date
    Apr 2008
    Posts
    104
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by CrazyChop View Post
    This is basically the kind of projects that is good for beginners to try. Either you try it yourself or learn PHP or...

    http://www.tutorialized.com/tutorial...thentication/1

    or you find a pre-package class that does it for you:

    http://www.phpclasses.org/browse/class/21.html

    It's also a topic covered by many PHP books.
    thanks i have already done it but there is one more question, how can i encrypt an HTML page into php likh if someone open that www.domain.com/domain.html directly it does not open and ask to login thru www.domain.com/clientlogin, and after logging in domain.html can be opened

  7. #7
    Join Date
    Apr 2008
    Posts
    104
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    i hope anyone could help me this time i have three pages
    1. Login in HTML
    2. Process-login.php // get user input and re directed to user dersire page
    3. Result page ( now the problem is that this result page is not able variables values from page 1 or even page 2... what could be the solution

  8. #8
    Join Date
    Apr 2009
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Login snnuipet

    a quick one mysql based.

    <?php

    function login(){
    print('<form method="post">
    <input type="hidden" name="id" value="null">
    <input type="text" name="uname" value="UserName"><br/>
    <input type="password" name="urpass" value="oooo"><br?>
    <input type="submit" name="login" value="Login"><br/>
    <input type="reset" value="Retry"></form>');
    }

    if(!isset($_POST['login'])){

    print login();

    }else{

    $urname = $_POST['uname'];
    $urpass = $_POST['urpass'];

    mysql_connect("localhost","dbuser","dbpass") or die(mysql_error());
    mysql_select_db("dbname") or die(mysql_error());

    $query = mysql_query("select user,password from $tablename");
    $result = mysql_fetch_row($query);
    $cqm = ($urname.$urpass && $result[1].$result[2]);
    if($cqm == true){

    setcookie("stat", $_SERVER['REMOTE_ADDR']);
    print("Succesfully loged!");
    header("refresh: 4; url= http://targeted_addres.com/?tab=logued");
    die();

    }
    }

    ?>

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •