function get_weekly_report($start_date, $end_date) { global $useradmin; $end_date = strtotime($end_date); $daily_visits_array = array(); $daily_unique_visitors_array = array(); for ($i = strtotime('Last Monday', strtotime($start_date)); $i <= $end_date;) { $from = date('Y-m-d', $i); $i = strtotime('+1 week', $i); if ($i <= $end_date) { $to = date('Y-m-d', $i); } else { $to = date('Y-m-d', $end_date); } $selectSQL = "SELECT SQL_CALC_FOUND_ROWS DISTINCT device_id FROM visitor_log WHERE DATE(time_stamp)>='{$from}' AND DATE(time_stamp)<='{$to}' AND user_state='start'"; $get_record = mysql_query_or_die($selectSQL, $useradmin); $row = mysql_fetch_row(mysql_query("SELECT FOUND_ROWS()", $useradmin)); $visits = isset($row[0]) ? $row[0] : 0; $selectSQL = "SELECT SQL_CALC_FOUND_ROWS device_id FROM visitor_log WHERE DATE(time_stamp)>='{$from}' AND DATE(time_stamp)<='{$to}' AND user_state='start'"; $get_record = mysql_query_or_die($selectSQL, $useradmin); $row = mysql_fetch_row(mysql_query("SELECT FOUND_ROWS()", $useradmin)); $unique_visitors = isset($row[0]) ? $row[0] : 0; $daily_visits_array[$from] = $visits; $daily_unique_visitors_array[$from] = $unique_visitors; } $return_array = array("visits" => $daily_visits_array, "unique_visitors" => $daily_unique_visitors_array); return $return_array; }
function get_properties_summary($from, $size) { global $useradmin, $document_root; $properties_html_array = array(); $selectSQL = "SELECT * FROM listings WHERE status='A' AND publish_on_internet='Y' ORDER BY list_date DESC LIMIT {$from}, {$size} "; $get_properties = mysql_query_or_die($selectSQL, $useradmin); while ($row_get_properties = mysql_fetch_assoc($get_properties)) { //determing if photo is corrupted $image_url = 'http://www.' . $_SERVER['SERVER_NAME'] . '/images/' . $row_get_properties['sysid'] . '_1.jpg'; $image_size = getimagesize($image_url); if (empty($image_size) || empty($image_size[0]) || empty($image_size[1])) { $image_url = 'img/imgdemo/300x180.gif'; } $properties_html = '<li style="display: block;" class="span4">'; $properties_html .= '<div class="product-item">'; $properties_html .= '<div class="imagewrapper">'; $properties_html .= '<img alt="" width="300" height="180" src="' . $image_url . '">'; //$size=getimagesize($document_root.'/images/'.$row_get_properties['sysid'].'_1.jpg">'); $properties_html .= '<span class="price"> $' . number_format($row_get_properties['list_price']) . '</span>'; $properties_html .= '</div>'; $properties_html .= '<h3><a href="property_detail.php?sysid=' . $row_get_properties['sysid'] . '" title="">' . $row_get_properties['address'] . '</a></h3>'; $properties_html .= '<ul class="title-info">'; $properties_html .= '<li>Bathrooms <span> ' . $row_get_properties['bathrooms'] . '</span></li>'; $properties_html .= '<li>Bathrooms <span> ' . $row_get_properties['bedrooms'] . '</span></li>'; $properties_html .= '<li>Square Footage <span>' . $row_get_properties['floor_area_total'] . ' sqft</span></li>'; $properties_html .= '<li>Type: <span>' . $row_get_properties['type_of_dwelling'] . '</span></li>'; $properties_html .= '</ul>'; $properties_html .= '</div>'; $properties_html .= '</li>'; array_push($properties_html_array, $properties_html); } return $properties_html_array; }
function get_time($date) { global $useradmin; $selectSQL = "SELECT DISTINCT device_id from visitor_log WHERE DATE(time_stamp)='{$date}' AND user_state='start'"; $get_result = mysql_query_or_die($selectSQL, $useradmin); $total_time = 0; while ($row_get_result = mysql_fetch_assoc($get_result)) { $temp_device_id = $row_get_result['device_id']; $selectSQL = "SELECT * FROM visitor_log WHERE device_id='{$temp_device_id}' AND DATE(time_stamp)='{$date}' ORDER BY time_stamp ASC"; $result = mysql_query_or_die($selectSQL, $useradmin); while ($row_result = mysql_fetch_assoc($result)) { if ($row_result['user_state'] == 'start') { $selectSQL = "SELECT * FROM visitor_log WHERE device_id='{$temp_device_id}' AND time_stamp>'" . $row_result['time_stamp'] . "' ORDER BY time_stamp ASC LIMIT 0, 1"; $next_entry = mysql_fetch_assoc(mysql_query_or_die($selectSQL, $useradmin)); if ($next_entry['user_state'] == 'end') { $selectSQL = "SELECT TIMESTAMPDIFF(SECOND, '" . $row_result['time_stamp'] . "', '" . $next_entry['time_stamp'] . "') AS result"; $duration = mysql_fetch_assoc(mysql_query_or_die($selectSQL, $useradmin)); $total_time += $duration['result']; } else { } } } } return $total_time; }
function set_active($index) { global $useradmin; $updateSQL = "UPDATE top_banners SET cover_page = 'N'"; $result = mysql_query_or_die($updateSQL, $useradmin); $updateSQL = "UPDATE top_banners SET cover_page = 'Y' WHERE banner_id = " . $index; $result = mysql_query_or_die($updateSQL, $useradmin); }
function get_user_detail($email) { global $useradmin; $selectSQL = "SELECT * FROM user_profile WHERE email='" . $email . "' AND removed ='N'"; $get_user = mysql_query_or_die($selectSQL, $useradmin); if ($row_get_user = mysql_fetch_assoc($get_user)) { return $row_get_user; } else { return false; } }
function get_firm_profile($firm_code) { global $useradmin; $selectSQL = "SELECT * FROM firm_profile WHERE firm_code='" . $firm_code . "'"; $get_firm = mysql_query_or_die($selectSQL, $useradmin); if ($row_get_firm = mysql_fetch_assoc($get_firm)) { return $row_get_firm; } else { return false; } }
function insert_sysid($sysid) { global $useradmin; $selectSQL = "SELECT * FROM sysid_raw_current WHERE sysid={$sysid}"; $get_sysid = mysql_query_or_die($selectSQL, $useradmin); if ($row_get_sysid = mysql_fetch_assoc($get_sysid)) { } else { $insertSQL = sprintf("INSERT INTO sysid_raw_current (sysid) VALUES(%s)", GetSQLValueString($sysid, "int")); $result = mysql_query_or_die($insertSQL, $useradmin); } }
function get_num_of_photos($sysid) { global $useradmin; $selectSQL = "SELECT SQL_CALC_FOUND_ROWS listings.sysid, listings.album_id, listing_album.album_id, album_profile.photo_id, photo_profile.photo_id, photo_path FROM listings" . " LEFT JOIN listing_album ON listings.sysid=listing_album.sysid" . " LEFT JOIN album_profile ON listing_album.album_id=album_profile.album_id" . " LEFT JOIN photo_profile ON album_profile.photo_id=photo_profile.photo_id" . " WHERE listings.sysid={$sysid} AND !ISNULL(photo_path) GROUP BY photo_path"; $result = mysql_query_or_die($selectSQL, $useradmin); $row = mysql_fetch_row(mysql_query("SELECT FOUND_ROWS()", $useradmin)); if (is_array($row) && !empty($row)) { return $row[0]; } else { return false; } }
function insert_update_ranking($sysid, $ranking) { global $useradmin; $selectSQL = "SELECT sysid FROM listing_ranking WHERE sysid={$sysid}"; $get_sysid = mysql_query_or_die($selectSQL, $useradmin); if ($row_get_sysid = mysql_fetch_assoc($get_sysid)) { echo "<br/>sysid" . $row_get_sysid['sysid'] . "is already in the database<br/>"; $updateSQL = sprintf("UPDATE listing_ranking SET ranking=%s WHERE sysid=%s", GetSQLValueString($ranking, "double"), GetSQLValueString($row_get_sysid['sysid'], "int")); $result = mysql_query_or_die($updateSQL, $useradmin); } else { echo "<br/>{$sysid} is not in the database, inserting new record<br/>"; $insertSQL = sprintf("INSERT INTO listing_ranking (sysid, ranking) VALUES (%s, %s)", GetSQLValueString($sysid, "int"), GetSQLValueString($ranking, "double")); $result = mysql_query_or_die($insertSQL, $useradmin); } }
function get_weekly_report($start_date, $end_date) { global $useradmin; $end_date = strtotime($end_date); $return_array = array(); for ($i = strtotime('Monday', strtotime($start_date)); $i <= $end_date;) { $from = date('Y-m-d', $i); $i = strtotime('+1 week', $i); $to = date('Y-m-d', $i); $selectSQL = "SELECT SQL_CALC_FOUND_ROWS DISTINCT device_id FROM visitor_log WHERE DATE(time_stamp)>='{$from}' AND DATE(time_stamp)<='{$to}' AND user_state='start'"; $get_record = mysql_query_or_die($selectSQL, $useradmin); $row = mysql_fetch_row(mysql_query("SELECT FOUND_ROWS()", $useradmin)); $return_array[$from] = $row[0]; } return $return_array; }
function find_properties($realtor_id) { //echo "<br/>Entered find_properties function<br/>"; global $useradmin; //$order=" listings.date_updated_local,"; $filter = " AND (listing_realtors.list_realtor_1_id='" . $realtor_id . "' \n\t\t\t\t\t\tOR listing_realtors.list_realtor_2_id='" . $realtor_id . "' \n\t\t\t\t\t\tOR listing_realtors.list_realtor_3_id='" . $realtor_id . "')"; $selectSQL = "SELECT SQL_CALC_FOUND_ROWS DISTINCT listings.sysid FROM listings" . " LEFT JOIN listing_realtors ON listings.sysid=listing_realtors.sysid" . " WHERE status='A' AND !ISNULL(listings.album_id) AND listings.property_type!='Land Only' AND area_desc!='VOT' AND area_desc!='FOT'" . $filter . " ORDER BY date_updated_local DESC"; //echo "<br/>".$selectSQL."<br/>"; $get_properties = mysql_query_or_die($selectSQL, $useradmin); $row = mysql_fetch_row(mysql_query("SELECT FOUND_ROWS()", $useradmin)); //echo "<br/>found ".$row[0]." records<br/>"; if (is_array($row)) { return $row[0]; } else { return 0; } }
<?php $document_root = '/home/home365/public_html'; $domain_name = 'http://www.home365.ca/'; require_once $document_root . '/dbconnect/dbconnect.php'; require_once $document_root . '/utilities/utilities.php'; if (mysql_select_db("home365_ios", $useradmin)) { } else { echo "Error selecting database, exited."; exit; } $blog_id = isset($_POST['blog_id']) ? $_POST['blog_id'] : $_GET['blog_id']; if (isset($blog_id) && $blog_id != '') { $selectSQL = "SELECT * FROM blogs WHERE blog_id={$blog_id} AND status='P'"; $get_blog = mysql_query_or_die($selectSQL, $useradmin); if ($row_get_blog = mysql_fetch_assoc($get_blog)) { $blogObject = $row_get_blog; } else { echo "The artile you are looking for doesn't exist anymore"; exit; } $page_title = "编辑文章"; } else { $blogObject = array("blog_id" => '', "blog_content" => '', "blog_title" => ''); $page_title = "新建文章"; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head>
function get_firm_profile($firm_code) { global $useradmin; $selectSQL = "SELECT * FROM firm_profile WHERE firm_code='" . $firm_code . "'"; $get_firm = mysql_query_or_die($selectSQL, $useradmin); if ($row_get_firm = mysql_fetch_assoc($get_firm)) { foreach ($row_get_firm as $key => $value) { if ($value == null) { $row_get_firm[$key] = 'N/A'; } } return $row_get_firm; } else { return false; } }
<?php error_reporting(E_ALL); $document_root = '/home/home365/public_html'; require_once $document_root . '/dbconnect/dbconnect.php'; require_once $document_root . '/utilities/utilities.php'; if (mysql_select_db("home365_ios", $useradmin)) { } else { echo "Error selecting database, exited."; exit; } $user_id = isset($_POST['u']) ? $_POST['u'] : $_GET['u']; $hash = isset($_POST['h']) ? $_POST['h'] : $_GET['h']; if (!empty($user_id) && !empty($hash)) { $selectSQL = "SELECT * FROM user_profile WHERE user_id=" . $user_id . " AND user_hash='" . $hash . "'" . " AND removed='N'"; $get_user = mysql_query_or_die($selectSQL, $useradmin); if ($row_get_user = mysql_fetch_assoc($get_user)) { if ($row_get_user['status'] != 'A') { echo "Welcome" . $row_get_user['last_name'] . ",<br/>"; $updateSQL = "UPDATE user_profile SET status = 'A' WHERE user_id=" . $user_id; $result = mysql_query_or_die($updateSQL, $useradmin); echo "Activation complete!<br/>"; } else { echo "You have been activated. You don't have to do it again!<br/>"; } echo '<a href="javascript:window.close();">Close</a>'; } else { echo "we didn't find you"; } }
<?php $document_root = '/home/home365/public_html'; require_once $document_root . '/dbconnect/dbconnect.php'; require_once $document_root . '/utilities/utilities.php'; if (mysql_select_db("home365_ios", $useradmin)) { } else { echo "Error selecting database, exited."; exit; } $sysid = isset($_GET['sysid']) ? $_GET['sysid'] : $_POST['sysid']; if (!empty($sysid)) { $selectSQL = "SELECT * FROM listings WHERE publish_on_internet='Y' AND status='A' AND sysid=" . $sysid; $get_property = mysql_query_or_die($selectSQL, $useradmin); $propertyObject = array(); if ($propertyObject = mysql_fetch_assoc($get_property)) { } else { } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>RealEstast</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="description" content=""> <meta name="author" content=""> <!-- Your styles --> <link href="../test1/css/bootstrap.css" rel="stylesheet" media="screen">
function get_geocode($address, $sysid) { global $useradmin; $selectSQL = "SELECT * FROM listing_geoaddress WHERE sysid=" . $sysid; $get_geocode = mysql_query_or_die($selectSQL, $useradmin); if ($row_get_geocode = mysql_fetch_assoc($get_geocode)) { return $row_get_geocode; } else { echo "<br/>Entering google api<br/>"; $url = "http://maps.google.com/maps/api/geocode/json?sensor=false&address=" . urlencode($address); $resp_json = file_get_contents($url); $resp = json_decode($resp_json, true); var_dump($resp); if ($resp['status'] == 'OK') { $lat = $resp['results'][0]['geometry']['location']['lat']; $lng = $resp['results'][0]['geometry']['location']['lng']; echo '<br/>' . $lat . '<br/>'; echo '<br/>' . $lng . '<br/>'; if (!empty($lat) && !empty($lng)) { $insertSQL = sprintf("INSERT INTO listing_geoaddress(sysid, lat, lng)VALUES(%s,%s,%s)", GetSQLValueString($sysid, "int"), GetSQLValueString($lat, "double"), GetSQLValueString($lng, "double")); $result = mysql_query_or_die($insertSQL, $useradmin); return $resp['results'][0]['geometry']['location']; } else { return false; } } else { return false; } } }
//$selectSQL = "SELECT * FROM blogs WHERE removed='N' AND status= 'P' ORDER BY last_updated_UTC DESC, date_created_UTC DESC"; $selectSQL = "SELECT SQL_CALC_FOUND_ROWS DISTINCT en, cn FROM city_profile WHERE en LIKE '%" . $keyword . "%' OR cn LIKE '%" . $keyword . "%' OR cn_tr LIKE '%" . $keyword . "%'"; $get_city = mysql_query_or_die($selectSQL, $useradmin); $row_city = mysql_fetch_row(mysql_query("SELECT FOUND_ROWS()", $useradmin)); $city_array = array(); while ($row_get_city = mysql_fetch_assoc($get_city)) { array_push($city_array, $row_get_city); } $selectSQL = "SELECT SQL_CALC_FOUND_ROWS DISTINCT address, city FROM listings WHERE address LIKE '%" . $keyword . "%' AND status='A' AND property_type!='Land Only' AND !ISNULL(listings.album_id) AND area_desc!='VOT' AND area_desc!='FOT'"; $get_address = mysql_query_or_die($selectSQL, $useradmin); $row_address = mysql_fetch_row(mysql_query("SELECT FOUND_ROWS()", $useradmin)); $address_array = array(); while ($row_get_address = mysql_fetch_assoc($get_address)) { array_push($address_array, $row_get_address); } $selectSQL = "SELECT SQL_CALC_FOUND_ROWS DISTINCT sub_area FROM subarea_profile WHERE sub_area LIKE '%" . $keyword . "%'"; $get_sub_area = mysql_query_or_die($selectSQL, $useradmin); $subarea_rows = mysql_fetch_row(mysql_query("SELECT FOUND_ROWS()", $useradmin)); $subarea_array = array(); while ($row_get_sub_area = mysql_fetch_assoc($get_sub_area)) { array_push($subarea_array, $row_get_sub_area); } if (count($city_array) > 0 || count($address_array) > 0 || count($subarea_array) > 0) { $return_code = 0; $error = "success"; } else { $return_code = 1; $error = "no results found"; } $return_array = array("return_code" => $return_code, "error" => $error, "city_number" => $row_city[0], "city" => $city_array, "address_number" => $row_address[0], "address" => $address_array, "sub_area_number" => $subarea_rows[0], "sub_area" => $subarea_array); echo json_encode($return_array);
function get_properties_summary($from, $size, $theme) { global $useradmin, $document_root; $properties_html_array = array(); $selectSQL = "SELECT SQL_CALC_FOUND_ROWS DISTINCT * FROM listings LEFT JOIN listing_album ON listings.sysid = listing_album.sysid LEFT JOIN album_profile ON listing_album.album_id=album_profile.album_id LEFT JOIN photo_profile ON photo_profile.photo_id=album_profile.photo_id WHERE status='A' AND publish_on_internet='Y' AND album_profile.cover='Y' ORDER BY list_date DESC LIMIT {$from}, {$size} "; $get_properties = mysql_query_or_die($selectSQL, $useradmin); $row = mysql_fetch_row(mysql_query("SELECT FOUND_ROWS()", $useradmin)); while ($row_get_properties = mysql_fetch_assoc($get_properties)) { //determing if photo is corrupted $image_url = $row_get_properties['photo_path']; $image_size = getimagesize($image_url); $type = $row_get_properties['type_of_dwelling']; $li_class = ' ' . str_replace('/', ' ', $type); if (empty($image_size) || empty($image_size[0]) || empty($image_size[1])) { $image_url = 'img/imgdemo/300x180.gif'; } if ($theme == 'home') { $properties_html = '<li style="display: block;" class="span4' . $li_class . '">'; $properties_html .= '<div class="product-item">'; $properties_html .= '<div class="imagewrapper">'; $properties_html .= '<img alt="" width="300" height="180" src="' . $image_url . '">'; //$size=getimagesize($document_root.'/images/'.$row_get_properties['sysid'].'_1.jpg">'); $properties_html .= '<span class="price"> $' . number_format($row_get_properties['list_price']) . '</span>'; $properties_html .= '</div>'; $properties_html .= '<h3><a href="property_detail.php?sysid=' . $row_get_properties['sysid'] . '" title="">' . $row_get_properties['address'] . '</a></h3>'; $properties_html .= '<ul class="title-info">'; $properties_html .= '<li>Bedrooms 睡房<span> ' . $row_get_properties['bedrooms'] . '</span></li>'; $properties_html .= '<li>Bathrooms 卫生间<span> ' . $row_get_properties['bathrooms'] . '</span></li>'; $properties_html .= '<li>Square Footage 套内面积<span>' . $row_get_properties['floor_area_total'] . ' sqft</span></li>'; $properties_html .= '<li>Type 房型 <span>' . $row_get_properties['type_of_dwelling'] . '</span></li>'; $properties_html .= '</ul>'; $properties_html .= '</div>'; $properties_html .= '</li>'; } elseif ($theme == 'list') { $properties_html = '<li style="display: block;" class="span12">'; $properties_html .= '<div class="product-item">'; $properties_html .= '<div class="row">'; $properties_html .= '<div class="span4">'; $properties_html .= '<div class="imagewrapper">'; $properties_html .= '<img alt="" width="300" height="180" src="' . $image_url . '">'; $properties_html .= '<span class="price"> $' . number_format($row_get_properties['list_price']) . '</span>'; $properties_html .= '</div>'; $properties_html .= '</div>'; $properties_html .= '<div class="span8">'; $properties_html .= '<div class="list-right-info">'; $properties_html .= '<div class="row">'; $properties_html .= '<div class="span4">'; $properties_html .= '<h3><a href="property_detail.php?sysid=' . $row_get_properties['sysid'] . '" title="">' . $row_get_properties['address'] . '</a></h3>'; $properties_html .= '<p>'; $proerties_html .= $row_get_properties['public_remarks']; $properties_html .= '</p>'; $properties_html .= '</div>'; $properties_html .= '<div class="span4">'; $properties_html .= '<ul class="title-info">'; $properties_html .= '<li>Bedrooms 睡房<span> ' . $row_get_properties['bedrooms'] . '</span> </li>'; $properties_html .= '<li>Bathrooms 卫生间<span> ' . $row_get_properties['bathrooms'] . '</span></li>'; $properties_html .= '<li>Square Footage 套内面积<span>' . $row_get_properties['floor_area_total'] . ' sqft</span></li>'; $properties_html .= '<li>Type 房型<span>' . $row_get_properties['type_of_dwelling'] . '</span></li>'; $properties_html .= '</ul>'; $properties_html .= '</div>'; $properties_html .= '</div>'; $properties_html .= '</div>'; $properties_html .= '</div>'; $properties_html .= '</div>'; $properties_html .= '</div>'; $properties_html .= '</li>'; } array_push($properties_html_array, $properties_html); } $return_array = array("rows" => intval($row[0]), "html" => $properties_html_array); return $return_array; }
function record($start_date, $end_date) { global $useradmin; $start = new DateTime($start_date); $end = new DateTime($end_date); $end = $end->modify('+1 day'); $interval = new DateInterval('P1D'); $period = new DatePeriod($start, $interval, $end); //var_dump($period); foreach ($period as $date) { $index_date = $date->format('Y-m-d'); //echo $index_date; $unique_visitors = get_unique_visits($index_date); $visits = get_visits($index_date); $time = get_time($index_date); //echo "<br/><br/>".$index_date."<br/><br/>"; //echo "unique visitors:".$unique_visitors."<br/>"; //echo "visits:".$visits."<br/>"; //echo "total time:".$time."<br/>"; $selectSQL = "SELECT * FROM visitor_daily_report WHERE report_date='" . $index_date . "'"; if ($row_record = mysql_fetch_assoc(mysql_query_or_die($selectSQL, $useradmin))) { //echo "<br/>record already in database!<br/>"; $updateSQL = sprintf("UPDATE visitor_daily_report SET visits=%s, unique_visitors=%s, total_time=%s WHERE report_date=%s", GetSQLValueString($visits, "int"), GetSQLValueString($unique_visitors, "int"), GetSQLValueString($time, "int"), GetSQLValueString($index_date, "date")); $result = mysql_query_or_die($updateSQL, $useradmin); } else { //echo "<br/>inserting new record into database!<br/>"; $insertSQL = sprintf("INSERT INTO visitor_daily_report (report_date, visits, unique_visitors, total_time) VALUES(%s, %s, %s, %s)", GetSQLValueString($index_date, "date"), GetSQLValueString($visits, "int"), GetSQLValueString($unique_visitors, "int"), GetSQLValueString($time, "int")); $result = mysql_query_or_die($insertSQL, $useradmin); } } }
function get_open_house() { global $useradmin, $current_YVR_date; $selectSQL = "SELECT sysid, open_house, last_trans_date, public_remarks, public_remarks_2 FROM listings WHERE (LOWER(public_remarks) LIKE '%open house%' OR LOWER(public_remarks_2) LIKE '%open house%') AND status='A' AND !ISNULL(listings.album_id) AND listings.property_type!='Land Only' AND area_desc!='VOT' AND area_desc!='FOT' AND DATE(last_trans_date)='" . $current_YVR_date . "'"; $get_listing = mysql_query_or_die($selectSQL, $useradmin); //$string_array=array(); while ($row_get_listing = mysql_fetch_assoc($get_listing)) { //echo "<br/><h1>".$row_get_listing[sysid]."</h1><br/>"; $description = $row_get_listing['public_remarks'] . $row_get_listing['public_remarks_2']; $pattern = '/(?i)open house(.+)/'; preg_match($pattern, $description, $matches); $date_string = process_date($matches[1]); $last_trans_year = date('Y', strtotime($row_get_listing['last_trans_date'])); if (!empty($date_string)) { $open_house_date = $last_trans_year . '-' . $date_string; } $temp_array = array("original" => $matches[1], "date" => $open_house_date); if (!empty($open_house_date)) { if (!empty($row_get_listing['open_house'])) { if ($open_house_date != $row_get_listing['open_house']) { echo '<br/>' . $row_get_listing['sysid'] . ' already has an open house date but a new open house date is set.Updating...<br/>'; $updateSQL = sprintf("UPDATE listings SET open_house=%s WHERE sysid=%s", GetSQLValueString($open_house_date, "date"), GetSQLValueString($row_get_listing['sysid'], "int")); $result = mysql_query_or_die($updateSQL, $useradmin); } else { echo '<br/>' . $row_get_listing['sysid'] . ' already has an open house date, and it is the most updated version...<br/>'; } } else { echo '<br/>' . $row_get_listing['sysid'] . ' does not have an open house date.<br/>'; $updateSQL = sprintf("UPDATE listings SET open_house=%s WHERE sysid=%s", GetSQLValueString($open_house_date, "date"), GetSQLValueString($row_get_listing['sysid'], "int")); $result = mysql_query_or_die($updateSQL, $useradmin); } } unset($open_house_date); //array_push($string_array, $temp_array); } //echo json_encode($string_array); }
function get_photo_id($sysid) { global $useradmin; $selectSQL = "SELECT album_profile.photo_id FROM listing_album" . " LEFT JOIN album_profile ON listing_album.album_id=album_profile.album_id" . " LEFT JOIN photo_profile ON album_profile.photo_id=photo_profile.photo_id" . " WHERE !ISNULL(photo_profile.photo_id) AND !ISNULL(photo_profile.photo_path) AND listing_album.sysid=" . $sysid . " GROUP BY photo_path"; $get_photo_id = mysql_query_or_die($selectSQL, $useradmin); $photo_id_array = array(); while ($row_get_photo_id = mysql_fetch_assoc($get_photo_id)) { array_push($photo_id_array, $row_get_photo_id['photo_id']); } return $photo_id_array; }
$password = isset($_POST['password']) ? $_POST['password'] : $_GET['password']; $email = isset($_POST['email']) ? $_POST['email'] : $_GET['email']; $gender = isset($_POST['gender']) ? $_POST['gender'] : $_GET['gender']; $user_hash = sha1(mt_rand(10000, 99999) . time() . $email); $current_GMT_time = get_GMT(time()); $current_date_time_string = date("Y-m-d H:i:s", $current_GMT_time); if (!empty($email)) { $selectSQL = "SELECT * FROM user_profile WHERE email ='" . $email . "'"; $get_user = mysql_query_or_die($selectSQL, $useradmin); if ($row_get_user = mysql_fetch_assoc($get_user)) { $return_code = 1; $error = "email has been registered"; } else { if (!empty($lastname) && !empty($gender)) { $insertSQL = sprintf("INSERT INTO user_profile(last_name, password, gender, email, user_hash, date_registered)VALUES(%s,%s,%s,%s,%s,%s)", GetSQLValueString($lastname, "text"), GetSQLValueString($password, "text"), GetSQLValueString($gender, "text"), GetSQLValueString($email, "text"), GetSQLValueString($user_hash, "text"), GetSQLValueString($current_date_time_string, "date")); $result = mysql_query_or_die($insertSQL, $useradmin); $user_id = mysql_insert_id(); require_once 'phpmailer/PHPMailerAutoload.php'; $mail = new PHPMailer(); $mail->isSMTP(); //$mail->SMTPDebug = 1; $mail->Host = 'host.zhidaomedia.com'; $mail->Port = 465; $mail->SMTPAuth = true; $mail->Username = '******'; $mail->Password = '******'; $mail->SMTPSecure = 'ssl'; $mail->From = '*****@*****.**'; $mail->FromName = 'Mailer'; $mail->addAddress($email); $mail->isHTML(true);