File size: 5.94Kb
<?php
$act=$HTTP_POST_VARS['act'];
$regname=$HTTP_POST_VARS['regname'];
$regemail=$HTTP_POST_VARS['regemail'];
$regpass1=$HTTP_POST_VARS['regpass1'];
$regpass2=$HTTP_POST_VARS['regpass2'];
require "inc.php";
if ((!isset($act))||($regname=="")||($regemail=="")||($regpass1=="")||($regpass2==""))
{
echo "
<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">
<html>
<head>
<title></title>
<meta name=\"description\" content=\"\">
<meta name=\"keywords\" content=\"\">
</head>
<body bgcolor=\"#FFFFFF\" text=\"#000000\" link=\"#006699\" vlink=\"#006699\" alink=\"#006699\">
<STYLE type=\"text/css\">
A {text-decoration: none;}
body
{
margin-left: 1%;
margin-right: 1%;
font-family: Arial, Helvetica, sans-serif;
font-size: 10pt;
background-color: #F0F0F0;
}
</STYLE>";
include "top.php";
echo"
<form method=\"post\" action=\"reg.php\">
<FONT size=2 color=\"#000000\" face=\"Arial\"><FONT size=2 color=\"#000000\" face=\"Arial\">
<TABLE width=100% border=1 cellpadding=1 bordercolor=\"#222288\" cellspacing=0>
<TR valign=top>
<TD> <FONT size=2 color=\"#000000\" face=\"Arial\">
<DIV>
<TABLE width=100% bgcolor=\"#FFFFFF\" border=0 cellpadding=5 bordercolor=\"#000000\" cellspacing=0>
<TR valign=top>
<TD colspan=\"4\" bgcolor=\"#8B93A0\"><FONT size=2 color=\"#000000\" face=\"Arial\">
<DIV align=\"center\"></DIV>
</FONT><FONT size=2 color=\"#000000\" face=\"Arial\">
<DIV align=\"center\"></DIV>
</FONT><FONT size=2 color=\"#000000\" face=\"Arial\">
<DIV align=\"center\"></DIV>
</FONT><FONT size=2 color=\"#000000\" face=\"Arial\">
<DIV align=\"center\"></DIV>
</FONT><FONT size=2 color=\"#000000\" face=\"Arial\">
<DIV align=\"center\"><strong>Registration</strong></DIV>
</FONT></TD>
</TR>
<TR valign=top>
<TD height=16 bgcolor=\"#D5DAEA\"> </TD>
<TD height=16 bgcolor=\"#D5DAEA\"><FONT size=2 color=\"#000000\" face=\"Arial\"><strong>Login</strong></FONT></TD>
<TD height=16 bgcolor=\"#D5DAEA\"><div align=\"justify\">
<input name=\"regname\" type=\"text\" size=\"70\" maxlength=\"50\" value=\"$regname\">
</div></TD>
<TD height=16 bgcolor=\"#D5DAEA\"> </TD>
</TR>
<TR valign=top>
<TD height=16 bgcolor=\"#D5DAEA\"> </TD>
<TD height=16 bgcolor=\"#D5DAEA\"><FONT size=2 color=\"#000000\" face=\"Arial\"><strong>E-Mail</strong></FONT></TD>
<TD height=16 bgcolor=\"#D5DAEA\"><div align=\"justify\">
<input name=\"regemail\" type=\"text\" size=\"70\" maxlength=\"50\" value=\"$regemail\">
</div></TD>
<TD height=16 bgcolor=\"#D5DAEA\"> </TD>
</TR>
<TR valign=top>
<TD height=16 bgcolor=\"#D5DAEA\"> </TD>
<TD height=16 bgcolor=\"#D5DAEA\"><FONT size=2 color=\"#000000\" face=\"Arial\"><strong>Password</strong></FONT></TD>
<TD height=16 bgcolor=\"#D5DAEA\">
<div align=\"justify\">
<input name=\"regpass1\" type=\"password\" size=\"70\" maxlength=\"50\" value=\"\">
</div></TD>
<TD height=16 bgcolor=\"#D5DAEA\"> </TD>
</TR>
<TR valign=top>
<TD height=16 bgcolor=\"#D5DAEA\"> </TD>
<TD height=16 bgcolor=\"#D5DAEA\"><FONT size=2 color=\"#000000\" face=\"Arial\"><strong>Confirm password</strong></FONT></TD>
<TD height=16 bgcolor=\"#D5DAEA\">
<div align=\"justify\">
<p>
<input name=\"regpass2\" type=\"password\" size=\"70\" maxlength=\"50\" value=\"\">
</p>
</div></TD>
<TD height=16 bgcolor=\"#D5DAEA\"> </TD>
</TR>
<TR valign=top>
<TD width=\"10%\" height=16 bgcolor=\"#D5DAEA\"><FONT size=2 color=\"#000000\" face=\"Arial\">
<DIV align=\"center\"></DIV>
</FONT></TD>
<TD width=\"15%\" height=16 bgcolor=\"#D5DAEA\"><FONT size=2 color=\"#000000\" face=\"Arial\">
<DIV align=\"center\"></DIV>
</FONT> </TD>
<TD width=\"65%\" height=16 bgcolor=\"#D5DAEA\">
<div align=\"justify\"><font color=\"#000000\" size=\"2\" face=\"Arial\">
<input type=\"submit\" name=\"Submit\" value=\" OK \">
<input type=\"hidden\" name=\"act\" value=\"post\">
</font></div></TD>
<TD width=\"10%\" height=16 bgcolor=\"#D5DAEA\"><FONT size=2 color=\"#000000\" face=\"Arial\">
<DIV align=\"center\"></DIV>
</FONT></TD>
</TR>
</table>
</div>
</font>
</TABLE>
</FONT></FONT></form>";
include "bottom.php";
echo"
</body>
</html>";
}else
{
$db=mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($dbname,$db);
$sql="select * from users where name='$regname'";
$c=mysql_query($sql);
if (mysql_num_rows($c)!=0)
{
Header("Location: reg.php?regname=User $regname already exist®email=$regemail");
} else
if ($regpass1!=$regpass2)
{
Header("Location: reg.php?regname=$regname®email=$regemail");
} else
{
$hash=md5($regpass1);
$regname=htmlspecialchars($regname, ENT_QUOTES);
$regemail=htmlspecialchars($regemail, ENT_QUOTES);
$sql="insert into users values(NULL, '$regname', '$regemail', '$hash', 'av0.gif', '0')";
$c=mysql_query($sql);
$sql="select * from users where name='$regname'";
$c=mysql_query($sql);
$res=mysql_fetch_array($c);
setcookie("usid", $res[usid]);
setcookie("pass", $hash);
$c=mysql_query($sql);
Header("Location: index.php");
}
}
?>