register.php
<html>
<body></body></html><link href="style.css" rel="stylesheet" type="text/css">
<center></center><form action="create_account.php" method="post" name="reg" id="reg">
<table width="839" border="0" cellpadding="0" cellspacing="0" class="text">
<tr>
<td>[img]images/blue-box_left.gif[/img]</td>
<td background="/images/blue-box_repeat.gif">Registrati[img]images/arrow.gif[/img]</td>
<td>[img]images/blue-box_right.gif[/img]</td>
</tr>
<tr bgcolor="#C5DBED" class="blue_box">
<td width="17"><span class="Stile1"></span><span class="Stile1"></span><span class="Stile1"></span><span class="Stile1"></span><span class="Stile1"></span></td>
<td width="799">
<table width=688 border=\"0\" cellpadding=1 cellspacing=1 class=text>
<tr>
<td colspan="3">Impostazioni utente </td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>
</p></td>
<td><span class="alert">*</span>Username</td>
<td></td>
</tr>
<tr>
<td width="148"></td>
<td width="280"><input name="user" type=text class=logger size="40" maxlength="32"></td>
<td width="285"></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td><span class="alert">*</span>Password</td>
<td><span class="alert">*</span>Ripeti password</td>
</tr>
<tr>
<td></td>
<td><div align="left">
<input name="pass" type=password class=logger id="pass" size="40" maxlength="32">
</div></td>
<td><input name="pass2" type=password class=logger id="pass2" size="40" maxlength="32"></td>
</tr>
<tr>
<td></td>
<td><div align="left"></div></td>
<td></td>
</tr>
<tr>
<td colspan="3">Impostazioni email
<div align="left"></div></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td><span class="alert">*</span>Email</td>
<td><span class="alert">*</span>Ripeti e mail</td>
</tr>
<tr>
<td></td>
<td><input name="mail" type=text class=logger id="mail" size="40" maxlength="100"></td>
<td><input name="mail2" type=text class=logger id="mail2" size="40" maxlength="100"></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td colspan="3"></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td><div align="center">
<input name="Submit" type="submit" class="logger" value="Prosegui">
</div></td>
<td></td>
</tr>
</table></td>
<td width="23"><span class="Stile1"></span><span class="Stile1"></span><span class="Stile1"></span></td>
</tr>
<tr bgcolor="#C5DBED">
<td><span class="Stile1"></span></td>
<td><span class="Stile1"> </span></td>
<td><span class="Stile1"></span></td>
</tr>
<tr bgcolor="#C5DBED">
<td><span class="Stile1"></span></td>
<td><span class="Stile1"></span></td>
<td><span class="Stile1"></span></td>
</tr>
<tr>
<td class="alert">[img]images/blue-box_down_left.gif[/img]</td>
<td bgcolor="#C5DBED" class="advisory"></td>
<td>[img]images/blue-box_down_right.gif[/img]</td>
</tr>
</table>
</form>
</body>
</html>
create_account.php
Codice PHP:
<?php
require('config.php');
function msg_error($msg)
{
echo "<span class=\"text\">[b]$msg[/b]</span>
";
echo "<a href=\"java script:history.go(-1)\">Indietro</a>";
exit();
}
if(isset($_POST['submit'])) {
$mail = $_POST['mail'];
$mail2 = $_POST['mail2'];
$pass = $_POST['pass'];
$pass2 = $_POST['pass2'];
$user = $_POST['user'];
$date = date("F j, Y, g:i a");
$passmd = md5('$pass');
if($mail == '' || $mail2 == '')
msg_error("Non puoi lasciare il campo mail vuoto!");
if($user == '')
msg_error("Non puoi lasciare il campo username vuoto!");
if($pass == '' || $pass2 == '')
msg_error("Non puoi lasciare il campo password vuoto!");
if($mail != $mail2)
msg_error("Le email inserite non coincidono!");
if($pass != $pass2)
msg_error("Le password inserite non coincidono!");
if($user == "$username") {
msg_error("L'username scelto è già utilizzato!");
} else {
$conn = mysql_connect("$db_host, $db_user, $db_pass")
or die("Impossibile selezionare database");
mysql_select_db("$db_name", $conn)
or die("Impostazioni connessione errate");
$query = "INSERT INTO
`members` (`user`, `pass`, `email`, `regdate`, `ban`)
VALUES
('$user', '$passmd', '$mail', '$date', '0')";
$insert = mysql_query($query, $conn)
or die(mysql_error());
}
} else {
header("Location: index.php?page=register.php");
}
?>
non inserisce niente e non da nessun errore manda solo a register.php con l'header