2017-08-23 3 views
-1

コードを確認した後、フォームデータを覚えておく:どのplayingcards-quote.phpから電子メールID

  <?php 
         <div class="main"> 
          <form id='contactus' action='<?php echo $formproc->GetSelfScript(); ?>' method='post' accept-charset='UTF-8'> 
         <div class="container"> 
             <div>&nbsp;</div> 
         <?php//echo $_SERVER['PHP_SELF'];?> 
         <input type='hidden' name='submitted' id='submitted' value='1'/> 
         <input type='hidden' name='<?php echo $formproc->GetFormIDInputName(); ?>' value='<?php echo $formproc->GetFormIDInputValue(); ?>'/> 
         <input type ='hidden' class='spmhidip' name='<?php echo $formproc->GetSpamTrapInputName(); ?>' /> 
         <div> 
         <span class='error' style="font-size: 12px;"><?php echo $formproc->GetErrorMessage(); ?></span> 
         <span class='error' style="font-size: 12px;"><?php echo $validation_errors; ?></span> 
         </div> 
         <div style="width:800px;"> 
         <div style="float:left;width:350px;"> 
          <div class='container'> 
          <label for='email' >Plastic Coated Paper :</label><br/> 
          <select name='paper' id='paper' value='<?php echo htmlentities($disp_paper) ?>' maxlength="50" onchange="chgSelect('coatedpaper');"> 
                <option selected value="0">Select Paper</option> 
                <option>Black Centered 330</option> 
                <option>Black Centered 320</option> 
                <option>Black Centered 315</option> 
                <option>Black Centered 305</option> 
                <option>Black Centered 300</option> 
                <option>Black Centered 280</option> 
                <option>White Centered 330</option> 
                <option>White Centered 320</option> 
                <option>White Centered 315</option> 
                <option>White Centered 305</option> 
                <option>White Centered 300</option> 
                <option>White Centered 280</option> 
               </select> 
         </div> 
        <div class='container'> 
         <label for='name' >First Name*: </label><br/> 
         <input type='text' name='name' id='name' maxlength="50" /><br/> 
         <span id='contactus_name_errorloc' class='error' style="font-size: 12px;"></span> 

        </div> 
        <div class='container'> 
         <label for='email' >Email Id*:</label><br/> 
         <p id="demo"> 
         <input type='text' name='email' id='email' maxlength="50" /><br/> 
         <div id="hello"> 

        </div> 
        </p> 
         <span id='contactus_email_errorloc' class='error' style="font-size: 14px;color:#D32626;background-color: #fff; 
        font-weight: 800;"></span> 
        <script> 
        document.getElementById("demo").addEventListener("click", myFunction); 

        function myFunction() 
        { 
         document.getElementById("hello").innerHTML = "<a href='http://www.alltypesofplayingcards.com/diwakar/customplayingcards/verification.php' target='_blank'>Please click on this link to verify your email address</a>"; 
        } 
        </script> 
        <div class='container'> 
         <input type='submit' name='Submit' value='Submit' /> 
         <br> 
        </div> 
       verification.php 
       <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
       <html xmlns="http://www.w3.org/1999/xhtml"> 
       <head> 
        <title>Custom Playing Cards > Email Verification</title> 
         <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> 
        <link href="css/style.css" type="text/css" rel="stylesheet" /> 
       </head> 

       <body> 
       <div id="header"> 
         <h3>Custom Playing Cards > Email Verification</h3> 
        </div> 
       <div id="wrap"> 

       <?php 

         mysql_connect("localhost", "playingc_diwakar", "[email protected]") or die(mysql_error()); // Connect to database server(localhost) with username and password. 
       mysql_select_db("playingc_diwakar") or die(mysql_error()); // Select registrations database. 

        if(isset($_POST['name']) && !empty($_POST['name']) AND isset($_POST['email']) && !empty($_POST['email'])){ 
        $name = mysql_escape_string($_POST['name']); // Turn our post into a local variable 
        $email = mysql_escape_string($_POST['email']); // Turn our post into a local variable 
        if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)){ 
        $msg = 'The email you have entered is invalid, please try again.'; 
       }else{ 
        // Return Success - Valid Email 
        $msg = 'Your account has been made, <br /> please verify it by clicking the activation link that has been send to your email.'; 
       } 
       $hash = md5(rand(0,1000)); 
       $password = rand(1000,5000); 
       $result = mysql_query("INSERT INTO users (username, password, email, hash) VALUES(
       '". mysql_escape_string($name) ."', 
       '". mysql_escape_string(md5($password)) ."', 
       '". mysql_escape_string($email) ."', 
       '". mysql_escape_string($hash) ."') ") or die(mysql_error()); 
       if (!$result) { 
        die('Invalid query: ' . mysql_error()); 
       } 
       $to  = $email; // Send email to our user 
       $subject = 'Signup | Verification'; // Give the email a subject 
       $message = ' 

       Thanks for signing up! 
       Your account has been created, you can login with the following credentials after you have activated your account by pressing the url below. 

       ------------------------ 
       Username: '.$name.' 
       Password: '.$password.' 
       ------------------------ 

       Please click this link to activate your account: 
       http://www.alltypesofplayingcards.com/diwakar/customplayingcards/playingcards-quote.php?email='.$email.'&hash='.$hash.' 

       '; // Our message above including the link 

       $headers = 'From:[email protected]' . "\r\n"; // Set from headers 
       mail($to, $subject, $message, $headers); // Send our email 
       } 

       ?> 



         <!-- stop php code --> 

         <!-- title and description --> 
         <h3>Email Verfication</h3> 
         <p>Please enter your name and email addres </p> 
         <?php 
        if(isset($msg)){ // Check if $msg is not empty 
         echo '<div class="statusmsg">'.$msg.'</div>'; // Display our message and wrap it with a div with the class "statusmsg". 
        } 
       ?> 

         <!-- start sign up form --> 
         <form action="" method="post"> 
          <label for="name">Name:</label> 
          <input type="text" name="name" value="" /> 
          <label for="email">Email:</label> 
          <input type="text" name="email" value="" /> 

          <input type="submit" class="submit_button" value="Sign up" /> 
         </form> 
         <!-- end sign up form --> 

        </div> 
        <!-- end wrap div --> 
       </body> 
       </html> 

1つのフォームの入力データ(customplaying-quote.php)の半分を覚えておいてください電子メールIDのフォームをverfying前verification.phpで開かれているリンクの形式でgmailのIDへのリンクを送りました。そして、私がgmailのIDでリンクを開き、ページを開くとページを更新してはいけません。

私はフォームplayingcards-quote.phpを持っていますが、これにはいくつかのドロップダウンアイテムがあり、名前は入力と電子メールです。私は、ドロップダウンの場合は "Black Centered 305"を入力し、入力テキストの場合は "xyx"として "name"を入力しました。ユーザーがメール入力ボックスをクリックすると、入力メールの下にリンクが表示され、リンクをクリックすると新しいタブがverifcation.phpとして開きます。私は電子メールと名前を入力して送信します。リンクが自分のgmail IDに移動し、自分のGmailアカウントを開いて自分のリンクを開くとページが開きますが、リフレッシュページの後に "Black Centered 305"と "name"のデータを保持できません。

+0

使用$ _SESSION [「日付」を保持して、その後に提出された場合

input type='text' name='name' id='name' maxlength="50" value='".(isset($_POST['submit']) ? $_POST['name'] : "")."'/><br/> 

が言って]配列に値を格納する –

答えて

0

使用$ _SESSION配列

か、たとえばこれを行うことができます:ページがこの値

+0

私を助けてくれてありがとう –

関連する問題