Jump to content

+++ Members sign up script +++


jaimeweb

Recommended Posts

Hi everyone.

Right, can anyone please help me or direct me to a script what will do the following...(i am not no expert with php or mysql so you may need to explain :d)

What it is im looking for is a members script. People visiting my site will sign up by creating an account filling in username password address full name d.o.b ect. Then i would like the information to be saved in a MySQL database. Then they will login and be redirected to a page of my choice...

It is not essiential to have any type of "update my settings/profile" or "forgot password" function...(only if its simple to set up...by that i mean it is on its own seperate page)

Hope that makes sence!
Please help!

Thanks
Link to comment
https://forums.phpfreaks.com/topic/30533-members-sign-up-script/
Share on other sites

http://www.google.co.uk/search?q=php+members+script&ie=utf-8&oe=utf-8&rls=org.mozilla:en-GB:official&client=firefox-a


Search on google brings up a ton of script results.. most on hotscripts etc are open source so you can learn from it, or simply use it. its best if you work with one of them and see what each one gives you, and which one works best for you.
first you need mysql database to hold members details:

[code]
CREATE TABLE members (
member_ID int unsigned not null auto_increment primary key,
username varchar(12),
password varchar(32),
firstname varchar(50),
surname varchar(50),
dob date
);
[/code]

Then you will need a script for a member to create an account, this is just a simple HTML form and PHP processing scipt to add the details to the database. It does not include any form checking or verification:

[code]
<?php

// check to see is user has submitted form
if (!isset($_POST['submit']) {

// show registration form
?>

<form name="create_user" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
First Name: <input name="firstname" type="text"><br>
Surname: <input name="surname" type="text"><br>
Date of Birth: <input name="dob" type="text"> (YYYYMMDD)<br>
Username: <input name="username" type="text"><br>
Password: <input name="password" type="text"><br>
<input name="submit" type="submit" value="Create User">
</form>

<?php
} else {

// process new user details
$query = "INSERT INTO members (username,password,firstname,surname,dob) VALUES
('".$_POST['username']."','".md5($_POST['password'])."','".$_POST['firstname']."','".$_POST['surname']."',".$_POST['dob'].")";
$result = mysql_query($query);

// check member created
if ($result) {
echo "Registration completed";
} else {
echo "There was a problem with your registration";
}

?>
[/code]

Then you will need a log in script:

[code]
<?php

// check to see if user has submitted form
if (!isset($_POST['login'])) {

// show login form
?>

<form name="login" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
Username: <input name="username" type="text"><br>
Password: <input name="password" type="password"><br>
<input name="login" type="submit" value="Login">
</form>

<?php
} else {

// connect to database here <=============

// process login details
$query = "SELECT * FROM members WHERE username = '".$_POST['username']."' AND password = '".md5($_POST['password'])."'";
$result = mysql_result($query);

if (mysql_num_rows($result) == 1) {
// user has been verified
echo "You have been logged";
} else {
// user rejected
echo "There was a problem with your login details";
}

?>
[/code]

Hope that gives you something to start with.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.