Jump to content

Undefined index: -- whats that mean?


JREAM

Recommended Posts

Notice: Undefined index: login in C:\Active_Projects\X8\cms\core\admin.settings.php on line 152

 

$login = $_POST['login'];

 

Above is what is on the line, am I not suppose to set variables to this?

What is a way to fix this?

 

something like: function p($value) { $_POST[$value]; }  ?

Link to comment
Share on other sites

$login = isset($_POST['login') ? $_POST['login'] : "";

This code is how I set variables sent via url.  First it checks if 'login' exists in the POST array, if it does it uses that value, if it doesn't it sets it to an empty string.  Of course you should also ALWAYS sanitize variables that are sent through a URL as they can be manipulated by the sender and used for an injection attack.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.