...

View Full Version : Members



afesoccer
08-24-2007, 04:18 AM
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?

Fumigator
08-24-2007, 04:58 AM
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 (http://us2.php.net/manual/en/ref.session.php).

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.

PappaJohn
08-24-2007, 07:12 AM
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.

usik
08-24-2007, 12:35 PM
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

afesoccer
08-24-2007, 05:22 PM
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.

usik
08-24-2007, 11:26 PM
<?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

afesoccer
08-25-2007, 03:03 AM
How do I make the members... members making an account and etc...

usik
08-25-2007, 04:03 AM
you need to make a register form that connects to a mysql database and saves the user

afesoccer
08-25-2007, 04:47 PM
How do I do that?

rafiki
08-25-2007, 05:05 PM
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
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 < 6 )
{
$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

}
?>

afesoccer
08-31-2007, 04:33 AM
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.

Fumigator
08-31-2007, 06:30 AM
A dollar a page, what a deal.

afesoccer
08-31-2007, 04:00 PM
Is anyone up?

rafiki
08-31-2007, 09:07 PM
i jus give you code for a register page. for FREE if you want more work done pay a decent amount!

afesoccer
09-01-2007, 05:30 AM
Ok, I'll have it please.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum