Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 15 of 15

Thread: Members

  1. #1
    Banned
    Join Date
    Aug 2007
    Posts
    113
    Thanks
    22
    Thanked 0 Times in 0 Posts

    Members

    How do I make a member section, where people log in and get access to pages that normal visitors cannot? Also how would I get the members along with a forum that is already set up on the same site?

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    Integration with a out-of-the-box forum script will be tricky if not impossible. You'll have to dig into the forum documentation to see if they provide an interface to their login process (doubtful).

    Your first question is answered simply but it's fairly involved unless you are experienced. It involves a couple of different parts-- storing username and password in either a database or a flat file, a login script, and then a method of carrying login information from page to page, usually done using sessions.

    If after reading through the page in the manual I linked to you're still interested in giving it a shot but don't know quite where to begin, let us know.

  • #3
    Senior Coder
    Join Date
    Apr 2007
    Location
    Quakertown PA USA
    Posts
    1,028
    Thanks
    1
    Thanked 125 Times in 123 Posts
    Regarding the forum issue, and I can only speak about phpBB...

    But, if this happens to be a phpBB forum, there are hacks available which allow you to use the phpBB user system, site-wide.

    Depending on the version:

    phpBB 2.x.x - hacks have been released for this purpose
    phpBB 3.x.Rx - I'm not sure if a hack has actually been released yet, but there are instructions available to do this.

    Search http://phpbb.com.

  • #4
    New Coder
    Join Date
    Aug 2007
    Location
    Wagga, Australia
    Posts
    59
    Thanks
    0
    Thanked 1 Time in 1 Post
    copy the core of the login code to make it available for your website and examine the code and figure out how it checks for users being online, or simply figure out what session values are set and do a simple check on your website so then it is like a portal? lol you may as well get community portal software like php-nuke or something, would save a lot of stuffing around

  • #5
    Banned
    Join Date
    Aug 2007
    Posts
    113
    Thanks
    22
    Thanked 0 Times in 0 Posts
    Ok, let's forget about the Forum. Let's say I'm just making a site with people logging in and being a member to get access to pages that normal visitors cant get.

  • #6
    New Coder
    Join Date
    Aug 2007
    Location
    Wagga, Australia
    Posts
    59
    Thanks
    0
    Thanked 1 Time in 1 Post
    PHP Code:
    <?php
    session_start
    ();
    if(!isset(
    $_SESSION["user"])) {
    session_destroy();
    die(
    header("Location: index.php"));
    }
    add something like that to the beginning of a page that you only want members able to access. And to set the session variable they have to login

  • Users who have thanked usik for this post:

    afesoccer (08-25-2007)

  • #7
    Banned
    Join Date
    Aug 2007
    Posts
    113
    Thanks
    22
    Thanked 0 Times in 0 Posts
    How do I make the members... members making an account and etc...

  • #8
    New Coder
    Join Date
    Aug 2007
    Location
    Wagga, Australia
    Posts
    59
    Thanks
    0
    Thanked 1 Time in 1 Post
    you need to make a register form that connects to a mysql database and saves the user

  • #9
    Banned
    Join Date
    Aug 2007
    Posts
    113
    Thanks
    22
    Thanked 0 Times in 0 Posts
    How do I do that?

  • #10
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,046
    Thanks
    19
    Thanked 42 Times in 42 Posts
    heres one i use, if you dont know how to code php to make a register form then maybe you should pay someone to code for you
    PHP Code:
    <?php
    if (isset($_POST['submit'])) {
    $submit $_POST['submit'];
    $username strip_tags($_POST['username']);
    $pass1 sha1(strip_tags($_POST['pass1']));
    $pass2 sha1(strip_tags($_POST['pass2']));
    $email $_POST['email'];
    $email2 $_POST['email_confirm'];
    $errormsg = array("No password entered or password too short \n""No email address entered or email address's didn't match "); 
    $error '';
    $count strlen($pass1);
    if (isset(
    $submit))


    if (empty(
    $pass1)  || $count )

    $error .= $errormsg[0];
    }
    if (empty(
    $pass2)) 
    {
    $error .= $errormsg[0];
    }
    if (empty(
    $email) || $email != $email2)
    {
    $error .= $errormsg[1];
    }
    if (
    $error == '')
    {
    include (
    "sqlprotect.php");
    include (
    "sqlconnect.php");
    mysql_select_db($db$con) or die(mysql_error());
    $user_exist mysql_result(mysql_query("SELECT COUNT(1) username FROM users WHERE username='$username'"), 0);
    if(
    $user_exist 0){ 
        echo 
    "I'm sorry but the username you specified has already been taken.  Please pick another one."
        unset(
    $username);   ?>    
        
        <form name="register" method="post" action="register.php">
    <label for="username">Display Name: <input type="text" name="username" id="username" /> <br />
    <label for="email">Email:</label><input id="email" type="text" name="email" /> <br />
    <label for="email2">Confirm Email:</label><input id="email2" type="text" name="email_confirm" /> <br />
    <label for="password">Password:</label><input id="password" type="password" name="pass1" /><br />
    <label for="pass2">Confirm Password:</label><input id="pass2" type="password" name="pass2" /><br />
    <input type="submit" name="submit" value="Register" /><br />
    </form>
         <?php
    }
    $email_exist mysql_result(mysql_query("SELECT COUNT(1) email FROM users WHERE email='$email'"), 0);
    if(
    $email_exist 0){ 
        echo 
    "I'm sorry but have already got an account. Please click <a href=\"/login.php\">here</a> to login "
        unset(
    $email);   
        exit;   
    }
    $query "INSERT INTO users (`email`, `username`, `password` ) 
    VALUES('$email', '$username', '$pass1')"

    $result = @mysql_query($query) or die (mysql_error()."<strong>SQL:</strong> $query");
    mysql_close();

    header("Location: /registersuccess.php");

    }else{
    echo 
    "<ul class='error'>";
    $err explode("\n","$error");
    foreach (
    $err as $key) {
    echo 
    "<li>$key</li>";
    }
    echo 
    "</ul> ";
    ?>
    <div class='form'>
    <form name="register" method="post" action="register.php">
    <label for="username">Display Name: <input type="text" name="username" id="username" /> <br />
    <label for="email">Email:</label><input id="email" type="text" name="email" /> <br />
    <label for="email2">Confirm Email:</label><input id="email2" type="text" name="email_confirm" /> <br />
    <label for="password">Password:</label><input id="password" type="password" name="pass1" /><br />
    <label for="pass2">Confirm Password:</label><input id="pass2" type="password" name="pass2" /><br />
    <input type="submit" name="submit" value="Register" /><br />
    </form>
    </div>
    <?php
    }
    }
    }else{

    ?>

    <form name="register" method="post" action="register.php">
    <label for="username">Display Name: <input type="text" name="username" id="username" /> <br />
    <label for="email">Email:</label><input id="email" type="text" name="email" /> <br />
    <label for="email2">Confirm Email:</label><input id="email2" type="text" name="email_confirm" /> <br />
    <label for="password">Password:</label><input id="password" type="password" name="pass1" /><br />
    <label for="pass2">Confirm Password:</label><input id="pass2" type="password" name="pass2" /><br />
    <input type="submit" name="submit" value="Register" /><br />
    </form>
    <?php

    }
    ?>

  • #11
    Banned
    Join Date
    Aug 2007
    Posts
    113
    Thanks
    22
    Thanked 0 Times in 0 Posts
    Sure, I'll pay someone about $5.00 paypal money just to make a simple site with two-five pages or more with people making accounts.

  • #12
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    A dollar a page, what a deal.

  • #13
    Banned
    Join Date
    Aug 2007
    Posts
    113
    Thanks
    22
    Thanked 0 Times in 0 Posts
    Is anyone up?

  • #14
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,046
    Thanks
    19
    Thanked 42 Times in 42 Posts
    i jus give you code for a register page. for FREE if you want more work done pay a decent amount!

  • #15
    Banned
    Join Date
    Aug 2007
    Posts
    113
    Thanks
    22
    Thanked 0 Times in 0 Posts
    Ok, I'll have it please.


  •  

    Posting Permissions

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