Jump to content

Archived

This topic is now archived and is closed to further replies.

mehole

Stuck with my tell-a-friend script

Recommended Posts

Hi

I have only very recently started learning php so I am VERY VERY new to it and have not done a lot so sorry for my lack of knowledge on the topic.

I have a php scipt that allows visitors to send a page of my site to a friend, and I was hoping to use the same script for every page but there are a couple of things I don't know how to do (well there is a lot of things I don't know how to do but this is just for this script  ;) ):
Get the URL of the current page so be displayed in the email.
I tried using:
[code]$URI = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; [/code]
But when I open the email it show the url of the actual .php file, not the url of the page that the form is on.
I have been told that I need the hard code the page to fix this but im not sure how to?

Also I am having trouble sending the e-mail to multiple email addresses, I tried using semi-colons but that didn't work, usless I put the wrong thing in. Can you use the variables separated with a semi-colon or does it have to be actual email addresses?

Thank you very much for any help anyone can give me
Mike

Share this post


Link to post
Share on other sites
$_SERVER['REQUEST_URI']; gets the current url, including the get method
url being
example.com/page.php?that=this
echo $_SERVER['REQUEST_URI'];
will show
/page.php?that=this

Share this post


Link to post
Share on other sites
You want to know where you were before you got to the script ...

[code]$http_referrer = $_SERVER['HTTP_REFERER']; // where did I come from??[/code]

Share this post


Link to post
Share on other sites
It's good to note HTTP_REFERER is unreliable and should not heavily rely on other than logging user behaviour etc.

Share this post


Link to post
Share on other sites
Ok I have tried using the HTTP_REFERER code but I'm now getting an error and i'm not sure what is wrong? this is my code:
[code]<?php

$name = $_POST['name'];
$http_referrer = $_SERVER['HTTP_REFERER'];

$msg = "Hey, it's $name\n";
$msg .= "Check out this funny picture over at Mike's Joke Page\n";
$msg .= "$http_referrer\n";
$msg .= "There's also some funny videos and cool games as well\n";
$msg .= "From $name\n";

$recipient = "{$_POST['email1']};{$_POST['email2']};{$_POST['email3']};{$_POST['email4']}{$_POST['email5']};{$_POST['email6']}";
$subject = "Recommendation From A Friend...";

$mailheaders = "From: {$_POST[myemail]}\r\n";
$mailheaders .= "Reply-To: {$_POST[myemail]}\r\n";

mail($recipient, $subject, $msg, $mailheaders);

header("Location: http://www.mikesjokepage.com");
exit;
?>[/code]

Can anyone see the problem?
Thanks
Mike

Share this post


Link to post
Share on other sites
[quote author=mehole link=topic=104852.msg418610#msg418610 date=1156014899]
Ok I have tried using the HTTP_REFERER code but I'm now getting an error and i'm not sure what is wrong? [/quote]

Care to share what the error actually is?

Share this post


Link to post
Share on other sites
[quote]Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, support@supportwebsite.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.
[/quote]

It seems to only happen when I enter multiple email addresses, here is the link, can you see what happens when you try:
http://mikesjokepage.com/Untitled-3.html

Share this post


Link to post
Share on other sites
Try Apnasoft Tell a friend Script.It has every thing which u need and it is too easy to customize.click on following link.
[url=http://www.apnasoft.be/scripts.html]www.apnasoft.be/scripts.html[/url]

Share this post


Link to post
Share on other sites
500's Internal error are normally something to do with config
Check your htaccess, or contact your hosting

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.