Henaro Posted December 8, 2007 Share Posted December 8, 2007 Hello everyone~ I've been having trouble with this function for a bit: function get_ses($pass, $key) { //Take the first 16 chars of session md5 and validate if (substr(md5($key)), 0, 16)==substr($_SESSION['a_stuff'], 0, 16)){ //Go 16 characters into the session, and take 16 characters out if (substr(md5($pass))==substr($_SESSION['a_stuff'], 16, 16)){ $ses_vald = "true"; }else{ $ses_vald = "false"; } }else{ //If key isn't valid return false $ses_valid = "false"; } return $ses_vald; } I get an error that says: Parse error: syntax error, unexpected ',' in /home/x/x/x/x/x/x/stuff/funs/get_ses.php on line 4 The problem is, is that I'm unable to locate that unexpected ,. Also, is this a good way to encrypt a login? Like if someone logs in and their pass is encrypted plus a set key on the config file? I'd like some criticism on it... Thanks, Hen Link to comment https://forums.phpfreaks.com/topic/80773-solved-some-questions-and-some-difficulty-on-encrypting-sessions/ Share on other sites More sharing options...
jacksonmj Posted December 8, 2007 Share Posted December 8, 2007 Try changing if (substr(md5($key)), 0, 16)==substr($_SESSION['a_stuff'], 0, 16)){ to if (substr(md5($key), 0, 16)==substr($_SESSION['a_stuff'], 0, 16)){ Link to comment https://forums.phpfreaks.com/topic/80773-solved-some-questions-and-some-difficulty-on-encrypting-sessions/#findComment-409697 Share on other sites More sharing options...
Henaro Posted December 8, 2007 Author Share Posted December 8, 2007 Ah thanks! Link to comment https://forums.phpfreaks.com/topic/80773-solved-some-questions-and-some-difficulty-on-encrypting-sessions/#findComment-409706 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.