Jump to content

Recommended Posts

Hello,

 

i am try'ing to create a simple php file editing and dont know how to solve one thing...

 

What i need, is to stop not show some html content to user and then continue showing

 

Example:

<?
$stop=stop();
$continue=continue();
echo "Here is my content
$stop
// this content is not shown!
$continue
continuing to show my content";
?>

 

Output would look like:

Here is my content
continuing to show my content

 

the function should be used with a variable, otherwise everyone knows how to do it :)

 

 

this is the last peace of the puzzle im solving  ::)

Link to comment
https://forums.phpfreaks.com/topic/175005-solved-php-stop-and-continue/
Share on other sites

Hi mysterbx,

 

sleep() should do what you need, have a look at the manual for further info at http://www.php.net/manual/en/function.sleep.php.

 

However, it isn't an ideal solution - and you may run into problems as the web server may buffer the script and output it all at once, you could try using;

 

echo 'something';
ob_flush();
flush();
sleep(10);
echo 'something else';

 

It might be worth looking at setTimeout() with Javascript (http://www.w3schools.com/JS/js_timing.asp).

 

Hope this helps.

sleep() may, was vague on what "not show some html content to user" actually means

 

If he still wants to display content, but only to selected users, then some form of authentication is required, if he wants to simply

<?php
echo '<div>here is some html to output</div>';

function here_is_some_code_to_run($aussie_chicks){
      if($aussie_chicks != 'Hot'){
            return false;
      }else{
            return true;
      }
}
$blonde6footandbusty = here_is_some_code_to_run('Over Wieght Midget Monkey');
if(!$blonde6footandbusty){
    require_once('a_bullet_to_the_head.php');
}

echo '<div>here is some continued html to out put</div>';
?>

 

Then he has the right idea 8)

i meant to say, that i dont want to use any "IF's" or anything that is not a variable, im making a simple script, for users who only know html or js, so i want to make it as simple as it can be..

 

I will try the flush(); thing though  ;)

 

will post something after i do :D

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.