Welcome Guest, Not a member yet? Register   Sign In
I just created this "form key" library, need suggestions
#2

[eluser]Dam1an[/eluser]
I actually had this bookmarked to go over at some point lol

I just quickly glossed over the code, and 2 things jumped out
1) CamelCase class name for the library, tut tut, should use underscores as per the style guide
2) You could rewrite the validate function in one line
Code:
// From this
if ($this->input->post('form_key') == $this->old_form_key)
{
    return TRUE; //  The key is valid, return true
}
else
{
    return FALSE; // The key is invalid, return false
}

// To this
return $this->input->post('form_key') == $this->old_form_key;

Edit: I'll probably give some more in depth comments when I actually read the article


Messages In This Thread
I just created this "form key" library, need suggestions - by El Forum - 06-18-2009, 02:20 PM



Theme © iAndrew 2016 - Forum software by © MyBB