dazz_club Posted April 1, 2008 Share Posted April 1, 2008 Hi there, I am setting up an email bulletin which contains a unique reference number which then can be used to order a free product from me. when the user clicks on my desired link in my bulletin, it will then go to a different page on then internet. This page will ask for the reference number to be typed in which allows you to proceed to the order form. My option is to set up user access where the user will simply type in the reference number given to them in the email bulletin. However there could be a possibility of them not really reading or even remembering the number at all. So what i am asking, can the page (ie the order form, or some script in this page) read the url the user comes from and if it sees a word/that it is looking for, it then allows you to go to the order page atuomaticly. is this possible?? kind regards Darren Quote Link to comment Share on other sites More sharing options...
jibster Posted April 1, 2008 Share Posted April 1, 2008 Not 100% what you mean. So the user is on a page on your site and you've given them a unique number? How have you given them this number? Are they anonymous users or are they logged in? Could you give the user this link to click: http://www.yoursite.com/orderfreeproduct.php?code=6843543 Then on your orderfreeproduct.php you would look at $_GET['code'] to see if its valid, then present the form. Quote Link to comment Share on other sites More sharing options...
mikefrederick Posted April 1, 2008 Share Posted April 1, 2008 Not positive what you want either but: $refer=$_SERVER['HTTP_REFERER']; //referring URL if(substr_count($refer,'searchingforstring')>0) { //if your string is found in the URL run commands; } Quote Link to comment Share on other sites More sharing options...
discomatt Posted April 1, 2008 Share Posted April 1, 2008 Also note $_SERVER['HTTP_REFERER'] is defined by the client, so it's value can't be trusted Quote Link to comment Share on other sites More sharing options...
dazz_club Posted April 1, 2008 Author Share Posted April 1, 2008 Hi there, Here is a breakdown of how it would work I send a html bulletin which contains the unique reference number, this is simply text >The user clicks on a button in the bulletin to order a free sample >> they then arrive to a login page where they type in the reference number >> this then allows them to proceed to an orderform where by they can order a free product. What i would like to do is i send the bulletin (which contains the ref on the url it is sent on http://www.mysite/bulletin/ref/XD234)>> they click the link on the bulletin >>the order form looks for a specifc ref number) and then displayes the form >>end in between this the order form page looks for a specific string thats in the url, i.e http://www.mysite/bulletin/ref/XD234/ The order page has script thats looks at the url and is wanting a specific request, ie. the ref number. If it is present it then allows the user to be show the form if not, another page will just say, you aren't allowed to see this page, or something similar. jibster and mikefrederick, eventhough you say you are not clear you seem to get my point. hope it helps you to understand clearly. kind regards Darren Quote Link to comment Share on other sites More sharing options...
redarrow Posted April 1, 2008 Share Posted April 1, 2008 here you go a 1 page setup for what you wanted to do. I have designed this in a email format, for orders sent to you with the user confirming there order via email..... the user goes to the current page they press a link for what they want as a free item.. the current user is presented with a form for them to fill in, once the form is filled in there echoed a thank you and sent a email to there email inbox. once the user has gon to there email inbox and read the email they press a link that goes back to the current page.... the link activates a form of the item they wanted free, the form will ask for more personal info like address,telephone ect ect ect........ once that form is filled in the form email you the admin with the order they wanted....... good luck.......... settings........... 1.name the current page what ever........ 2.rename the link that sends them a specil link off where the current page going to be.......... 3. rename the admins email address.......... <?php session_start(); echo"<center> <h3>Please select a free item to order via the link provided!</h3> <br> <a href='".$_SERVER['PHP_SELF']."?ref=free_cup'>Order free cup</a> <p></p> <a href='".$_SERVER['PHP_SELF']."?ref=free_shirt'>Order free shirt</a> <p></p> <a href='".$_SERVER['PHP_SELF']."?ref=free_pen'>Order free pen</a> <p></p> <h3>Please be advised a specil link will be sent via your email address to collect your free gift!<h3> </center>"; $form_order=" <center> <form method='POST' action='".$_SERVER['PHP_SELF']."?ref=email'> <p></p> Order form for a free <font color='red'>".$_GET['ref']."</font>! <p></p> username! <br> <input type='text' name='username'> <p></p> Valid email! <br> <input type='hidden' name='x' value='".$_GET['ref']."'> <input type='text' name='email_address'> <br><br> <input type='submit' name='submit' value='Send the free item to my email address please!'> </center> "; switch ($_GET['ref']){ case "free_cup": echo "<br><br>$form_order<br><br>"; exit; case "free_shirt": echo "<br<br>$form_order<br><br>"; exit; case "free_pen": echo "<br><br>$form_order<br><br>"; exit; } if($_POST['submit']){ $date=date("dmy"); $x=$_POST['x']; $username=$_POST['username']; $email_address=$_POST['email_address']; $mes=" Thank you $username for the order of a $x it will be in the post once you goto this link <a href='free.php?cmd=go&confirm=$x'>HERE PLEASE CONFIRM ORDER</a> and fill the form out, dont forget to give the post man maximun 15 days please re order if the free product dosent arrive in that time thank you."; $to = $email_address; $subject = 'Your '.$x.' '; $message = $mes; $headers = "From: me@me.com.com\r\n" . 'X-Mailer: PHP/' . phpversion() . "\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: text/html; charset=utf-8\r\n" . "Content-Transfer-Encoding: 8bit\r\n\r\n"; // Send if(mail($to, $subject, $message, $headers)){ echo"Thank you $username your $x specil link been sent to your email address of $email_address!"; }else{ echo "Sorry $username the $email_address issint working! <br> Please try to re order your $x agin!"; } } if($_GET['cmd']=="go"){ switch ($_GET['confirm']){ case "free_cup": echo "<br><br>$form_order_item<br><br>"; exit; case "free_shirt": echo "<br<br>$form_order_item<br><br>"; exit; case "free_pen": echo "<br><br>$form_order_item<br><br>"; exit; $form_order_item=" <center> <form method='POST' action='".$_SERVER['PHP_SELF']."?ref=confirm'> <p></p> Posting form for a free <font color='red'>".$_GET['confirm']."</font>! <p></p> username! <br> <input type='text' name='username'> <p></p> Address! <br> <input type='text' name='address'> <p></p> Post code! <br> <input type='text' name='post_code'> <p></p> telephone/mobile! <br> <input type='text' name='telephone'> <p></p> Valid email! <br> <input type='hidden' name='x' value='".$_GET['confirm']."'> <input type='text' name='email_address'> <br><br> <input type='submit' name='submit' value='Send the free item to my address please!'> </center> "; if($_POST['submit']){ if($_GET['ref']=="confirm"){ $x=$_POST['x']; $username=$_POST['username']; $email_address=$_POST['email_address']; $address=$_POST['address']; $post_code=$_POST['post_code']; $telephone=$_POST['telephone']; $Date_sent=$_POST['date_sent']; $mes=" Order for item: <br> username: $username address: $address post code: $post_code telephone: $telephone email: $email_address Date sent $date Memo to admin please send the item of $x ASAP date ordered was $date. "; $to = 'admin@admin.com'; $subject = 'A order for '.$x.' '; $message = $mes; $headers = "From: ".$email."\r\n" . 'X-Mailer: PHP/' . phpversion() . "\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: text/html; charset=utf-8\r\n" . "Content-Transfer-Encoding: 8bit\r\n\r\n"; // Send if(mail($to, $subject, $message, $headers)){ echo"Thank you $username your $x going to be sent to your home!"; } } } } } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.