Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
PHP A Big problem Help me Out !
Old 05-25-2005, 09:31 PM PHP A Big problem Help me Out !
Uche's Avatar
Extreme Talker

Posts: 174
Location: Nigeria/Lagos
Trades: 0
Hello guys,
i'm trying to create a small portal where by every users thats comes in to d site must register b4 they could view tutorials in the website.. i created everything and every thing seems to work fine.. when u click on Register.php it Register and display confirmation.. but **** it woun't dump into DB and it woun't send me Activation Code to my box.. i'm confused pls can someone help me out ?? here is the Register.php code

The Database is working perfectly but i didn't get infos in it no info.



PHP Code:
<?php

include 'dbconn.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 were not the same, 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 fields was left empty, please try again.");</script>';
echo 
'<script>history.back(1);</script>';
exit;

}

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

echo 
'<script>alert("You entered an invalid email address. Please try again.");</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("The username you entered is already in use, please try again.");</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 UcheAlone.\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://EDITTHISURL.COM/activate.php?id=".$act."\n\nPlease do not reply, this is an automated mailer.\n\nThanks""FROM: no-reply@uchealone.com");

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 registering, you will 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.</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 script at the moment.</p>
<p>Your data was not lost. Username: '
.$username.' | Password: '.$pass.' | Email: '.$email.' | Full name: '.$name.'</p>
<p>Please try again later.</p>
</div>

</body>
</html>
'


}

} else {

?>
<html>
<head>
<title>Register</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>
Upon confirmation of your details, you will be sent an email containing your username, password and details on how to activate your account so as to be able to use this website. </div>

</div>

</body>
</html>

<? mysql_close($l); ?>
__________________
Life is just lyke a school where everybody goes to learn one or two thing. the more u school, the more u learn more about school..The more we live our lifes.. the more we learn more about life.

Please login or register to view this content. Registration is FREE
Uche is offline
Reply With Quote
View Public Profile Visit Uche's homepage!
 
 
Register now for full access!
Old 05-26-2005, 02:34 AM
0beron's Avatar
Defies a Status

Posts: 1,832
Location: Somewhere else entirely
Trades: 0
Please don't post duplicate threads.

After a quick look through that I can't see anything wrong. Is your or die(mysql_error()) giving you any errors or not? If it is then you have a sql problem, if not, try putting an echo next to it in the code to make sure execution is getting to that part of your script?
__________________
UPDATE 0beron SET talkupation = talkupation + lots WHERE post = 'helpful';

Please login or register to view this content. Registration is FREE
(aka MSN handwriting for forums)
0beron is offline
Reply With Quote
View Public Profile Visit 0beron's homepage!
 
Old 05-26-2005, 05:42 AM Why ?
Uche's Avatar
Extreme Talker

Posts: 174
Location: Nigeria/Lagos
Trades: 0
Oh sorry 4 duplicating my thread.. thnks 4 ur response.. now the infos are dumping in to the DB.. Yet still not sending Activation Code. why ?www.uchealone.com/uchealone/Register.php[/url]
__________________
Life is just lyke a school where everybody goes to learn one or two thing. the more u school, the more u learn more about school..The more we live our lifes.. the more we learn more about life.

Please login or register to view this content. Registration is FREE

Last edited by Uche; 05-26-2005 at 06:12 AM..
Uche is offline
Reply With Quote
View Public Profile Visit Uche's homepage!
 
Reply     « Reply to PHP A Big problem Help me Out !
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.11701 seconds with 12 queries