Set Session in PHP email doesn't seem to work -


lol, seems question has not ever been asked before in google.

so, trying send email via php form. scenario of registered member invite thier friend our page typing many email address text area. when submit form, form send email email address enters in text area.

this email news letter. in email there products show addressed email.

what want $_session in email is: when people has email adress click 1 of products in news letter , come page, page whom got link page.

[edit]

i dont want achieve string this: index.php?email=$email&username=$username since can set 1 link not global link , this can manipulated new coming people.

what mean global link is, mentioned above, there many products going represent in newsletter, such ../product-a.php, ../product-b.php, ../product-c.php, ../product-d.php, , on. , make create many different sessions in pages because user have clicked 1 of product explore website first before deciding buy product or register website.

so, here code set session:

      <?php        $kemail=$_post['to'];       $to  = "$kemail";        $referal_identity = "dsfsdf";       $referal_address = "sadasdad@sada.com";       $_session['referal_identity']=$referal_identity;       $_session['referal_address']=$referal_address;          $subject = 'your friend good';       // message       $message = '<html>                   <head>                   <title>from our company</title>                   </head>                     <body>                       <p>your friend invite you. click <a href="index"> link </a> </p>                     </body>                   </html>';       $headers  = 'mime-version: 1.0' . "\r\n";       $headers .= 'content-type: text/html; charset=iso-8859-1' . "\r\n";       $headers .= 'from: klaudia <klaudia@srsrsrthisesr.com>' . "\r\n";       mail($to, $subject, $message, $headers);        ?>           <form action="" method="post">           email: <textarea name="to"></textarea>                  <input type="submit" name="submit" value="send">         </form> 

some test in index.page

                <?php                 session_start();                              $referal_identity=$_session['referal_identity'];                     $referal_address=$_session['referal_address'];                  ?>                          <body>                           <?php echo $referal_identity ?>                         <?php echo $referal_address ?>                           <p><a href="test-referal.php">test-referal.php</a></p>                          </body> 



if created session in email, can call in 1 time in page links of webpage. that's why want session, or that.


sessions used track particular user visiting website relatively small frame of time. don't you're trying do.

take @ link in email:

click <a href="index"> link </a> 

that link all have transferring data email body website. link going need carry sort of identifier.

when user creates these referrals, generate kind of token. unique string do. save token in database identify information referral. can include information want track. include token in email:

click <a href="http://somewebsite.com/index?referral=' . urlencode($sometoken) . '"> link </a> 

so user click on this:

click <a href="http://somewebsite.com/index?referral=abc123"> link </a> 

now when user clicks on link visit site, can token:

$_get["referral"] 

and can use value check database of data you're tracking. tell referral brought particular new user site.

you can generate multiple tokens multiple purposes along how ever many dimensions want track referrals.


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -