Code:$host = "localhost";
$dbuser = "root";
$pass = "password";
$db_name = "service";
$progname = "SQLService 2";
$taxrate=1.06;
$default_sort_field = "svcdate";
//Don't touch anything below this line unless you KNOW what you are doing! These are
//Critical functions to the operation of SQLService!!! Don't blame me if you fsck something up!
//WARNING!! Adding to the status/priority entries below WILL confuse Service! New's will become
//In-Progress's, Closed's -> Response, etc.. Do NOT fiddle with these unless you KNOW
//what you are doing!!!!! (Although, it IS safe if there is no data in the DB, or none to import.)
//Really, just don't, OK?
$statstr=array("Closed","New","In Progress","Response","Responded","Wtg. Parts","RMA","Ready");
$priostr=array("Normal","Priority","Warranty","On-Site","RUSH","Emergency");
$link = mysql_connect($host, $dbuser, $pass);
if (!$link) {
die("Could not connect to MySQL Database: ".mysql_error());
}
//User Name & ID Lookup Table
$uidquery = mysql_query("SELECT name FROM nuke.nuke_users WHERE username LIKE \"$cookie[1]\"");
$fullname = mysql_result($uidquery,0,"name");
//End Lookup Table
$TITLE = "<h4><u>$progname</u></h4>Current User: $fullname <a href=\"account-logout.html\">[Logout]</a><br>";
function bround($dVal,$iDec) {
static $dFuzz=0.00001;
$iRoundup=0;
$iSign=($dVal!=0.0) ? intval($dVal/abs($dVal)) : 1;
$dVal=abs($dVal);
$dWorking=$dVal*pow(10.0,$iDec+1)-floor($dVal*pow(10.0,$iDec))*10.0;
$iEvenOddDigit=floor($dVal*pow(10.0,$iDec))-floor($dVal*pow(10.0,$iDec-1))*10.0;
if (abs($dWorking-5.0)<$dFuzz) $iRoundup=($iEvenOddDigit%2!=0) ? 1 : 0;
else $iRoundup=($dWorking>5.0) ? 1 : 0;
return $iSign*((floor($dVal*pow(10.0,$iDec))+$iRoundup)/pow(10.0,$iDec));
}
function mydate($format, $publictime) {
$publictime = ereg_replace('[^0-9]','',$publictime);
$sec = substr($publictime, 12, 2);
$min = substr($publictime, 10, 2);
$hour = substr($publictime, 8, 2);
$day = substr($publictime, 6, 2);
$month = substr($publictime, 4, 2);
$year = substr($publictime, 0, 4);
return date($format, mktime($hour,$min,$sec,$month,$day,$year));
}
|