Prevost Posted June 27, 2007 Share Posted June 27, 2007 Ok, Im a complete n00b when it comes to anything else besides html so I do apologise if I am asking a stupid question. Im currently running a cgi script on my server (.pl extension). I also have a basic user system on my site and a small php code snipplet needs to be placed on pages to prevent certain user levels from being able to access the page and vice versa. I also want this CGI page to be restricted to certain users as this page is a "premium" service so to speak. I have tried placing the php snipplet on the top of the page to see if it would work and obviously it didnt. If anyone could suggest anything, I would be very greatful! Quote Link to comment Share on other sites More sharing options...
JJohnsenDK Posted June 27, 2007 Share Posted June 27, 2007 you need to be more specific... do you store your user_levels in a database? and is your user system writing in PHP? Cause the simpel answer would be like this: if($userlevel == "highest_level"){ echo "Secret page"; }else{ echo "You do not have permission to enter this page!"; } Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted June 27, 2007 Share Posted June 27, 2007 the question is specific. i am not sure if you can run PHP in CGI files. maybe there is a way to transfer sessions, like they both have them then just re-create your php snippit into perl so you can check if they are the required level. Quote Link to comment Share on other sites More sharing options...
Prevost Posted June 27, 2007 Author Share Posted June 27, 2007 Firstly, the user system is PHP based with MySQL backend. Like ive said the page im trying to protect is a CGI page (.pl) but the code snipplet is PHP and PHP wont run on a CGI file Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted June 27, 2007 Share Posted June 27, 2007 yeh i understood you. if there was a way for CGI to read session variables from PHP, which i am not sure about. you'd have to ask a CGI pro. then you could just run the same piece of code, except in CGI form, in your CGI file... Quote Link to comment Share on other sites More sharing options...
Prevost Posted June 27, 2007 Author Share Posted June 27, 2007 Is there not cgi inlcude snipplet? Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted June 27, 2007 Share Posted June 27, 2007 i'm not sure you can run php included scripts. you might have to re-write the code into CGI format. 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.