Jump to content

Strange but i need it.

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
4 replies to this topic

#1
mandriva

mandriva

    Newbie

  • Members
  • PipPip
  • 15 posts
Ok here goes although you may find this request a little odd.

What i would like is some code i can put on my index page that displays a box and a number of current people browsing my site, however i dont want it to be current users i would like it to be a made up number to look like there ara a lot of people browsing my site because at the moment ther isnt any.

I know this sounds odd but it would really help me out.

cheers

#2
v0id

v0id

    Retired

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,936 posts
You can easily do this in PHP. You just need to get a random number and output it. Then, when somebody refreshes your website they will see a new number indicating how many people you want to "simulate." IMO, I think it's a bad practice to do. I don't like sites that tries to cheat its users, with incorrect information.

echo "There's currently " . rand(1, 15) . " users online right now!";
// Another alternative is mt_rand. Simply add "mt_" and it will work.


#3
mandriva

mandriva

    Newbie

  • Members
  • PipPip
  • 15 posts
Many thanks for that. I hear what you are saying and its something i have really tried to avoid. I have a good website and need people to advertise on it to make money. Feedback from people who want to advertise are that there isnt enough advertisements on the site hence i need something to sway them and a faked number maybe the way to start my business off.

#4
Guest_Jordan_*

Guest_Jordan_*
  • Guests
If you don't like the idea of using PHP you can always use JavaScript although anyone smart enough will be able to see the code and recognize that you are not actually calculating current users. PHP would be your best bet.

[HIGHLIGHT="JavaScript"]There are currently <script type="text/javascript">document.write(Math.floor(Math.random()*200))</script> browsing this site.[/HIGHLIGHT]

#5
Guest_Kaabi_*

Guest_Kaabi_*
  • Guests
The random number you would generate would have to be a relatively short interval, as jumping from 5,000 to 12,000 in a page refresh would look "sketch".