Welcome Guest, Not a member yet? Register   Sign In
redirect to 403
#1

[eluser]überfuzz[/eluser]
Is it possible to redirect() to 403 without doing a custom 403page? If yes, how?

I'd like to throw a 403 if a visitor tries to reach an off limit url. I'm checking for this in a my controller and I like to redirect from that my controller.
#2

[eluser]srisa[/eluser]
Is it necessary to redirect? Send out 403 headers from the controller and load a view to display the appropriate message.
#3

[eluser]überfuzz[/eluser]
[quote author="srisa" date="1257986552"]Is it necessary to redirect? Send out 403 headers from the controller and load a view to display the appropriate message.[/quote]
Well what I really would like to do is to fire the CI error message, with a 403. If I'm throwing a 403 in the header with a location: etc I get my own error, don't I?
#4

[eluser]überfuzz[/eluser]
Oh, I forgot to show what I've been tinkering with.
Code:
$message_403 = "You don't have access to the url you where trying to reach.";
show_error($message_403 , 403 );
Quote:An Error Was Encountered

You don't have access to the url you where trying to reach.
This throws a CI error, but I can't change the header in the error template.

It's not exactly a matter of life and death, but I'd like to get this:
Quote:403 Forbidden

You don't have access to the url you where trying to reach.
#5

[eluser]srisa[/eluser]
Which version of CI are you using? This is how show_error function signature looks like in my CI 1.7.0
Code:
/**
     * General Error Page
     *
     * This function takes an error message as input
     * (either as a string or an array) and displays
     * it using the specified template.
     *
     * @access    private
     * @param    string    the heading
     * @param    string    the message
     * @param    string    the template name
     * @return    string
     */
    function show_error($heading, $message, $template = 'error_general')
    {
           ......
        }
#6

[eluser]troy_mccormick[/eluser]
[quote author="srisa" date="1258240913"]
Code:
<?php
function show_error($heading, $message, $template = 'error_general')
{
     ...
}
?>
[/quote]

I hate to bring up an old thread, but where I'm looking at (Common.php) it has this on CI 1.7.2:

Code:
<?php
function show_error($message, $status_code = 500)
{
     ...
}
?>

Am I just looking in the completely wrong place, or did it get taken out on purpose...or am I just completely crazy? Maybe two for three?? :-P

Thanks again for the great framework! :-P




Theme © iAndrew 2016 - Forum software by © MyBB