pouncer Posted November 9, 2006 Share Posted November 9, 2006 [code=php:0] if (!$log->IsLoggedIn()) { //i want to msgbox here. You need to be logged in to access the member area. header('Location: index.php'); }[/code] Quote Link to comment Share on other sites More sharing options...
genericnumber1 Posted November 9, 2006 Share Posted November 9, 2006 http://www.phpfreaks.com/forums/index.php/topic,6264.0.htmlguidelines4. Ask good questions! Consider the wording of your question carefully, be specific about your problem(s), and make sure that you have actually asked a question. Use punctuation and spelling to the best of your ability. Run on paragraphs without sentence breaks, and full of mispelled words limits your chances for a reply.Including some or all of the following information will increase the chance you get an answer.a) Your PHP version, platform (operating system), and webserverB) Your hosting companyc) Pertinent php.ini settings (SafeMode=On, for example).d) Error messages if any are generatede) Code snippets, enclosed in the php bbcode tags. NOTE: all you have to do is paste in your code, highlight the section that is PHP, and hit the PHP bbcode button to insert the right codes. If you are pasting HTML, javascript, SQL or some other language, you can use the Code button in a similar manner, to preserve indentation of your code blocks.f) MySQL, Postgresql or other database table definition(s). g) Links to the script(s) you are having problems with. Quote Link to comment Share on other sites More sharing options...
haaglin Posted November 9, 2006 Share Posted November 9, 2006 u can use:[code]die("You need to be logged in to access the member area.");[/code]Or you can use session variables. Quote Link to comment Share on other sites More sharing options...
pouncer Posted November 9, 2006 Author Share Posted November 9, 2006 Sorry, generic, did you not understand what I asked? (worrying) Quote Link to comment Share on other sites More sharing options...
pouncer Posted November 9, 2006 Author Share Posted November 9, 2006 [quote author=haaglin link=topic=114451.msg465648#msg465648 date=1163112086]u can use:[code]die("You need to be logged in to access the member area.");[/code]Or you can use session variables.[/quote]Thanks. and yeah, the $log->IsLoggedIn() basically checks if there's a $_SESSION['UserID'];hm, i ust tried it, it just echos that line at the top. is there a way to actually prompt a msgbox on the screen? Quote Link to comment Share on other sites More sharing options...
haaglin Posted November 9, 2006 Share Posted November 9, 2006 Then you need to pass that to a variable in javascript on the next page that is loading. on index.php: [code]var msg = <?php echo $_SESSION['error']; ?>if(alert != null || alert != "") { alert(msg);}[/code] Quote Link to comment Share on other sites More sharing options...
haaglin Posted November 9, 2006 Share Posted November 9, 2006 And remember to set the $_SESSION['error'] variable before dedirecting. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.