Jump to content

where is problem in reg.php


Recommended Posts

when try to reg it say

Registration failed: please specify all the fields correctly

 

 

 

 

<div id="content_top">
 Registration
</div>
<div id="content_main">
<?PHP
 
  $regCoins = 0; // Startcoins
 
  $laufZeit = 365; //Tage autoloot,safebox
  $calcLZ = (60*60*24)*365;
  $expireStamp = time()+$calcLZ;
  $expireDate = date("Y-m-d H:i:s",$expireStamp);
 
if($serverSettings['register_on'] && !checkInt($_SESSION['user_admin']) && !$_SESSION['user_admin']>=0) {  
 
    if(isset($_POST['submit']) && $_POST['submit']=="Register") {
      if((checkAnum($_POST['account']) && strlen($_POST['account'])>=8 && strlen($_POST['account'])<=16) && checkAnum($_POST['pass'])  && strlen($_POST['pass'])>=8 && strlen($_POST['pass2'])<=16 && !empty($_POST['pass2']) && $_POST['pass']==$_POST['pass2'] && checkMail($_POST['email']) && strlen($_POST['email'])<=40 && $_POST['captcha']==$_SESSION['captcha_id'] &&(checkAnum($_POST['deletcode']) && strlen($_POST['deletcode'])==7)) {
        $lcode = mysql_real_escape_string($_POST['deletcode']);
        
        $zuFall = rand(99999,999999999);
        $userpass=mysql_real_escape_string($_POST['pass']);
        
        $aktivHash = ($serverSettings['mail_activation']) ? md5($zuFall):'';
        $accountStatus = ($serverSettings['mail_activation']) ? 'BLOCK':'OK';
        
        $sqlCmd = "INSERT INTO account.account
        (login,password,email,social_id,create_time,status,coins,autoloot_expire,safebox_expire,web_aktiviert)
        VALUES
        ('".$_POST['account']."',PASSWORD('".$userpass."'),'".mysql_real_escape_string($_POST['email'])."','".$lcode."','".$sqlZeit."','".$accountStatus."','".$regCoins."','".$expireDate."','".$expireDate."','".$aktivHash."')";
        $sqlQry = mysql_query($sqlCmd,$sqlServ);
        if($sqlQry) {
          
          
          $absender = $serverSettings['titel']." Registration";
          $email = $serverSettings['reg_mail'];
          $empfaenger = $_POST['email'];
          $mail_body = "Hallo ,
          
          deine Registration auf ".$serverSettings['titel']." war erfolgreich! Um auch auf dem Server spielen zu k&#1094;nnen, musst du deinen Account aktivieren.
          Das kannst du &#1100;ber den folgenden Link tun:
          
          ".$serverSettings['url']."/index.php?s=login&do=aktivieren&hash=".$aktivHash."
          
          Deine Daten sind:
          Account: ".$_POST['account']."
          Passwort: ".$userpass."
          
          L&#1094;schcode: ".$lcode."

          
          Viel Spa&#1071; beim Spielen,
          
          Dein ".$serverSettings['titel']."-Team
          
          
          Diese E-Mail wurde automatisch generiert. Bitte keine Antworten an diese Adresse schicken.";
          $titel = "Registrierung auf ".$serverSettings['titel'];
          
          $header = "X-Priority: 3\n";
          $header .= "X-Mailer: ".$serverSettings['titel']." Homepage Mailer\n";
          $header .= "MIME-Version: 1.0\n";
          $header .= "From: ".$absender." <".$serverSettings['reg_mail'].">\n";
          $header .= "Reply-To: ".$serverSettings['reg_mail']."\n";
          $header .= "Content-Type: text/plain; charset=iso-8859-1\n";
          
          
          if($serverSettings['mail_activation']) {
            mail($empfaenger, $titel, $mail_body, $header);
            echo'<div id="success"><p class="success">Account successfully created..</p></div>';
          }
          else {
            echo'<div id="success"><p class="success">Account successfully created..</p></div>';
          }
          
        }
        else {
          echo'<div id="fail"><p class="fail">Registration failed: The account already exists</p></div>';
        }
        
      }
      else {
        echo'<div id="fail"><p class="fail">Registration failed: please specify all the fields correctly</p></div>';
      }
    }
  ?>
    <p>All fields are required and must be filled.<?PHP if($serverSettings['mail_activation']) { echo'<br/><b>Der Account wird per E-Mail aktiviert, also eine richtige E-Mail eingeben!</b>'; } ?></p>
    <form action="index.php?s=register" method="POST">
      <table>
        <tr>
          <th class="topLine">Account:</th>
          <td class="tdunkel"><input type="text" name="account" maxlength="16" size="16"/> 8-16 (a-Z,0-9)</td>
        </tr>
        <tr>
          <th class="topLine">Password:</th>
          <td class="tdunkel"><input type="password" name="pass" maxlength="16" size="16"/> 8-16(a-Z,0-9)</td>
        </tr>
        <tr>
          <th class="topLine">Repeat Password:</th>
          <td class="thell"><input type="password" name="pass2" maxlength="16" size="16"/></td>
        </tr>
        <tr>
          <th class="topLine">E-Mail:</th>
          <td class="tdunkel"><input type="text" name="email" maxlength="50" size="25"/> max. 40</td>
        </tr>
        <tr>
          <th class="topLine">deletecode:</th>
          <td class="tdunkel"><input type="text" name="deletcode" maxlength="7" size="7"/> 7a-Z,0-9)</td>
        </tr>
        <tr>
          <th class="topLine">Captcha:</th>
          <td class="tdunkel"><img src="./captcha/captcha.php" title="Captcha"/>&nbsp;<input type="text" name="captcha" maxlength="5" size="5"/></td>
        </tr>
        <tr>
          <th class="topLine" style="text-align:center;" colspan="2"><input class="btn" type="submit" name="submit" value="Register"/> &bull; <input type="reset" class="btn" value="zur&uuml;cksetzen"/></th>
        </tr>
      </table>
    </form>
  <?PHP
  }
  else {
    echo'<p class="meldung">Registration is disabled or you have already registered. There can be no other account be created</p>';
  }
?>
</div>
<div id="content_footer">
</div>

Link to comment
Share on other sites

failed at this line:

if ((checkAnum($_POST['account']) && strlen($_POST['account']) >= 8 && strlen($_POST['account']) <= 16) && checkAnum($_POST['pass']) && strlen($_POST['pass']) >= 8 && strlen($_POST['pass2']) <= 16 && !empty($_POST['pass2']) && $_POST['pass'] == $_POST['pass2'] && checkMail($_POST['email']) && strlen($_POST['email']) <= 40 && $_POST['captcha'] == $_SESSION['captcha_id'] && (checkAnum($_POST['deletcode']) && strlen($_POST['deletcode']) == 7)) {

never saw such an ugly code. Debug all conditions here and you will fix that

What happens here?

(checkAnum($_POST['account']) && strlen($_POST['account']) >= 8 && strlen($_POST['account']) <= 16)

checks if posted "account" has only alpabetic or numeric characters + checks the charakter lengh (min 8 chars, max 16 chars)

checkAnum($_POST['pass']) && strlen($_POST['pass']) >= 8 && strlen($_POST['pass2']) <= 16 && !empty($_POST['pass2']) && $_POST['pass'] == $_POST['pass2']

same here for password + check if password is given and the same as password2

checkMail($_POST['email']) && strlen($_POST['email']) <= 40

checkMail should be a function to check if this is a valid mail + checks that mail has max 40 chars

$_POST['captcha'] == $_SESSION['captcha_id']

Checks captcha

(checkAnum($_POST['deletcode']) && strlen($_POST['deletcode']) == 7)

delete code must given + exact 7 chars

 

Now debug this.

Edited by Ayaka
Link to comment
Share on other sites

Nobody can help you here because you have to debug your script yourself. No one here can do this for you because we have no server access. We dont know how your functions checkAnum or checkMail look like. We dont know what exactly you post in the form. We only know your register.php which seems "ok".

Edited by Ayaka
Link to comment
Share on other sites

then where i know functions checkanum in website or in game

in website it is function

<?PHP

  function calcPages($gesEin,$aktSeite,$eSeite) {
    $output = array();
    $esQuote = ceil(($gesEin/$eSeite));
    if($aktSeite==0) {$aktSeite=1;}
    $startS = ($aktSeite*$eSeite)-$eSeite;
    $output[0]=$esQuote;
    $output[1]=$startS;
    return $output;
  }
 
  function checkAnum($wert) {
    $checkit = preg_match("/^[a-zA-Z0-9]+$/",$wert);
    if($checkit) {
      return true;
    }
    else {
      return false;
    }
  }
 
  function checkIP($wert) {
    $checkit = preg_match("/^[0-9\*]{1,3}+\.[0-9\*]{1,3}+\.[0-9\*]{1,3}+\.[0-9\*]{1,3}+$/",$wert);
    if($checkit) {
      return true;
    }
    else {
      return false;
    }
  }
 
  function checkName($wert) {
    $checkit = preg_match("/^[a-zA-Z0-9[:space:]]+$/",$wert);
    if($checkit) {
      return true;
    }
    else {
      return false;
    }
  }
 
  function checkVoucher($wert) {
    $checkit = preg_match("/^[0-9]+[0-9\-]+[0-9]+$/",$wert);
    $wert = str_replace('-','',$wert);
    if($checkit && strlen($wert)>=16 && strlen($wert)<=25) {
      return true;
    }
    else {
      return false;
    }
  }
 
  function checkPwd($wert) {
    $checkit = preg_match("/^[a-zA-Z0-9[:space:]]+$/",$wert);
    if($checkit) {
      return true;
    }
    else {
      return false;
    }
  }
 
  function checkMail($string) {
    if(preg_match("/^[a-zA-Z0-9\._-]+@[a-zA-Z0-9\.-]+\.[a-zA-Z]{2,4}$/", $string)) {
      return true;
    }
    else { return false; }
  }
 
  function checkInt($wert) {
    $checkit = preg_match("/^[0-9]+$/",$wert);
    if($checkit) {
      return true;
    }
    else {
      return false;
    }
  }
 
  function checkRate($wert) {
    //if(checkInt($wert) && $wert>0) {
    if(preg_match("/^[1-9]+\.[0-9]+$/",$wert) || $wert>0) {
      return true;
    }
    else {
      return false;
    }
  }

  function compareItems($inputID) {
 
    $input = "./archives/items.txt";
    
    $getFile =  file($input);
    $getZeilen = count($getFile);
    
    for($x=0;$x<$getZeilen;$x++) {
    
      $aktZeile = $getFile[$x];
      $splitZeile = explode('|||',$aktZeile);
      $startWert = $splitZeile[0]+0;
      $endWert = $splitZeile[1]+0;
      if($inputID<=$endWert AND $inputID>=$startWert) {
        $maxStufe = $endWert-$startWert;
        $stufe=$inputID-$startWert;
        $aus=array();
        $aus['item'] = $splitZeile[2];
        $aus['groesse'] = trim($splitZeile[3]);
        $aus['stufe'] = ($maxStufe==0) ? NULL : $stufe;
        $aus['maxStufe'] = $maxStufe;
        $aus['vnum']=$startWert;
        return $aus;
      }
    }
    $nItem=array();
    $nItem['groesse']=1;
    $nItem['item']=$inputID;
    $nItem['stufe']=NULL;
    $nItem['maxStufe']=0;
    $nItem['vnum']=$inputID;
    return $nItem;
 
  }
 
  function checkPos($inID) {
    global $sqlServ;
    $sqlCmd="SELECT pos,vnum FROM player.item WHERE owner_id='".$inID."' AND window='SAFEBOX'";
    $sqlQry=mysql_query($sqlCmd,$sqlServ);
    
    $lagerPos=array();
    while($getLager=mysql_fetch_object($sqlQry)) {
      $maxGr = compareItems($getLager->vnum);
      $aktPos=$getLager->pos;
      for($i=1;$i<=$maxGr['groesse'];$i++) {
        $lagerPos[$aktPos]=$getLager->vnum;
        $aktPos = $aktPos + 5;
      }
    }
    
    $sqlCmd="SELECT pos,vnum FROM player.item WHERE owner_id='".$inID."' AND window='MALL'";
    $sqlQry=mysql_query($sqlCmd,$sqlServ);
    
    $islPos=array();
    while($getISL=mysql_fetch_object($sqlQry)) {
      $maxGr = compareItems($getISL->vnum);
      $aktPos=$getISL->pos;
      for($i=1;$i<=$maxGr['groesse'];$i++) {
        $islPos[$aktPos]=$getISL->vnum;
        $aktPos = $aktPos + 5;
      }
    }
    
    $returnArray['lager']=$lagerPos;
    $returnArray['islager']=$islPos;
    
    return $returnArray;
  }
 
  function listLager($inArray,$typus=0) {
    if($typus==1) {
      $ueS='IS-Lager';
      $cInput=$inArray['islager'];
    }
    else {
      $ueS='Lager';
      $cInput=$inArray['lager'];
    }
    echo'<table class="lager">';
    echo'<tr>
      <th class="topLine" colspan="5">'.$ueS.'</th>
    </tr>';
    for($i=0;$i<45;$i++) {
      if($i==0) { echo'<tr>'; }
      if(isset($cInput[$i])) {
        $zF="tdunkel";
        $getItem = compareItems($cInput[$i]);
        $iStufe = (checkInt($getItem['stufe'])) ? "+".$getItem['stufe'] : '';
        $lineout="<a title=\"".$getItem['item'].$iStufe."\">".$i."</a>";
      }
      else { $zF="thell"; $lineout=$i; }
      echo '<td class="'.$zF.'">'.$lineout.'</td>';
      if($i!=0 && ($i+1)%5==0) {
        echo'</tr>';
        if(($i+1)!=45) { echo '<tr>'; }
      }
    }
    echo'</table>';
 
  }
 
  function findPos($belegtePos,$iGroesse) {
    $possPos=array();
    for($i=0;$i<45;$i++) {
    
      if(empty($belegtePos[$i])) {
      
        for($y=0;$y<$iGroesse;$y++) {
        
          $aktPos=$i+($y*5);
          $thisFits = true;
          if(!isset($belegtePos[$aktPos]) && $aktPos<45) {
            $thisFits = true;
          }
          else {
            $thisFits = false;
            break;
          }
          
        }
        if($thisFits) { $possPos[]=$i; }
        
      }
    
    }
    return $possPos;
  }

  function checkUploadSize($dateiGr,$maxGr) {
    $maxGrByte = $maxGr*1024;
    if($dateiGr<=$maxGrByte) {
      return true;
    }
    else {
      return false;
    }
  }
 
  function imageCheckSize($datei,$xMax,$yMax) {
    $erlaubteBilder = array(
      'image/jpeg' => '.jpg',
      'image/gif'  => '.gif'
    );
    $getGr=getimagesize($datei);

    if($getGr[0]<=$xMax && $getGr[1]<=$yMax && !empty($erlaubteBilder[$getGr['mime']]) ) {
      return $erlaubteBilder[$getGr['mime']];
    }
    else {
      return false;
    }
  }
 
  function imageUpload($dateiIn,$maxDateiGr,$maxDateix,$maxDateiy) {
    if($_FILES[$dateiIn]['size']>0) {
      if(checkUploadSize($_FILES[$dateiIn]['size'],$maxDateiGr)) {
        if($dateiEndung = imageCheckSize($_FILES[$dateiIn]['tmp_name'],$maxDateix,$maxDateiy)) {
          $md5datei = md5_file($_FILES[$dateiIn]['tmp_name']).'_'.rand(10000,99999);
          if(move_uploaded_file($_FILES[$dateiIn]['tmp_name'],'./is_img/'.$md5datei.$dateiEndung)) {
            return $md5datei.$dateiEndung;
          }
          else { return false; }
        }
        else { return false; }
      }
      else { return false; }
    }
    else { return false; }
  }
 
  function getMapByIndex($mapIndex) {
    if(checkInt($mapIndex)) {
      $mapArchive = "./archives/maps.txt";
      $mapContents = file($mapArchive);
      $returnArray=false;
      foreach($mapContents AS $aktMap) {
      
        $splitZeile = explode("|||",$aktMap);
        if(trim($splitZeile[0])==$mapIndex) {
          $returnArray=array();
          $returnArray=$splitZeile;
        }
        
      }
      
      if(is_array($returnArray)) {
        return $returnArray;
      }
      else {
        return false;
      }
      
    }
    else {
      return false;
    }
  }
 
  function listItems($iid='') {
    echo'<select name="itemtyp">';
      echo'<option value="">-------</option>';
      $itemDatei = "./archives/items.txt";
      $itemListe = file($itemDatei);
      $dateiLaenge = count($itemListe);
      for($i=0;$i<$dateiLaenge;$i++) {
        $splitZeile = explode("|||",$itemListe[$i]);
        $selected= ($iid>=$splitZeile[0] && $iid<=$splitZeile[1]) ? 'selected=selected':''; // to go
        echo'<option '.$selected.' value="'.$splitZeile[0].'">'.$splitZeile[2].'</option>';
      }
    echo'</select>';
  }
 
  function listMaps() {
    $mDatei = file('./archives/maps.txt');
    
    echo'<ul class="menue">';
    
    foreach($mDatei AS $aktMap) {
      
      $splitZeile = explode("|||",$aktMap);
      if(isset($splitZeile[6])) {
        echo '<li><a href="index.php?s=admin&a=map&mapindex='.$splitZeile[0].'">'.$splitZeile[6].'</a></li>';
      }
    
    }
    
    echo'</ul>';
    
  }
 
  function getDatum($timeStamp=0)
  {
    return date("d.m.Y",$timeStamp);
  }
 
  function getZeit($timeStamp=0)
  {
    return date("H:i",$timeStamp);
  }

  function x_nl2br($input)
  {
    $input = str_replace("\n",'<br/>',$input);
    return $input;
  }
 
  function listNewsKat($mIndex=-1)
  {
    global $newsKategorien;
    echo'<select name="kategorie">';
    foreach($newsKategorien AS $katIndex => $katName)
    {
      $selected = ($mIndex==$katIndex) ? 'selected="selected"' : '';
      echo'<option '.$selected.' value="'.$katIndex.'">'.$katName.'</option>';
    }
    echo'</select>';
  }
 
  function checkBetween($input,$lower=0,$upper=0)
  {
    if($input>=$lower && $input<=$upper) { return true; }
    else { return false; }
  }
?>

Edited by raihan3
Link to comment
Share on other sites

  • Honorable Member

Add me on skype, i'll help you.

pollux.epvp

 

€dit:

Problem was: There are fields on the account table which doesn't allow values which are "null" or empty. Just go in navicat, right click your table you want to modify and select "design table". Then put every field, which causes an error to "allow null" and save your changes.

Edited by .Poᴌᴌuᶍ
added explanation
  • Love 2
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.