For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > July 2004 > $_GET help









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author $_GET help
Mark Jensen

2004-07-27, 3:58 pm

I'm new to PHP and can't get this to work. Client asked that user get
kicked after 2 unsuccessful login attempts.

//MAXATTEMPTS is set to 2
//$attempts is set to 0 at the beginning of the file
$attempts=(int)$_REQUEST["la"];
if ($attempts==MAXATTEMPTS) {
Header("Location: http://foo.com/foo.htm");
} else {
$attempts++;
Header("Location:
modules.php?name=$module_name&stop=1&la=$attempts");
}

I never drop into the foo.com relocation, and $attempts is blank (I
tacked it onto the header "&attempts=$attempts").

Global variables is enabled on the server (hostforweb.com)

Any ideas of what I'[m missing? It seems so simple to do that I'm
getting pretty POed by now! :)

Mark Jensen
Paul C-T

2004-07-27, 3:58 pm

> if ($attempts== ' $ ' MAXATTEMPTS) {




"Mark Jensen" <a@a.a> wrote in message
news:r42dg0hujtfrp9t49eufjk3c9ft9ih8pb3@
4ax.com...
> I'm new to PHP and can't get this to work. Client asked that user get
> kicked after 2 unsuccessful login attempts.
>
> //MAXATTEMPTS is set to 2
> //$attempts is set to 0 at the beginning of the file
> $attempts=(int)$_REQUEST["la"];
> if ($attempts==MAXATTEMPTS) {
> Header("Location: http://foo.com/foo.htm");
> } else {
> $attempts++;
> Header("Location:
> modules.php?name=$module_name&stop=1&la=$attempts");
> }
>
> I never drop into the foo.com relocation, and $attempts is blank (I
> tacked it onto the header "&attempts=$attempts").
>
> Global variables is enabled on the server (hostforweb.com)
>
> Any ideas of what I'[m missing? It seems so simple to do that I'm
> getting pretty POed by now! :)
>
> Mark Jensen



Miles Wolstenholme

2004-07-27, 8:55 pm

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Paul C-T wrote:

|>if ($attempts== ' $ ' MAXATTEMPTS) {
|
|
|
|
|
| "Mark Jensen" <a@a.a> wrote in message
| news:r42dg0hujtfrp9t49eufjk3c9ft9ih8pb3@
4ax.com...
|
|>I'm new to PHP and can't get this to work. Client asked that user get
|>kicked after 2 unsuccessful login attempts.
|>
|>//MAXATTEMPTS is set to 2
|>//$attempts is set to 0 at the beginning of the file
|>$attempts=(int)$_REQUEST["la"];
|>if ($attempts==MAXATTEMPTS) {
|>Header("Location: http://foo.com/foo.htm");
|>} else {
|>$attempts++;
|>Header("Location:
|>modules.php?name=$module_name&stop=1&la=$attempts");
|>}
|>
|>I never drop into the foo.com relocation, and $attempts is blank (I
|>tacked it onto the header "&attempts=$attempts").
|>
|>Global variables is enabled on the server (hostforweb.com)
|>
|>Any ideas of what I'[m missing? It seems so simple to do that I'm
|>getting pretty POed by now! :)
|>
|>Mark Jensen
|
|
|

Mark,

Do you mean:

$attempts = $_REQUEST['la'];

This should work fine .... if not, have you tried without the global
variable?

$attempts = $la

Miles


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)

iD8DBQFBBsO7aChlcX0WGowRAkAYAJ9wUpotnL5z
TzFlIIpKwzCtCZ/ihwCgqQU6
tPi+C3PjNGUulPte4qa8o90=
=I+Xq
-----END PGP SIGNATURE-----
Mark Jensen

2004-07-28, 3:56 pm

On Tue, 27 Jul 2004 22:06:03 +0100, Miles Wolstenholme
<miles.wolstenholme@runbox.com> wrote:

>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>Paul C-T wrote:
>
>|>if ($attempts== ' $ ' MAXATTEMPTS) {
>|
>|
>|
>|
>|
>| "Mark Jensen" <a@a.a> wrote in message
>| news:r42dg0hujtfrp9t49eufjk3c9ft9ih8pb3@
4ax.com...
>|
>|>I'm new to PHP and can't get this to work. Client asked that user get
>|>kicked after 2 unsuccessful login attempts.
>|>
>|>//MAXATTEMPTS is set to 2
>|>//$attempts is set to 0 at the beginning of the file
>|>$attempts=(int)$_REQUEST["la"];
>|>if ($attempts==MAXATTEMPTS) {
>|>Header("Location: http://foo.com/foo.htm");
>|>} else {
>|>$attempts++;
>|>Header("Location:
>|>modules.php?name=$module_name&stop=1&la=$attempts");
>|>}
>|>
>|>I never drop into the foo.com relocation, and $attempts is blank (I
>|>tacked it onto the header "&attempts=$attempts").
>|>
>|>Global variables is enabled on the server (hostforweb.com)
>|>
>|>Any ideas of what I'[m missing? It seems so simple to do that I'm
>|>getting pretty POed by now! :)
>|>
>|>Mark Jensen
>|
>|
>|
>
>Mark,
>
>Do you mean:
>
>$attempts = $_REQUEST['la'];
>
>This should work fine .... if not, have you tried without the global
>variable?
>
>$attempts = $la
>
>Miles
>
>
>-----BEGIN PGP SIGNATURE-----
>Version: GnuPG v1.2.4 (MingW32)
>
> iD8DBQFBBsO7aChlcX0WGowRAkAYAJ9wUpotnL5z
TzFlIIpKwzCtCZ/ihwCgqQU6
>tPi+C3PjNGUulPte4qa8o90=
>=I+Xq
>-----END PGP SIGNATURE-----


Weeeellllll, this is the simple snippet:
if(isset($la)){
Header("Location: http://foo.com");
}else{
Header("Location:
modules.php?name=$module_name&stop=1&la=1&a=$la");
}

I put $la into the Header so I could see if there is any value...but
the URL ends up "...&la=1&a="

Now, I don't know if $la is empty, or if I am trying to debug this in
an odd way (how do you all debug without alert();? ). I tried the
above, $_GET['$la'], and $_REQUEST['$la']... nothing. Honestly, I
flummoxed by not having an alert that I can pop up easily with a
client side script...

Rupe

2004-07-28, 8:56 pm


"Mark Jensen" <a@a.a> wrote in message
news:r42dg0hujtfrp9t49eufjk3c9ft9ih8pb3@
4ax.com...
> I'm new to PHP and can't get this to work. Client asked that user get
> kicked after 2 unsuccessful login attempts.
>
> //MAXATTEMPTS is set to 2
> //$attempts is set to 0 at the beginning of the file
> $attempts=(int)$_REQUEST["la"];
> if ($attempts==MAXATTEMPTS) {
> Header("Location: http://foo.com/foo.htm");
> } else {
> $attempts++;
> Header("Location:
> modules.php?name=$module_name&stop=1&la=$attempts");
> }
>
> I never drop into the foo.com relocation, and $attempts is blank (I
> tacked it onto the header "&attempts=$attempts").
>
> Global variables is enabled on the server (hostforweb.com)
>
> Any ideas of what I'[m missing? It seems so simple to do that I'm
> getting pretty POed by now! :)
>
> Mark Jensen


$1a is NOT a valid variable name (and can/need you cast the array element??)

http://uk.php.net/language.variables

RU


Mark Jensen

2004-07-29, 3:55 am

On Wed, 28 Jul 2004 21:56:20 +0100, "Rupe" <not@home.eva> wrote:

>
>"Mark Jensen" <a@a.a> wrote in message
> news:r42dg0hujtfrp9t49eufjk3c9ft9ih8pb3@
4ax.com...
>
>$1a is NOT a valid variable name (and can/need you cast the array element??)
>
>http://uk.php.net/language.variables
>
>RU
>


But as it is l(ogin)a(ttempts), I needn't worry.

Now I can't seem to get the nuke function is_admin() to work...damn,
something ain't right here...
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com