View file magforum/reg.php

File size: 3.25Kb
<?  
require("functionChat.ssp");

function ValidNN($s) 
{
  return !eregi("[^a-z0-9_]",$s);
}


$r = GetRandom();
$nn=ReplaceChar($nn);

if (empty($nn)) 
{
  LogResult(utf(4),utf(26),"index.php?p=$r");
}

if (!ValidNN($nn))
{
  LogResult(utf(4),utf(35),"index.php?p=$r");
}

openDB(); 
if ($log=="old") // зарегистрированный пользователь
{
  $result = checkpass($nn,$pass,"email,subjectlen,names,vals");
  InitParam(mysql_result($result,0, "names"),mysql_result($result,0, "vals"));
  $usetrans = GetParam('usetrans');
  $email = mysql_result($result,0, "email");
  $subjectlen = mysql_result($result,0, "subjectlen");
  if (!($subjectlen >= 0 and $subjectlen <= 255)) { $subjectlen = $DefSubjectLen;}
}  
else 
{
  if ($log=="new")
  {
    $sqlSel="select * from users where nick = '$nn'";
    $result=mysql_query($sqlSel) or die(mysql_error()); 
    $Count=mysql_num_rows($result);
    if ($Count != 0)
    {
      LogResult(utf(4),utf(27),"index.php?p=$r&amp;login=$nn&amp;pass=$pass");
    }
    include("antimat.ssp");
    $BadWord = GetBadWord($nn);
    if ($BadWord != "") LogResult(utf(4),utf(25)."<br/>$BadWord", "index.php?p=$r");
    $email = "";
    $messlim = $DefMessLim;
    $subjectlen = $DefSubjectLen;
    $usetrans = 0;
  }
  else
  {
    LogResult(utf(4),utf(28),"index.php?p=$r");
  }  
}    
mysql_close();

require("headerwml.ssp");

echo "<card id=\"ComputerMag\" title=\"ComputerMag\">"; 

echo "<onevent type=\"onenterforward\">\n";
echo "<refresh>\n";
echo "<setvar name=\"password\" value=\"\"/>\n";
echo "<setvar name=\"email\" value=\"\"/>\n";
echo "<setvar name=\"subjectlen\" value=\"\"/>\n";
echo "<setvar name=\"lang\" value=\"\"/>\n";
echo "</refresh>\n";
echo "</onevent>\n";
 
echo "<p align=\"center\">";            
// Правильный синтаксис ников
echo utf(0).":<b>$nn</b><br/>\n";
echo utf(1).":(a-Z,0-9)<br/>";
echo "<input name=\"password\" title=\"=\" type=\"text\" value=\"$pass\" maxlength=\"10\"/>";

echo utf(29)."<br/>";
echo "<input name=\"email\" title=\"=\" emptyok=\"true\" type=\"text\" value=\"$email\" maxlength=\"50\"/>";

echo utf(30)."<br/>".utf(31)."<br/>(1-255):<br/>";
echo "<input name=\"subjectlen\" format=\"*N\" title=\"=\" type=\"text\" value=\"$subjectlen\" maxlength=\"3\"/>";

echo utf(73).":<br/>";
if ($usetrans == $NOT_SET) $usetrans = 0;
echo "<select name=\"lang\" value=\"$usetrans\" title=\"=\">\n";
echo "<option value=\"0\">Off</option>\n";
echo "<option value=\"1\">On</option>\n";
echo "</select>\n";

echo "</p>";
echo "<p>";
echo "<a href=\"index.php?p=$r&amp;login=$nn&amp;pass=$pass\">- ".utf(9)."</a><br/>\n";
echo "<anchor>- ".utf(32);
echo "<go method=\"post\" href=\"savereg.php?log=$log\">\n";
echo "<postfield name=\"email\" value=\"$(email)\"/>\n";
echo "<postfield name=\"subjectlen\" value=\"$(subjectlen)\"/>\n";
echo "<postfield name=\"refrint\" value=\"$DefRefrInt\"/>\n";
echo "<postfield name=\"lang\" value=\"$(lang)\"/>\n";
echo "<postfield name=\"pass\" value=\"$pass\"/>\n"; 
echo "<postfield name=\"nn\" value=\"$nn\"/>\n";
echo "<postfield name=\"newpass\" value=\"$(password)\"/>\n";
echo "<postfield name=\"newnn\" value=\"$nn\"/>\n"; 

echo "</go>\n";
echo "</anchor>\n";   
echo "</p>";
include ("bottom.inc");
?>