intenz skrifaði:<input type="submit" name="button" value="Halda áfram">
type="button" submittar ekki formið og því sendist breytan aldrei.
oki svona er þetta núna:
Kóði: Velja allt
<?php
$name=$_POST[name];
$username=$_POST[username];
$email=$_POST[email];
$email2=$_POST[email2];
$password=$_POST[password];
$password2=$_POST[password2];
$terms=$_POST[accept];
$confirm_code=md5(uniqid(rand()));
//see if password is correct
if ($password==$password2)
{
}
else
{
header("location:villa/incorrectpassword.html");
break;
}
//see if email is correct
if ($email==$email2)
{
}
else
{
header("location:villa/incorrectemail.html");
break;
}
//see if username is alphanumberic
if (!eregi(("[^A-Za-z0-9.^]"),$username))
{
}
else
{
header("location:villa/incorrectusername.html");
break;
}
//see if name is alpharic
if (!eregi(("[^A-Z a-z^]"),$name))
{
}
else
{
header("location:villa/incorrectname.html");
break;
}
if (isset($terms))
{
}
else
{
header("location:villa/terms.html");
break;
}
if ($name=="")
{header("location:villa/empty.html"); break;}
elseif ($username=="")
{header("location:villa/empty.html"); break;}
elseif ($email=="")
{header("location:villa/empty.html"); break;}
elseif ($password=="")
{header("location:villa/empty.html"); break;}
include('connect.php');
$query=sprintf("SELECT * FROM users WHERE username ='%s'",
mysql_real_escape_string($username));
$result=mysql_query($query);
$num=mysql_num_rows($result);
if ($num==0)
{}
else
{header('location:villa/nameinuse.html');}
$query=sprintf("SELECT * FROM users WHERE username ='%s'",
mysql_real_escape_string($email));
$result=mysql_query($query);
$num=mysql_num_rows($result);
if ($num==0)
{}
else
{header('location:villa/emailinuse.html');}
mysql_query(sprintf("INSERT INTO `b.ingimarsson`.`temp` (`code`, `username`, `email`, `password`) VALUES ('%s', '%s', '%s', '%s')",
mysql_real_escape_string($confirm_code),
mysql_real_escape_string($username),
mysql_real_escape_string($email),
mysql_real_escape_string($password)));
?>
<body bgcolor="#252525">
<font color="white" face="arial" >
<b>
<h2>Nýskráning</h2>
<h2>______________________________</h2>
</b>
</font>
</body>
<body bgcolor="#252525">
<font color="white" face="arial" >
<b>
<?php
?>
<body bgcolor="#252525">
<font color="white" face="arial" >
<b>
<?php
echo "fullt nafn: ".$name."<br/>" ;
echo "notendanafn: ".$username."<br/>" ;
echo "netfang: ".$email."<br/>" ;
echo "lykilorð: ";
?>
<input type="button" value="sýna lykilorð" onclick="alert('<?php echo ($password); ?>')">
<br/>
<br/>
<?php
echo $confirm_code;
?>
<br/>
<br/>
<form name="form" method="post">
<input type="submit" name="button" value="Halda áfram">
</form>
<?php
if(isset($_POST['button']))
{
mysql_query(sprintf("INSERT INTO `b.ingimarsson`.`users` (`name`, `username`, `email`, `password`) VALUES ('%s', '%s', '%s', '%s')",
mysql_real_escape_string($name),
mysql_real_escape_string($username),
mysql_real_escape_string($email),
mysql_real_escape_string($password)));
echo "echo";
}
else
{}
?>
</b>
</font>
</body>
þegar ég ýti á takkann fer ég yfir á villa/terms.html, wtf