Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
what's wrong with my php? :~(
Old 01-22-2009, 05:15 PM what's wrong with my php? :~(
Junior Talker

Posts: 2
Trades: 0
<?PHP
$message = stripcslashes($message);
$message = "
Message: $message \n
From: $name \n
Phone: $phone \n
";

$from = "From: $email \r\n";

mail("my@adress.com", "New message from website", $message, $from);
header('Location: contact.html');
exit;

?>

Hi all,
This exact code used to work just fine untill a week ago.
But now for some reason all I'm recieving are BLANK email messages. Can anyone suggest what went wrong and why?
THNX...
t_a_m_r_o is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-22-2009, 05:27 PM Re: what's wrong with my php? :~(
stevej's Avatar
Professional Multitasker

Posts: 996
Location: Not positive
Trades: 0
Most likely, your host changed some settings in the configuration, such as version of php, or something like that. Look around and see if there are any changes that have been made that would affect something like this.

- Steve
stevej is offline
Reply With Quote
View Public Profile
 
Old 01-22-2009, 06:09 PM Re: what's wrong with my php? :~(
Insensus's Avatar
Ultra Talker

Posts: 487
Name: Mark Stegeman
Location: Netherlands, Europe
Trades: 0
I think this script relies on register_globals on, which it probably isn't because it's safer to have it off.
What that means is that you have to look in what way the message is coming to the script e.g. POST or GET and then change the $message, $name, $phone and $email to $_POST['message'], $_POST['name'] etc. or $_GET['message'], $_GET['name'] etc.
__________________
<?php ($helpfull>0)?$talkupation++ : '';?>
Insensus is offline
Reply With Quote
View Public Profile
 
Old 01-22-2009, 06:28 PM Re: what's wrong with my php? :~(
Skilled Talker

Posts: 68
Name: Avi Zolty
Location: Atlanta
Trades: 0
I am no expert at PHP, but I have a few things to add.
1) you don't need to put "exit;" (I've never used it at least- might be wrong).
2) You need to specify what the variables mean, and were in the form the information is coming from. So for example...
$message = $_REQUEST['message'];
where you retrieve information from the form.
3) Perhaps try something like this
$message = stripslashes($message1);
so you don't overuse the $message variable. I understand you don't have to, but it makes the script "easier"; if that makes sense (in my humble opinion).
4) If this still doesn't work, try contact your host manager, especially if this script WAS working.

Most likely they removed some sort of software that allows you to not have to declare the variables, and specify where to retrieve the information from in the form you submitted... though I don't know how that'd work.
__________________
"If you say something interesting, people will remember your name" ~ Anonymous


Please login or register to view this content. Registration is FREE
.asp <- Irony

Last edited by Zoltar1992; 01-22-2009 at 06:30 PM..
Zoltar1992 is offline
Reply With Quote
View Public Profile
 
Old 01-22-2009, 07:08 PM Re: what's wrong with my php? :~(
stevej's Avatar
Professional Multitasker

Posts: 996
Location: Not positive
Trades: 0
Quote:
Originally Posted by Insensus View Post
I think this script relies on register_globals on, which it probably isn't because it's safer to have it off.
What that means is that you have to look in what way the message is coming to the script e.g. POST or GET and then change the $message, $name, $phone and $email to $_POST['message'], $_POST['name'] etc. or $_GET['message'], $_GET['name'] etc.
Agreed. Here is a quick idea for some code that should work: (assuming the menu is set to POST)

PHP Code:
<?php
$message 
$_POST['message'];
$name $_POST['name'];
$phone $_POST['phone'];
$email $_POST['email'];
 
$body "
Message: 
$message \n 
From: 
$name \n
Phone: 
$phone \n
"
;
 
$from "From: $email \r\n";

  
mail("my@adress.com""New message from website"$body$from);
header('Location: contact.html');
?>
- Steve
stevej is offline
Reply With Quote
View Public Profile
 
Old 01-22-2009, 07:43 PM Re: what's wrong with my php? :~(
Junior Talker

Posts: 2
Trades: 0
stevej Thank you!
Zoltar1992 Thank you!
Insensus Thank you!

It's all better now
t_a_m_r_o is offline
Reply With Quote
View Public Profile
 
Old 01-22-2009, 08:27 PM Re: what's wrong with my php? :~(
Defies a Status

Posts: 1,605
Trades: 0
Glad you got it working but you may still want to change: stripcslashes( )

to:stripslashes ()
__________________
Colbyt

Please login or register to view this content. Registration is FREE
colbyt is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to what's wrong with my php? :~(
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 1.22738 seconds with 12 queries