in reply to Re^17: global var
in thread global var
are those log messages from both the one that was failing and the one that worked? its hard to tell
IF the only thing you call in the working example is manageusers::OpenConnection() then why you you expect $manageusers::LoggedOn_user_id to be anything but zero? So You have yet to prove that you are actually setting $manageusers::LoggedOn_user_id by code that is being run anywhere. Show us all of the subroutines that contain the following code and any subroutines they call
In particular where $uid gets set before you run $LoggedOn_user_id = $uid;.New login warn("Hash evaluation succeded - $passhash = $passhash1 : $sessiondata +2 = $sessiondata2md5p"); my $timein = time(); $session->param('user_id',$uid); $session->param('username',$username); $session->param('forename', $forename); $session->param('lastname', $lastname); $session->param('timein', $timein); $session->param('timeout', 0); $session->param('attempts',0); $session->param('isloggedin',1); $session->expires('+7d'); $LoggedOn_user_id = $uid; #$session->param("user_id"); [download] Already logged on if ($status == 1) { warn("Process Login returning after confirmed already logged in: s +tatus: '$status' sessionname: '$sessionname' SID: '$sid'"); my $username1 = $session->param("user_id"); warn("username1 : '$username1'"); $LoggedOn_user_id = $username1; warn("Already logged on LoggedOn_user_id : '$LoggedOn_user_id'");
and i can become any user i want to be by manipulating the user_id parm i send back to you, that doesnt seem very secure does it? It is easy to create code that sends back any value i want in the user_id field
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^19: global var
by tultalk (Monk) on Apr 11, 2017 at 20:14 UTC | |
are those log messages from both the one that was failing and the one that worked? its hard to tell. The one that failed. No log from the one that worked . Ran in Padre and can't find log. "You have yet to prove that you are actually setting $manageusers::LoggedOn_user_id by code that is being run anywhere." The rwo code blocks above do exactly that. Entire code at end Filled with comments
You say: In particular where $uid gets set before you run $LoggedOn_user_id = $uid; . $uid is popuated earlier in processing a new logon. "and i can become any user i want to be by manipulating the user_id parm i send back to you, that doesn't seem very secure does it? It is easy to create code that sends back any value i want in the user_id field" That makes no sense to me. When a legitimate user tries to log in, the username and password are encrypted and sent back for comparison to the username/password from the database as encrypted by the same algorithm on the server.
| [reply] [d/l] [select] |
by huck (Prior) on Apr 11, 2017 at 23:44 UTC | |
The rwo code blocks above do exactly that. No they do not prove anything, you did not show us where that code was, how it was called, nor did you call it in your example. In the code you just showed us there are many reasons those code segments can be skipped leaving $LoggedOn_user_id set to its initial 0 regarding $LoggedOn_user_id being undef
you dont check to see if $session->id() ne $sid. If they are not the same it is because either the $sid never existed or that session has expired. in either of those cases a new session-collection and session-id is created and when you try to use my $username1 = $session->param("user_id"); to set $LoggedOn_user_id = $username1; it will be undef as the following code demonstrates. result
| [reply] [d/l] [select] |
by tultalk (Monk) on Apr 19, 2017 at 02:28 UTC | |
Been sick. Back to this You siad to add this:
What is it supposed to do? Error below:
Also i have checked $LoggedOn_user_id in the code block for existing user loged on and new user login and in both cases $LoggedOn_user_id contains the value I expect. In neither case is $LoggedOn_user_id undefined or 0. The value is not passed across the boundary between the pm and the cgi script that calls for the value. You state: you dont check to see if $session->id() ne $sid. If they are not the same it is because either the $sid never existed or that session has expired. The $sid/session id is from the cookie. If the cookie expired then a new session is created. Both cases are addressed. The problem lies in my lack of understanding of the scope of variables and their persistence. running in padre still shows the variable in not exported by manageusers. | [reply] [d/l] [select] |
by tultalk (Monk) on Apr 20, 2017 at 22:42 UTC | |
This is error log showing the value of LoggedOn_user_id after logon ( already logged on user) . Program waiting for next "click" before proceeding.
And here is the program code
No it is not all there. ust the aprt that produced the error log.
Too much code? Hey too much code. Not enough code? Hey not enough code. | [reply] [d/l] [select] |