greatchap Posted February 3, 2011 Share Posted February 3, 2011 Hi Guys, I am developer and relatively new to php although I have written a few scripts. I have a site which runs on linux/unix platform. I am facing a weird problem: - I have a php script (e.g. site.com/test/test.php) which takes a input from url, and creates a session and opens a wordpress php in another folder (e.g. site.com/wp/index.php) - I wrote a small php code in that wp/index.php which checks if session exists or not. if yes, then no problem, if not then die and show a message. Now the problem is when I run the script, it opens the wp/index.php and the page opens. Good. But when I click on any link in that page e.g about or so, then I get message which I wrote that session not found and so on... I don't know why this is happening. So if you guys can help me with this it would be great. Alternatively, I thought if I protect the wp folder (using protect folder thru cpanel) and write a php script outside which call the php inside the wp folder with a hardcoded uname & pw, then i can run the php inside without anyone knowing what the actual uname or pw is. This way if a user directly tries to access it , he wont be able to do so as uname & password box will appear. But I dunno how to call a php inside protected folder. I tried to redirect but the uname & pw box appeared. I would be grateful if anyone can help me. Thanks a lot, Cheers, GR Quote Link to comment https://forums.phpfreaks.com/topic/226546-session-problem/ Share on other sites More sharing options...
Mr_J Posted February 3, 2011 Share Posted February 3, 2011 can you add a link? will help to actually see... I'm newish to php as well and started using sessions just a while ago so its all still fresh in my mind Quote Link to comment https://forums.phpfreaks.com/topic/226546-session-problem/#findComment-1169286 Share on other sites More sharing options...
doddsey_65 Posted February 3, 2011 Share Posted February 3, 2011 did you remember to include session_start(); at the top of every page that uses this session? Quote Link to comment https://forums.phpfreaks.com/topic/226546-session-problem/#findComment-1169288 Share on other sites More sharing options...
greatchap Posted February 3, 2011 Author Share Posted February 3, 2011 Ya I do put in session start at the begining of every page. otherwise the index page inside wordpress would have not opened in the first place. Kinda weird as to why its happening. By the way how can I use php to access a protected folder. Quote Link to comment https://forums.phpfreaks.com/topic/226546-session-problem/#findComment-1169300 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.