my script runs a multi page quiz system... every new page reperforms all the variable functions which slows the script down ($ip2 is probably the main culprit - that searches for host name) how do i set up the code so that it only goes through those functions one time only?
<?php
global $options,$options1,$cats,$sum,$sum1;
$write_to_db=1;
$ip = $SERVER['REMOTE_ADDR'];
$ip2 = gethostbyaddr($ip);
$id=rand(100,1000000000000);
session_start();
$oraclecookie = $COOKIE['oraclecookie'];
if($_COOKIE['oraclecookie']==null){
setcookie("oraclecookie", "$id", mktime(0, 0, 0, 5, 14, 2005));}