function pageController($dbc) { var_dump($_POST); $error = ''; $errors = NULL; $limit = 2; $pageNumber = Input::has('pageNumber') ? Input::get('pageNumber') : 1; $pageNumber = $pageNumber > 0 ? $pageNumber : 1; $pageNumber = is_numeric($pageNumber) ? $pageNumber : 1; $offset = $limit * $pageNumber - $limit; if (!empty($_POST)) { if (checkValues()) { $errors = insertPark($dbc); } } deletePark($dbc); $stmt = $dbc->prepare("SELECT * FROM national_parks LIMIT :limit OFFSET :offset"); $stmt->bindValue(':offset', $offset, PDO::PARAM_INT); $stmt->bindValue(':limit', $limit, PDO::PARAM_INT); $stmt->execute(); $parks = $stmt->fetchAll(PDO::FETCH_ASSOC); $count = $dbc->query('SELECT COUNT(*) FROM national_parks;')->fetchColumn(); $maxPage = ceil($count / $limit); $next = $pageNumber + 1; $previous = $pageNumber - 1; if ($pageNumber > $maxPage) { $pageNumber = 1; header("Location: national_parks.php?pageNumber=1"); die; } return array('pageNumber' => $pageNumber, 'previous' => $previous, 'next' => $next, 'parks' => $parks, 'maxPage' => $maxPage, 'error' => $error, 'errors' => $errors); }
function insert_comment() { $id_zhout = $this->uri->segment(3); $write_comment = checkValues(urldecode($this->uri->segment(4))); $date = strtotime(date("Y-m-d H:i:s")); if ($write_comment == '') { $write_comment = '/'; } $data = array('id_member' => $this->session->userdata('id_member'), 'id_zhout' => $id_zhout, 'comment_content' => $write_comment, 'userip' => '', 'date' => $date, 'active' => 1); $this->model_product->insert_comment($data); }
function pageController($dbc) { var_dump($_POST); $error = ''; $errors = NULL; if (!empty($_POST)) { if (checkValues()) { $errors = insertPark($dbc); } } return array('errors' => $errors); }
function pageController($dbc) { $errors = null; if (!empty($_POST)) { if (checkValues()) { $errors = insertPark($dbc); } else { $message = "Invalid format. Please try again."; $javascript = "<script type='text/javascript'>alert('{$message}');</script>"; echo $javascript; } } deletePark($dbc); // Count $countAll = 'SELECT count(*) FROM national_parks'; $count_stmt = $dbc->query($countAll); $count = $count_stmt->fetchColumn(); $limit = 2; $max_page = ceil($count / $limit); // Sanitizing $page = Input::has('page') ? Input::get('page') : 1; // grabs url value if exists, if not set to 1 $page = is_numeric($page) ? $page : 1; // is value numeric, if not set to 1 $page = $page > 0 ? $page : 1; // is value greater than zero, if not set to 1 $page = $page <= $max_page ? $page : $max_page; // is value less than or equal maximum amount of pages, if not set to max page // Offset $offset = $page * $limit - $limit; $selectAll = 'SELECT * FROM national_parks LIMIT :limit OFFSET :offset'; $stmt = $dbc->prepare($selectAll); $stmt->bindValue(':limit', $limit, PDO::PARAM_INT); $stmt->bindValue(':offset', $offset, PDO::PARAM_INT); $stmt->execute(); $parks = $stmt->fetchAll(PDO::FETCH_ASSOC); return array('page' => $page, 'parks' => $parks, 'errors' => $errors, 'max_page' => $max_page); }
function pageController($dbc) { $errors = null; if (!empty($_POST)) { if (checkValues()) { $errors = insertPark($dbc); } else { $message = "Invalid format. Do over!"; $javascript = "<script type='text/javascript'>alert('{$message}');<?script>"; echo $javascript; } } deletePark($dbc); // Count $countAll = 'SELECT count(*) FROM national_parks'; $count_stmt = $dbc->query($countAll); $count = $count_stmt->fetchColumn(); $limit = 2; $max_page = ceil($count / $limit); // Sanitizing $page = Input::has('page') ? Input::get('page') : 1; $page = $page > 1 ? $page : 1; // Is value greater than 0 if not set to 1. $page = is_numeric($page) ? $page : 1; // If input not numeric then return 1. $page = $page <= $max_page ? $page : $max_page; // Offset $offset = $page * $limit - $limit; $selectAll = "SELECT * FROM national_parks LIMIT {$limit} OFFSET {$offset}"; $stmt = $dbc->query($selectAll); $stmt->bindValue(':limit', $limit, PDO::PARAM_INT); $stmt->bindValue(':offset', $offset, PDO::PARAM_INT); $stmt->execute(); $parks = $stmt->fetchAll(PDO::FETCH_ASSOC); return array('page' => $page, 'parks' => $parks, 'errors' => $errors, 'max_page' => $max_page, 'limit' => $limit); }
} $value = strtr($value, array_flip(get_html_translation_table(HTML_ENTITIES))); $value = strip_tags($value); $value = mysql_real_escape_string($value); $value = htmlspecialchars($value); return $value; } $limit = ""; $users_ip = $_SERVER['REMOTE_ADDR']; if (@$_REQUEST['val']) { $EventInput = checkValues($_REQUEST['EventInput']); $datepicker = checkValues($_REQUEST['datepicker']); $datepicker = $datepicker . ' ' . $_REQUEST['start_time_min']; $datepicker = strtotime($datepicker); $where_text = checkValues($_REQUEST['Where']); $WhoInvited = checkValues($_REQUEST['WhoInvited']); mysql_query("INSERT INTO facebook_event (EventInput,datepicker,where_text,WhoInvited,users_ip,date_created) VALUES('" . $EventInput . "','" . $datepicker . "','" . $where_text . "','" . $WhoInvited . "','" . $users_ip . "','" . strtotime(date("Y-m-d H:i:s")) . "')"); $limit = "limit 1"; } $result = mysql_query("SELECT * FROM facebook_event where users_ip = '" . $users_ip . "' order by id desc " . $limit); while ($row = mysql_fetch_array($result)) { ?> <div class="show_event"> <img src="ico.png" style="float:left;" alt="" /> <label style="float:left" class="text"> <b><?php echo $row['EventInput']; ?> </b><br /> <?php echo $row['where_text'];
function insert_wall($data) { $this->db->query("INSERT INTO tb_zhopie_zhout (zhout_content,userip,date,id_member) VALUES('" . checkValues($data['value']) . "','" . $data['user_ip'] . "','" . strtotime(date("Y-m-d H:i:s")) . "','" . $data['user_id'] . "')"); $result = $this->db->query("SELECT *,UNIX_TIMESTAMP() - date AS TimeSpent \n\t\t\t\tFROM (tb_zhopie_zhout LEFT JOIN tb_zhopie_profile ON tb_zhopie_profile.id_member = tb_zhopie_zhout.id_member)\n\t\t\t\tJOIN tb_picture \n\t\t\t\tWHERE tb_zhopie_zhout.id_member = '" . $data['user_id'] . "'and tb_picture.id_member = tb_zhopie_zhout.id_member and tb_picture.folder='profil_picture' and tb_picture.primary=1\n\t\t\torder by tb_zhopie_zhout.id_zhout desc limit 0,1;"); return $result; }
<?php $url = $_GET['url']; $url = checkValues($url); function checkValues($value) { $value = trim($value); if (get_magic_quotes_gpc()) { $value = stripslashes($value); } $value = strtr($value, array_flip(get_html_translation_table(HTML_ENTITIES))); $value = strip_tags($value); $value = htmlspecialchars($value); return $value; } function fetch_record($path) { $file = fopen($path, "r"); if (!$file) { return FALSE; } $data = ''; while (!feof($file)) { $data .= fgets($file, 1024); } return $data; } $string = fetch_record($url); if ($string == FALSE) { echo FALSE; return;
} } } } if ($page < $counter - 1) { $pagination .= "<li><a href='#' data-page='{$next}' data-filter='{$filter}' data-term='{$termt}'><i class='icon-chevron-right'></i></a></li>"; $pagination .= "<li><a href='#' data-page='{$lastpage}' data-filter='{$filter}' data-term='{$termt}'><i class='icon-arrow-right'></i></a></li>"; } else { $pagination .= "<li class='active'><a href='#' data-page='{$lastpage}' data-filter='{$filter}' data-term='{$termt}'><i class='icon-chevron-right'></i></a></li>"; $pagination .= "<li class='active'><a href='#' data-page='{$lastpage}' data-filter='{$filter}' data-term='{$termt}'><i class='icon-arrow-right'></i></a></li>"; } $pagination .= "</ul>\n"; } return $pagination; } $aterm = $termt = checkValues($_REQUEST['term']); $term = ''; foreach (explode(" ", $aterm) as $value) { $term .= "+{$value}* "; } $page = $_REQUEST['page']; $filter = $_REQUEST['filter']; //echo "filter: $filter \n"; $per_page = 10; $arraySearch = explode(" ", $termt); $arrayFields = array("eurocode", "descripcion", "medidas"); $countSearch = count($arraySearch); $a = 0; $b = 0; $query = "SELECT nombre, eurocode, descripcion, medidas FROM productos p INNER JOIN categorias c ON p.categoria = c.id WHERE (("; $countFields = count($arrayFields);
$page = is_numeric($page) ? $page : 1; $page = $page > 0 ? $page : 1; $page = $page <= $max_page ? $page : $max_page; $errors = []; $posts = $stmt1->fetch(); $rows = $posts[0]; // Offsetting $offset = $limit * $page - $limit; $selectAll = "SELECT * FROM posts LIMIT :limit OFFSET :offset"; $stmt = $dbc->prepare($selectAll); $stmt->bindValue(':limit', 4, PDO::PARAM_INT); $stmt->bindValue(':offset', $offset, PDO::PARAM_INT); $stmt->execute(); $posts = $stmt->fetchALL(PDO::FETCH_ASSOC); if (!empty($_POST)) { if (checkValues()) { $errors = insertPost($dbc); } else { $message = "Invalid format. Please try again."; $javascript = "<script type='text/javascript'>alert('{$message}');</script>"; echo $javascript; } } ?> <!DOCTYPE html> <html> <head> <title>Handel</title> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
$ret = preg_replace("#(^|[\n ])([\\w]+?://[\\w\\#\$%&~/.\\-;:=,?@\\[\\]+]*)#is", "\\1<a href=\"\\2\" target=\"_blank\">\\2</a>", $ret); $ret = preg_replace("#(^|[\n ])((www|ftp)\\.[\\w\\#\$%&~/.\\-;:=,?@\\[\\]+]*)#is", "\\1<a href=\"http://\\2\" target=\"_blank\">\\2</a>", $ret); $ret = preg_replace("#(^|[\n ])([a-z0-9&\\-_.]+?)@([\\w\\-]+\\.([\\w\\-\\.]+\\.)*[\\w]+)#i", "\\1<a href=\"mailto:\\2@\\3\">\\2@\\3</a>", $ret); $ret = substr($ret, 1); return $ret; } $next_records = 10; $show_more_button = 0; if (isset($_REQUEST['value'])) { if (checkValues($_REQUEST['value'])) { $uname = $_SESSION['username']; //$id=$_SESSION['user_id']; //echo $id; //$userip = $_SERVER['REMOTE_ADDR']; echo "INSERT INTO status_posts (post,user_name,USER_ID,date_created) VALUES('" . checkValues($_REQUEST['value']) . "','" . $uname . "'," . $id . ",'" . strtotime(date("Y-m-d H:i:s")) . "')"; mysql_query("INSERT INTO status_posts (post,user_name,USER_ID,date_created) VALUES('" . checkValues($_REQUEST['value']) . "','" . $uname . "'," . $id . ",'" . strtotime(date("Y-m-d H:i:s")) . "')"); $result = mysql_query("SELECT *,\n\t\tUNIX_TIMESTAMP() - date_created AS TimeSpent FROM status_posts order by p_id desc limit 1"); } elseif ($_REQUEST['show_more_post']) { $next_records = $_REQUEST['show_more_post'] + 10; $result = mysql_query("SELECT *, UNIX_TIMESTAMP() - date_created AS TimeSpent FROM status_posts order by p_id desc limit " . $_REQUEST['show_more_post'] . ", 10"); $check_res = mysql_query("SELECT * FROM status_posts order by p_id desc limit " . $next_records . ", 10"); $show_more_button = 0; // button in the end $check_result = mysql_num_rows($check_res); if ($check_result > 0) { $show_more_button = 1; } } else { $show_more_button = 1; $result = mysql_query("SELECT *, UNIX_TIMESTAMP() - date_created AS TimeSpent FROM status_posts order by p_id desc limit 0,10"); }
function fetch_url($url, $flag = 0) { $images = array(); $image_counter = 0; try { $imgs_list = array(); //$url = $_REQUEST['url']; $pattern = "#^(http:\\/\\/|https:\\/\\/|www\\.)(([A-Z0-9][A-Z0-9_-]*)(\\.[A-Z0-9][A-Z0-9_-]*)+).*\$#i"; $ck_url = parse_url($url); if (!isset($ck_url['scheme'])) { $url = 'http://' . $url; } if (!preg_match($pattern, $url)) { echo json_encode(array('result' => 'error', 'data' => '1')); exit; } $is_video = false; $youtube_vimeo = false; $daily_metacafe = false; $youtube_or_vimeo = ''; $url = checkValues($url); $url_info = parse_url($url); if ($url_info['host'] == 'www.youtube.com' || $url_info['host'] == 'www.vimeo.com' || $url_info['host'] == 'youtube.com' || $url_info['host'] == 'vimeo.com') { $is_video = true; $youtube_vimeo = true; if ($url_info['host'] == 'www.youtube.com' || $url_info['host'] == 'youtube.com') { $youtube_or_vimeo = 'youtube'; } elseif ($url_info['host'] == 'www.vimeo.com' || $url_info['host'] == 'vimeo.com') { $youtube_or_vimeo = 'vimeo'; } } elseif ($url_info['host'] == 'www.dailymotion.com' || $url_info['host'] == 'www.metacafe.com' || $url_info['host'] == 'metacafe.com' || $url_info['host'] == 'dailymotion.com') { $is_video = true; $daily_metacafe = true; } else { $is_video = false; $youtube_vimeo = false; $daily_metacafe = false; } //echo "<br>".$url; $html = file_get_contents_curl($url); $html123 = $html; if ($html == '') { echo json_encode(array('result' => 'error', 'data' => '2')); return $images; //exit(); } $doc = new DOMDocument(); // $doc->preserveWhiteSpace = FALSE; // @$doc->loadHTMLFile($url); // @$doc->normalizeDocument(); @$doc->loadHTML($html); $nodes = $doc->getElementsByTagName('title'); if ($nodes->length > 0) { $title = $nodes->item(0)->nodeValue; } $metas = $doc->getElementsByTagName('meta'); $links = $doc->getElementsByTagName('link'); //get and display what you need: $html2 = '<div class="link_images">'; $html_imgs = ''; $furl = ''; $k = 1; $video_url = ''; $description = ''; $og_title = false; $og_desc = false; $meta = ''; $isFetch = false; if ($flag == 0) { // title and description on all pages all posible tags for ($i = 0; $i < $metas->length; $i++) { $meta = $metas->item($i); if (($meta->getAttribute('name') == 'description' || $meta->getAttribute('name') == 'DESCRIPTION') && !$og_desc) { $description = $meta->getAttribute('content'); } if ($meta->getAttribute('property') == 'og:description') { $description = $meta->getAttribute('content'); $og_desc = true; } if ($meta->getAttribute('name') == 'title' && !$og_title) { $title = $meta->getAttribute('content'); } if ($meta->getAttribute('property') == "og:title") { $title = $meta->getAttribute('content'); $og_title = true; } if ($meta->getAttribute('property') == 'og:image') { $html_imgs .= "<img src='" . $meta->getAttribute('content') . "' width='100' id='" . $k . "' >"; if ($k == 1) { $isFetch = true; $furl = $meta->getAttribute('content'); if ($youtube_or_vimeo == 'youtube') { for ($more_img = 0; $more_img < 4; $more_img++) { $handle = @fopen(str_replace('default', $more_img, $meta->getAttribute('content')), 'r'); if ($handle !== false) { if ($more_img == 0) { $html_imgs = ''; $furl = str_replace('default', $more_img, $meta->getAttribute('content')); } $html_imgs .= "<img src='" . str_replace('default', $more_img, $meta->getAttribute('content')) . "' width='100' id='" . $k . "' >"; $k++; } } } else { $k++; } } } if ($meta->getAttribute('property') == 'og:url') { if ($youtube_or_vimeo == 'youtube') { $video_url_temp = $meta->getAttribute('content'); $parsed_link = parse_url($video_url_temp); parse_str($parsed_link['query'], $var_array); $video_url = 'http://www.youtube.com/v/' . (isset($var_array['v']) ? $var_array['v'] : '') . '&autoplay=1'; } elseif ($youtube_or_vimeo == 'vimeo') { $video_url_temp = $meta->getAttribute('content'); $parsed_link = parse_url($video_url_temp); $vid = str_replace('/', '', $parsed_link['path']); $video_url = 'http://vimeo.com/moogaloop.swf?clip_id=' . $vid; } } } for ($i = 0; $i < $links->length; $i++) { $link = $links->item($i); if ($link->getAttribute('rel') == 'image_src') { $html_imgs .= "<img src='" . $link->getAttribute('href') . "' width='100' id='" . $k . "' >"; if ($k == 1) { $furl = $link->getAttribute('href'); $isFetch = true; } $k++; } if ($link->getAttribute('rel') == 'video_src') { $video_url = $link->getAttribute('href'); } if (!$isFetch) { if ($meta->getAttribute('rel') == 'videothumbnail') { $html_imgs .= "<img src='" . $meta->getAttribute('href') . "' width='100' id='" . $k . "' >"; if ($k == 1) { $furl = $meta->getAttribute('href'); $isFetch = true; } $k++; } } } } if ($is_video == false) { $imgs = $doc->getElementsByTagName('img'); $count = $imgs->length; if ($count > 20) { $count = 20; } for ($i = 0; $i < $count; $i++) { $meta = $imgs->item($i); $src = $meta->getAttribute('src'); $img_src_info = parse_url($src); if (!isset($img_src_info['host'])) { $com_src = 'http://' . $url_info['host'] . $src; } else { $com_src = $src; } if ($com_src != '') { $images[$image_counter++] = $com_src; return $images; list($width, $height, $type, $attr) = @getimagesize($com_src); if ($width >= 30 && $height >= 30) { $html_imgs .= "<img src='" . $com_src . "' width='100' id='" . $k . "' >"; if ($k == 1) { $furl = $com_src; } $k++; } } } /*echo'<pre>'; print_r($images); echo '</pre>';*/ } elseif ($is_video == true) { if (!$isFetch) { $imgs = $doc->getElementsByTagName('img'); $count = $imgs->length; if ($count > 12) { $count = 12; } for ($i = 0; $i < $count; $i++) { $meta = $imgs->item($i); $src = $meta->getAttribute('src'); $img_src_info = parse_url($src); if (!isset($img_src_info['host'])) { $com_src = 'http://' . $url_info['host'] . $src; } else { $com_src = $src; } if ($com_src != '') { $images[$image_counter++] = $com_src; return $images; list($width, $height, $type, $attr) = @getimagesize($com_src); if ($width >= 30 && $height >= 30) { $html_imgs .= "<img src='" . $com_src . "' width='100' id='" . $k . "' >"; if ($k == 1) { $furl = $com_src; } $k++; } } } } } if ($flag == 0) { if ($html_imgs != '') { $html2 .= $html_imgs; } else { $html2 = '<div style="display:none">'; } $html2 .= '<input type="hidden" name="total_images" id="total_images_img" value="' . --$k . '" /> <input type="hidden" name="cur_image" id="cur_image" value="' . ($furl != '' ? 1 : 0) . '" /> <input type="hidden" name="url_image" id="url_image" value="' . (isset($furl) ? $furl : '') . '" /> <input type="hidden" name="url_video" id="url_video" value="' . urlencode($video_url) . '" /> </div>'; $total_img = 0; $total_img = $k; if ($title == '') { $title = $url; } $html = '<div class="link_info"> <label id="link_title_lable" class="title"> ' . @strip_tags($title) . '</label> <input type="text" style="display:none; width:300px;" name="link_feed_title" id="link_feed_title" value="' . @strip_tags($title) . '"/> <br clear="all" /> <label class="url">' . substr($url, 0, 200) . '</label> <br clear="all" /><br clear="all" /> <label id="link_desc_lable" class="desc">' . @strip_tags($description) . '</label> <textarea style="display:none" rows="3" cols="45" name="link_feed_desc" id="link_feed_desc">' . @strip_tags($description) . '</textarea> <span id="nav_img_btn" style="display:' . ($k >= 1 ? 'block' : 'none') . '"> <br clear="all" /><br clear="all" /> <label style="float:left;width:53px"><img src="' . base_url() . 'imgs/prev_lite.png" id="prev" onclick="prev_imgs();" alt="" /><img src="' . base_url() . 'imgs/' . ($k == 1 ? 'next_lite.png' : 'next.png') . '" id="next" onclick="next_imgs();" alt="" /></label> <label class="totalimg"><span style="color:#000000"><span id="selected_image">1</span> of ' . $total_img . '</span> Choose a Thumbnail</label> <br clear="all" /> </span> <span id="no_thumb" style="display:' . ($k >= 1 ? 'block' : 'none') . '"> <label style="float:left;padding-top: 5px;"><input type="checkbox" value="1" name="no_thumbnail" id="no_thumbnail"/></label> <label class="totalimg">No-Thumbnail</label> <br clear="all" /> </span> <script language="javascript"> $(document).ready(function () { $("#no_thumbnail").click(function(){ if($("#no_thumbnail").attr("checked")) { $("#nav_img_btn").hide(); $(".link_images img").hide(); } else { $(".link_images img").hide(); $("#nav_img_btn").show(); $("img#1").fadeIn(); } }); $("#link_title_lable").click(function() { $("#link_title_lable").hide(); $("#link_feed_title").show(); $("#link_feed_title").focus(); }); $("#link_feed_title").blur(function(){ $("#link_title_lable").text($("#link_feed_title").val()); $("#link_title_lable").show(); $("#link_feed_title").hide(); }); $("#link_desc_lable").click(function() { $("#link_desc_lable").hide(); $("#link_feed_desc").show(); $("#link_feed_desc").focus(); }); $("#link_feed_desc").blur(function(){ $("#link_desc_lable").text($("#link_feed_desc").val()); $("#link_desc_lable").show(); $("#link_feed_desc").hide(); }); }); </script> </div> '; $fhtml = $html2 . $html; } // echo json_encode(array('result'=>'success','data'=> $fhtml)); // exit(); } catch (Exception $e) { // echo json_encode(array('result'=>'error','data'=>$e->getMessage())); // exit(); } return $images; }
// Stripslashes if (get_magic_quotes_gpc()) { $value = stripslashes($value); } // Convert all <, > etc. to normal html and then strip these $value = strtr($value, array_flip(get_html_translation_table(HTML_ENTITIES))); // Strip HTML Tags $value = strip_tags($value); // Quote the value $value = mysql_real_escape_string($value); $value = htmlspecialchars($value); return $value; } if (checkValues($_REQUEST['comment_text']) && $_REQUEST['post_id']) { $uname = $_SESSION['username']; mysql_query("INSERT INTO status_comments (post_id,user_name,comments,date_created) VALUES('" . $_REQUEST['post_id'] . "','" . $uname . "','" . checkValues($_REQUEST['comment_text']) . "','" . strtotime(date("Y-m-d H:i:s")) . "')"); $result = mysql_query("SELECT *,\n\t\tUNIX_TIMESTAMP() - date_created AS CommentTimeSpent FROM status_comments order by c_id desc limit 1"); } function clickable_link($text = '') { $text = preg_replace('#(script|about|applet|activex|chrome):#is', "\\1:", $text); $ret = ' ' . $text; $ret = preg_replace("#(^|[\n ])([\\w]+?://[\\w\\#\$%&~/.\\-;:=,?@\\[\\]+]*)#is", "\\1<a href=\"\\2\" target=\"_blank\">\\2</a>", $ret); $ret = preg_replace("#(^|[\n ])((www|ftp)\\.[\\w\\#\$%&~/.\\-;:=,?@\\[\\]+]*)#is", "\\1<a href=\"http://\\2\" target=\"_blank\">\\2</a>", $ret); $ret = preg_replace("#(^|[\n ])([a-z0-9&\\-_.]+?)@([\\w\\-]+\\.([\\w\\-\\.]+\\.)*[\\w]+)#i", "\\1<a href=\"mailto:\\2@\\3\">\\2@\\3</a>", $ret); $ret = substr($ret, 1); return $ret; } while ($rows = mysql_fetch_array($result)) { $days2 = floor($rows['CommentTimeSpent'] / (60 * 60 * 24)); $remainder = $rows['CommentTimeSpent'] % (60 * 60 * 24);