0

I need to attach a random number to a query string in an SHTML page. It's straightforward to generate the value in PHP:

function get_random_id(){
  srand ((double) microtime( )*1000000);
  return rand(0,1844);
}

But how do you use this when the SHTML page uses syntax like this?

<img src="<!--#echo var="imagemapgif" -->" name="Image1" width="169" height="41" usemap="#Map" id="Image1">

Anyone know of a syntax manual for SHTML pages? Thanks.

Alex
  • 34,699
  • 13
  • 75
  • 158
  • I think I found the answer: Those weird included code are Apache SSI. So concatenating the full time (year, day, hour, minute, second) should create a random value for my purposes. – Alex Apr 14 '11 at 21:42

1 Answers1

2

You need to run an external program to get a random number using a server side include.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
  • I've got a solution documented here: http://devharbor.blogspot.com/2011/04/create-quasi-random-number-with-apache.html It's not a true random number, but it works for what I need. – Alex Apr 15 '11 at 15:38