Welcome Guest, Not a member yet? Register   Sign In
Specific Page Error Reporting
#1

[eluser]Matalina[/eluser]
I have a problem I need some brainstorming with.

I would like to have users submit error reports on a per page basis. For example there is an error on a report and I want to send in that error. I click the send error report button and it takes me to a log page, where I can add a message to the report so that more details are given than just the page.

I want to log, the uri_string of the page that the user clicked the button from, the user_id and the date/time of the report as well as the submitted message.

Basically the question at hand is what would be the best way to store the uri_string so that it's usable when the form is submitted on the next page.

$_SERVER['REFERRER'] isn't very reliable on a browser to browser basis.

If I set the uri_string in sessions at the beginning of my control, it will be overwritten by the error page when it's loaded.

If I hook into after the controller has been called to store the uri would that work? Would it store the uri of the prior page long enough to pull the data and store it in the database?

I can't send the uri within the anchor tag as it'll have slashes etc in it. I can't encrypt it because I don't want to add in all the other extra characters into allowed uri string characters.

The only fall back I can think of is to use the default CI_Controller instead of the MY_Controller and do all the things in MY_Controller except store the URI session. But that's not DRY. And I'd rather not have to rewrite all my controllers.

*talking to myself*
Though only one or two control uses MY_Controller and not the BASE_Controller for logged in users.

Anyone other ideas or comments on the options presented?

*figured it out*
I will Use the BASE_Controller to set the uri in sessions. And have Errors extend MY_Controller. The only other controller that extends MY_Controller is the public viewable pages (login, lost password) etc. So I can save the uri in sessions on that one controller and error's won't over write it.

Sorry for rambling lol. But writing it out helped me figure it out. So I'm posting it anyway, so someone else will have it if they can understand it.
#2

[eluser]weboap[/eluser]

you can use a combination of

Code:
//user agent lib
$ref = $this->agent->referrer();


//input class
$ip = $this->input->ip_address();

//session class

//put the user_id in the session initially after login


//then

$user_id = $this->session->userdata('user_id');

and go from there....
#3

[eluser]Matalina[/eluser]
yeah that doesn't help all the $this->agent->referrer does is reference $_SERVER['HTTP_REFERER'] which isn't reliable

from php.net
[blockquote]
'HTTP_REFERER'
The address of the page (if any) which referred the user agent to the current page. This is set by the user agent. Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature. In short, it cannot really be trusted.
[/blockquote]




Theme © iAndrew 2016 - Forum software by © MyBB