View Single Post
Old 04-21-2007   #6 (permalink)
liam.smith
Registered User
 
Join Date: Apr 2007
Posts: 5

hi all
thanks for the help mike but im afraid im not really getting it =[

Let me try giving you my code and see if you can better understand where Im coming from?

I have used the tutorial on biorust to make the member system so that you can sign up and log in. All their info is stored in a table called "users"

the registration page for members

PHP Code:
<?php

include 'config.php';

if(isset(
$_POST['submit']))
{

$first addslashes(trim($_POST['firstname']));
$surname addslashes(trim($_POST['surname']));
$username addslashes(trim($_POST['username']));
$email addslashes(trim($_POST['email']));
$pass addslashes(trim($_POST['password']));
$conf addslashes(trim($_POST['confirm']));

$ip $_SERVER['REMOTE_ADDR'];
$date date("d, m y");

if ( 
$_POST['password'] == $_POST['confirm'] )
{}else{

echo 
'<script>alert("Your passwords did not match =[ please enter the same password in each field.");</script>';
echo 
'<script>history.back(1);</script>';
exit;

}

$password md5($pass);

if ((((( empty(
$first) ) || ( empty($surname) ) || ( empty($username) ) || ( empty($email) ) || ( empty($password) )))))
{

echo 
'<script>alert("One or more field was left empty, gotta fill them all out!.");</script>';
echo 
'<script>history.back(1);</script>';
exit;

}

if((!
strstr($email "@")) || (!strstr($email ".")))
{

echo 
'<script>alert("Pretty sure thats not a real email address. Please try again =p");</script>';
echo 
'<script>history.back(1);</script>';
exit;

}

$q mysql_query("SELECT * FROM Users WHERE Username = '$username'") or die(mysql_error());
if(
mysql_num_rows($q) > 0)
{

echo 
'<script>alert("Sadly that name already belongs to someone else =[ Try something else?");</script>';
echo 
'<script>history.back(1);</script>';
exit;

}

$name $first ' ' $surname;
$actkey mt_rand(1500).'f78dj899dd';
$act sha1($actkey);

$query mysql_query("INSERT INTO Users (Username, Password, Name, Email, Date, IP, Actkey) VALUES ('$username','$password','$name','$email','$date','$ip','$act')") or die(mysql_error());
$send mail($email "Registration Confirmation" "Thank you for registering with YourScene!.\n\nYour username and password is below, along with details on how to activate your account.\n\nUser: ".$username."\nPass: ".$pass."\n\nClick the link below to activate your account:\nhttp://ys.hgbforum.net/activate.php?id=".$act."\n\nPlease do not reply to this email as its not an email address we check!.\n\nThanks""FROM: contact@hgbforum.net");

if((
$query)&&($send))
{

echo 
' <html>
<head>
<title>Success</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>

<body>

<div id="success">
<p>Thank you for signing up to YourScene! you should recieve an email soon with your login details and your activation link so that you can activate your account.</p>
<p><a href="login.php">Click here</a> to login once you have activated your account.</p>
</div>

</body>
</html>
'


} else {

echo 
'
<html>
<head>
<title>Error</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>

<body>

<div id="error">
<p>We are sorry, there appears to be a problem with our website at the moment =[</p>
<p>Fear not though! Your data was not lost! Username: '
.$username.' | Password: '.$pass.' | Email: '.$email.' | Full name: '.$name.'</p>
<p>Please try again in a little while.</p>
</div>

</body>
</html>
'


}

} else {

?>
<html>
<head>
<title>Sign Up</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>

<body>

<div id="wrapper">

<div id="head">the registration page</div>
<br>
<div id="main"> 
<p>Welcome to the registration, fill out the form below and hit Submit. All fields are required,so fill them all out! </p>
<form action="<?= $_SERVER['PHP_SELF'?>" method="post">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="50%">First name </td>
<td width="50%"><input name="firstname" type="text" id="firstname"></td>
</tr>
<tr>
<td>Surname</td>
<td><input name="surname" type="text" id="surname"></td>
</tr>
<tr>
<td>Email Address </td>
<td><input name="email" type="text" id="email"></td>
</tr>
<tr>
<td>Username</td>
<td><input name="username" type="text" id="username"></td>
</tr>
<tr>
<td>Password</td>
<td><input name="password" type="password" id="password"></td>
</tr>
<tr>
<td>Confirm Password </td>
<td><input name="confirm" type="password" id="confirm"></td>
</tr>
<tr>
<td>Register</td>
<td><input name="submit" type="submit" class="textBox" value="Submit"></td>
</tr>
</table>
</form>
When you click sumbit, you will be sent an email containing your username, password and details on how to activate your account =] </div>

</div>

</body>
</html>

<? mysql_close($l); ?>
Seperatley I have a form that allows you to enter information into the table "bandprofile" in the same database.

Enter into bandprofile

PHP Code:
<html>
<head>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<?php
include("config.php");
if (
$_POST['process'] == "yes") {
$name=addslashes($_POST['name']);
$bio=addslashes($_POST['bio']);
$site=addslashes($_POST['site']);
$photo=addslashes($_POST['photo']);
mysql_query("INSERT INTO bandprofile (name,bio,site,photo) VALUES('$name','$bio','$site','$photo')") or die(mysql_error());
?>
<p>Sorted! Your profiles all done =]</p>
<?php
}
else {
?>
<form action="makeprofile.php" method="post">
<input type="hidden" name="process" value="yes" />
<center><h1>Make A Profile</h1><br /> <br /></center>
<table border="0">
<tr>
<td>Band Name:</td>
<td><input type="text" name="name" /></td>
</tr>
<tr>
<td valign="top">Bio:</td>
<td><textarea rows="10" cols="20" name="bio"></textarea></td>
</tr>
<tr>
<td>URL to image:</td>
<td><input type="text" name="photo" /></td>
</tr>
<tr>
<td>Website:</td>
<td><input type="text" name="site" /></td>
</tr>
</table>
<br />
<input type="submit" value="Go" />
</form>
<?php
}
?> 
</body>
</html>
What id like is for when you sign up as a member your members page has a link (such as "customise my profile") to the bandprofile form on it. You fill it out and the info is sent to the table "bandprofile". Then, the next time you log in and click the link "customise my profile" the form is shown and in the different fields are all the information you entered last time.

Id like it so that you (as a member) can ONLY see / use the form that edits YOUR information

please, anyone that can help with this id be most grateful and could even give credit on my site if youd like =]

hope to hear back soon and any more information needed just ask!

(ps. sorry about the delay in response from myself Ive not been well latley)

thanks
Liamx
liam.smith is offline