Gayner Posted September 1, 2009 Share Posted September 1, 2009 IS this possible if so can somone please lead me in the right direction? ok here.. If bla bla XX.... $show = "*NEW USERS"; then i echo $show.. then i wait like let's say 20minutes then $show doesn't work anymore Possible? Thanks i really need something like this!! Quote Link to comment https://forums.phpfreaks.com/topic/172680-php-variable-show-for-only-xx-amount-of-time-then-doesnt-show/ Share on other sites More sharing options...
dropfaith Posted September 1, 2009 Share Posted September 1, 2009 No idea how this would be done but its kinda worded wierd so i might be missing what you want. Im picturing a display that shows all new records that have been created in the last 20 mins and if the timestamp on the record is > then 20 mins it doesnt display? Quote Link to comment https://forums.phpfreaks.com/topic/172680-php-variable-show-for-only-xx-amount-of-time-then-doesnt-show/#findComment-910184 Share on other sites More sharing options...
Gayner Posted September 1, 2009 Author Share Posted September 1, 2009 No idea how this would be done but its kinda worded wierd so i might be missing what you want. Im picturing a display that shows all new records that have been created in the last 20 mins and if the timestamp on the record is > then 20 mins it doesnt display? No lol my bad my english not good im young.. I make a variable called $rofl and i want it to be echo'd only for 5minutes then after 5minutes is gone up don't show/echo $rofl u get? lo Quote Link to comment https://forums.phpfreaks.com/topic/172680-php-variable-show-for-only-xx-amount-of-time-then-doesnt-show/#findComment-910188 Share on other sites More sharing options...
trq Posted September 1, 2009 Share Posted September 1, 2009 Store a timestamp indicating when your users signed in, check this timestamp and if it was within the last 5 minutes display the data, else, don't. Quote Link to comment https://forums.phpfreaks.com/topic/172680-php-variable-show-for-only-xx-amount-of-time-then-doesnt-show/#findComment-910192 Share on other sites More sharing options...
JonnoTheDev Posted September 1, 2009 Share Posted September 1, 2009 HTTP is static. Once you have requested a url the output is sent to the browser. The output can only change once the page is requested again (i.e user clicks refresh). An option is to poll the server via an AJAX request however I fail to see why a user would stay on the same web page for a period of 5 minutes. Quote Link to comment https://forums.phpfreaks.com/topic/172680-php-variable-show-for-only-xx-amount-of-time-then-doesnt-show/#findComment-910193 Share on other sites More sharing options...
Gayner Posted September 1, 2009 Author Share Posted September 1, 2009 HTTP is static. Once you have requested a url the output is sent to the browser. The output can only change once the page is requested again (i.e user clicks refresh). An option is to poll the server via an AJAX request however I fail to see why a user would stay on the same web page for a period of 5 minutes. Well on my forums when i have 200 people online and I Create a Topic or something i would want it to say *NEW TOPIC or something to get there attention... and then i would want the echo'd $variable to go away after xx amount of seconds.. too abd I have no idea on how to do this, if some smart php person can write up a simple script for me i'd me then happy to say thank u.. Quote Link to comment https://forums.phpfreaks.com/topic/172680-php-variable-show-for-only-xx-amount-of-time-then-doesnt-show/#findComment-910198 Share on other sites More sharing options...
kickstart Posted September 1, 2009 Share Posted September 1, 2009 Hi If you have a page that is being output then while building that page you just pick up the date / time of the latest topic and display your message if it is within the last 5 minutes. All the best Keith Quote Link to comment https://forums.phpfreaks.com/topic/172680-php-variable-show-for-only-xx-amount-of-time-then-doesnt-show/#findComment-910199 Share on other sites More sharing options...
Gayner Posted September 1, 2009 Author Share Posted September 1, 2009 Hi If you have a page that is being output then while building that page you just pick up the date / time of the latest topic and display your message if it is within the last 5 minutes. All the best Keith Ok sweet, well im going to do this with you ok.. First, it will be if time (500) that's 6 minutes... else $variable =""; ? ? ? Please help me out Quote Link to comment https://forums.phpfreaks.com/topic/172680-php-variable-show-for-only-xx-amount-of-time-then-doesnt-show/#findComment-910206 Share on other sites More sharing options...
trq Posted September 1, 2009 Share Posted September 1, 2009 Were not here to write code for people. Think about your problem logically, break it into smaller pieces and code a solution. Quote Link to comment https://forums.phpfreaks.com/topic/172680-php-variable-show-for-only-xx-amount-of-time-then-doesnt-show/#findComment-910210 Share on other sites More sharing options...
Gayner Posted September 1, 2009 Author Share Posted September 1, 2009 Were not here to write code for people. Think about your problem logically, break it into smaller pieces and code a solution. Hey I already started and im trying my best.... I just need simple answers, you have the answer u want to giv me to me in your brain u just decided not to tell me and post that response? u think im that dumb? lol thx Quote Link to comment https://forums.phpfreaks.com/topic/172680-php-variable-show-for-only-xx-amount-of-time-then-doesnt-show/#findComment-910214 Share on other sites More sharing options...
trq Posted September 1, 2009 Share Posted September 1, 2009 u think im that dumb? No, just lazy and unwilling to think for yourself. Good luck. Quote Link to comment https://forums.phpfreaks.com/topic/172680-php-variable-show-for-only-xx-amount-of-time-then-doesnt-show/#findComment-910216 Share on other sites More sharing options...
Gayner Posted September 1, 2009 Author Share Posted September 1, 2009 u think im that dumb? No, just lazy and unwilling to think for yourself. Good luck. your right, lol sorry dood im just really excited that i get to learn php..i guess your 18k posts just doesn't fit u all, why not post that 1more thing that will help me? maybe u will have 19k faster then u think ~~ lolol Quote Link to comment https://forums.phpfreaks.com/topic/172680-php-variable-show-for-only-xx-amount-of-time-then-doesnt-show/#findComment-910217 Share on other sites More sharing options...
jamesxg1 Posted September 1, 2009 Share Posted September 1, 2009 Ok get a countdown and then maybe use unset() , Tutorial here, http://us.php.net/manual/en/function.unset.php James. Quote Link to comment https://forums.phpfreaks.com/topic/172680-php-variable-show-for-only-xx-amount-of-time-then-doesnt-show/#findComment-910218 Share on other sites More sharing options...
trq Posted September 1, 2009 Share Posted September 1, 2009 sorry dood im just really excited that i get to learn php Learning to program means learning to think logically. If you can't think a problem through yourself from point a - point b - point x, it doesn't matter how much syntax you know, you can't program. i guess your 18k posts just doesn't fit u all, why not post that 1more thing that will help me? Not really sure what your trying to get at there, but I didn't get 18,000+ posts asking questions. Ive helped quite a few people around here. Quote Link to comment https://forums.phpfreaks.com/topic/172680-php-variable-show-for-only-xx-amount-of-time-then-doesnt-show/#findComment-910220 Share on other sites More sharing options...
jamesxg1 Posted September 1, 2009 Share Posted September 1, 2009 @thorpe, I dont think i have actually ever seen you ask a question, Not saying you haven't but you are the THE MAN ! on here litrully lol , What this guy says you should really pay attention to he knows what hes doing, James. Quote Link to comment https://forums.phpfreaks.com/topic/172680-php-variable-show-for-only-xx-amount-of-time-then-doesnt-show/#findComment-910221 Share on other sites More sharing options...
Gayner Posted September 1, 2009 Author Share Posted September 1, 2009 @thorpe, I dont think i have actually ever seen you ask a question, Not saying you haven't but you are the THE MAN ! on here litrully lol , What this guy says you should really pay attention to he knows what hes doing, James. Doesn't matter how much you suck up to people too, you will never be as a good as them. Same logic as Thorne said? looks like im just as smart already! Quote Link to comment https://forums.phpfreaks.com/topic/172680-php-variable-show-for-only-xx-amount-of-time-then-doesnt-show/#findComment-910225 Share on other sites More sharing options...
jamesxg1 Posted September 1, 2009 Share Posted September 1, 2009 @thorpe, I dont think i have actually ever seen you ask a question, Not saying you haven't but you are the THE MAN ! on here litrully lol , What this guy says you should really pay attention to he knows what hes doing, James. Doesn't matter how much you suck up to people too, you will never be as a good as them. Same logic as Thorne said? looks like im just as smart already! Agreed, But i think you need to re-define your definition of 'Suck Up' as that was not a suck up it was a complement and a way of telling you that you ask for help so appreciate what people give you that dont have to waste there time on you. No one can question your intelligence as no one here knows you but i highly doubt that you are. James. Quote Link to comment https://forums.phpfreaks.com/topic/172680-php-variable-show-for-only-xx-amount-of-time-then-doesnt-show/#findComment-910273 Share on other sites More sharing options...
Gayner Posted September 1, 2009 Author Share Posted September 1, 2009 @thorpe, I dont think i have actually ever seen you ask a question, Not saying you haven't but you are the THE MAN ! on here litrully lol , What this guy says you should really pay attention to he knows what hes doing, James. Doesn't matter how much you suck up to people too, you will never be as a good as them. Same logic as Thorne said? looks like im just as smart already! Agreed, But i think you need to re-define your definition of 'Suck Up' as that was not a suck up it was a complement and a way of telling you that you ask for help so appreciate what people give you that dont have to waste there time on you. No one can question your intelligence as no one here knows you but i highly doubt that you are. James. I was being starcastic man.. I play baseball, i thro 90mph imm here for fun.. Anyway let's get back on subject.. could u please guys help me on this script? lol Thanks ~ Quote Link to comment https://forums.phpfreaks.com/topic/172680-php-variable-show-for-only-xx-amount-of-time-then-doesnt-show/#findComment-910279 Share on other sites More sharing options...
jamesxg1 Posted September 1, 2009 Share Posted September 1, 2009 Ok, and pretty inpressive dude , Ok about the subject lol, Maybe sessions would help you i wouldnt use it permantly but as a band aid as such eg. <?php session_start(); // this bit you will have to do but time() + 20(mins) == $time // $_SESSION['timelimit'] = $time; if($_SESSION['timelimit'] == time()) { } else { echo "HELLO NEW USER"; } James. Quote Link to comment https://forums.phpfreaks.com/topic/172680-php-variable-show-for-only-xx-amount-of-time-then-doesnt-show/#findComment-910296 Share on other sites More sharing options...
Gayner Posted September 1, 2009 Author Share Posted September 1, 2009 Ok, and pretty inpressive dude , Ok about the subject lol, Maybe sessions would help you i wouldnt use it permantly but as a band aid as such eg. <?php session_start(); // this bit you will have to do but time() + 20(mins) == $time // $_SESSION['timelimit'] = $time; if($_SESSION['timelimit'] == time()) { } else { echo "HELLO NEW USER"; } James. Ok sweet, i guess i'll hav to use that now.. see man that's all i wanted... thanks.. btw u2 rocks.. since i saw ur avatar time for me to watch some yt vid's of em.. lol Quote Link to comment https://forums.phpfreaks.com/topic/172680-php-variable-show-for-only-xx-amount-of-time-then-doesnt-show/#findComment-910299 Share on other sites More sharing options...
jamesxg1 Posted September 1, 2009 Share Posted September 1, 2009 Lmao glad to be of help , Haha agreed they are top notch , Haha same , James. Quote Link to comment https://forums.phpfreaks.com/topic/172680-php-variable-show-for-only-xx-amount-of-time-then-doesnt-show/#findComment-910303 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.