FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » PHP Contact Form, mt-rand(), problem Validating 1 input
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
PHP Contact Form, mt-rand(), problem Validating 1 input [message #181596] Thu, 23 May 2013 16:43 Go to next message
bill is currently offline  bill
Messages: 310
Registered: October 2010
Karma: 0
Senior Member
Hi, Newviw here;

Win 7 Home Premium, XAMPP 1.7.3, PHP 5.3,

Two pages: Form.php, check.php (& thanks.html).
They work fine; sends e-mail, formatted, and readable.


Form.php:
$d=($a.$b.$c);
echo "Your code is : " .$d." Enter it in the box below, including
dashes : <br />";

<form action="Check.php" method="post">
<b>Your Code: </b><input type="text" name="code" size="10
maxlength="14" /><br /><br /> ...

BUT: When I begin to add some security, things quit working.

1st, I add to form.php an mt-rand() build of a random code assigned to $d.

$d=($a.$b.$c);
echo "Your code is : " .$d." Enter it in the box below, including
dashes : <br />";

Works OK.

Check.php:
Now, when I try to validate the 'code' in check.php, things stop working.

$code = check_input($_POST['code'], "Enter Your Code");
stops everything in its tracks.

Any comments, advice, leads much appreiated.

TIA.

Twayne`
Re: PHP Contact Form, mt-rand(), problem Validating 1 input [message #181597 is a reply to message #181596] Thu, 23 May 2013 16:47 Go to previous messageGo to next message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma: 0
Senior Member
Twayne wrote:
^^^^^^

> Hi, Newviw here;
> […] mt-rand() […]
> […] things stop working.
> Any comments, advice, leads much appreiated.

<http://www.catb.org/~esr/faqs/smart-questions.html>


PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f806at$ail$1$8300dec7(at)news(dot)demon(dot)co(dot)uk>
Re: PHP Contact Form, mt-rand(), problem Validating 1 input [message #181599 is a reply to message #181597] Thu, 23 May 2013 20:25 Go to previous messageGo to next message
bill is currently offline  bill
Messages: 310
Registered: October 2010
Karma: 0
Senior Member
On 5/23/2013 12:47 PM, Thomas 'PointedEars' Lahn wrote:
> Twayne wrote:
> ^^^^^^
>
>> Hi, Newviw here;
>> […] mt-rand() […]
>> […] things stop working.
>> Any comments, advice, leads much appreiated.
>
> <http://www.catb.org/~esr/faqs/smart-questions.html>
>
>
> PointedEars
>
http://edhelper.com/language/Reading_Skills.htm
Re: PHP Contact Form, mt-rand(), problem Validating 1 input [message #181600 is a reply to message #181599] Thu, 23 May 2013 20:32 Go to previous messageGo to next message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma: 0
Senior Member
Twayne wrote:

> On 5/23/2013 12:47 PM, Thomas 'PointedEars' Lahn wrote:
>> Twayne wrote:
>> ^^^^^^
>>
>>> Hi, Newviw here;
>>> […] mt-rand() […]
>>> […] things stop working.
>>> Any comments, advice, leads much appreiated.
>>
>> <http://www.catb.org/~esr/faqs/smart-questions.html>
>
> http://edhelper.com/language/Reading_Skills.htm

*PLONK*
Re: PHP Contact Form, mt-rand(), problem Validating 1 input [message #181607 is a reply to message #181599] Thu, 23 May 2013 22:37 Go to previous messageGo to next message
Scott Johnson is currently offline  Scott Johnson
Messages: 196
Registered: January 2012
Karma: 0
Senior Member
On 5/23/2013 1:25 PM, Twayne wrote:
> On 5/23/2013 12:47 PM, Thomas 'PointedEars' Lahn wrote:
>> Twayne wrote:
>> ^^^^^^
>>
>>> Hi, Newviw here;
>>> […] mt-rand() […]
>>> […] things stop working.
>>> Any comments, advice, leads much appreiated.
>>
>> <http://www.catb.org/~esr/faqs/smart-questions.html>
>>
>>
>> PointedEars
>>
> http://edhelper.com/language/Reading_Skills.htm

WOW, not a good way to get help. PE was correct.

Supply the code to the failing function and someone may be able to help.

But I would first check the attitude at the door.

Scotty
Re: PHP Contact Form, mt-rand(), problem Validating 1 input [message #181609 is a reply to message #181607] Thu, 23 May 2013 23:01 Go to previous messageGo to next message
Doug Miller is currently offline  Doug Miller
Messages: 171
Registered: August 2011
Karma: 0
Senior Member
Scott Johnson <noonehome(at)chalupasworld(dot)com> wrote in news:knm5fj$pb8$1@dont-
email.me:

> On 5/23/2013 1:25 PM, Twayne wrote:
>> On 5/23/2013 12:47 PM, Thomas 'PointedEars' Lahn wrote:
>>> Twayne wrote:
>>> ^^^^^^
>>>
>>>> Hi, Newviw here;
>>>> […] mt-rand() […]
>>>> […] things stop working.
>>>> Any comments, advice, leads much appreiated.
>>>
>>> <http://www.catb.org/~esr/faqs/smart-questions.html>
>>>
>>>
>>> PointedEars
>>>
>> http://edhelper.com/language/Reading_Skills.htm
>
> WOW, not a good way to get help. PE was correct.
>
> Supply the code to the failing function and someone may be able to help.
>
> But I would first check the attitude at the door.

Consider the source, Scott.

Twayne is a nym-shifting numbskull from way back. Over in alt.home.repair, many of us
have had him killfiled for ten or fifteen years. Every year or so, he nymshifts to evade the
filters; he'd probably do it more often if it didn't take him so long to figure out that nobody's
reading his posts. He's just recently showed up in some of the computer software NGs, and
this is at least the second nym of his that I've had to KF since that happened.
Re: PHP Contact Form, mt-rand(), problem Validating 1 input [message #181648 is a reply to message #181607] Fri, 24 May 2013 15:21 Go to previous messageGo to next message
bill is currently offline  bill
Messages: 310
Registered: October 2010
Karma: 0
Senior Member
On 5/23/2013 6:37 PM, Scott Johnson wrote:
> On 5/23/2013 1:25 PM, Twayne wrote:
>> On 5/23/2013 12:47 PM, Thomas 'PointedEars' Lahn wrote:
>>> Twayne wrote:
>>> ^^^^^^
>>>
>>>> Hi, Newviw here;
>>>> […] mt-rand() […]
>>>> […] things stop working.
>>>> Any comments, advice, leads much appreiated.
>>>
>>> <http://www.catb.org/~esr/faqs/smart-questions.html>
>>>
>>>
>>> PointedEars
>>>
>> http://edhelper.com/language/Reading_Skills.htm
>
> WOW, not a good way to get help. PE was correct.
>
> Supply the code to the failing function and someone may be able to help.
>
> But I would first check the attitude at the door.
>
> Scotty

I did, Scottie. I posted relevant code and also offered to provide full
code if it was necessary. Our "friend" simply decided to remove same in
his response. Not good treatment of an admitted newbie.

Twayne`
Re: PHP Contact Form, mt-rand(), problem Validating 1 input [message #181650 is a reply to message #181609] Fri, 24 May 2013 15:24 Go to previous messageGo to next message
bill is currently offline  bill
Messages: 310
Registered: October 2010
Karma: 0
Senior Member
On 5/23/2013 7:01 PM, Doug Miller wrote:
> Scott Johnson <noonehome(at)chalupasworld(dot)com> wrote in news:knm5fj$pb8$1@dont-
> email.me:
>
>> On 5/23/2013 1:25 PM, Twayne wrote:
>>> On 5/23/2013 12:47 PM, Thomas 'PointedEars' Lahn wrote:
>>>> Twayne wrote:
>>>> ^^^^^^
>>>>

>
> Consider the source, Scott.
>
> Twayne is a nym-shifting numbskull from way back. Over in alt.home.repair, many of us
> have had him killfiled for ten or fifteen years. Every year or so, he nymshifts to evade the
> filters; he'd probably do it more often if it didn't take him so long to figure out that nobody's
> reading his posts. He's just recently showed up in some of the computer software NGs, and
> this is at least the second nym of his that I've had to KF since that happened.
>

Lots of numbskulls in this group.
Re: PHP Contact Form, mt-rand(), problem Validating 1 input [message #181669 is a reply to message #181648] Fri, 24 May 2013 22:31 Go to previous messageGo to next message
Scott Johnson is currently offline  Scott Johnson
Messages: 196
Registered: January 2012
Karma: 0
Senior Member
On 5/24/2013 8:21 AM, Twayne wrote:
> On 5/23/2013 6:37 PM, Scott Johnson wrote:
>> On 5/23/2013 1:25 PM, Twayne wrote:
<snip>
>>
>> WOW, not a good way to get help. PE was correct.
>>
>> Supply the code to the failing function and someone may be able to help.
>>
>> But I would first check the attitude at the door.
>>
>> Scotty
>
> I did, Scottie. I posted relevant code and also offered to provide full
> code if it was necessary. Our "friend" simply decided to remove same in
> his response. Not good treatment of an admitted newbie.
>
> Twayne`

OK here is your Original Post:

************************
Hi, Newviw here;

Win 7 Home Premium, XAMPP 1.7.3, PHP 5.3,

Two pages: Form.php, check.php (& thanks.html).
They work fine; sends e-mail, formatted, and readable.


Form.php:
$d=($a.$b.$c);
echo "Your code is : " .$d." Enter it in the box below, including
dashes : <br />";

<form action="Check.php" method="post">
<b>Your Code: </b><input type="text" name="code" size="10
maxlength="14" /><br /><br /> ...

BUT: When I begin to add some security, things quit working.

1st, I add to form.php an mt-rand() build of a random code assigned to $d.

$d=($a.$b.$c);
echo "Your code is : " .$d." Enter it in the box below, including
dashes : <br />";

Works OK.

Check.php:
Now, when I try to validate the 'code' in check.php, things stop working.

$code = check_input($_POST['code'], "Enter Your Code");
stops everything in its tracks.

Any comments, advice, leads much appreiated.

TIA.

Twayne`
**********************

1. where is the relevant code of check_input(), the function that you
said is failing?

2. Where did you say that you will provide full code?

3. Best advice here, IMHO, if you don't like a reply then just ignore
it. If you bite back then you lose.

It is not that people do not want to help, but their time is very
valuable to them and like to get to the straight skinny. This is
probably why PE pointed you to how to ask good questions in here.

Will await the code.

Scotty
Re: PHP Contact Form, mt-rand(), problem Validating 1 input [message #181694 is a reply to message #181669] Sat, 25 May 2013 07:56 Go to previous message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma: 0
Senior Member
Scott Johnson wrote:

> OK here is your Original Post:

Thanks, but no, thanks.

> […]
> It is not that people do not want to help, but their time is very
> valuable to them and like to get to the straight skinny. This is
> probably why PE pointed you to how to ask good questions in here.

It is one reason why I did that. The underlying reason is that a person who
would even invest the time to post something *readable* does not deserve to
read as answer anything else except advice how to do just that.

Good answers, which require a corresponding amount of free time by the
person writing them, are to be deserved by posting smart questions, i. e. by
investing a considerable amount of free time for trying to answer them by
oneself, and then put them in proper words if that did not work, before they
are posted. Who thinks they could save all their free time by just posting
questions to others should not be surprised if the latter people are not
willing to invest any of their free time for the answer that the questioner
meant to save. Quid pro quo.

> Will await the code.

As others pointed out later, apparently “Twayne” is anything but a newbie.
Please do not feed the troll, then.


PointedEars
--
Danny Goodman's books are out of date and teach practices that are
positively harmful for cross-browser scripting.
-- Richard Cornford, cljs, <cife6q$253$1$8300dec7(at)news(dot)demon(dot)co(dot)uk> (2004)
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: how to judge the best Best Framework ?
Next Topic: why php echo does not show up in HTML?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue Nov 26 21:41:38 GMT 2024

Total time taken to generate the page: 0.02560 seconds