the email is send out and the folder is created but the data is not save to the database
the domain have been change for security purpose. thanks in advance ;D
Code: Select all
<?php
$host="localhost"; // Host name
$username="zulfadly_code"; // Mysql username
$password="lololosadsad"; // Mysql password
$db_name="zulfadly_code"; // Database name
$tbl_name="member"; // Table name
// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
// username and password sent from form
$myusername=$_POST['myusername'];
$mypassword=$_POST['mypassword'];
$clas=$_POST['clas'];
$desc=$_POST['desc'];
$folderurl=$_POST['folderurl'];
$vpass=$_POST['vpass'];
$email=$_POST['email'];
$sql="SELECT * FROM $tbl_name WHERE username='$myusername'";
$result=mysql_query($sql);
// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
// If result matched $myusername and $mypassword, table row must be 1 row
if($count==1){
// Check if Username taken, if taken then echo else insert
print "Username Taken! <a href='register.php'>Retry</a>";
exit;
}
//check if passwords are the same
if ($mypassword != $vpass) {
echo "The passwords do not match. <a href='register.php'>Retry</a>";
exit;
}
else {
$dir = 'u//'. $_POST[folderurl]; //see the double \\
if(!is_dir($dir))
{
$email = $_REQUEST['email'] ;
$message = "Thank you for registering! Below are the details for your registration. \n\nUsername: $myusername \n Password: $mypassword \n Url: http://www.example.com/ons/u/ $folderurl";
mail( "$email", "Registration Info",
$message, "From: admin@example.com" );
mysql_query("INSERT INTO member (id, username, password, class, desc, email)
VALUES ('', '$myusername', '$mypassword', '$clas', '$desc', '$email')");
echo "Thank you for registering! We have sent an message to your email regarding your registration info. If you have not received, please check your junk mailbox. Click <a href='index.html'>here</a> to login!";
mkdir($dir);
echo "Sub Folder Successfully Created!";
}
else {
echo "Url Taken!";
}
}
?>