View file magmail/savegamereg.php

File size: 1.96Kb
<?

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

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


require("functionChat.ssp");
$ErrorMess = "Error";

$r = GetRandom();
$nn=substr(ReplaceChar($nn),0,10);

if (empty($newpass))
{
  LogResult($ErrorMess,$EmptyFieldMess,"prev");
}

require("antimat.ssp");
$BadWord = GetBadWord($nn);
if ($BadWord != "") LogResult($ErrorMess,"$BadWordMess<br/>$BadWord", "prev");
 

openDB();


$usetrans = $lang;

if ($log=="old") $result = checkpass($nn,$pass,"","prev");
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($ErrorMess,$NNRegMess,"prev");
    }
  }  
  else
  { 
    LogResult($ErrorMess,$InvalidCallMess,"prev");
  }
}    
      
  
if (!ValidNN($nn))
{
  LogResult($ErrorMess,$InvNNSyntaxMess,"prev");
}
if (!ValidPass($newpass))
{
  LogResult($ErrorMess,$InvPassSyntaxMess,"prev");
}
if (trim($email) != "" and !validEmail($email))
{
  LogResult($ErrorMess,$InvEmailSyntaxMess,"prev");
}

if ($log=="old")
{
  $sqlUpd = "update users set nick='$nn', pass='$newpass', email='$email' where nick = '$nn' and pass='$pass'";
  mysql_query($sqlUpd) or die(mysql_error());
}
else 
{ 
  if ($log=="new")
  {
    $now = time();
    $sqllogin ="insert into users (status,sent,regtime,refrint,messlim,mode,nick,pass,email,pi) values ('$RegStatus','0', '$now', '$DefRefrInt','$DefMessLim', '$CommonMode','$nn', '$newpass','$email','$pi')"; 	 mysql_query($sqllogin) or die(mysql_error()); // Вставляем незарегистр. юзера
      
    $sqlIns ="insert into partners (time,nick,pi) values ('$now','$nn','$pi')"; 
    mysql_query($sqlIns) or die(mysql_error());  
  }
}
LogResult($OKMess,$ProfSaveMess,"prev");
mysql_close();   
?>