View previous topic :: View next topic |
Author |
Message |
mrpaul -
Joined: 23 Sep 2005 Posts: 18
|
Posted: Sun Sep 25, 2005 12:45 pm Post subject: php form data probs |
|
|
Hi, i am haveing probs with this php code here;
it's ment to add news to news.html
[php]
<?php
$addnews = "news.htm";
$news = $_POST['news'];
$name = $_POST['name'];
$pass = $_POST['password'];
$password = "addme";
if ("$pass == $password")
{
$file = fopen ( $addnews, "a+") ;
fwrite ( $file, "Name: <b> $name </b><br><b>Feedback: </b>$news <br><hr>" ) ;
fclose ( $file ) ;
echo ( " <h3>Thank for you feedback $name.<br></h3>your feedback: <br> $news " );
}
else
echo ( " CENSORED OFFF " );
;exit
?>
[/php]
however
1) it adds the news regardlst of the password
2) it adds it to the bottom of the page, is ther a way round that? |
|
Back to top |
|
 |
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Sun Sep 25, 2005 1:33 pm Post subject: Re: php form data probs |
|
|
The test below is not correctly written and thus the script does not what you intend to:
Code: |
if ("$pass == $password")
|
It should be:
Code: |
if ($pass == $password)
|
Enclosing the test between two " characters makes a lot of difference and has a different meaning. _________________ Support Team
Aprelium - http://www.aprelium.com |
|
Back to top |
|
 |
mrpaul -
Joined: 23 Sep 2005 Posts: 18
|
Posted: Sun Sep 25, 2005 2:12 pm Post subject: |
|
|
Thansk! |
|
Back to top |
|
 |
cmxflash -
Joined: 11 Dec 2004 Posts: 872
|
Posted: Sun Sep 25, 2005 4:39 pm Post subject: |
|
|
Correct me if I'm wrong, but I don't think this is going to work:
Code: |
else
echo ( " CENSORED OFFF " );
;exit
|
|
|
Back to top |
|
 |
Tim1681 -
Joined: 17 Jan 2005 Posts: 160 Location: Bristol, CT, USA
|
Posted: Sun Sep 25, 2005 4:51 pm Post subject: |
|
|
... i don't think it would work .. but im probably wronggg. I think i would go with something alittle more syntax friendly .. like:
Code: | else{
echo "Bad Words";
}
exit; |
_________________ mysql> SELECT * FROM users WHERE clue > 0;
0 rows returned.
 |
|
Back to top |
|
 |
mrpaul -
Joined: 23 Sep 2005 Posts: 18
|
Posted: Sun Sep 25, 2005 5:31 pm Post subject: |
|
|
nope it works fine, it dosent tell tehm to CENSORED off anymroe tho it logs ther ip and then sned then to my error 401 page |
|
Back to top |
|
 |
AbyssUnderground -
Joined: 31 Dec 2004 Posts: 3855
|
Posted: Sun Sep 25, 2005 5:42 pm Post subject: |
|
|
Still... its not very polite to use that sort of language. _________________ Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk |
|
Back to top |
|
 |
mrpaul -
Joined: 23 Sep 2005 Posts: 18
|
Posted: Sun Sep 25, 2005 6:00 pm Post subject: |
|
|
bah i'll sleep at night,
i only used it as a example here.
it's also not nice to post try to post news on my site when i never said it was ok. |
|
Back to top |
|
 |
AbyssUnderground -
Joined: 31 Dec 2004 Posts: 3855
|
Posted: Sun Sep 25, 2005 6:32 pm Post subject: |
|
|
Quote: | it's also not nice to post try to post news on my site when i never said it was ok. |
Whats this meant to mean? _________________ Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk |
|
Back to top |
|
 |
mrpaul -
Joined: 23 Sep 2005 Posts: 18
|
Posted: Sun Sep 25, 2005 6:44 pm Post subject: |
|
|
Dont get me wrong i aint saying u tryied to post something on my site,
in the code, it only echos CENSORED off if they get the wrong password, so ther must be trying to post news and i think being told to CENSORED off is ok. |
|
Back to top |
|
 |
AbyssUnderground -
Joined: 31 Dec 2004 Posts: 3855
|
Posted: Sun Sep 25, 2005 7:33 pm Post subject: |
|
|
Well if you intend on keeping your visitors, a simple 'Sorry, the password you entered was incorrect. Please make sure you have access rights to this area' should do just fine.
All I am trying to say is that swearing on the forum is not going to get you replies any quicker. Some people are offended by bad language and may know the answer to the question but not bother to post because of the language you use.
I'd think about it next time. _________________ Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk |
|
Back to top |
|
 |
MonkeyNation -
Joined: 05 Feb 2005 Posts: 921 Location: Cardiff
|
Posted: Mon Sep 26, 2005 10:31 am Post subject: |
|
|
The Inquisitor wrote: | Well if you intend on keeping your visitors, a simple 'Sorry, the password you entered was incorrect. Please make sure you have access rights to this area' should do just fine.
All I am trying to say is that swearing on the forum is not going to get you replies any quicker. Some people are offended by bad language and may know the answer to the question but not bother to post because of the language you use.
I'd think about it next time. |
I don't think it matters to be honest.
I have worse things lurking on some of my pages.
mrpaul -> header("Location: http://hotmale.com") works better than fuck off. _________________
 |
|
Back to top |
 |
 |
|