Hallo Freunde,
ich bin es mal wieder! :-(
Ich habe jetzt ein "einfaches" Registry-Script geschrieben und wollte es jetzt mal testen!
Nur leider werden die Daten nicht in die Datenbank eingetragen:
Die connect.inc.php ist korrekt eingebunden und verbindet auch, aber wieso sendet er die Daten nicht an die Datenbank?
ich bin es mal wieder! :-(
Ich habe jetzt ein "einfaches" Registry-Script geschrieben und wollte es jetzt mal testen!
Nur leider werden die Daten nicht in die Datenbank eingetragen:
PHP-Code:
<?php $title = "Tuerk-Community - Registger" ?>
<?php date_default_timezone_set("Europe/Berlin"); ?>
<?php require_once("includes/top.php"); ?>
<div id="full">
<?php
$form = "<form action='register.php' method='post'>
<table>
<tr>
<td><label for='first name'>Firstname:<font color='#F00'>*</font></label></td>
<td><input type='text' name='firstname' /></td>
</tr>
<tr>
<td><label for='last name'>Lastname:<font color='#F00'>*</font></label></td>
<td><input type='text' name='lastname' /></td>
</tr>
<tr>
<td><label for='username'>Username:<font color='#F00'>*</font></label></td>
<td><input type='text' name='username' /></td>
</tr>
<tr>
<td><label for='email'>Email:<font color='#F00'>*</font></label></td>
<td><input type='email' name='email' /></td>
</tr>
<tr>
<td><label for='password'>Password:<font color='#F00'>*</font></label></td>
<td><input type='password' name='password' /></td>
</tr>
<tr>
<td><label for='password'>Confirm Password:<font color='#F00'>*</font></label></td>
<td><input type='password' name='repassword' /></td>
</tr>
<tr>
<td><label for='avatar'>Avatar:</label></td>
<td><input type='file' name='avatar' /></td>
</tr>
<tr>
<td><label for='website'>Website:</label></td>
<td><input type='text' name='website' /></td>
</tr>
<tr>
<td><label for='youtube'>Youtube Username:</label></td>
<td><input type='text' name='youtube' /></td>
</tr>
<tr>
<td><label for='bio'>Bio/About:</label></td>
<td><textarea name='bio' cols='35' rows='5' /></textarea>
</tr>
<tr>
<td>
<td><font color='#F00'>*</font> to be required</td>
</tr>
<tr>
<td><label for='register'>Register</label></td>
<td><input type='submit' name='submitbtn' value='Submit' /></td>
</tr>
</table>
</form>";
if($_POST['submitbtn'])
{
//Loginvariables
$firstname = strip_tags($_POST['firstname']);
$lastname = strip_tags($_POST['lastname']);
$username = strip_tags($_POST['username']);
$email = strip_tags($_POST['email']);
$password = strip_tags($_POST['password']);
$repassword = strip_tags($_POST['repassword']);
$website = strip_tags($_POST['website']);
$youtube = strip_tags($_POST['youtube']);
$bio = strip_tags($_POST['bio']);
//Avatar upload
$name = $_FILES['avatar']['name'];
$type = $_FILES['avatar']['type'];
$size = $_FILES['avatar']['size'];
$tmpname = $_FILES['avatar']['tempname'];
$ext = substr($name, strrpos($name, '.'));
if($firstname && $lastname && $username && $email && $password && $repassword)
{
if($password == $repassword)
{
//WE CHECKED IF THE EMAIL IS VALID
if(strlen($email)==6 || preg_match("/^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-.]+\.([a-zA-Z]{2,4})$/",$email))
{
require_once("includes/connect.inc.php");
//WE CHECKED IF THE USERNAME IS EXIST
$query = mysql_query("SELECT * FROM users WHERE username='$username'");
$numrows = mysql_num_rows($query);
if($numrows == 0)
{
//WE CHECKED IF THE EMAIL IS EXIST
$query = mysql_query("SELECT * FROM users WHERE email='$email'");
$numrows = mysql_num_rows($query);
if($numrows == 0)
{
$pass = md5(md5($password));
$date = date("F d, Y");
//CREATE AVATAR
if($name)
{
move_uploaded_file($tmpname, "avatar/$username.$ext");
$avatar = "$username.$ext";
}
else
$avatar = "default_avatar.png";
//CREATE THE ACTIVEATE-CODE
$code = substr(sha1(rand(11111111111, 99999999999)), 2, 25);
$webmaster = "xxxxxx@web.de"; // put hire your email
$subject = "Activate Yout Account";
$headers = "From: Webmaster Tuerkcom<$webmaster>";
$message = "Hello $firstname. Welcome to tuerkcom.com Below is a link for you to activate your account on tuerkcom.com\n\n Click hire to activate your account: http://www.sdsdasdasd.bplaced.net/tuerkcom/activate.php?code=$code";
//mail($email,$subject, $message, $headers);
echo "Thanks $username for registering. You must now activate your account by the activatin-code that has been sent to <b>$email</b><br />If you are haveing problems please contact the site-admin at <a href='mailto:xxxxxx@web.de'>Webmaster</a>.";
mysql_query("INERST INTO users VALUES ('', '$firstname', '$lastname', '$username', '$email', '$pass', '$avatar', '$bio.', '$website', '$youtube', '', '0', '$code', '0', '$date')");
}
else
echo "This email is already taken.$form.";
}
else
echo "This username is already taken.$form.";
}
else
echo "You did not enter a valid email.$form.";
}
else
echo "Your passwords did not match.$form.";
}
else
echo "You did not fill in all the required fields. $form";
}
else
{
echo $form;
};
?>
</div>
<?php require_once("includes/bottom.php") ?>
Kommentar