index.php
Go to the documentation of this file.00001 <?php 00002 00005 00014 // Check if the SID (Server ID) file is existing. If it is not, we create it. 00015 00016 $hFile; 00017 00018 $sid = ""; 00019 00020 // The Web server has to have writing permissions on the SID directory 00021 // This variable as to be properly setuped in to have a properly working SID. 00022 $sidDirectory = ""; 00023 00024 if(($hFile = @fopen($sidDirectory."server.sid", "x+")) === FALSE) 00025 { 00026 // Read the SID 00027 $hFile = fopen($sidDirectory."server.sid", "r"); 00028 00029 if($hFile) 00030 { 00031 while (!feof($hFile)) 00032 { 00033 $sid = fgets($hFile, 4096); 00034 break; 00035 } 00036 00037 fclose($hFile); 00038 } 00039 } 00040 else 00041 { 00042 // Generate the SID 00043 $sid = md5(microtime()); 00044 00045 // Write the SID to the server.sid file 00046 if(fwrite($hFile, $sid) === FALSE) 00047 { 00048 die; 00049 } 00050 } 00051 00052 echo $sid; 00053 00055 ?>
