Web site counters - If you did not subscribe, please accept our
If you did not subscribe, please accept our . apologies. You will not be subscribed if you do . not visit the confirmation URL.nn . If you subscribed, please confirm this by visiting . the following URL:n . $url; $mailmsg = new SimpleMail(); $mailmsg->send($_POST[ email ],$subject,$body,$headers); Once the mail has been sent, all that is left to do is send the user to the Thank You page. We will look at the Thank You page shortly. $redirect = thanks.php?u= . $user_id . &ml= . $_POST[ ml_id ] . &t=s ; break; When the user receives the confirmation e-mail, he or she clicks the link at the bottom, which loads user_transact.php again, this time with action=confirm. When confirming, you simply need to do one thing change the pending flag for the appropriate subscription to 0. Once that is done, redirect the user to the Thank You page for confirmation, and send another e-mail informing the user of his or her new subscription. You will also provide an easy means of removal in the e-mail. The first thing to do is make sure the user ID and mailing list ID were passed to the function. If not, you simply redirect the user to user.php. case confirm : if (isset($_GET[ u ], $_GET[ ml ])) { … } else { $redirect = user.php ; } Next, find the subscription that matches the user ID and mailing list ID and update the pending column to 0. Remember that the user_id and ml_id columns combined make up a primary key, so there can be just one record for each set of possible values. $sql = UPDATE ml_subscriptions SET pending=0 . WHERE user_id= . $_GET[ u ] . AND ml_id= . $_GET[ ml ]; mysql_query($sql, $conn); Look familiar? It should you are grabbing the mailing list name based on the mailing list id, just as you did for the Subscribe case. Looks like this is a prime candidate for a function: $sql = SELECT listname FROM ml_lists . WHERE ml_id= . $_GET[ ml ]; $result = mysql_query($sql, $conn); $row = mysql_fetch_array($result); $listname = $row[ listname ]; 508 Chapter 14
In case you need quality webspace to host and run your web applications, try our personal web hosting services.