Jump to content

PHP Variable show for only XX amount of time then doesnt show?


Gayner

Recommended Posts

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!!

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.. :)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

@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!  :wtf:

Link to comment
Share on other sites

@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!  :wtf:

 

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.

Link to comment
Share on other sites

@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!  :wtf:

 

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 ~

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.