Re: Simple Problem? ... Please Advise ...



number1.email@xxxxxxxxx wrote:
> I've tried to enter this code but I'm having some problems...please
> advise:
>
> 1) I put the following line of code in my php script:
>
> $username=$_REQUEST['username'];
>
> I get the following error:
>
> Notice: Undefined index: username in
> /export/home/mydbsite.com/public_html/index.php on line 118

Never encountered this error, no matter if I would run that in shell or
through the web server.

You could try

if (array_key_exists('username',$_REQUEST)) {
$username=$_REQUEST['username'];
}

This would first check the $_REQUEST array and see if there is key called
"username" before trying to assign the value to the variable $username.

If you still get an error message, but the script seems to work as it should,
then do

if (@array_key_exists('username',$_REQUEST)) {
$username=$_REQUEST['username'];
}

notice the '@' in front of array_key_exists(), it's there to suppress error
messages.

Don't forget to access the page with the url

http://your.host.net/~yourusername/index.php?username=yourusername


Usually you try to fetch the variables as early as possible in the script and
don't do that inside a function, as this usually can mess things up as there
is the possibility that you get a function-local array instead of the global one.



//Aho
.



Relevant Pages

  • Re: logon script error message
    ... userName = WshNetwork.UserName ... acess sysvol and run the script manually. ... ' Map drives ... The error message refers to the line mapping h: ...
    (microsoft.public.windows.server.general)
  • Re: logon script error message
    ... userName = WshNetwork.UserName ... acess sysvol and run the script manually. ... The error message refers to the line mapping h: ... Maybe the variable userName is incorrect or undefined. ...
    (microsoft.public.windows.server.general)
  • Re: logon script error message
    ... It is inconsistent. ... reproduced.In this script: ... userName = WshNetwork.UserName ... Some users have an inconsistent "access denied" error message popping ...
    (microsoft.public.windows.server.general)
  • Re: Form Security
    ... After all this, if no error message has been generated, the form contents are emailed to me. ... I'm no Linux guru, so I don't know what someone could do to cause problems with this script, other than spam me. ... What he's proposing is false security - which is worse than no security ...
    (comp.lang.php)
  • Re: [Full-disclosure] SSH brute force blocking tool
    ... And just what on God's earth does "SOMEONE LOGGING IN WITH USERNAME SET ... TO A VALID PASSWORD ENTRY" have to do with this script. ... the classic attack is the symlink attack. ...
    (Full-Disclosure)