Results 1 to 7 of 7

Thread: PHP Script for Registering and Signing in the Website

  1. #1
    Join Date
    Aug 2006
    Posts
    142

    PHP Script for Registering and Signing in the Website

    Hi friends,
    I am trying to make the code for my site so that unregistered users can be kept out. But I am not able to do. I am going somewhere wrong. Can anyone help me by giving me the code. I need to make PHP Script for Registering and Signing in, so my site is protected from those who are not registered members. Please help me soon..
    ~HARE KRISHNA HARE RAM~

  2. #2
    Join Date
    May 2008
    Posts
    2,012

    Re: PHP Script for Registering and Signing in the Website

    I have done the similar thing, also if you want to register and have users log then How are you planning to store their information.?? I used the Perl script for the Login and a SQL (mySQL) database as back-end to hold the information. I think that you can also do this easily since this approach is very simple. It uses text boxes and simple insert, update, and select statements to access the database.

  3. #3
    Join Date
    May 2008
    Posts
    2,297

    Re: PHP Script for Registering and Signing in the Website

    I would like to tell you that the suggestion mentioned by the "Katty" is correct but you can do the same thing with PHP & MySQL. It totally depends upon you that which script you find more comfortable. You can use the various script for the same application, but it's upto you to select the script in which you have enough knowledge.

  4. #4
    Join Date
    Oct 2005
    Posts
    2,393

    Re: PHP Script for Registering and Signing in the Website

    The following is the PHP Script for Registering and Signing :
    <?php
    session_start();

    if ($_POST)
    {
    $_SESSION['logged_in'] = true;
    echo 'Logged in'
    }
    else
    {
    // For Displaying Login form.
    echo '<form action="?" method="post">' . "\r\n";
    }
    ?>

    To log users out:
    $_SESSION = array();
    session_destroy();

    Hope that this will help you a lot.

  5. #5
    Join Date
    Feb 2008
    Posts
    1,852

    Re: PHP Script for Registering and Signing in the Website

    The following code would be helpful for making the Login Page :
    <?php
    print "<form action='$PHP_SELF' method='post' enctype='multipart/form-data' name='auth'>
    &nbsp;&nbsp;<p><font color=\"#000000\">Name: </font>
    <input type=\"text\" name=\"name\" size=\"20\" maxlength=\"35\"></p>
    <p><font color=\"#000000\">Password:&nbsp; </font>
    <input type=\"password\" name=\"pass\" size=\"20\">
    <input type=\"submit\" value=\"Authorize\"></div>
    </form>";

    $name = trim($_POST['name']);
    $pass = trim($_POST['pass']);
    if ($_SERVER['REQUEST_METHOD'] == 'POST'){
    if ($pass=="test")
    $redirect = $PHP_SELF."?admin=$admin&$POST_var=$POST_value"; //example
    header('Location: '.$redirect);
    }else{
    ...
    }
    }

  6. #6
    Join Date
    Jan 2008
    Posts
    1,521

    Re: PHP Script for Registering and Signing in the Website

    The following code you can use for the authentication :
    <?php
    if ($_REQUEST['pass'] === 'YOUR PASSWORD/PASSPHRASE') {
    // display secure content
    } else {
    ?>
    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
    <input type="password" name="pass" />
    <input type="submit" value="Submit" />
    </form>
    <?php
    }
    ?>
    You can use the above code to give the password to the multiple pages.

  7. #7
    Join Date
    Apr 2008
    Posts
    1,948

    Re: PHP Script for Registering and Signing in the Website

    You can also use the following script for the password but only as Session
    <?php
    if (!isset($_SESSION)) {
    session_start();
    }
    if (($_POST['password'] == $password) || ($_SESSION['password'] == $password)) {
    if (isset($_POST['password'])) {
    $_SESSION['password'] = $_POST['password'];
    }

    // secure content

    } else {
    ?>
    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
    <input type="password" name="password" />
    <input type="submit" value="Submit" />
    </form>
    <?php } ?>

Similar Threads

  1. Re-enable the script for website in opera.
    By Holly Dayin in forum Technology & Internet
    Replies: 2
    Last Post: 24-02-2012, 07:54 PM
  2. Acrobat 9 (or 9.1) -- Script changes prevents signing
    By Roockie in forum Windows Software
    Replies: 4
    Last Post: 10-07-2010, 05:36 AM
  3. Background Music Script for Website
    By REDBULL in forum Software Development
    Replies: 5
    Last Post: 31-12-2009, 12:55 PM
  4. Free open source PHP calender script for my website?
    By garfield1 in forum Software Development
    Replies: 1
    Last Post: 01-08-2009, 09:21 PM
  5. Need script for website with firefox only
    By Gap meer in forum Software Development
    Replies: 4
    Last Post: 01-12-2008, 05:44 PM

Tags for this Thread

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
  •  
Page generated in 1,713,410,561.95958 seconds with 16 queries