Connect("mysql.s223.sureserver.com", "conquerstars", "33896778", "conquerstars_association"); $linkptr->SetFetchMode(ADODB_FETCH_ASSOC); if (!$linkptr) { echo "Fail to connect to the database"; exit(); } } function checkLogin($status){ if (!isset($_SESSION['cmsusername'])){ //header("Location: index.php?reason=loginfirst"); if ($status != "menu") { header("Location: ../index.php?reason=loginfirst"); } else { header("Location: index.php?reason=loginfirst"); } //header("Location: index.php?reason=loginfirst"); } } function GetUpdate() { global $linkptr; connect(); $updatetime = "Last Update:"; $sql = "select * from system;"; $rs = $linkptr->Execute($sql); if (!Empty($rs)) { if ($rs->RecordCount()>0) { while (!$rs->EOF) { $updatetime .= " ".$rs->fields["update_date"]; $updatetime .= " by ".$rs->fields["update_by"]; $rs->MoveNext(); } } } return $updatetime; } function _login($username, $password) { global $linkptr; $query="SELECT * FROM login where username = '$username' and password = '".md5($password)."' "; //echo $query; $rs=$linkptr->Execute($query); //$num=mysql_numrows($result); if (!Empty($rs)) { if ($rs->RecordCount()>0) { $isValid = true; $_SESSION['cmsusername'] = $username; $_SESSION['controllevel'] = $rs->fields["controllevel"]; } else { $isValid = false; } } else { $isValid = false; } return $isValid; } function _insertItem() { connect(); } function _updateItem() { } function _deleteItem() { } function _insertGalleryItem() { } function _updateGalleryItem() { } function _deleteGalleryItem() { } function _formGalleryPart() { global $linkptr; $galleryContent = ""; $sql = "select * from bookflip_gallery order by item_seq"; //echo $sql; $rs = $linkptr->Execute($sql); if (!Empty($rs)) { if ($rs->RecordCount()>0) { while (!$rs->EOF) { // $galleryContent .= "\t\tfields["gallery_icon"] . "\" content=\"pics/" . $rs->fields["gallery_path"] . "\" />\r\n"; $rs->MoveNext(); } } } return $galleryContent; } function _formPagesPart() { global $linkptr; $pageContent = ""; $sql = "select * from bookflip_item order by item_seq"; //echo $sql; $rs = $linkptr->Execute($sql); if (!Empty($rs)) { if ($rs->RecordCount()>0) { while (!$rs->EOF) { $pageContent .= "\t\tfields["item_time"] . "\" Period=\"ODD\" Loop=\"YES\" Mode=\"RANDOM\" id=\"" . $rs->fields["item_id"] . "\" >.\\pics\\" . $rs->fields["item_path"] . "\r\n"; $rs->MoveNext(); } } } return $pageContent; } function _formRandomPagesPart() { global $linkptr; $pageContent = ""; $sql = "select * from bookflip_random_item order by item_seq"; //echo $sql; $rs = $linkptr->Execute($sql); if (!Empty($rs)) { if ($rs->RecordCount()>0) { while (!$rs->EOF) { $pageContent .= "\t\tfields["item_time"] . "\" Period=\"ODD\" Loop=\"YES\" Mode=\"RANDOM\" id=\"" . $rs->fields["item_id"] . "\" >.\\pics\\" . $rs->fields["item_path"] . "\r\n"; $rs->MoveNext(); } } } return $pageContent; } function _formSystemPart() { global $linkptr; $pageContent = ""; $sql = "select * from bookflip_system where sys_name = 'Pending Time' "; $rsPend = $linkptr->Execute($sql); $pendtime = "60000"; if (!Empty($rsPend)) { if ($rsPend->RecordCount()>0) { $pendtime = $rsPend->fields["sys_value"]; } } $sql = "select DATE_FORMAT(start_date, '%Y-%m-%d') as startdate, DATE_FORMAT(end_date, '%Y-%m-%d') as enddate,DATE_FORMAT(start_date, '%T') as starttime,DATE_FORMAT(end_date, '%T') as endtime from bookflip_period where enabled = 'Y' order by start_date"; //echo $sql; $rs = $linkptr->Execute($sql); if (!Empty($rs)) { if ($rs->RecordCount()>0) { while (!$rs->EOF) { // // $pageContent .= "\t\tfields["startdate"] . "\" toDate=\"" . $rs->fields["enddate"] . "\" fromTime=\"" . $rs->fields["starttime"] . "\" toTime=\"" . $rs->fields["endtime"] . "\" pendPeriod=\"" . $pendtime . "\" />\r\n"; $rs->MoveNext(); } } } return $pageContent; } function _formXML() { connect(); $xmlContent = ""; $xmlContent .= "\r\n" . "\t\r\n"; // Pages Item $xmlContent .= _formPagesPart(); $xmlContent .= "\t\r\n"; $xmlContent .= "\t\r\n"; // Random Item $xmlContent .= _formRandomPagesPart(); $xmlContent .= "\t\r\n" . "\t\r\n"; // Gallery Item $xmlContent .= _formGalleryPart(); $xmlContent .= "\t\r\n" . "\t\r\n"; // System Part $xmlContent .= _formSystemPart(); $xmlContent .= "\t\r\n" . ""; //echo $xmlContent; $myFile = "config.xml"; $fh = fopen($myFile, 'w') or die("can't open file"); fwrite($fh, $xmlContent); //$stringData = "Pointy Pinto\n"; //fwrite($fh, $stringData); fclose($fh); } function _searchHistory() { } function _insertHistory($itemName, $period, $path) { global $previewprefix; $tablename = "bookflip_history"; $arr1 = array(); $arr1["name"] = "item_name"; $arr1["previewname"] = ""; $arr1["formname"] = ""; $arr1["value"] = $itemName; $arr1["type"] = "v"; $arr1["prefix"] = ""; $arr1["destination"] = ""; $arr1["uselang"] = true; $arr4 = array(); $arr4["name"] = "period"; $arr4["previewname"] = ""; $arr4["formname"] = ""; $arr4["value"] = $period; $arr4["type"] = "v"; $arr4["prefix"] = ""; $arr4["destination"] = ""; $arr4["uselang"] = true; $arr5 = array(); $arr5["name"] = "item_path"; $arr5["previewname"] = ""; $arr5["formname"] = ""; $arr5["value"] = $path; $arr5["type"] = "v"; $arr5["prefix"] = ""; $arr5["destination"] = ""; $arr5["uselang"] = true; $arr = array(); array_push($arr, $arr1); array_push($arr, $arr2); array_push($arr, $arr3); array_push($arr, $arr4); array_push($arr, $arr5); $ret = GlobalAdd($arr, $tablename); if ($ret == "") header("Location: finish.php?op=addstep1"); else { echo $ret; return $ret; } } ?>