نمایش نتایج 1 تا 2 از 2

نام تاپیک: ایراد این فرم ثبت نام چیه

  1. #1
    محروم شده
    تاریخ عضویت
    فروردین 1390
    محل زندگی
    تهران
    پست
    785

    ایراد این فرم ثبت نام چیه


    <?php
    session_start();
    include('config.php');
    if(isset($_POST['submit']))
    {
    //whether the username is blank
    if($_POST['username']=='')
    {
    $_SESSION['error']['username'] = "User name is required";
    }
    //whether the email is blank
    if($_POST['email'] == '')
    {
    $_SESSION['error']['email'] = "E-mail is required";
    }
    else
    {
    //whether the email format is correct
    if(preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\._-]*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/",$_POST['email']))
    {
    //if it has the correct format whether the email has already exist
    $email=$_POST['email'];
    $sql1 ="SELECT * FROM users WHERE email = '$email'";
    $result1 = mysqli_query($connect,$sql1)or die(mysqli_error());
    if(mysqli_num_rows($result1) >0)
    {
    $_SESSION['error']['email']="This Email is already used";
    }
    }
    else
    {
    //this error will set if the email format is not correct
    $_SESSION['error']['email'] = "Your email is not valid";
    }
    }
    //whether the password is blank
    if($_POST['password']=='')
    {
    $_SESSION['error']['password']="password is required";
    }
    //if error exist we will go to registration form
    if(isset($_SESSION['error']))
    {
    header("Location:register.php");
    exit;
    }
    else
    {
    $username = $_POST['username'];
    $email =$_POST['email'];
    $password =$_POST['password'];
    $com_code= md5(uniqid(rand()));
    $sql2 = "INSERT INTO users(username,email,password,com_code)VALUES('$us ername','$email','$password','$com_code')";
    $result2=mysqli_query($connect,$sql2)or die (mysqli_error());
    if($result2)
    {
    $to = $email;
    $subject = "confirmation form manner.com to $username";
    $header = " manner : confirmation from manner.com";
    $message = "please click the link below to verify and active your account .\r\n";
    $message = "register.php/confirm.php?passkey=$com_code";
    $sentmail = mail($to,$subject,$message,$header);

    if($sentmail)
    {
    echo "your configuration link has been sent to your Email Address.";
    }
    else
    {
    echo "can not send configuration link to your e-mail address";
    }
    }
    }
    }
    ?>










    کد HTML:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link rel="stylesheet" href="innerstyle.css" type="text/css" />
    <title>Untitled Document</title>
    </head>
    <?php
       session_start();
       if(isset($_SESSION['error']))
       {
         echo '<p>'.$_SESSION['error']['username'].'</p>';
    	 echo '<p>'.$_SESSION['error']['email'].'</p>';
    	 echo '<p>'.$_SESSION['error']['password'].'</p>';
    	 unset($_SESSION['error']);
       }
    ?>
    	 
    <body>
    <div id="wrapper">
          <div id="header">
               <img src="img/Sugar cubes.png" width="128" height="91" />
               <img src="img/web design.png" width="128" height="80" />
          </div>
          <!--endheader-->
    <div id="menu">
             <ul>
               <li><a class="menu" href="#">صفحه اصلی</a></li>
               <li><a class="menu" href="#">اخبار</a></li>
               <li><a class="menu" href="#">گالری</a></li>
               <li><a class="menu" href="#">عضویت</a></li>
               <li><a class="menu" href="#">ورود</a></li>
               <li><a class="menu" href="#">درباره ما</a></li>
               <li><a class="menu" href="#">تماس با ما</a></li>
             </ul>
          </div>
          
          <!--end menu-->
      <div id="content">
        <div id="news">
            <p>فرم عضویت:</p>
            <form id="form1" name="form1" method="post" action="rg.php">
              <table width="257" height="213" border="0">
                <tr>
                  <td width="76" class="tdb">نام کاربری: </td>
                  <td width="165"><label for="username"></label>
                  <input type="text" name="username" id="textfield2" /></td>
                </tr>
                <tr>
                  <td class="tdb">ایمیل:</td>
                  <td><label for="email"></label>
                  <input type="text" name="email" id="textfield3" /></td>
                </tr>
                <tr>
                  <td class="tdb">رمز عبور: </td>
                  <td><label for="email2"></label>
                  <input type="password" name="password" id="textfield4" /></td>
                </tr>
                
               
               
                <tr>
                <td height="21" colspan="2"><input type="submit" name="button" id="button" value="ثبت نام" /></td>
                </tr>
    			<tr>
    			<td colspan="2" class="tdb"><a href="login.php">ورود</a></td>
    			</tr>
              </table>
              
             
          </form>
            <p>&nbsp;</p>
        
        </div>
     </div>
       <!--end content-->
      
      <div class="clear"></div>  
      <div id="footer">
           <div id="moz">
            <img src="img/HP-Firefox.png"  />
           </div>
        <div id="mostnews">
      <div id="titr">
                <h4> پر بازدید ترین خبرها</h4>
          </div>
          <!--end titr-->
                   <div id="mnews">
                     <p><a href="#">افتتاح سایت</a></p>
                     <p><a href="#">افتتاح سایت</a></p>
                     <p><a href="#">افتتاح سایت</a></p>
                   </div>
                   <!--end mnews-->
                   <div class="clear"></div>
        </div>
               <!--end mostnews-->
        <div id="designer">
           <p> Design by : Mojtaba pakdel &copy;2011</p>
        
        </div>
    	
      </div>
     
    </div>
    </body>
    </html>
    

  2. #2
    محروم شده
    تاریخ عضویت
    فروردین 1390
    محل زندگی
    تهران
    پست
    785

    نقل قول: ایراد این فرم ثبت نام چیه

    کسی بلد نیست جواب ما رو بده؟؟؟

قوانین ایجاد تاپیک در تالار

  • شما نمی توانید تاپیک جدید ایجاد کنید
  • شما نمی توانید به تاپیک ها پاسخ دهید
  • شما نمی توانید ضمیمه ارسال کنید
  • شما نمی توانید پاسخ هایتان را ویرایش کنید
  •