Hello drew010,
I inserted the following link in the ad display page:
<a href="index.php?a=28&b=137&page=<?php echo $_SERVER['PHP_SELF']; ?>">Report Misuse</a>
In this index.php?a=28&b=137 is the contact us page url.
I modified the formail contact_us.php file to include the following lines:-
$adid = $GET[page]; in the begining and URL: $POST[adid] in the mail body
It doesnt seems to capture the url of the ad display page. However in the mail received, it does show the "URL" text but nothing in front of it.
Before this I tried several other possibilities also. I am enclosing the contents of the contact us form and the contact_us.php file:
Also how to make url of the ad display page so that it can be made a link like "Back to the Current Ad"
Can you please tell what could be wrong.
<---------- contents of contact us form file ---------->
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD><FORM action="contact_us.php" method="post">
<TABLE>
<TR>
<TH align="right"> Name:* </TH>
<TD> <INPUT type="text" name="name" size="30"> </TD>
</TR>
<TR>
<TH align="right"> Email:* </TH>
<TD> <INPUT type="text" name="email" size="30"> </TD>
</TR>
<TR>
<TH align="right">Subject:*</TH>
<TD><SELECT name="subject" id="subject">
<OPTION selected>Comments/Suggestions</OPTION>
<OPTION>Feedback</OPTION>
<OPTION>Report Misuse</OPTION>
<OPTION>General Support</OPTION>
</SELECT></TD>
</TR>
<TR valign="top">
<TH align="right"> Query:* </TH>
<TD> <TEXTAREA name="comments" rows="6" cols="30"></TEXTAREA> </TD>
</TR>
<TR>
<TH></TH>
<TD> <INPUT type="submit" name="Submit" value="Submit"> </TD>
</TR>
</TABLE>
</FORM></TD>
</TR>
</TBODY>
</TABLE>
<---------- contents of contact_us.php file ---------->
<?
######################## CONFIGURATION ###############################
// $referer_c is to check from where a person came, set to 0 to disable it
// $referer - the url from where people are allowed to access this script
// ex: yoursite.com
// $succed is the page people will see if the forms succeed
// $fail is the page people will see if the form fails
// $adminadd - Enter the email where you want the form to be mailed
// $mailuser - Set to 0 if you don't want to send the thank you mail to user
$referer_c = "0";
$referer = array("outlookclassifieds.com","www.outlookclassifieds.com");
$succeed = "index.php?a=28&b=135";
$fail = "index.php?a=28&b=136";
$adminadd = "contact@outlookclassifieds.com";
$mailuser = "1";
$adid = $_GET[page];
// Verification of the HTML Form Submitted
// Add as many as you want below, seperated by OR
// Example : OR !$_POST['myownhtmlvalue']
if($referer_c=="1") {
if(!isset($_REQUEST['grant'])) { // Check if user hasn't given a value for grant using url
while(list($key,$val)=each($referer)) {
if(strstr($_SERVER['HTTP_REFERER'],$val)) {
$grant = 'true';
} // End giving grant a value
} // End while
} // End if grant
if($grant!='true') {
header("Location: $fail");
exit;
}
}
if(!$POST['name'] OR !$POST['email'] OR !$_POST['comments']) {
header("Location: $fail");
exit;
}
// Email check - Comment is using / and / if you dont need it
// ex: / if() { ---- exit;} /
if(!eregi("[a-z0-9]+@+[a-z0-9]+[.]+[a-z0-9]", $_POST['email'])) {
header("Location: $fail");
exit;
}
CONFIGURATION - 2
$sender_user = "Do_Not_Reply@outlookclassifieds.com <Do_Not_Reply@outlookclassifieds.com>";
$sender_admin = $POST['name']."<".$POST['email'].">";
$subject_user = "<AUTO REPLY> {$POST[subject]}";
$subject_admin = "{$POST[subject]}";
// Edit both of these mails to suite your needs
$user_mail_body = ("Thank you for contacting OutlookClassifieds.com. We have successfully recieved your request and will respond to you personally very soon.");
// Add the values which are in the form here too
// ex: $_POST['somethingintheform']
$admin_mail_body = ("Contact from: $POST[name]
Email: $POST[email]
Subject: $POST[subject]
Comments: $POST[comments]
URL: $_POST[adid]");
// Configuration ends here
// Mail user if it has to be done
if($mailuser=="1") {
mail($_POST['email'],$subject_user,$user_mail_body,"From:".$sender_user."\r\n")
OR header("Location: $fail");
}
// Mail Administrator
mail($adminadd,$subject_admin,$admin_mail_body,"From:".$sender_admin."\r\n")
OR header("Location: $fail");
header("Location: $succeed");
?>