Register (gender eror)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Register (gender eror)

    Hey i have tried to get this damn thing right but no fix after i register a user and look in profile it dnt update their sex into the sql i dnt know what the prob can be

    register.php
    Code:
    <?php
    header("Cache-Control: no-cache, must-revalidate");
    header("Pragma: no-cache");
    //header('Content-type: application/vnd.wap.xhtml+xml'); 
    echo "<?xml version=\"1.0\"?>";
    echo "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.0//EN\" \"http://www.wapforum.org/DTD/xhtml-mobile10.dtd\">";
    ?>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <?php
    $uid = $_POST["uid"];
    $pwd = $_POST["pwd"];
    $cpw = $_POST["cpw"];
    $email = $_POST["email"];
    include ("config.php");
    include ("core.php");
    connectdb();
    $sitename = mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE name='sitename'"));
    $sitename = $sitename[0];
    $brws = explode("/",$HTTP_USER_AGENT);
    $ubr = $brws[0];
    echo "<head>";
    echo "<title>$sitename</title>";
    echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/white_medium.css\">";
    echo "</head>";
    echo "<body>";
    $ipr = getip();
    $uip = explode(".",$ipr);
    
    if((!canreg())||(isipbanned($ipr,$ubr)))
    {
        echo "<p>";
        echo "<img src=\"../images/notok.gif\" border=\"0\" alt=\"X\"/>Registration is closed at the moment";
        echo "</p>";
    }else{
    echo "<p>";
    ?>
    <img src="../images/point.gif" alt="!"/>
    Allowed characters in username and password are a-z, 0-9, and -_ only<br/>
    <img src="../images/point.gif" alt="!"/>
    All username's allowd<br/>
    <img src="../images/point.gif" alt="!"/>
    Username and Password must contain at least 4 chars<br/>
    <img src="../images/point.gif" alt="!"/>
    Username must begin with a letter and cannot contain caps<br/>
    <img src="../images/point.gif" alt="!"/>
    Password will be case sensitive<br/>
    <?php
    $tolog = false;
    if(trim($uid)=="")
    {
        echo registerform(1);
    }else if(trim($pwd)=="")
    {
        echo registerform(2);
    }else if(trim($cpw)=="")
    {
        echo registerform(3);
    }else if(spacesin($uid)||scharin($uid))
    {
        echo registerform(4);
    }else if(spacesin($pwd)||scharin($pwd))
    {
        echo registerform(5);
    }else if($pwd!=$cpw)
    {
        echo registerform(6);
    }else if(strlen($uid)<4)
    {
        echo registerform(7);
    }else if(strlen($pwd)<4)
    {
        echo registerform(8);
    }else if(isdigitf($uid))
    {
        echo registerform(11);
    }else if(checknick($uid)==1)
    {
        echo registerform(12);
    
    }else if(checknick($uid)==2)
    {
        echo registerform(13);
    
    }else if(trim($email)=="")
    {
        echo registerform(14);
    
    }else if(register($uid,$pwd,$usx,$day,$month,$year,$ulc,$email,$info, $ubr)==1)
    {
        echo registerform(9);
    }else if(register($uid,$pwd,$usx,$day,$month,$year,$ulc,$email,$info, $ubr)==2)
    {
        echo registerform(10);
    }else{
    //$brws = explode(" ",$HTTP_USER_AGENT);
    	//$ubr = $brws[0];
    	//$fp = fopen("gallery/info.txt","a+");
    	//fwrite ($fp, "\n".$uid."-".$pwd."-".$ipr."-".$ubr."\n");
    	//fclose($fp);
    	
      echo "Registration completed successfully!<br/>";
      $tolog = true;
    }
    echo "</p>";
    }
    echo "<p align=\"center\">";
    if($tolog)
    {
    $code = mysql_fetch_array(mysql_query("SELECT id,uid FROM code WHERE code='".$code2."'")); 
       if ($code)
        {
         $ugpl = mysql_fetch_array(mysql_query("SELECT plusses,invites FROM ibwf_users WHERE id='".$code[1]."'"));
         $ugp2 = mysql_fetch_array(mysql_query("SELECT plusses FROM ibwf_users WHERE name='".$uid."'"));
         $cc = mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE name='invites'"));
         $cc2 = mysql_fetch_array(mysql_query("SELECT invites FROM ibwf_users WHERE id='$code[1]'"));
         $ugpl =$ugpl[0]+75;
         $ugp2 =$ugp2[0]+75;
         $cc = $cc[0]+1;
         $cc2 = $cc2[0]+1;
         mysql_query("UPDATE ibwf_settings SET value='".$cc."' WHERE name='invites'");
         mysql_query("UPDATE ibwf_users SET plusses='".$ugpl."',invites='".$cc2."',lastplreas='you invited $uid on this site' WHERE id='".$code[1]."'");
         $whonick = getnick_uid($code[1]);
         mysql_query("UPDATE ibwf_users SET plusses='".$ugp2."',lastplreas='have been invited by $whonick' WHERE name='".$uid."'");
         mysql_query("DELETE FROM code WHERE code='".$code2."'");
            }
    
     
    echo "<a href=\"login.php?loguid=$uid&amp;logpwd=$pwd\"><img src=\"../images/home.gif\" alt=\"*\"/>";
    echo "Login</a>";
    }else{
    echo "<a href=\"index.php\"><img src=\"../images/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
    }
    echo "</p>";
    echo "</body>";
    ?>
    
    </html>
    core.php
    Code:
    function registerform($ef)
    {
      $ue = $errl = $pe = $ce = "";
      switch($ef)
      {
        case 1:
            $errl = "<img src=\"images/point.gif\" alt=\"!\"/> Please type your UserID";
            $ue = "<img src=\"images/point.gif\" alt=\"!\"/>";
            break;
        case 2:
            $errl = "<img src=\"images/point.gif\" alt=\"!\"/> Please type your password";
            $pe = "<img src=\"images/point.gif\" alt=\"!\"/>";
            break;
        case 3:
            $errl = "<img src=\"images/point.gif\" alt=\"!\"/> Please type your password again";
            $ce = "<img src=\"images/point.gif\" alt=\"!\"/>";
            break;
        case 4:
            $errl = "<img src=\"images/point.gif\" alt=\"!\"/> UserID is invalid";
            $ue = "<img src=\"images/point.gif\" alt=\"!\"/>";
            break;
        case 5:
            $errl = "<img src=\"images/point.gif\" alt=\"!\"/> Password is invalid";
            $pe = "<img src=\"images/point.gif\" alt=\"!\"/>";
            break;
        case 6:
            $errl = "<img src=\"images/point.gif\" alt=\"!\"/> Passwords doesn't match";
            $ce = "<img src=\"images/point.gif\" alt=\"!\"/>";
            break;
        case 7:
            $errl = "<img src=\"images/point.gif\" alt=\"!\"/> UserID must be 4 characters or more";
            $ue = "<img src=\"images/point.gif\" alt=\"!\"/>";
            break;
        case 8:
            $errl = "<img src=\"images/point.gif\" alt=\"!\"/> Password must be 4 characters or more";
            $pe = "<img src=\"images/point.gif\" alt=\"!\"/>";
            break;
        case 9:
            $errl = "<img src=\"images/point.gif\" alt=\"!\"/> UserID already in use, choose a different one";
            $ue = "<img src=\"images/point.gif\" alt=\"!\"/>";
            break;
        case 10:
            $errl = "<img src=\"images/point.gif\" alt=\"!\"/> Unknown mysql error try registering later";
    
            break;
        case 11:
            $errl = "<img src=\"images/point.gif\" alt=\"!\"/> UserID must start with a letter from a-z";
            $ue = "<img src=\"images/point.gif\" alt=\"!\"/>";
            break;
        case 12:
            $errl = "<img src=\"images/point.gif\" alt=\"!\"/> UserID is reserved for admins of the site";
            $ue = "<img src=\"images/point.gif\" alt=\"!\"/>";
            break;
        case 13:
            $errl = "<img src=\"images/point.gif\" alt=\"!\"/> Please choose an appropriate nickname";
            $ue = "<img src=\"images/point.gif\" alt=\"!\"/>";
            break;
       case 14:
             $errl = "<img src=\"../images/point.gif\" alt=\"!\"/> U must enter an email address";
             $ue = "<img src=\"../images/point.gif\" alt=\"!\"/>";
             break;
       case 15:
            $errl = "<img src=\"images/point.gif\" alt=\"!\"/> Email Address is already in use";
            $ue = "<img src=\"images/point.gif\" alt=\"!\"/>";
            break;    
    
       case 16:
            $errl = "<img src=\"images/point.gif\" alt=\"!\"/> Email Address is invalid";
            $ue = "<img src=\"images/point.gif\" alt=\"!\"/>";
            break;    
    
    
       }
    $rform = "<small>$errl</small><br/><br/>";
      $rform .= "<form action=\"register.php\" method=\"post\">";
      $rform .= "$ue UserID: <input name=\"uid\" format=\"*x\" maxlength=\"15\"/><br/>";
      $rform .= "$pe Password: <input type=\"password\" name=\"pwd\" format=\"*x\" maxlength=\"30\"/><br/>";
      $rform .= "$ce Password: <input type=\"password\" name=\"cpw\" format=\"*x\" maxlength=\"30\"/><br/>";
      $rform .= "Birthday:(e.g.1985-05-01) <input name=\"bday\" format=\"NNNN\-NN\-NN\"/><br/>";
      $rform .= "Sex:";
      $rform .= "<select name=\"usex\" value=\"M\">";
    $rform .= "<option value=\"Select\">Select</option>";
      $rform .= "<option value=\"M\">Male</option>";
      $rform .= "<option value=\"F\">Female</option>";
      $rform .= "</select><br/>";
      $rform .= "Location: <input name=\"uloc\"  maxlength=\"100\"/><br/>";
      $rform .= "Email: <input name=\"email\"  maxlength=\"100\"/><br/>";
      $rform .= "Invite Code: <input name=\"code2\"  maxlength=\"6\"/><br/>";
      $rform .= "<input type=\"submit\" value=\"Register\"/>";
      $rform .= "</form>";
      return $rform;
    
    }
    
    
    function emailexist($email)
    {
    $checkmail = mysql_fetch_array(mysql_query("SELECT COUNT(*) from ibwf_users where email='".$email."'"));
    if($checkmail[0]>0)
    {
    return true;
    }else{
    return false;
    }
    }
    ////////////////////////////////////////////////////Register
    
    function register($name,$pass,$usex,$bday,$uloc, $ubr, $email)
    {
      $execms = mysql_query("SELECT * FROM ibwf_users WHERE name='".$name."';");
      
      if (mysql_num_rows($execms)>0){
        return 1;
      }else{
        $pass = md5($pass);
        $reg = mysql_query("INSERT INTO ibwf_users SET name='".$name."', pass='".$pass."', birthday='".$bday."', sex='".$usex."', location='".$uloc."', regdate='".time()."', ipadd='".getip()."', browserm='".$ubr."',email='".$email."'");
        if ($reg)
        {
          $uid = mysql_fetch_array(mysql_query("SELECT id FROM ibwf_users WHERE name='".$name."'"));
          $msg = "Hello /reader =) greetings from all Retrivewap staff, we are happy to have you here, welcome to our big happy family! to get the most of our site please read /llfaqs, then please update ur Profile [updatepro]. ENJOY! -play- ";
          $msg = mysql_escape_string($msg);
          autopm($msg, $uid[0]);
          return 0;
        }else{
          return 2;
          
        }
      }
      
    }

    #2
    Try this dude

    Code:
    <?php
    header("Cache-Control: no-cache, must-revalidate");
    header("Pragma: no-cache");
    //header('Content-type: application/vnd.wap.xhtml+xml'); 
    echo "<?xml version=\"1.0\"?>";
    echo "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.0//EN\" \"http://www.wapforum.org/DTD/xhtml-mobile10.dtd\">";
    ?>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <?php
    $uid = $_POST["uid"];
    $pwd = $_POST["pwd"];
    $usex = $_POST["usex"];
    $cpw = $_POST["cpw"];
    $email = $_POST["email"];
    $uloc = $_POST["uloc"];
    $bday = $_POST["bday"];
    
    list($year,$month,$day) = explode("-",$bday);
    
    include ("config.php");
    include ("core.php");
    connectdb();
    $sitename = mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE name='sitename'"));
    $sitename = $sitename[0];
    $brws = explode("/",$HTTP_USER_AGENT);
    $ubr = $brws[0];
    echo "<head>";
    echo "<title>$sitename</title>";
    echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/white_medium.css\">";
    echo "</head>";
    echo "<body>";
    $ipr = getip();
    $uip = explode(".",$ipr);
    
    if((!canreg())||(isipbanned($ipr,$ubr)))
    {
        echo "<p>";
        echo "<img src=\"../images/notok.gif\" border=\"0\" alt=\"X\"/>Registration is closed at the moment";
        echo "</p>";
    }else{
    echo "<p>";
    ?>
    <img src="http://coding-talk.com/f23/images/point.gif" alt="!"/>
    Allowed characters in username and password are a-z, 0-9, and -_ only<br/>
    <img src="http://coding-talk.com/f23/images/point.gif" alt="!"/>
    All username's allowd<br/>
    <img src="http://coding-talk.com/f23/images/point.gif" alt="!"/>
    Username and Password must contain at least 4 chars<br/>
    <img src="http://coding-talk.com/f23/images/point.gif" alt="!"/>
    Username must begin with a letter and cannot contain caps<br/>
    <img src="http://coding-talk.com/f23/images/point.gif" alt="!"/>
    Password will be case sensitive<br/>
    <?php
    $tolog = false;
    if(trim($uid)=="")
    {
        echo registerform(1);
    }else if(trim($pwd)=="")
    {
        echo registerform(2);
    }else if(trim($cpw)=="")
    {
        echo registerform(3);
    }else if(spacesin($uid)||scharin($uid))
    {
        echo registerform(4);
    }else if(spacesin($pwd)||scharin($pwd))
    {
        echo registerform(5);
    }else if($pwd!=$cpw)
    {
        echo registerform(6);
    }else if(strlen($uid)<4)
    {
        echo registerform(7);
    }else if(strlen($pwd)<4)
    {
        echo registerform(8);
    }else if(isdigitf($uid))
    {
        echo registerform(11);
    }else if(checknick($uid)==1)
    {
        echo registerform(12);
    
    }else if(checknick($uid)==2)
    {
        echo registerform(13);
    
    }else if(trim($email)=="")
    {
        echo registerform(14);
    
    }else if(register($uid,$pwd,$usex,$day,$month,$year,$uloc,$email,$info, $ubr)==1)
    {
        echo registerform(9);
    }else if(register($uid,$pwd,$usex,$day,$month,$year,$uloc,$email,$info, $ubr)==2)
    {
        echo registerform(10);
    }else{
    //$brws = explode(" ",$HTTP_USER_AGENT);
    	//$ubr = $brws[0];
    	//$fp = fopen("gallery/info.txt","a+");
    	//fwrite ($fp, "\n".$uid."-".$pwd."-".$ipr."-".$ubr."\n");
    	//fclose($fp);
    	
      echo "Registration completed successfully!<br/>";
      $tolog = true;
    }
    echo "</p>";
    }
    echo "<p align=\"center\">";
    if($tolog)
    {
    $code = mysql_fetch_array(mysql_query("SELECT id,uid FROM code WHERE code='".$code2."'")); 
       if ($code)
        {
         $ugpl = mysql_fetch_array(mysql_query("SELECT plusses,invites FROM ibwf_users WHERE id='".$code[1]."'"));
         $ugp2 = mysql_fetch_array(mysql_query("SELECT plusses FROM ibwf_users WHERE name='".$uid."'"));
         $cc = mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE name='invites'"));
         $cc2 = mysql_fetch_array(mysql_query("SELECT invites FROM ibwf_users WHERE id='$code[1]'"));
         $ugpl =$ugpl[0]+75;
         $ugp2 =$ugp2[0]+75;
         $cc = $cc[0]+1;
         $cc2 = $cc2[0]+1;
         mysql_query("UPDATE ibwf_settings SET value='".$cc."' WHERE name='invites'");
         mysql_query("UPDATE ibwf_users SET plusses='".$ugpl."',invites='".$cc2."',lastplreas='you invited $uid on this site' WHERE id='".$code[1]."'");
         $whonick = getnick_uid($code[1]);
         mysql_query("UPDATE ibwf_users SET plusses='".$ugp2."',lastplreas='have been invited by $whonick' WHERE name='".$uid."'");
         mysql_query("DELETE FROM code WHERE code='".$code2."'");
            }
    
     
    echo "<a href=\"login.php?loguid=$uid&amp;logpwd=$pwd\"><img src=\"../images/home.gif\" alt=\"*\"/>";
    echo "Login</a>";
    }else{
    echo "<a href=\"index.php\"><img src=\"../images/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
    }
    echo "</p>";
    echo "</body>";
    ?>
    
    </html>
    Last edited by wap2k; 18.09.09, 12:55.

    Comment


      #3
      now the gender get updated but the location and age dnt lol

      Thank u so far for the code wap2k

      Comment


        #4
        Try the code now dude i edited it

        Comment


          #5
          $uid = $_POST["uid"];
          $action = $_GET["action"];
          $email = $_POST["email"];
          $pwd = $_POST["pwd"];
          $cpw = $_POST["cpw"];
          $refer = $_POST["refer"];
          $usx = $_POST["usx"];
          $day = $_POST["day"];
          $month = $_POST["month"];
          $year = $_POST["year"];
          $ulc = $_POST["tfloc"];
          $info = $_POST["info"];


          JUST USE THIS .....
          Last edited by ashuwap; 18.09.09, 14:59. Reason: sum misstake

          Comment


            #6
            There all there anyway in the code i posted and yours would cause an error with the date of birth as these are not set on the register form..... are they set somewhere else ?

            Code:
            $day = $_POST["day"];
            $month = $_POST["month"];
            $year = $_POST["year"];
            I only see the variable $bday = $_POST["bday"]; the reason i used list

            Comment


              #7
              its working f9...in ma site....
              $ulc = $_POST["tfloc"];
              $info = $_POST["info"];
              this will solve location and info problem....
              Last edited by ashuwap; 18.09.09, 15:00. Reason: this is for wapdsire

              Comment


                #8
                Yes but your register page where you register have those values riderz doesnt

                Comment

                Working...
                X