PhP - po odeslani infa se nic nestane ?!
dobry den , kdyz uz mam udelanou registraci v php tak sem ji chtel vyzkouset.
zadam info (jmeno , heslo, email) a odeslu .. ale pak se nic nestane
co stim ? ....
muzete to vyskouset na adrese:http://bhacks-registration.atwebpages.com/index.ph p
a zde je php kod :
.
<?php
mysql_pconnect('fdb3.runhosting.com', '****', '****');
?>
<html>
<head>
<title>PHP Tutorials</title>
</head>
<body>
<?php
if ( !$_POST['submit'] ) {
?>
<form action="index.php" method="post">
<table border="1">
<tr>
<td>
Username:
</td>
<td>
<input type="text" name="username">
</td>
</tr>
<tr>
<td>
Password:
</td>
<td>
<input type="password" name="password">
</td>
</tr>
<tr>
<td>
Password (Confrim):
</td>
<td>
<input type="password" name="passwordconf">
</td>
</tr>
<tr>
<td>
Email:
</td>
<td>
<input type="text" name="email">
</td>
</tr>
<tr>
<td colspan="2" aling="center">
<input type="submit" value="Create User" name=submit">
</td>
</tr>
</table>
</form>
<?php
} else {
$username = $_POST ["username"];
$password = $_POST ["password"];
$paswordconf = $_POST["passwordconf"];
$email = $_POST["email"];
$errors = array();
if ( !$username ) {
$errors[1] = "You did not enter a username.";
}
if ( !$pasword ) {
$errors[2] = "You did not enter a password.";
}
if ( !$paswordcofn ) {
$errors[3] = "You did not enter a password confirmation.";
}
if ( !$email ) {
$errors[4] = "You did not enter email.";
}
if ( !$password != $passwordconf ) {
$errors[5] = "The passwords you entered did not match.";
}
if ( count($error) > 0 ) {
foreach ( $errors as $error ) {
echo "$error<br>";
}
} else {
mysql_query("INSERT INTO `users`.`user_info`
(`username`, `password`, `email`, `user_admin_level`)
VALUES ('".$username."', '".md5($password)."', '".$email."', '1') ; ") ;
}
}
?>
</body>
</html>