PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
i'm tring to call up a cookie and dectect whats in it and if its users or watever then do this... but even tho i know the cookies are there its not calling up the right page... see in the header.php file i have this
if ($page == 'login' && $ucp == 'user' OR isset ($logcbaa) == 'user'){
include ("ucp.php");
}
to call the right control panel, for the type of user, and if they just come to the site and loggedin previously and never logged out then it should still have the cookies and log them in automaticly..... see the first part of the if statement is correct that works is the or.... that doesnt... does anyone know whats wrong
If you are using an include statement to include the file that has the code which checks the cookies, be sure to include using the path on the server as opposed to the URL.
well there is no error that shows up so i dont know exactly....
everythign works except for teh fact that my cookies are not functioning i set the cookie but i duno why its not being called up when i call it
the whole objective is to get it so that when you login.... it sets a cookie called cblog and it has your status for what user panel you get so if your status is just a user your only allowed certian things etc...
that works logging in works... but when you come back to the site or go to somewhere else on the site it doesnt show the control panel anymore.... it'll just show the login screen...
thats my whole problem...... erg... see what i do i use an if to check to see if the cookies set and get the cookie what is teh value of the cookie and if it matches one of the properties i ahve lined out (user... staff.... admin), then go to the one it matches but it doesnt....
when i make it so that the cookie has to be there to show a control panel, nothign shows up. making the control panel show up is all up to the cookie
for some reason its not finding or getting the cookie...
well the cookies might not even be on my hard drive becasue i've tried searching for them but havent found them i set the dir on the cookie to "/" where would that be ... in the c:/ drive.. i duno
so does that mean inside the first cookie it has the value [idcbaa] => 2 like all together like that or it the [idcbaa] just the name and the value is whats after the => thing well if it is that means its setting the cookie right but its not picking it up in the if statement
i found my cookies their in the temporary internet file folder.. under a text file called cbaa..... it contains both cookies... so should i isset($cbaa) .. becasue they are both in that file?....
Clarification about my include comment.....if using the include function, be sure you are using a path(Something like /usrs/me/web/file.php) as opposed to a URL(http://www.site.com/file.php). I've found that if you do the latter, it will not work with cookies very well, for some reason.
Secondly, This code you posted in your first post could be the problem.
o.k. i got this code off of the php manual ... duno it still doesnt work... i changed the $logcbaa to $cbaa because i found that both of the cookies i set are in one file called cbaa.... this is makeing my head hurt
One thing I just thought of, is..cookies can only be used either by files in the directory they were created in, or subdirectories from that directory. Make sure that's not the problem you are having.
If that isn't your problem, try making a blank page with only a simple code to echo out your cookie variable. That's the easiest way to tell wether it is setting them correctly or not.
you mean like the file with the set cookie is in ..../cbaa/filename.php
so make sure when i call the cookie the file thats calling it in has to be the same .....
well all my files for my web page are in /cbaa/ except for the pics which are in /cbaa/pics/