I have written a function to generate and store a salt data for a
session cookie.  I haven't written the MySQL code, so that is absent. 
Basically what I am trying to do is make it so that if there is no
value submitted for an argument, I want it to fall back to the
defaults set up in my config.ini file.  This file is successfully
parsed into the array "$_SETTINGS".  I have no problems doing this.  I
get an "Unexpected T_VARIABLE" in the line with the function
definition.  I know this means that I've got a variable call in the
wrong place, but I don't know why it thinks it is wrong.

Can you not default to variables in a function?  Or am I just writing
it incorrectly?  Please enlighten me on this, I'm pretty much stuck.

--CODE SNIPPET--
function create_salt_data($destination =
$_SETTINGS['session.salt_var'], $prefix =
$_SETTINGS['session.salt_prefix'], $crypt_method =
$_SETTINGS['session.salt_crypt']) {
        $crypt_command = '$salt_data = ' . $crypt_method . '(uniqid("' .
$prefix . '"));';
        //Did compiling the salt together fail?  If so, return failure.
        if (!eval($crypt_command)) {
                return false;
        }
//      $salt_data = $crypted_salt;
        
        if ($destination != 'return') {
                $_SESSION[$destination] = $salt_data;
                return true;
        }
        else {
                return $salt_data;
        }
}

I have worked around it by making the defaults null, and then testing
and replacing them inside the function.  It takes more code than I
would like it to, I'm trying to condense my files.

Thanks in advance!

-- 
The Disguised Jedi
[EMAIL PROTECTED]

PHP rocks!
"Knowledge is Power.  Power Corrupts.  Go to school, become evil"

Disclaimer: Any disclaimer attached to this message may be ignored.
This message is Certified Virus Free

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to