if not logged in - return to index |
[eluser]miauksius[/eluser]
Hi, I have a problem. I'm creating a guestbook, and I dont want that not logged in users could read the comments in it, so i tried this: Code: <?php But it doesent work. It doesent redirect at all. Why? Could you give me some tips? Cause im gonna need this in other pages too. Thank you for your help
[eluser]Dam1an[/eluser]
I think you meant to put that code inside the construtor? Try Code: <?php
[eluser]miauksius[/eluser]
It works! THANK YOU! But why does it work when I create function named the same as class (Guestbook), but not when I create function _constructor? Aren't thay the same?
[eluser]Dam1an[/eluser]
The PHP5 equivalent is __construct() It's 2 underscores and construct, not constructor Also I just noticed your redirect function, it hould just have the controller/function names. There's no need to include index.php, as if you then get rid of index.php from the URL, you'll have to change it all manually
[eluser]miauksius[/eluser]
Thanks again for those notes. But how can I get rid of that index.php from my url?
[eluser]Dam1an[/eluser]
There's this wonderful thing called a user guide Read it and it will tell you the answers
[eluser]wowdezign[/eluser]
[quote author="miauksius" date="1248823682"]Thanks again for those notes. But how can I get rid of that index.php from my url?[/quote] [quote author="Dam1an" date="1248828734"]There's this wonderful thing called a user guide Read it and it will tell you the answers[/quote] Speaking of which, you'll find the answer to the index.php question at: http://ellislab.com/codeigniter/user-gui.../urls.html
[eluser]Dam1an[/eluser]
@wowdezign, thats the actualy page I linked to Although hopefully he'll read the whole user guide
[eluser]wowdezign[/eluser]
@Dam1an, Sorry, I didn't even notice it was a live link. :red:
|
Welcome Guest, Not a member yet? Register Sign In |