everlifefree Posted January 5, 2008 Share Posted January 5, 2008 Hi I am new here so I hope this is where and how I post this... On my site I have a this code that is supposed to mail a link but it sends something weird that doesn't work... Please Help! Here's The PHP CODE: if (isset($_POST["Submit"], $_POST["topic"], $_POST["body"]) and $_POST["topic"] != "" and $_POST["body"] != "") { if (isset($_POST["opponent"]) and $_POST["opponent"] != "") { $opponent = myF(myQ("SELECT `id` FROM `[x]users` WHERE LCASE(`username`) = '".strtolower($_POST["opponent"])."'")); if ($opponent["id"] > 0) { myQ(" INSERT INTO `[x]debates` (`user`,`opponent`,`date`,`duration`,`topic`,`body`,`votes`) VALUES ( '".me("id")."', '{$opponent["id"]}', '".time()."', '{$_POST["duration"]}', '{$_POST["topic"]}', '{$_POST["body"]}', '".pk(array(me("id"),$opponent["id"]))."' ) "); $mail_replace = array( "{me}" => me("username"), "{url}" => "http://".$_SERVER['HTTP_HOST'].str_replace("/index.php", NULL, $_SERVER['PHP_SELF'])."?L=debates.request&id=".mysql_insert_id() ); Here's The mails tpl: <obj mail_subject>Debate request with {me}!</obj mail_subject> <obj mail_body>{me} requested a Debate with you. Please click the following link to accept or deny this request. <a href="{url}">My Debates</a></obj mail_body> Here's The mail sent now: Dan requested a Debate with you. Please click the following link to accept or deny this request. (link here that will take you to 404 error) My Debates Here's The mail I want sent: Dan requested a Debate with you. Please click the following link to accept or deny this request. My Debates (the words My Debates the link taking you to "main url"?L=debates.request&id="debate id that php script requested to mail") Quote Link to comment https://forums.phpfreaks.com/topic/84586-solved-invalid-mailing-code/ Share on other sites More sharing options...
everlifefree Posted January 5, 2008 Author Share Posted January 5, 2008 I believe the problem lies in the below php code if that will help anyone know what to fix... Problem PHP: $mail_replace = array( "{me}" => me("username"), "{url}" => "http://".$_SERVER['HTTP_HOST'].str_replace("/index.php", NULL, $_SERVER['PHP_SELF'])."?L=debates.request&id=".mysql_insert_id() ); Quote Link to comment https://forums.phpfreaks.com/topic/84586-solved-invalid-mailing-code/#findComment-431421 Share on other sites More sharing options...
everlifefree Posted January 6, 2008 Author Share Posted January 6, 2008 Is there a better place to post this to get an answer?? Quote Link to comment https://forums.phpfreaks.com/topic/84586-solved-invalid-mailing-code/#findComment-431598 Share on other sites More sharing options...
Ken2k7 Posted January 6, 2008 Share Posted January 6, 2008 "{url}" => "http://".$_SERVER['HTTP_HOST'].str_replace("/index.php", NULL, $_SERVER['PHP_SELF'])."?L=debates.request&id=".mysql_insert_id() change to: "{url}" => "http://".$_SERVER['HTTP_HOST'].str_replace("/index.php", "?L=debates.request&id=".mysql_insert_id(),$_SERVER['PHP_SELF']) Quote Link to comment https://forums.phpfreaks.com/topic/84586-solved-invalid-mailing-code/#findComment-431705 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.