Re: [PHP] Links hierarchy maintenance
Hi Jessen, The question is how to make it aware of the context. Do you know any work dealing with that? Thanks --- Per Jessen [EMAIL PROTECTED] wrote: Adil Drissi wrote: Hi, Yes this is the correct way to do things. As i said, i'm using different styles for the menus links indicating the current page. Suppose my page has one horiontal menu at the top and one vertical menu at the left. In this case, one element of the horizontal menu and one from the vertical menu will be displayed differently from the other elements. So the function that will be inluded will be more complex to handle this. I was just wondering, how other poeple are dealing with that. Of course it is feasable, but i want to do it the best way. CSS ? If that's not enough to alter the display, you need to make your includes sensitive to or aware of the context they're being included in. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Links hierarchy maintenance
Yes like that, but you can consider also that the vertical menu has different style for the link of the current page. Anyway it does not matter for this problem. Can you show us how your php function looks like? Or maybe you are just doing a test for each link for your function to know if it is the link that should be displayed differently. I was wondering if there is a way to do the same thing without the overhead of all that if statements. --- tedd [EMAIL PROTECTED] wrote: Yes this is the correct way to do things. As i said, i'm using different styles for the menus links indicating the current page. Suppose my page has one horiontal menu at the top and one vertical menu at the left. In this case, one element of the horizontal menu and one from the vertical menu will be displayed differently from the other elements. So the function that will be inluded will be more complex to handle this. I was just wondering, how other poeple are dealing with that. Of course it is feasable, but i want to do it the best way. I hope the problem i posted is clearer now Two menus, do you mean like this: http://webbytedd.com/clients/beckyscan/about-company.php It's still just css and php -- simply a logic problem. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Links hierarchy maintenance
Hi, I'm working on a site that is becoming more and more bigger (containing more links). Now the problem of links maintenance arises. An intuitive idea that i'm trying to do right know is calling php functions that will display every part of the site that is repetitive. For example left side menu and footer. For the left side menu with static HTML and CSS i'm disabling the link to the actual page, like that the user has a visual presentation allowing him to know where he is exaclty in the site. This introduces more difficulty for the function that will display the menu. So i'm wondering if there is some efficient way of modeling and implementing this. All suggestions are welcome, and if some part of the problem is not clear enough please feel free to ask me more questions if necessary. Thanks Looking for last minute shopping deals? Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Links hierarchy maintenance
Hi, Yes this is the correct way to do things. As i said, i'm using different styles for the menus links indicating the current page. Suppose my page has one horiontal menu at the top and one vertical menu at the left. In this case, one element of the horizontal menu and one from the vertical menu will be displayed differently from the other elements. So the function that will be inluded will be more complex to handle this. I was just wondering, how other poeple are dealing with that. Of course it is feasable, but i want to do it the best way. I hope the problem i posted is clearer now --- tedd [EMAIL PROTECTED] wrote: At 9:23 AM -0800 3/8/08, Adil Drissi wrote: I'm working on a site that is becoming more and more bigger (containing more links). Now the problem of links maintenance arises. An intuitive idea that i'm trying to do right know is calling php functions that will display every part of the site that is repetitive. For example left side menu and footer. For the left side menu with static HTML and CSS i'm disabling the link to the actual page, like that the user has a visual presentation allowing him to know where he is exaclty in the site. This introduces more difficulty for the function that will display the menu. So i'm wondering if there is some efficient way of modeling and implementing this. All suggestions are welcome, and if some part of the problem is not clear enough please feel free to ask me more questions if necessary. In all of my pages, I use includes. I have one include for the header, one for the footer and one for the navigation, which is usually called by the header. If something changes in navigation, I change one file and it's done throughout the site. Look into includes. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] regular expressions question
Hi, Is there any way to limit the user to a set of characters for example say i want my user to enter any character between a and z (case insensitive). And if the user enters just one letter not belonging to [a-z], this will not be accepted. I tried eregi('[a-z]', $fname) but this allows the user to enter abdg4512kdkdk for example. Thank you - Never miss a thing. Make Yahoo your homepage.
Re: [PHP] regular expressions question
Thank you guys, The answers you gave me not only solved the problem, but i included more characters like space and -. Thank you again --- Richard Lynch [EMAIL PROTECTED] wrote: On Tue, March 4, 2008 1:19 pm, Adil Drissi wrote: Is there any way to limit the user to a set of characters for example say i want my user to enter any character between a and z (case insensitive). And if the user enters just one letter not belonging to [a-z], this will not be accepted. I tried eregi('[a-z]', $fname) but this allows the user to enter abdg4512kdkdk for example. What you tried only requires ONE a-z character somewhere in the input. Try this: preg_match('^[a-z]+$', $fname); This will: ^ anchor the string at the beginning [a-z]+ a to z, with at least one letter $ anchor the string at the end Note, however, that some people have other characters in their first name, such as apostrophe, space, and dash. Oh, and the digit 3, for bo3b who was a programmer on the first Apple Macintosh. His parents were hippies, and that really is his name... You may want to obtain a LARGE list of first names and run them through your validator as a test. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session destruction problem
Hi, I made an error i was using unset($_SESSION[sessioname]) instead of unset($_SESSION). I'm sorry, but anyway, now i want to give another detail. All the time i was testing with opera. After testing in firefox and ie there is no problem with the code i posted. Thank you very much for your help --- Adil Drissi [EMAIL PROTECTED] wrote: Hi, Below you'll find my code. I think now that the problem is in my algorithm, because the is created anytime the page is refreshed. But i don't know how to check if the client was logged out or it is a real new connexion to the page. As you will see one can click on logout, then press the back button of the browser, and then refresh the page, but he is still connected. I would like to help me fixe that. Here is the code: ---index.php-- //the first page where the user enters his login and password !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=utf-8 / link rel=stylesheet type=text/css href=../styles/style.css media=screen / titleLogin page/title /head body form name = manage action = manage.php method=post div style = padding-top: 40px; padding-bottom: 40px;height = 100%; centertable width = 100% cellspacing=10 trtd width = 50% align = rightLogin/tdtd width = 50% align = leftinput type=text name=login //td/tr trtd width = 50% align = rightPassword/tdtd width = 50% align = leftinput type=password name=password //td/tr /table input type=submit name=connect value = Connect/ br/br/br/ /center /form /body /html - manage.php //where the form posts data and here is where the session is created ?php session_start(); $sessionid = session_id(); $referer = @$HTTP_REFERER; if (isset($_REQUEST['connect'])){ $passwd = addslashes($_POST['password']); $login = addslashes($_POST['login']); require_once ../../../includes/connexion.php; $sql = mysql_query(SELECT * FROM user WHERE login ='.$login.' and password = '.$passwd.') or die(Incorrect username or password.); $result = mysql_fetch_array($sql); if (($result[0] != null)) { $_SESSION['sessioname'] = $_POST['login']; } else Header (Location: ./index.php); mysql_close(); } else if(!isset($_SESSION['sessioname'])) { Header (Location: ./index.php); } ? !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=utf-8 / /head body ?php if(isset( $_SESSION['sessioname'])) { echo $_SESSION['sessioname'] ; echo , . session_id(); echo , a href = 'logout.php'Log Out/a nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;; } else echo a href = 'index.php'Login/a nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;; ? /body /html logout.php -- ?php session_start(); unset($_SESSION[sessioname]); $_SESSION = array(); session_destroy(); header(location: index.php); ? --- Richard Lynch [EMAIL PROTECTED] wrote: On Sat, February 16, 2008 2:31 pm, Adil Drissi wrote: I need help with sessions. I have a simple authentification relying only on sessions (i don't use cookies). Do you mean that you are also using the no_cookie setting in PHP and using the URL to pass around the session ID? Or jut that you don't use extra cookies on top of the one PHP uses by default? After the user submits his username and password, the script checks if that corresponds to a record in a mysql table. If this is the case $_SESSION['sessioname'] = $_POST['login'];. the $_SESSION['sessioname'] is checked in subsequent pages to see if the user is connected or not. The problem is after the user logs out, and after that uses the previous button of the browser he becomes connected. How can i prevent this please. If the URL has the old session ID, and you aren't destroying it completely somehow, then they'll be logged in once they go back to the URL with the session ID. ?php session_start(); unset($_SESSION[sessioname]); session_destroy(); header(location: index.php); ? If you want to destroy the session completely, use: $_SESSION = array(); to wipe out ALL the session data. Also, on *some* browsers, sending the cookies session_start (if you are using cookies) and the Location: header with an INCOMPLETE URL means the browser will screw up. Use the COMPLETE URL in your header(Location) And use a capital L in Location, as well, to be totally kosher, I think. -- Some people have a gift link here. Know what
Re: [PHP] Session destruction problem
thank you tedd, I understood what you explained to me last time. I was wondering if there is another method to prevent that. Thanks --- tedd [EMAIL PROTECTED] wrote: At 2:45 PM -0800 2/19/08, Adil Drissi wrote: Hi, Below you'll find my code. I think now that the problem is in my algorithm, because the is created anytime the page is refreshed. But i don't know how to check if the client was logged out or it is a real new connexion to the page. As you will see one can click on logout, then press the back button of the browser, and then refresh the page, but he is still connected. I would like to help me fixe that. Here is the code: You received an answer, but fail to understand. Unless you use javascript to manipulate the browser's history you are going to continue to have problems with the user browser's back button. But, explain why the user using the back button is a problem. If he logs in, he's in. If he logs out, he's out. If he hits the back button after logging out and cancels his log out -- so what? What problems does that present? Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session destruction problem
Hi, Below you'll find my code. I think now that the problem is in my algorithm, because the is created anytime the page is refreshed. But i don't know how to check if the client was logged out or it is a real new connexion to the page. As you will see one can click on logout, then press the back button of the browser, and then refresh the page, but he is still connected. I would like to help me fixe that. Here is the code: ---index.php-- //the first page where the user enters his login and password !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=utf-8 / link rel=stylesheet type=text/css href=../styles/style.css media=screen / titleLogin page/title /head body form name = manage action = manage.php method=post div style = padding-top: 40px; padding-bottom: 40px;height = 100%; centertable width = 100% cellspacing=10 trtd width = 50% align = rightLogin/tdtd width = 50% align = leftinput type=text name=login //td/tr trtd width = 50% align = rightPassword/tdtd width = 50% align = leftinput type=password name=password //td/tr /table input type=submit name=connect value = Connect/ br/br/br/ /center /form /body /html - manage.php //where the form posts data and here is where the session is created ?php session_start(); $sessionid = session_id(); $referer = @$HTTP_REFERER; if (isset($_REQUEST['connect'])){ $passwd = addslashes($_POST['password']); $login = addslashes($_POST['login']); require_once ../../../includes/connexion.php; $sql = mysql_query(SELECT * FROM user WHERE login ='.$login.' and password = '.$passwd.') or die(Incorrect username or password.); $result = mysql_fetch_array($sql); if (($result[0] != null)) { $_SESSION['sessioname'] = $_POST['login']; } else Header (Location: ./index.php); mysql_close(); } else if(!isset($_SESSION['sessioname'])) { Header (Location: ./index.php); } ? !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=utf-8 / /head body ?php if(isset( $_SESSION['sessioname'])) { echo $_SESSION['sessioname'] ; echo , . session_id(); echo , a href = 'logout.php'Log Out/a nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;; } else echo a href = 'index.php'Login/a nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;; ? /body /html logout.php -- ?php session_start(); unset($_SESSION[sessioname]); $_SESSION = array(); session_destroy(); header(location: index.php); ? --- Richard Lynch [EMAIL PROTECTED] wrote: On Sat, February 16, 2008 2:31 pm, Adil Drissi wrote: I need help with sessions. I have a simple authentification relying only on sessions (i don't use cookies). Do you mean that you are also using the no_cookie setting in PHP and using the URL to pass around the session ID? Or jut that you don't use extra cookies on top of the one PHP uses by default? After the user submits his username and password, the script checks if that corresponds to a record in a mysql table. If this is the case $_SESSION['sessioname'] = $_POST['login'];. the $_SESSION['sessioname'] is checked in subsequent pages to see if the user is connected or not. The problem is after the user logs out, and after that uses the previous button of the browser he becomes connected. How can i prevent this please. If the URL has the old session ID, and you aren't destroying it completely somehow, then they'll be logged in once they go back to the URL with the session ID. ?php session_start(); unset($_SESSION[sessioname]); session_destroy(); header(location: index.php); ? If you want to destroy the session completely, use: $_SESSION = array(); to wipe out ALL the session data. Also, on *some* browsers, sending the cookies session_start (if you are using cookies) and the Location: header with an INCOMPLETE URL means the browser will screw up. Use the COMPLETE URL in your header(Location) And use a capital L in Location, as well, to be totally kosher, I think. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ -- PHP General Mailing List
Re: [PHP] Session destruction problem
Is your session being set in any other place but your login page? No, just in the page just to which the form of login and password points. Looking for last minute shopping deals? Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session destruction problem
Hi, I suppose this can be used to solve the problem i posted. Can you please tell me how, or send a link to ressource explaining that? Thanks --- Daniel Brown [EMAIL PROTECTED] wrote: On Feb 16, 2008 3:31 PM, Adil Drissi [EMAIL PROTECTED] wrote: Hi everybody, I need help with sessions. I have a simple authentification relying only on sessions (i don't use cookies). Just to let you know, if you're using sessions, you're using cookies. You're not setting the data in the client-side cookie, but a cookie is still installed on the system containing the PHPSESSID. -- /Dan Daniel P. Brown Senior Unix Geek ? while(1) { $me = $mind--; sleep(86400); } ? Looking for last minute shopping deals? Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session destruction problem
Hi, Thanks for the link, it is very interesting, but as the author says, the solutions are not perfect. I'm wondering how yahoo mail for example are doing, or maybe they are using something else (not php)? Thank you --- tedd [EMAIL PROTECTED] wrote: At 12:31 PM -0800 2/16/08, Adil Drissi wrote: Hi everybody, I need help with sessions. I have a simple authentification relying only on sessions (i don't use cookies). After the user submits his username and password, the script checks if that corresponds to a record in a mysql table. If this is the case $_SESSION['sessioname'] = $_POST['login'];. the $_SESSION['sessioname'] is checked in subsequent pages to see if the user is connected or not. The problem is after the user logs out, and after that uses the previous button of the browser he becomes connected. How can i prevent this please. Here is my logout.php: ?php session_start(); unset($_SESSION[sessioname]); session_destroy(); header(location: index.php); ? That will destroy the session, but not the browser history. You'll need javascript to alter window history. Google window.history.forward Here's one link that may help: http://www.4guysfromrolla.com/webtech/111500-1.2.shtml Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Looking for last minute shopping deals? Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Session destruction problem
Well, i'm doing all that. Maybe something is wrong in my code. I'll arrange my code in a way that it will be easy to run and i'll post it. I think like that, you'll see by yourself and you gonna help to fix that for sure. Thank you --- Shawn McKenzie [EMAIL PROTECTED] wrote: Adil Drissi wrote: Hi everybody, I need help with sessions. I have a simple authentification relying only on sessions (i don't use cookies). After the user submits his username and password, the script checks if that corresponds to a record in a mysql table. If this is the case $_SESSION['sessioname'] = $_POST['login'];. the $_SESSION['sessioname'] is checked in subsequent pages to see if the user is connected or not. The problem is after the user logs out, and after that uses the previous button of the browser he becomes connected. How can i prevent this please. Here is my logout.php: ?php session_start(); unset($_SESSION[sessioname]); session_destroy(); header(location: index.php); ? Thank you for advance Looking for last minute shopping deals? Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping I don't think they are reconnected. What happens if they logout, then hit back, then hit refresh? Are they loggedin? Probably not. It may just appear that way because the back bottom brings up a cache of the previous page. But once the user tries to do anything that requires that they be loggedin, I doubt they can. -Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Session destruction problem
Hi everybody, I need help with sessions. I have a simple authentification relying only on sessions (i don't use cookies). After the user submits his username and password, the script checks if that corresponds to a record in a mysql table. If this is the case $_SESSION['sessioname'] = $_POST['login'];. the $_SESSION['sessioname'] is checked in subsequent pages to see if the user is connected or not. The problem is after the user logs out, and after that uses the previous button of the browser he becomes connected. How can i prevent this please. Here is my logout.php: ?php session_start(); unset($_SESSION[sessioname]); session_destroy(); header(location: index.php); ? Thank you for advance Looking for last minute shopping deals? Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php