EOT; } function endDidIt() { echo << EOT; } function spacesToHyphens($event) { $strleng = strlen($event); for ($i=0; $i < $strleng; $i++) { if ($event[$i] == " ") { $event[$i]='-'; } } return $event; } function displayTcol($url,$span,$width,$caption) { echo << $caption tickets EOT; } function connectDb($dbName) { $link = mysql_connect("mysql.serve.com", "goodtime", "kaplan77") or mysql_connect("mysql.serve.com", "goodtime", "sting77"); mysql_select_db("$dbName") or die("Could not select database"); return $link; } function EmailCheck($Email) { $Result = ereg ("^[^@ ]+@[^@ ]+\.[^@ \.]+$", $Email ); if ($Result) return TRUE; else return FALSE; } //do an insert or update query function putQuery($query) { mysql_query($query) or die("Query failed, Please call us at 800-774-8499 or email goodtime@voicenet.com"); } //do a single result query function doSingleResult($query) { $result = mysql_query($query) or die("Query failed, Please call us at 800-774-8499 or email goodtime@voicenet.com"); $row = mysql_fetch_row($result); return $row[0]; } function displayCatLinks($type) { $combo="combo".$type; echo "
"; } //get the ip even if it's forwarded from the cache server or some other way function getIp() { global $HTTP_POST_VARS; global $HTTP_CLIENT_IP; global $REMOTE_ADDR; if (getenv(HTTP_CLIENT_IP)){ $ip=getenv(HTTP_CLIENT_IP); } else { $ip=getenv(REMOTE_ADDR); } return $ip; } //set the user cookie and session cookie if a first time visitor //second time visitor, add a new session, or keep the same if it's under one day //if we keep the same day under one session it's no big deal //if we keep the same day under one session it's no big deal function setUser($ad) { global $HTTP_REFERER; global $userCookie; global $sessionCookie; global $REMOTE_ADDR; global $id; global $t; global $mysession; //check to see if there is a cookie, //if there is then check the ip, if a different ip, then add them with that ip //and increment the session variable to $session+1 also add a new HTTP_REFERER $ip = getIp(); $link=connectDb("Events"); $userCookie = $mysession["userCookie"]; $sessionCookie = $mysession["sessionCookie"]; if ($userCookie != "") { //if user cookie is set, then check if the session cookie is, //if it is then we just leave and don't do anything //if it isn't then we add a session cookie(session cookies) //expire after one day $len=0; $len=strlen($ad); if ($len < 2) { $ad="NOAD"; $id=0; $t=0; } if (isset($HTTP_REFERER)) { $query = "INSERT INTO SESSION (USER_ID,REFERRER_URL,IP_ADDRESS,AD_ID,ARTIST_ID,TRACK_ID,CREATED_DATE) VALUES ('$userCookie','$HTTP_REFERER','$ip','$ad','$id','$t',NOW())"; } else { $query = "INSERT INTO SESSION (USER_ID,IP_ADDRESS,AD_ID,CREATED_DATE) VALUES ('$userCookie','$ip','$ad',NOW())"; } //do a insert or update query putQuery($query); $query="SELECT LAST_INSERT_ID()"; $value=doSingleResult($query); //now get tomorrow's date and time and throw a cookie on there that //expires tomorrow //setcookie("sessionCookie",$value,time()+3600,"/", ".goodtimetickets.com",1); $mysession = array ("userCookie" => $userCookie, "sessionCookie" => $value, "ID" => session_id()); session_register("mysession"); // commented $exp = mktime (0,0,0,date("m") ,date("d")+1,date("Y")); //$exp = strftime("%A, %d-%b-%Y %H:%M:%S", $exp); //Header("Set-Cookie:sessionCookie=$value;expires=$exp GMT;\n\n"); } else if ($sessionCookie == "") { $query = "INSERT INTO USER (ORDERS) VALUES ('0')"; putQuery($query); //get the user_id, it's tnhe last inserted id $query="SELECT LAST_INSERT_ID()"; $value=doSingleResult($query); //set the cookie commented //setcookie("userCookie",$value,time()+5184000,"/", ".goodtimetickets.com",1); //Header("Set-Cookie:userCookie=$value;expires=Friday,16-Jan-2037 00:00:00 GMT;\n\n"); //if there is an http_referrer throw it on, if not just do a null value //Use $PHP_SELF (for the name of the current page: "myscripT.php"), and $QUERY_STRING (for the query string: "first=john&last=Doe". $len=0; $len=strlen($ad); if ($len < 2) { $ad="NOAD"; $id=0; $t=0; } if (isset($HTTP_REFERER)) { $query = "INSERT INTO SESSION (USER_ID,REFERRER_URL,IP_ADDRESS,AD_ID,ARTIST_ID,TRACK_ID,CREATED_DATE) VALUES ('$value','$HTTP_REFERER','$ip','$ad','$id','$t',NOW())"; } else { $query = "INSERT INTO SESSION (USER_ID,IP_ADDRESS,CREATED_DATE,AD_ID) VALUES ('$value','$ip',NOW(),'$ad')"; } //put the query putQuery($query); //get the last session id inserted $query="SELECT LAST_INSERT_ID()"; $value2=doSingleResult($query); //now get tomorrow's date and time and throw a cookie on there that //expires tomorrow //setcookie("sessionCookie",$value2,time()+3600,"/", ".goodtimetickets.com",1); $mysession = array ("userCookie" => $value, "sessionCookie" => $value2, "ID" => session_id()); session_register("mysession"); //$exp = mktime (0,0,0,date("m") ,date("d")+1,date("Y")); //$exp = strftime("%A, %d-%b-%Y %H:%M:%S", $exp); //Header("Set-Cookie:sessionCookie=$value2;expires=$exp GMT;\n\n"); } mysql_close($link); } ?>