Example #1
0
function insertComment($username, $text) {
   //  if were not connected, connect.
    global $isConnected;
    if (isset($isConnected) == false)
    connectDb ();

//Escape all strings and use the strip_tags() to be more safe
    
   $safe_strings = TRUE;

   function safeString($string){
    $string = mysql_real_escape_string(strip_tags($string));
    return $string;
   }
   
   $username = safeString($username);
   $text = safeString($text);
  
//$username = mysql_real_escape_string($username);
  //$ $text = mysql_real_escape_string($text);
    
// date and time
    $date = getCurrentDate();
    
//Inserts a comment dB. 
    mysql_query("INSERT INTO comment (`username`, `text`, `date`) VALUES ('$username' , '$text', '$date')")
    or die("Something went wrong with the insert query" . mysql_error());
}
Example #2
0
 function __construct()
 {
     $this->AccountId = 0;
     $this->BatchId = 0;
     $this->CreatedUserId = 0;
     $this->ModifiedUserId = 0;
     $this->RecordCount = 0;
     $this->CurrentRecord = 0;
     $this->CreatedDate = getCurrentDate();
     $this->CompletedDate = getCurrentDate();
     $this->ModifiedDate = getCurrentDate();
 }
	function addNewView() {
	    $reviewId = $_GET['review_id'];
		if (isset($_SESSION['uname'])) {
		    $viewedBy = $_SESSION['uname'];
		} else {
		    $viewedBy = "Anonymous";
		}
		$viewedDate = getCurrentDate();
		$ipAddress = getUserIpAddress();
		$tableName = "review_hits";
		$id = generateUniqueId($tableName);
		$query = "INSERT INTO " . $tableName . " (id, review_id, viewed_by, view_date, ip_viewed_from) VALUES ($id, $reviewId, '$viewedBy', '$viewedDate', '$ipAddress')";
		echo $query;
		mysql_query($query) or die(mysql_error());
	}
	function insertReviewPiks($reviewId, $fileNames) {
	    $query = "INSERT INTO review_pic (review_id, pic_url, uploaded_date, is_deleted) VALUES ";
		$dated=getCurrentDate();
		for ($i=0;$i<sizeof($fileNames);$i++) {
		    $fileName = $fileNames[$i];
			$query .= "($reviewId, '$fileName', '$dated', 0)";
			if (($i+1) != sizeof($fileNames)) {
			    $query .= ", ";
			}
			
		}
		if (sizeof($fileNames) > 0) {
		    mysql_query($query) or die(mysql_error());
	    }
	}
Example #5
0
 function _setLinksToTimeLabels()
 {
     $portal_item = $this->getContextItem();
     $start_date = $this->_getDateFromDateTime($this->getCreationDate());
     if ($this->isClosed()) {
         $end_date = $this->_getDateFromDateTime($this->getClosureDate());
     }
     $current_date = getCurrentDate();
     $get_time_item_ids = false;
     $first = true;
     if ($portal_item->showTime()) {
         $time_item_id_array = array();
         $time_list = $portal_item->getTimeList();
         if ($time_list) {
             $time_item = $time_list->getFirst();
             while ($time_item) {
                 if (!$time_item->isDeleted()) {
                     $date_label_start = $this->_getBeginDateFromTimeLabel($time_item->getTitle());
                     $date_label_end = $this->_getEndDateFromTimeLabel($time_item->getTitle());
                     if ($date_label_end < $date_label_start) {
                         $date_label_end = $date_label_end + 10000;
                     }
                     if ($date_label_start <= $start_date and $start_date <= $date_label_end) {
                         $get_time_item_ids = true;
                     }
                     if ($first) {
                         if ($date_label_start > $start_date) {
                             $get_time_item_ids = true;
                         }
                         $first = false;
                     }
                     if ($current_date < $date_label_start) {
                         $get_time_item_ids = false;
                     }
                     if (isset($end_date) and $date_label_start <= $end_date and $end_date <= $date_label_end) {
                         $get_time_item_ids = false;
                     }
                     if ($get_time_item_ids) {
                         $time_item_id_array[] = $time_item->getItemID();
                     }
                 }
                 $time_item = $time_list->getNext();
             }
         }
         $this->setTimeListByID($time_item_id_array);
     }
 }
Example #6
0
 /**
  *  override the base class method getSmarty
  *  @param:  NULL
  *  @return: object $smarty
  *  @access: public
  */
 public function &getSmarty()
 {
     global $use_db_debug;
     //输出头
     header("Content-Type:text/html;charset=UTF-8");
     if (file_exists(LIB_PATH . 'smarty/Smarty.class.php')) {
         include_once LIB_PATH . 'smarty/Smarty.class.php';
     } else {
         die("you have not install SMARTY or it is not the corrent location");
     }
     include_once FUNCTION_PATH . 'getCurrentDate.fun.php';
     $smarty = new Smarty();
     $smarty->template_dir = ROOT_PATH . 'theme/admin/';
     //增加根据用户theme的数据
     //进行设置Smarty的编译目录
     if (!file_exists(DATA_CACHE_PATH . 'smarty/admin/')) {
         mkdir(DATA_CACHE_PATH . 'smarty/admin/') or die("Can't create the Smarty compile directly, please check the privilege is 777");
     }
     $smarty->compile_dir = DATA_CACHE_PATH . 'smarty/admin/';
     $smarty->config_dir = THEME_CONFIG_PATH . SYSTEM_LANG . '/';
     $smarty->left_delimiter = THEME_LEFT_DELIMITER;
     $smarty->right_delimiter = THEME_RIGHT_DELIMITER;
     if ($use_db_debug) {
         $smarty->compile_check = false;
     }
     // assign the images and css file path
     $smarty->assign('image_url', IMAGE_URL);
     $smarty->assign('root_url', ROOT_URL);
     $smarty->assign('css_url', ROOT_URL . 'theme/admin/');
     $smarty->assign('now_date', getCurrentDate());
     $smarty->assign('user_name', $_SESSION['user']['name']);
     $smarty->assign('module', $_SESSION['module']);
     $smarty->assign('action', $_SESSION['action']);
     $smarty->assign('showbest', $_GET['showbest']);
     return $smarty;
 }
Example #7
0
/**
 * Updates a post.
 *
 * @param string $uid
 * @param string $postid
 * @param string $title
 * @param string $content
 * @param array $categories
 * @return void
 */
function pivotx_update_post($uid, $postid, $title, $content, $categories = '')
{
    global $PIVOTX, $conversion_method, $body_separator;
    $oldentry = $PIVOTX['db']->read_entry($postid);
    $entry['code'] = $postid;
    $entry['date'] = $oldentry['date'];
    list($pivotintro, $pivotbody) = explode($body_separator, stripTrailingSpace(stripslashes($content)));
    $entry['introduction'] = $pivotintro;
    $entry['body'] = $pivotbody;
    $entry['introduction'] = tidyHtml($entry['introduction'], TRUE);
    $entry['body'] = tidyHtml($entry['body'], TRUE);
    if (empty($categories)) {
        $entry['category'] = $oldentry['category'];
    } else {
        $entry['category'] = $categories;
    }
    $entry['publish_date'] = $oldentry['publish_date'];
    $entry['edit_date'] = date("Y-m-d-H-i", getCurrentDate());
    $entry['title'] = stripTrailingSpace(stripslashes($title));
    $entry['subtitle'] = $oldentry['subtitle'];
    $entry['user'] = $uid;
    $entry['convert_lb'] = $conversion_method;
    $entry['status'] = "publish";
    $entry['allow_comments'] = 1;
    $entry['keywords'] = $oldentry['keywords'];
    $entry['vialink'] = $oldentry['vialink'];
    $entry['viatitle'] = $oldentry['viatitle'];
    $PIVOTX['db']->set_entry($entry);
    $PIVOTX['db']->save_entry(TRUE);
}
Example #8
0
?>
</div>
<?php 
include '../CommonPage/addDetails.php';
include '_selectDueDate.php';
?>
<div class="ui segment">
<div id="dueDorm">
    <form action="" method="post">
        <select class="ui search dropdown" id="selectDueDate" name="DueDateSelector">
            <?php 
$DateList = array();
$DateList = array_unique($array);
echo "<option value='start'>Due Date</option>";
foreach ($DateList as $value) {
    if ($value < getCurrentDate()) {
        echo '<option>' . $value . '</option> <br>';
    }
}
?>
        </select>
    </form>
</div>

<div id="firstResult">
    <div class="tableTop"><h1 style="text-align: center">Student List</h1></div>
    <div class="container" style="border:1px solid #000000">
        <table id="student-grid"  class="display ui celled table" cellspacing="0";width="100%"style="border:"1px solid black"">
        <thead style="background-color: rgb(240, 240, 240)">
        <tr>
            <td>Student RollNo</td>
Example #9
0
?>
</div>
<?php 
include '../CommonPage/addDetails.php';
include '_selectDueDate.php';
?>
<div class="ui segment">
    <div id="dueDorm">
        <form action="" method="post">
            <select class="ui search dropdown" id="selectDueDate" name="DueDateSelector">
                <?php 
$DateList = array();
$DateList = array_unique($array);
echo "<option value='start'>Due Date</option>";
foreach ($DateList as $value) {
    if ($value >= getCurrentDate()) {
        echo '<option>' . $value . '</option> <br>';
    }
}
?>
            </select>
        </form>
    </div>

    <div id="firstResult">
        <div class="tableTop"><h1 style="text-align: center">Student List</h1></div>
        <div class="container" style="border:1px solid #000000">
            <table id="student-grid"  class="display ui celled table" cellspacing="0";width="100%"style="border:"1px solid black"">
            <thead style="background-color: rgb(240, 240, 240)">
            <tr>
                <td>Student RollNo</td>
Example #10
0
 /**
  * Saves the current entry - sql implementation.
  *
  * Returns true if successfully saved. Current implementation
  * seems to return true no matter what...
  *
  * @param boolean $update_index Whether to update the date index.
  * @return boolean
  */
 function save_entry($update_index = TRUE)
 {
     // Set the 'commcount', 'commnames'..
     unset($commnames);
     if (isset($this->entry['comments'])) {
         // Initialise the IP blocklist.
         $blocklist = new IPBlock();
         foreach ($this->entry['comments'] as $comment) {
             if (!$blocklist->isBlocked($comment['ip'])) {
                 if ($comment[moderate] != 1) {
                     $commnames[] = stripslashes($comment['name']);
                 } else {
                     // if moderation is on, we add the name as '-'..
                     $commnames[] = '-';
                 }
             }
         }
         if (isset($commnames) && count($commnames) > 0) {
             $this->entry['comment_names'] = implode(", ", array_unique($commnames));
             $this->entry['comment_count'] = count($commnames);
         } else {
             $this->entry['comment_names'] = "";
             $this->entry['comment_count'] = 0;
         }
     } else {
         unset($this->entry['comments']);
         $this->entry['comment_names'] = "";
         $this->entry['comment_count'] = 0;
     }
     // Set the 'trackcount', 'tracknames'..
     unset($tracknames);
     if (isset($this->entry['trackbacks'])) {
         foreach ($this->entry['trackbacks'] as $trackback) {
             $tracknames[] = stripslashes($trackback['name']);
         }
         if (isset($tracknames) && count($tracknames) > 0) {
             $this->entry['trackback_names'] = implode(", ", array_unique($tracknames));
             $this->entry['trackback_count'] = count($tracknames);
         } else {
             $this->entry['trackback_names'] = "";
             $this->entry['trackback_count'] = 0;
         }
     } else {
         unset($this->entry['trackbacks']);
         $this->entry['trackback_names'] = "";
         $this->entry['trackback_count'] = 0;
     }
     // Make sure we have an URI
     if (empty($this->entry['uri'])) {
         $this->entry['uri'] = makeURI($this->entry['title']);
     }
     $values = array('title' => $this->entry['title'], 'uri' => $this->entry['uri'], 'subtitle' => $this->entry['subtitle'], 'introduction' => $this->entry['introduction'], 'body' => $this->entry['body'], 'convert_lb' => intval($this->entry['convert_lb']), 'status' => $this->entry['status'], 'date' => $this->entry['date'], 'publish_date' => $this->entry['publish_date'], 'edit_date' => date("Y-m-d H:i:s", getCurrentDate()), 'user' => $this->entry['user'], 'allow_comments' => $this->entry['allow_comments'], 'keywords' => $this->entry['keywords'], 'via_link' => $this->entry['vialink'], 'via_title' => $this->entry['viatitle'], 'comment_count' => $this->entry['comment_count'], 'comment_names' => $this->entry['comment_names'], 'trackback_count' => $this->entry['trackback_count'], 'trackback_names' => $this->entry['trackback_names'], 'extrafields' => $this->entry['extrafields']);
     // Check if the entry exists
     $this->sql->query("SELECT uid FROM " . $this->entriestable . " WHERE uid=" . intval($this->entry['uid']));
     if (is_array($this->sql->fetch_row())) {
         // It exists, we do an update..
         $qry = array();
         $qry['update'] = $this->entriestable;
         $qry['value'] = $values;
         $qry['where'] = "uid=" . intval($this->entry['uid']);
         $this->sql->build_update($qry);
         $this->sql->query();
     } else {
         // New entry.
         // Add the UID to the values array if it is already set (for
         // example when importing entries).
         if ($this->entry['uid'] != '') {
             $values['uid'] = $this->entry['uid'];
         }
         $qry = array();
         $qry['into'] = $this->entriestable;
         $qry['value'] = $values;
         $this->sql->build_insert($qry);
         $this->sql->query();
         // Set the UID to the last inserted ID if it isn't already set
         // (which is normally the case for new entries).
         if ($this->entry['uid'] == '') {
             $this->entry['uid'] = $this->sql->get_last_id();
         }
         // A bit of a nasty hack, but needed when we have to insert tags for a new entry,
         // and $db is not yet aware of the new $uid.
         $GLOBALS['db']->entry['uid'] = $this->entry['uid'];
     }
     // We will also need to save the comments and trackbacks.. We should
     // try to prevent doing unneeded queries, so we only insert comments
     // and trackbacks which have no ['uid'] yet. (because these are either
     // new, or are being converted from flat files)
     if (!empty($this->entry['comments'])) {
         foreach ($this->entry['comments'] as $comment) {
             if ($comment['uid'] == "") {
                 // Ah, let's insert it.
                 $comment['entry_uid'] = $this->entry['uid'];
                 $comment['contenttype'] = 'entry';
                 // make sure we don't try to add the 'remember info' or 'allowedit' fields..
                 if (isset($comment['rememberinfo'])) {
                     unset($comment['rememberinfo']);
                 }
                 if (isset($comment['allowedit'])) {
                     unset($comment['allowedit']);
                 }
                 // Registered, Notify, etc. have to be integer values.
                 $comment['registered'] = intval($comment['registered']);
                 $comment['notify'] = intval($comment['notify']);
                 $comment['discreet'] = intval($comment['discreet']);
                 $comment['moderate'] = intval($comment['moderate']);
                 $comment['entry_uid'] = intval($comment['entry_uid']);
                 $qry = array();
                 $qry['into'] = $this->commentstable;
                 $qry['value'] = $comment;
                 $this->sql->build_insert($qry);
                 $this->sql->query();
             }
         }
     }
     if (!empty($this->entry['comments'])) {
         foreach ($this->entry['trackbacks'] as $trackback) {
             if ($trackback['uid'] == "") {
                 // Ah, let's insert it.
                 $trackback['entry_uid'] = $this->entry['uid'];
                 $qry = array();
                 $qry['into'] = $this->trackbackstable;
                 $qry['value'] = $trackback;
                 $this->sql->build_insert($qry);
                 $this->sql->query();
             }
         }
     }
     // Delete the keywords / tags..
     $qry = array();
     $qry['delete'] = $this->tagstable;
     $qry['where'] = "contenttype='entry' AND target_uid=" . intval($this->entry['uid']);
     $this->sql->build_delete($qry);
     $this->sql->query();
     $tags = getTags(false, $this->entry['introduction'] . $this->entry['body'], $this->entry['keywords']);
     // Add the keywords / tags..
     foreach ($tags as $tag) {
         $qry = array();
         $qry['into'] = $this->tagstable;
         $qry['value'] = array('tag' => $tag, 'contenttype' => 'entry', 'target_uid' => $this->entry['uid']);
         $this->sql->build_insert($qry);
         $this->sql->query();
     }
     // Delete the categories..
     $qry = array();
     $qry['delete'] = $this->categoriestable;
     $qry['where'][] = "contenttype='entry'";
     $qry['where'][] = "target_uid=" . intval($this->entry['uid']);
     $this->sql->build_delete($qry);
     $this->sql->query();
     // Add the Categories..
     foreach ($this->entry['category'] as $cat) {
         $qry = array();
         $qry['into'] = $this->categoriestable;
         $qry['value'] = array('category' => safeString($cat, true), 'contenttype' => 'entry', 'target_uid' => $this->entry['uid']);
         $this->sql->build_insert($qry);
         $this->sql->query();
     }
     // Store the 'extra fields'
     if (!is_array($this->entry['extrafields'])) {
         $this->entry['extrafields'] = array();
     }
     $extrakeys = array();
     foreach ($this->entry['extrafields'] as $key => $value) {
         $extrakeys[] = $this->sql->quote($key);
         // No need to store empty values
         if (empty($value)) {
             unset($this->entry['extrafields'][$key]);
         }
         // Serialize any arrays..
         if (is_array($value)) {
             $this->entry['extrafields'][$key] = serialize($value);
         }
     }
     if (count($extrakeys) > 0) {
         $qry = array();
         $qry['delete'] = $this->extrafieldstable;
         $qry['where'][] = "target_uid=" . intval($this->entry['uid']);
         $qry['where'][] = "contenttype='entry'";
         $qry['where'][] = "fieldkey IN (" . implode(", ", $extrakeys) . ")";
         $this->sql->build_delete($qry);
         $this->sql->query();
     }
     foreach ($this->entry['extrafields'] as $key => $value) {
         $qry = array();
         $qry['into'] = $this->extrafieldstable;
         $qry['value'] = array('fieldkey' => safeString($key, true), 'value' => $value, 'contenttype' => 'entry', 'target_uid' => $this->entry['uid']);
         $this->sql->build_insert($qry);
         $this->sql->query();
     }
     //echo "<pre>\n"; print_r($extrakeys); echo "</pre>\n";
     //echo "<pre>\n"; print_r($this->entry['extrafields']); echo "</pre>\n";
     return TRUE;
 }
Example #11
0
 /**
  * Checks if any pages set to 'timed publish' should be published.
  *
  * This code might have to be optimized to only check the latest pages for 
  * a very big site.
  */
 function checkTimedPublish()
 {
     $date = date("Y-m-d-H-i", getCurrentDate());
     $pageindex = $this->getIndex();
     foreach ($pageindex as $chapter) {
         // Skip chapters with no pages
         if (!isset($chapter['pages'])) {
             continue;
         }
         foreach ($chapter['pages'] as $page) {
             if ($page['status'] == 'timed' && $page['publish_date'] <= $date) {
                 $page = $this->getPage($page['uid']);
                 $page['date'] = $page['publish_date'];
                 $page['status'] = "publish";
                 $this->savePage($page);
                 /* Disabled for now since it sendMailNotification doesn't support pages yet:
                    if (!$PIVOTX['config']->get('disable_new_page_notifications')) {
                        sendMailNotification('page',$page);
                    }
                    */
             }
         }
     }
 }
Example #12
0
 /** cron log, INTERNAL
  *  daily cron, move old log entries to table log_archive
  *
  * @return array results of running this cron
  */
 public function _cronLog()
 {
     include_once 'functions/misc_functions.php';
     include_once 'functions/date_functions.php';
     $time_start = getmicrotime();
     $cron_array = array();
     $cron_array['title'] = 'log cron';
     $cron_array['description'] = 'move old logs to log archive';
     $cron_array['success'] = false;
     $cron_array['success_text'] = 'cron failed';
     $context_item = $this->_environment->getCurrentContextItem();
     $log_DB = $this->_environment->getLogManager();
     $log_DB->resetlimits();
     $log_DB->setContextLimit(0);
     $from = 0;
     $range = 500;
     $log_DB->setRangeLimit($from, $range);
     //       // only archive logs that are older then the beginning of the actual day
     //       // getCurrentDate() returns date("Ymd");
     //             // Datenschutz : Logdaten nach bestimmtem Zeitraum löschen
     //       // Wenn im context_item das Extra eingestellt ist, dann
     //       if($context_item->getLogDeleteInterval() <= 1){
     //          $log_DB->setTimestampOlderLimit(getCurrentDate());
     //       } else {
     //          $log_DB->setTimestampOlderLimit(getCurrentDateTimeMinusDaysInMySQL($context_item->getLogDeleteInterval()));
     //       }
     $log_DB->setTimestampOlderLimit(getCurrentDate());
     $data_array = $log_DB->select();
     $count = count($data_array);
     if ($count == 0) {
         $cron_array['success'] = true;
         $cron_array['success_text'] = 'nothing to do';
     } else {
         $count_all = 0;
         $log_archive_manager = $this->_environment->getLogArchiveManager();
         while (count($data_array) > 0) {
             // save old logs in log archive
             $success = $log_archive_manager->save($data_array);
             if ($success) {
                 // delete old logs
                 $success = $log_DB->deleteByArray($data_array);
                 if ($success) {
                     $cron_array['success'] = true;
                     $count_all = $count_all + count($data_array);
                     $cron_array['success_text'] = 'move ' . $count_all . ' log entries';
                 }
             }
             unset($data_array);
             $data_array = $log_DB->select();
         }
         unset($log_archive_manager);
     }
     unset($log_DB);
     $time_end = getmicrotime();
     $time = round($time_end - $time_start, 0);
     $cron_array['time'] = $time;
     return $cron_array;
 }
Example #13
0
 /** cron log, INTERNAL
  *  daily cron
  *
  * @return array results of running this cron
  */
 function _cronPageImpressionAndUserActivity()
 {
     include_once 'functions/misc_functions.php';
     $time_start = getmicrotime();
     $cron_array = array();
     $cron_array['title'] = 'page impression and user activity cron';
     $cron_array['description'] = 'count page impressions and user activity';
     $cron_array['success'] = true;
     $cron_array['success_text'] = 'cron failed';
     $log_manager = $this->_environment->getLogManager();
     $room_list = $this->getRoomList();
     $count_rooms = 0;
     if ($room_list->isNotEmpty()) {
         $room_item = $room_list->getFirst();
         while ($room_item) {
             // get latest timestamp of page impressions and user actitivty
             // from extra field PIUA_LAST
             $piua_last = $room_item->getPageImpressionAndUserActivityLast();
             if (!empty($piua_last)) {
                 $oldest_date = $piua_last;
             } else {
                 // if there is no entry take creation_date
                 $creation_date = $room_item->getCreationDate();
                 $oldest_date = getYearFromDateTime($creation_date) . getMonthFromDateTime($creation_date) . getDayFromDateTime($creation_date);
             }
             $current_date = getCurrentDate();
             $day_diff = getDifference($oldest_date, $current_date);
             $pi_array = $room_item->getPageImpressionArray();
             $ua_array = $room_item->getUserActivityArray();
             $pi_input = array();
             $ua_input = array();
             // for each day, get page impressions and user activity
             for ($i = 1; $i < $day_diff; $i++) {
                 $log_manager->resetLimits();
                 $log_manager->setContextLimit($room_item->getItemID());
                 $log_manager->setRequestLimit("commsy.php");
                 $older_limit_stamp = datetime2Timestamp(date("Y-m-d 00:00:00")) - ($i - 1) * 86400;
                 $older_limit = date('Y-m-d', $older_limit_stamp);
                 $log_manager->setTimestampOlderLimit($older_limit);
                 $log_manager->setTimestampNotOlderLimit($i);
                 $pi_input[] = $log_manager->getCountAll();
                 $ua_input[] = $log_manager->countWithUserDistinction();
             }
             // put actual date in extra field PIUA_LAST
             $room_item->setPageImpressionAndUserActivityLast($current_date);
             $room_item->setPageImpressionArray(array_merge($pi_input, $pi_array));
             $room_item->setUserActivityArray(array_merge($ua_input, $ua_array));
             $room_item->saveWithoutChangingModificationInformation();
             $count_rooms++;
             unset($room_item);
             $room_item = $room_list->getNext();
         }
     }
     unset($room_list);
     unset($log_manager);
     $cron_array['success_text'] = 'count page impressions and user activity of ' . $count_rooms . ' rooms';
     $time_end = getmicrotime();
     $time = round($time_end - $time_start, 0);
     $cron_array['time'] = $time;
     return $cron_array;
 }
<?php

session_start();
include "../common/DatabaseConnection.php";
$db = new DatabaseConnection();
$db->createConnection();
$locationFK = $_SESSION['userLoc'];
$type = $_GET['artefactType'];
$dateType = $_GET['dtype'];
if ($dateType == 'c') {
    getCurrentDate($locationFK, $type, $db);
} else {
    getPending($locationFK, $type, $db);
}
function getCurrentDate($locationFK, $type, $db)
{
    $sql = "select s.ScheduleMaintenancePK,s.ArtefactCode,a.ArtefactName,s.ScheduledServiceDate from scheduledmaintenance s\r\n\t\tinner join artefact a\r\n\t\ton s.ArtefactCode = a.ArtefactCode\r\n\t\twhere  s.ScheduleMaintenancePK not in  (select ScheduleMaintenanceFK from tasklist)\r\n\t\tand s.ScheduledServiceDate = current_date() and s.LocationFK='{$locationFK}' and s.ArtefactTypeCode = '{$type}' and a.visiblestatus='on'";
    if ($result = $db->setQuery($sql)) {
        if ($result->num_rows > 0) {
            $resultArray = array();
            while ($row = $result->fetch_assoc()) {
                $url = "conditionalReport.php?artefactCode=" . $row['ArtefactCode'] . "&key=" . $row['ScheduleMaintenancePK'];
                $name = $row['ArtefactName'];
                echo "<a href=" . $url . " class='list-group-item'>" . "<span class='glyphicon glyphicon-file'></span>" . $name . "<span class='badge'>" . date('d/m/Y', strtotime($row['ScheduledServiceDate'])) . "</span></a>";
                //echo " <a href=".$url." class='list-group-item' ><span class='glyphicon glyphicon-file'></span>".$name."<span class='badge'>".date('d/m/Y', strtotime($row['ScheduledServiceDate']))."</span></a>";
            }
            //echo json_encode($resultArray);
        } else {
            echo "NULL";
        }
    }
Example #15
0
 /**
  * Checks if any entries set to 'timed publish' should be published.
  *
  * @return void
  */
 function checkTimedPublish()
 {
     global $PIVOTX;
     $date = date("Y-m-d-H-i", getCurrentDate());
     $entries = $this->read_entries(array('full' => true, 'status' => 'timed'));
     foreach ($entries as $entry) {
         if ($entry['publish_date'] <= $date) {
             $entry['date'] = $entry['publish_date'];
             $entry['status'] = "publish";
             $this->set_entry($entry);
             $this->save_entry(TRUE);
             if (!$PIVOTX['config']->get('disable_new_entry_notifications')) {
                 sendMailNotification('entry', $this->entry);
             }
             writeTags($this->entry['keywords'], '', $this->entry['code']);
             updateSearchIndex($this->entry);
         }
     }
 }
Example #16
0
         if (isset($_POST['clock_pulse']) and !empty($_POST['clock_pulse'])) {
            $room_item->setTimeTextArray($_POST['clock_pulse']);
         }

         if (isset($_POST['future']) and !empty($_POST['future'])) {
            $room_item->setTimeInFuture($_POST['future']);
         }

         // save room_item
         $room_item->save();

         // change (insert) time labels
         $clock_pulse_array = array();
         if (isset($_POST['clock_pulse']) and !empty($_POST['clock_pulse']) and !empty($_POST['clock_pulse'][1])) {
            $current_year = date('Y');
            $current_date = getCurrentDate();
            $ad_year = 0;
            $first = true;
            foreach ($_POST['clock_pulse'] as $key => $clock_pulse) {
              $date_string = $clock_pulse['BEGIN'];
              $month = $date_string[3].$date_string[4];
                  $day = $date_string[0].$date_string[1];
              $begin = $month.$day;

              $date_string = $clock_pulse['END'];
              $month = $date_string[3].$date_string[4];
                  $day = $date_string[0].$date_string[1];
              $end = $month.$day;

              $begin2 = ($current_year+$ad_year).$begin;
              if ($end < $begin) {
Example #17
0
 /**
  * Save a single page
  *
  * @param integer $id
  * @param array $page
  */
 function savePage($page)
 {
     $value = array('title' => $page['title'], 'uri' => $page['uri'], 'subtitle' => $page['subtitle'], 'introduction' => $page['introduction'], 'body' => $page['body'], 'user' => $page['user'], 'sortorder' => $page['sortorder'], 'allow_comments' => $page['allow_comments'], 'date' => $page['date'], 'chapter' => $page['chapter'], 'publish_date' => $page['publish_date'], 'edit_date' => date("Y-m-d H:i:s", getCurrentDate()), 'convert_lb' => intval($page['convert_lb']), 'status' => $page['status'], 'keywords' => $page['keywords'], 'template' => $page['template'], 'extrafields' => '');
     if ($page['uid'] == "" || $page['uid'] == ">") {
         // New page!
         $qry = array();
         $qry['into'] = $this->pagestable;
         $qry['value'] = $value;
         $this->sql->build_insert($qry);
         $this->sql->query();
         $uid = $this->sql->get_last_id();
     } else {
         $uid = intval($page['uid']);
         $qry = array();
         $qry['update'] = $this->pagestable;
         $qry['value'] = $value;
         $qry['where'] = "uid=" . $uid;
         $this->sql->build_update($qry);
         $this->sql->query();
     }
     // Delete the keywords / tags..
     $qry = array();
     $qry['delete'] = $this->tagstable;
     $qry['where'] = "contenttype='page' AND target_uid=" . intval($uid);
     $this->sql->build_delete($qry);
     $this->sql->query();
     $tags = getTags(false, '', $page['keywords']);
     // Add the keywords / tags..
     foreach ($tags as $tag) {
         $qry = array();
         $qry['into'] = $this->tagstable;
         $qry['value'] = array('tag' => $tag, 'contenttype' => 'page', 'target_uid' => intval($uid));
         $this->sql->build_insert($qry);
         $this->sql->query();
     }
     // Store the 'extra fields'
     if (!is_array($page['extrafields'])) {
         $page['extrafields'] = array();
     }
     $extrakeys = array();
     foreach ($page['extrafields'] as $key => $value) {
         $extrakeys[] = $this->sql->quote($key);
         if (empty($value)) {
             unset($page['extrafields'][$key]);
         }
     }
     if (count($extrakeys) > 0) {
         $qry = array();
         $qry['delete'] = $this->extrafieldstable;
         $qry['where'][] = "target_uid=" . intval($uid);
         $qry['where'][] = "contenttype='page'";
         $qry['where'][] = "fieldkey IN (" . implode(", ", $extrakeys) . ")";
         $this->sql->build_delete($qry);
         $this->sql->query();
     }
     foreach ($page['extrafields'] as $key => $value) {
         $qry = array();
         $qry['into'] = $this->extrafieldstable;
         $qry['value'] = array('fieldkey' => safeString($key, true), 'value' => $value, 'contenttype' => 'page', 'target_uid' => $uid);
         $this->sql->build_insert($qry);
         $this->sql->query();
     }
     unset($this->index);
     $this->getIndex();
     // Return the uid of the page we just inserted / updated..
     return $uid;
 }
Example #18
0
$d['layout']['dir'] = dirname($d['layout']['php']);
$g['dir_layout'] = $g['path_layout'] . $d['layout']['dir'] . '/';
$g['url_layout'] = $g['s'] . '/layouts/' . $d['layout']['dir'];
$g['img_layout'] = $g['url_layout'] . '/_images';
define('__KIMS_CONTENT__', $g['path_core'] . 'engine/content.engine.php');
if ($my['admin'] && (!$_SERVER['HTTP_REFERER'] || $panel == 'Y') && $panel != 'N' && !$iframe && !is_file($g['dir_layout'] . '_var/nopanel.txt')) {
    include $g['path_core'] . 'engine/adminpanel.engine.php';
} else {
    foreach ($g['switch_1'] as $_switch) {
        include $_switch;
    }
    if ($m != 'admin') {
        include $g['path_var'] . 'sitephp/' . $_HS['uid'] . '.php';
        if ($_HS['buffer']) {
            $g['buffer'] = true;
            ob_start('ob_gzhandler');
        }
    }
    $g['location'] = getLocation(0);
    $g['browtitle'] = getPageTitile();
    include './layouts/' . $d['layout']['dir'] . '/_includes/_import.control.php';
    include $g['path_layout'] . $d['layout']['php'];
    foreach ($g['switch_4'] as $_switch) {
        include $_switch;
    }
    echo "\n" . '<!-- KimsQ Rb v.' . $d['admin']['version'] . ' / Runtime : ' . round(getCurrentDate() - $g['time_start'], 3) . ' -->';
    if ($g['buffer']) {
        ob_end_flush();
    }
}
db_close($DB_CONNECT);
<?

	include("./bl/db.php");
	include("./bl/util.php");
	//include("validaterequest.php");
	$email = $_POST['email'];
	$fname = $_POST['firstName'];
	$lname = $_POST['lastName'];
	$email = $_POST['email'];
	$pass = $_POST['password'];
	$cpass = $_POST['confirmPassword'];
	$contact_no = "+91" . $_POST['contact-no'];

	if($pass != '' && $cpass != '') {
	    // Add server side validation.
	}
	$dated = getCurrentDate();
	$query="INSERT INTO user (username, password, first_name, last_name, contact_no, email_id, user_type, active, date_created) VALUES ('$email', '$pass', '$fname', '$lname', '$contact_no', '$email', 2, 1, '$dated')";
    $result = mysql_query($query) or die(mysql_error());
	header("Location: ./login.php?msg=1");	
?>
Example #20
0
} else {
    $profile_username = $_GET['username'];
    $smarty->assign('friendship_status', getFriendshipState(getUserId($_SESSION['username']), getUserId($profile_username)));
    $smarty->assign('isrequester', isrequester(getUserId($_SESSION['username']), getUserId($profile_username)));
}
$smarty->assign('profile_info', getUserProfileInfo($profile_username));
$smarty->assign('n_friends_usr', countFriends(getUserId($_SESSION['username'])));
$smarty->assign('n_friends_prf', countFriends(getUserId($profile_username)));
$smarty->assign('n_circles', getNumberOfCircles(getUserId($_SESSION['username'])));
$friendsID = getFriendsId($profile_username);
foreach ($friendsID as $friendID) {
    $friends[$friendID['idauthenticated2']] = getUsername($friendID['idauthenticated2']);
    $friends[$friendID['idauthenticated2']]['info'] = getUserProfileInfo(getUsername($friendID['idauthenticated2'])['username']);
}
$smarty->assign('friends', $friends);
$data = getCurrentDate();
$smarty->assign('data', $data);
$circles = getCirclesByUser(getUserId($_SESSION['username']));
$smarty->assign('circles', $circles);
$posts = getUserPosts($profile_username, getUserId($profile_username));
foreach ($posts as $post) {
    if (postInCircle($post['idpost'])) {
        if (postFromCorrectCircle(getUserId($_SESSION['username']), $post['idpost'])) {
            $posts_profile[$post['idpost']]['date'] = getDatee(extractRegDate($post['idpost']));
            $posts_profile[$post['idpost']]['post'] = $post;
            $posts_profile[$post['idpost']]['profile'] = getUserProfileInfo(getUsername($post['idauthenticated'])['username']);
        }
    } else {
        $posts_profile[$post['idpost']]['date'] = getDatee(extractRegDate($post['idpost']));
        $posts_profile[$post['idpost']]['post'] = $post;
        $posts_profile[$post['idpost']]['profile'] = getUserProfileInfo(getUsername($post['idauthenticated'])['username']);
Example #21
0
 protected function isMenuValid()
 {
     // We have the following pattern to search for the menu validity:
     // Du [day_number] au [day_number] [month_name]
     $keys = findRegExpFromTextFile('pdf_texts/' . $this->getSimpleName() . '.txt', "/Du\\s+\\d*\\sau\\s+\\d*\\s+.+/");
     $rangeCheck = true;
     if ($keys) {
         $first = current(array_filter($keys));
         if ($first) {
             $line = current(array_filter($first));
         }
     }
     if ($line) {
         // [0] = Du, [1] = startDay number, [2] = au, [3] enDay number, [4] = month name
         $parts = preg_split('/\\s+/', trim($line));
         if (count($parts) == 5) {
             $startDayNumber = intval($parts[1]);
             $endDayNumber = intval($parts[3]);
             $monthNumber = convertMonthNameToNumber(strtolower($parts[4]));
             $startDate = $startDayNumber . '-' . $monthNumber . '-' . getCurrentYear() . ' 00:01';
             $endDate = $endDayNumber . '-' . $monthNumber . '-' . getCurrentYear() . ' 23:59';
             $currentDate = getCurrentDate();
             $rangeCheck = false;
             $rangeCheck = checkInRange($startDate, $endDate, intval($currentDate->format('U')));
         }
     }
     return $rangeCheck;
 }
Example #22
0
 /**
  * Create the SQL table for Pages.
  *
  * @param link $sql
  */
 function makePagesTable()
 {
     global $PIVOTX;
     $tablename = safeString($PIVOTX['config']->get('db_prefix') . "pages", true);
     $userdata = $PIVOTX['users']->getUsers();
     $username = $userdata[0]['username'];
     $query1 = "CREATE TABLE {$tablename} (\n\t\t      uid INTEGER PRIMARY KEY,\n\t\t      title TEXT NOT NULL,\n\t\t      uri TEXT NOT NULL,\n\t\t      subtitle TEXT NOT NULL,\n\t\t      introduction TEXT NOT NULL,\n\t\t      body TEXT NOT NULL,\n\t\t      convert_lb INTEGER(11) NOT NULL DEFAULT 0,\n\t\t      template TEXT NOT NULL,\n\t\t      status TEXT NOT NULL,\n\t\t      date DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',\n\t\t      publish_date DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',\n\t\t      edit_date DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',\n\t\t      chapter INTEGER(11) NOT NULL DEFAULT 0,\n\t\t      sortorder INTEGER(11) NOT NULL DEFAULT 0,\n\t\t      user TEXT NOT NULL,\n\t\t      allow_comments INTEGER(11) NOT NULL DEFAULT 0,\n\t\t      keywords TEXT NOT NULL,\n      \t\textrafields TEXT NOT NULL\n\t\t    );";
     $query2 = "INSERT INTO {$tablename} (uid, title, uri, subtitle, introduction, body, convert_lb, template, status, date, publish_date, edit_date, chapter, sortorder, user, allow_comments, keywords, extrafields) VALUES\n\t\t\t\t(1, '%title%', 'about', '', '<p>Hi! This website runs on <a href=\"http://pivotx.net\">PivotX</a>, the coolest free and open tool to power your blog and website. To change this text, edit ''<tt>About PivotX</tt>'', under ''<tt>Pages</tt>'' in the PivotX backend.</p>', '<p>PivotX is a feature rich weblogging tool that is simple enough for the novice     weblogger to use and complex enough to meet the demands of advanced webmasters.     It can be used to publish a variety of websites from the most basic weblog to very advanced CMS style solutions.</p>\r\n<p>PivotX is - if we do say so ourselves - quite an impressive piece of software. It     is made even better through the use of several external libraries. We thank their     authors for the time taken to develop these very useful tools and for making     them available to others.</p>\r\n<p>Development of PivotX (originally Pivot) started back in 2001 and has continuously     forged ahead thanks to the efforts of a lot     of dedicated and very talented people. The PivotX core team is still very active     but keep in mind that PivotX would not be what it is today without the valuable     contributions made by several other people.</p>', 5, '', 'publish', '%now%-00', '%now%-00', '%now%-00', 1, 10, '{$username}', 1, '', ''); ";
     //Mancava il campo NOT NULL extrafields in entrambi i casi
     $query3 = "INSERT INTO {$tablename} (uid, title, uri, subtitle, introduction, body, convert_lb, template, status, date, publish_date, edit_date, chapter, sortorder, user, allow_comments, keywords, extrafields) VALUES\n\t\t\t\t(2,  '%title%', 'links', '', '<p>Some links to sites with more information:</p>\r\n<ul>\r\n<li>PivotX - <a href=\"http://pivotx.net\">The PivotX website</a></li>\r\n<li>Get help on <a href=\"http://forum.pivotx.net\">the PivotX forum</a></li>\r\n<li>Read <a href=\"http://book.pivotx.net\">the PivotX documentation</a></li>\r\n<li>Browse for <a href=\"http://themes.pivotx.net\">PivotX Themes</a></li>\r\n<li>Get more <a href=\"http://extensions.pivotx.net\">PivotX Extensions</a></li>\r\n<li>Follow <a href=\"http://twitter.com/pivotx\">@pivotx on Twitter</a></li>\r\n</ul>\r\n<p><small>To change these links, edit ''<tt>Links</tt>'', under ''<tt>Pages</tt>'' in the PivotX backend.</small></p>', '', 5, '', 'publish', '%now%-01', '%now%-01', '%now%-01', 1, 10, '{$username}', 1, '', '');";
     //Mancava il campo NOT NULL extrafields in entrambi i casi
     $now = date("Y-m-d-H-i", getCurrentDate());
     $query2 = str_replace("%now%", $now, $query2);
     $query2 = str_replace("%title%", __('About PivotX'), $query2);
     $query3 = str_replace("%now%", $now, $query3);
     $query3 = str_replace("%title%", __('Links'), $query3);
     $this->query($query1);
     $this->query($query2);
     $this->query($query3);
     // Aggiungere alter table per
     // 		      FULLTEXT KEY `title` (`title`,`subtitle`,`introduction`,`body`, `keywords`)
 }
Example #23
0
function changeTerminationPoint($link, $user, $vlanNumber, $newTerminationPoint)
{
    //проверка на наличие прав
    require_once 'access.php';
    $canDoEdit = canDo($link, $user, 'EDIT_ENTRY');
    if (!$canDoEdit) {
        header('Location: index.php');
        die;
    }
    //подготовка
    $vlanNumber = (int) $vlanNumber;
    if ($vlanNumber == 0) {
        $_SESSION['updateTerminationForVlan'] = "Некорректный номер влана!";
        header('Location: admin.php');
        die;
    }
    //узнаем текущую терминацию
    $queryForCurrentTerminationPoint = "SELECT termination_point FROM spd_table WHERE vlan_id={$vlanNumber}";
    $resultForCurrentTerminationPoint = mysqli_query($link, $queryForCurrentTerminationPoint);
    $currentTermination = mysqli_fetch_assoc($resultForCurrentTerminationPoint)['termination_point'];
    $newTerminationPoint = trim($newTerminationPoint);
    $newTerminationPoint = mysqli_real_escape_string($link, $newTerminationPoint);
    //запрос
    $query = "UPDATE spd_table SET termination_point='{$newTerminationPoint}' WHERE vlan_id='{$vlanNumber}'";
    $result = mysqli_query($link, $query);
    if (!$result) {
        die(mysqli_error($link));
    }
    $affected_rows = mysqli_affected_rows($link);
    //запись в сессию
    if ($affected_rows != 0) {
        $_SESSION['updateTerminationForVlan'] = "Терминация успешно изменена для " . $affected_rows . " записей! Влан " . $vlanNumber . " теперь терминируется на " . $newTerminationPoint . "!";
        //запись в лог действий
        //вытаскиваем имя текущего пользователя, чтобы можно было подставить значение в строку сообщения
        $userLogin = $user['login'];
        $dt_action = getCurrentDate();
        $message = "Пользователем {$userLogin} сменена точка терминации c \"{$currentTermination}\" на \"{$newTerminationPoint}\" для влана {$vlanNumber}.";
        //подключение файла с функцией логирования
        require_once 'logging.php';
        //выполняем логирование
        if (!loggingAction($link, $user, $message, $dt_action)) {
            //запись неиспешности в сессию
            $_SESSION['logging'] = 'Логирование действия не удалось!';
        }
    } else {
        $_SESSION['updateTerminationForVlan'] = "Не удалось сменить терминацию для влана " . $vlanNumber . ". Возможно, такого влана нет.";
        return false;
    }
    return true;
}
Example #24
0
<?php

include '../CommonPage/initializer.php';
checkUser($_SESSION["Username"]);
$deleteItem = $_GET["deleteItem"];
if ($deleteItem == 'ajakoDate') {
    $sql = "Delete from book where DueDate='" . getCurrentDate() . "'";
    $conn->query($sql);
} else {
    if (is_numeric($deleteItem)) {
        $sql = "Delete from book where Id='" . $deleteItem . "'";
        $conn->query($sql);
    } else {
        $sql = "Delete from book where DueDate='" . $deleteItem . "'";
        $conn->query($sql);
        $_SESSION['deleteMessage'] = true;
        redirect_to('admin.php');
    }
}
Example #25
0
<head>
    <script>
        $(document).ready(function(){
            removeAllActiveClass();
        })
    </script>

    <?php 
include '../CommonPage/initializer.php';
checkUser($_SESSION["Username"]);
$updatedDueDate = getCurrentDate();
?>
    <?php 
if (isset($_POST['editTodaysDetails'])) {
    $dueDate = $_POST["editedDueDate"];
    $query = "Update book set DueDate='" . $dueDate . "' where DueDate='" . getCurrentDate() . "'";
    $editResult = "yes";
    if ($conn->query($query) === true) {
        $editResult = "yes";
        $updatedDueDate = $dueDate;
    } else {
        $editResult = "no";
    }
}
?>
</head>
<body>
<?php 
include '../CommonPage/header.php';
include '../CommonPage/nav.php';
?>
Example #26
0
 /**
  * Composes an entry based on the email.
  *
  */
 function compose_entry()
 {
     global $PIVOTX;
     $entry = $this->entry;
     if (strlen($entry['introduction']) > 2 || strlen($entry['body']) > 2) {
         // if so, save the new entry and generate files (if necessary)
         $entry['code'] = ">";
         $entry['date'] = $entry['publish_date'] = date('Y-m-d-H-i', getCurrentDate());
         if (!isset($entry['title']) || $entry['title'] == "") {
             $entry['title'] = $this->cfg['title'];
         }
         if (!isset($entry['subtitle'])) {
             $entry['subtitle'] = '';
         }
         if (!isset($entry['status']) || $entry['status'] == "") {
             $entry['status'] = $this->cfg['status'];
         }
         $entry['allow_comments'] = $this->cfg['allow_comments'];
         $entry['convert_lb'] = 0;
         if (!isset($entry['user']) || $entry['user'] == "" || !$PIVOTX['users']->getUser($entry['user'])) {
             $entry['user'] = $this->cfg['author'];
         }
         //check for valid sender: $replyaddress must be in $this->cfg['allowed_senders']
         $allowed = false;
         if (strlen($entry['replyaddress']) > 2) {
             $replyaddress = 'x' . strtolower($entry['replyaddress']);
             foreach ($this->cfg['allowed_senders'] as $sender) {
                 if (strpos($replyaddress, strtolower($sender)) > 0) {
                     $allowed = true;
                     break;
                 }
             }
         }
         if ($allowed) {
             $entry['category'] = array($this->cfg['category']);
             if (isset($entry['override_cat'])) {
                 $entry['category'] = array($entry['override_cat']);
             }
         } else {
             $entry['category'] = array($this->cfg['spam_category']);
             $entry['status'] = 'hold';
         }
         $entry = $PIVOTX['db']->set_entry($entry);
         $PIVOTX['db']->save_entry(true);
         $msg = __('Your entry has been posted!') . "\n\n" . sprintf("%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s", __('User'), $entry['user'], __('Category'), implode(',', $entry['category']), __('Title'), $entry['title'], __('Subtitle'), $entry['subtitle'], __('Introduction'), $entry['introduction']);
         $msg_title = __('Moblog entry posted');
     } else {
         $msg = __("Not posted: Could not parse your entry.\n\nPlease report this in the PivotX forum");
         $msg_title = __('Moblog entry not posted');
     }
     $msg .= "\n\n" . sprintf(__("Processed: %s"), formatDate('', "%day%-%month%-'%ye% %hour24%:%minute%")) . "\n";
     // to wrap it up, send a confirmation by mail..
     if ($entry['replyaddress'] != "" && $this->cfg['send_confirmation']) {
         $add_header = sprintf("From: %s", $entry['replyaddress'] . "\n");
         $add_header .= sprintf("X-loop: pivotx-moblog");
         if (!pivotxMail($entry['replyaddress'], $msg_title, $msg, $add_header)) {
             debug("Failed to send moblog confirmation message");
         }
     }
     return $msg;
 }
        echo json_encode($return);
        //header("Location: registration.php?e=".urlencode($error));
        exit;
    }
    return;
}
function getCurrentDate()
{
    $d = getdate();
    $month = $d[mon];
    $day = $d[mday];
    $year = $d[year];
    return $month . "-" . $day . "-" . $year;
}
checkIfUsernameExists($username, $tbl_name);
$date = getCurrentDate();
$password = securePassword($password);
/* create a prepared statement */
$sql = 'INSERT INTO ' . $tbl_name . ' (
    registrationDate, 
    primaryContact, 
    primaryEmail, 
    primaryPhone, 
    university,
    size,
    username,
    password,
    address
) 
VALUES (?,?,?,?,?,?,?,?,?)';
if ($stmt = $mysqli->prepare($sql)) {
<html>
<head>
    <?php 
include '../CommonPage/initializer.php';
checkUser($_SESSION["Username"]);
$updatedDueDate = getCurrentDate();
?>
    <?php 
if (isset($_POST['editDueDetails'])) {
    $dueDate = $_POST["editedDueDate"];
    $unDueDate = $_POST["unEditedDueDate"];
    $query = "Update book set DueDate='" . $dueDate . "' where DueDate='" . $unDueDate . "'";
    $editResult = "yes";
    if ($conn->query($query) === true) {
        $editResult = "yes";
        $updatedDueDate = $dueDate;
    } else {
        $editResult = "no";
    }
}
if ($_GET) {
    $specificDueDate = $_GET['specificDueDate'];
    $sql = "select DueDate from book where DueDate='" . $specificDueDate . "'";
    $rowResult = $conn->query($sql);
    while ($row = mysqli_fetch_assoc($rowResult)) {
        $initialDueDate = $row['DueDate'];
    }
}
?>
    <script>
        $(document).ready(function(){