Ninjakreborn Posted September 19, 2006 Share Posted September 19, 2006 Any site that carries a lot of information you notice you use a lot of state saving. Sessions, cookies, get, post, all over the place. The site I am doing, uses a lot of sessions, it uses a lot of posts, and alot of get'sIt comes down to certain areas, where I am chaining together a good number of variables.http://www.domainname.com/display.php?school=UPenn&category=Item&subcategory=Sporting%20Goods&postset=postset1and at some points it might get even bigger, is this going to present a problem, I heard when it get's over 255 characters, then there's a problem, because some browsers can cut some of that off.That's under 100 all together, with all characters together including hte domain name, so I know this should be fine, but in the event, I get it 2-3 times longer than that(hasn't happened yet), what can I do, to prevent this, or what do I have to worry about with doing it like that. Quote Link to comment https://forums.phpfreaks.com/topic/21302-url-reconstruction-with-php/ Share on other sites More sharing options...
zq29 Posted September 19, 2006 Share Posted September 19, 2006 Either use a method other than 'get', or pass an 'id' and grab everything from the database based on that id ? Quote Link to comment https://forums.phpfreaks.com/topic/21302-url-reconstruction-with-php/#findComment-94776 Share on other sites More sharing options...
wildteen88 Posted September 19, 2006 Share Posted September 19, 2006 Also dont use words as your variables. Shorten them such as:sch for schoolcat for categoryscat for subcategoryps for post set.No need to make your variables so obvious to the user what they are. That you can do in your actuall code using comments. Additionally you might want to use mod_rewrite to tidy up your urls so its like this:site.com/schoolName/Category/subCategory/PostSetOr just use SA's suggesstion and use another method. Such as use a temporary session variables which holds an array of School name, category, sub cat etc, Eg:[code=php:0]$_SESSION['school_nav'] = array('sname' => 'SchoolNameHere', 'cat' => 'categoryName' ..etc..);[/code]Then use $_SESSION['school_nav']['sname'] to access the school name$_SESSION['school_nav']['cat'] to access the category etc.Use the power of arrays when dealling with masses of data dont create 1 session var for each variable. Use arrays to store multiple things in an session which relate to each other. Quote Link to comment https://forums.phpfreaks.com/topic/21302-url-reconstruction-with-php/#findComment-94784 Share on other sites More sharing options...
Ninjakreborn Posted September 19, 2006 Author Share Posted September 19, 2006 Whether I use that right now or not, I am not sure, but the advice you gave me may prove invaluable. So I always have a group of sessions for the user, so instead, I can create an array. like$_SESSION['userinfo'] = array(then create a inside the array for there username, email, ip address, last logged in date, and everything else. Then if I have admin later I could do$_SESSION['admin'] = arraythen have all that in therethen use temporary set's of session data for other things.So tehre would actually never be a need for get if this was true, so there has to be negatives to doing that, what negatives come with doing that, that you know of? if any.I like that idea Quote Link to comment https://forums.phpfreaks.com/topic/21302-url-reconstruction-with-php/#findComment-94789 Share on other sites More sharing options...
zq29 Posted September 19, 2006 Share Posted September 19, 2006 There are uses for 'get', such as passing information from external sources. For example, if you send an activation email to someone requesting that they activate their account by clicking the link mysite.com/activate.php?id=546564As far as I see it, there are no negative effects to using Wildteen's method, I use that method in my projects - Why pass data through the URL when you don't need too? It's both messy, and provides a small insight as to how parts of your system work. Quote Link to comment https://forums.phpfreaks.com/topic/21302-url-reconstruction-with-php/#findComment-94792 Share on other sites More sharing options...
wildteen88 Posted September 19, 2006 Share Posted September 19, 2006 [quote author=businessman332211 link=topic=108662.msg437381#msg437381 date=1158687271]Whether I use that right now or not, I am not sure, but the advice you gave me may prove invaluable. So I always have a group of sessions for the user, so instead, I can create an array. like$_SESSION['userinfo'] = array(then create a inside the array for there username, email, ip address, last logged in date, and everything else. Then if I have admin later I could do$_SESSION['admin'] = arraythen have all that in therethen use temporary set's of session data for other things.So tehre would actually never be a need for get if this was true, so there has to be negatives to doing that, what negatives come with doing that, that you know of? if any.I like that idea[/quote]Nothing as far as I know of. Its still the same thing just that you are using an array. Quote Link to comment https://forums.phpfreaks.com/topic/21302-url-reconstruction-with-php/#findComment-94797 Share on other sites More sharing options...
Ninjakreborn Posted September 19, 2006 Author Share Posted September 19, 2006 I see what you mean, for now I used get, like wildteen said about cutting down the variable names. but now that I know this about sessions, I am going to start using little packets of information, as session arrays. I am goign to start passing information around that way, I am always afraid to use sessions, because I am afraid there might be something that won't work right, or something. So I am going to put some thought into it, and start using that in my future projects, and see how the outcomes turn out. Quote Link to comment https://forums.phpfreaks.com/topic/21302-url-reconstruction-with-php/#findComment-94799 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.