public static function test($fpTypeID) { $ob_mapping = new Mapping(); $table_name = $ob_mapping->get_mappped_value('map_table_names', 'l_mlp_property'); $querySelect = "SELECT 1 FROM {$table_name} WHERE listingType = 'rhsProject' AND fpTypeID = {$fpTypeID} AND specialListingID = 3"; my_print($querySelect); $dbhSelect = self::$dbh->prepare($querySelect); if (!$dbhSelect) { my_print(self::$dbh->errorInfo()); die; } $dbhSelect->execute(); $ar_result = $dbhSelect->fetchAll(PDO::FETCH_ASSOC); if (count($ar_result)) { return false; } $queryInsert = "INSERT INTO {$table_name} (listingType, fpTypeID, specialListingID) VALUES ('rhsProject', {$fpTypeID}, 3)"; $dbhInsert = self::$dbh->prepare($queryInsert); if (!$dbhInsert) { my_print(self::$dbh->errorInfo()); die; } $dbhInsert->execute(); $last_id = self::$dbh->lastInsertId(); return $last_id; }
public function get_property_name($key) { if (isset($this->property_names[$key])) { return $this->property_names[$key]; } else { my_print(debug_backtrace()); die("The key {$key} not exist."); } }
static function Get() { $conn = GetConnection(); $results = $conn->query("SELECT * FROM 2015Fall_Persons"); $row = $results->fetch_assoc(); //var_dump($row);//=> its like "print(r);" //echo '<pre>' //print_r my_print($row); }
function FetchAll($sql) { $ret = array(); $conn = GetConnection(); $results = $conn->query($sql); $error = $conn->error; if ($error) { //or echo $error my_print($error); } else { while ($rs = $results->fetch_assoc()) { $ret[] = $rs; } } $conn->close(); return $ret; }
public static function save_data($table, $data = array()) { if (!is_array($data)) { die("No value to insert into {$table} \n"); } $columns = array_keys($data); $values = array_values($data); if (count($columns) != count($values)) { die("No of columns are not matched with no. of values while inserting into table {$table}. \n"); } $str_columns = join($columns, ', '); $str_values = join($values, '\', \''); $query = "INSERT INTO {$table} ({$str_columns}) VALUES ('{$str_values}')"; $dbh = self::$dbh->prepare($query); if (!$dbh) { my_print(self::$dbh->errorInfo()); die; } $dbh->execute(); $last_id = self::$dbh->lastInsertId(); return $last_id; }
function select(&$r, &$w, &$e, $tv_sec = 0, $tv_usec = 0) { $streams_r = array(); $streams_w = array(); $streams_e = array(); $sockets_r = array(); $sockets_w = array(); $sockets_e = array(); if ($r) { foreach ($r as $resource) { switch (get_rtype($resource)) { case 'socket': $sockets_r[] = $resource; break; case 'stream': $streams_r[] = $resource; break; default: my_print("Unknown resource type"); break; } } } if ($w) { foreach ($w as $resource) { switch (get_rtype($resource)) { case 'socket': $sockets_w[] = $resource; break; case 'stream': $streams_w[] = $resource; break; default: my_print("Unknown resource type"); break; } } } if ($e) { foreach ($e as $resource) { switch (get_rtype($resource)) { case 'socket': $sockets_e[] = $resource; break; case 'stream': $streams_e[] = $resource; break; default: my_print("Unknown resource type"); break; } } } $n_sockets = count($sockets_r) + count($sockets_w) + count($sockets_e); $n_streams = count($streams_r) + count($streams_w) + count($streams_e); #my_print("Selecting $n_sockets sockets and $n_streams streams with timeout $tv_sec.$tv_usec"); $r = array(); $w = array(); $e = array(); # Workaround for some versions of PHP that throw an error and bail out if # select is given an empty array if (count($sockets_r) == 0) { $sockets_r = null; } if (count($sockets_w) == 0) { $sockets_w = null; } if (count($sockets_e) == 0) { $sockets_e = null; } if (count($streams_r) == 0) { $streams_r = null; } if (count($streams_w) == 0) { $streams_w = null; } if (count($streams_e) == 0) { $streams_e = null; } $count = 0; if ($n_sockets > 0) { $res = socket_select($sockets_r, $sockets_w, $sockets_e, $tv_sec, $tv_usec); if (false === $res) { return false; } if (is_array($r) && is_array($sockets_r)) { $r = array_merge($r, $sockets_r); } if (is_array($w) && is_array($sockets_w)) { $w = array_merge($w, $sockets_w); } if (is_array($e) && is_array($sockets_e)) { $e = array_merge($e, $sockets_e); } $count += $res; } if ($n_streams > 0) { $res = stream_select($streams_r, $streams_w, $streams_e, $tv_sec, $tv_usec); if (false === $res) { return false; } if (is_array($r) && is_array($streams_r)) { $r = array_merge($r, $streams_r); } if (is_array($w) && is_array($streams_w)) { $w = array_merge($w, $streams_w); } if (is_array($e) && is_array($streams_e)) { $e = array_merge($e, $streams_e); } $count += $res; } #my_print(sprintf("total: $count, Modified counts: r=%s w=%s e=%s", count($r), count($w), count($e))); return $count; }
function channel_create_stdapi_net_udp_client($req, &$pkt) { my_print("creating udp client"); $peer_host_tlv = packet_get_tlv($req, TLV_TYPE_PEER_HOST); $peer_port_tlv = packet_get_tlv($req, TLV_TYPE_PEER_PORT); # We can't actually do anything with local_host and local_port because PHP # doesn't let us specify these values in any of the exposed socket API # functions. #$local_host_tlv = packet_get_tlv($req, TLV_TYPE_LOCAL_HOST); #$local_port_tlv = packet_get_tlv($req, TLV_TYPE_LOCAL_PORT); $sock = connect($peer_host_tlv['value'], $peer_port_tlv['value'], 'udp'); my_print("UDP channel on {$sock}"); if (!$sock) { return ERROR_CONNECTION_ERROR; } # # If we got here, the connection worked, respond with the new channel ID # $id = register_channel($sock); packet_add_tlv($pkt, create_tlv(TLV_TYPE_CHANNEL_ID, $id)); add_reader($sock); return ERROR_SUCCESS; }
foreach($ai_results as $ai_key => $ai_result) { $app_output .= print_r($ai_result, 1); $aw_details[] = $ai_result; } $ob_log->write("Get wash dry data for appointmentID: {$result['appointmentID']} ");*/ debug_message('Gathered Appointment data.'); // Gather the property type if (isset($result['propertyType']) and !empty($result['propertyType'])) { //$property_type = $arr_propery_types[strtolower($result['propertyType'])]; // To Do - add to Mapping class $property_type = strtolower($result['propertyType']); // To Do - add to Mapping class } else { die('Property type is not defined in the appointment ' . $result['appointmentID']); } my_print($result['appointmentID']); //my_print($ap_details); if (!count($ap_details)) { $ob_log->write("Appointment details not found for {$result['appointmentID']}. Cron skip this appointment."); continue; } if ($result['propertyPurpose'] == 1) { $propertyPurpose = 'Sell'; } elseif ($result['propertyPurpose'] == 2) { $propertyPurpose = 'Rent'; } // property data array $arr_property = array('propertyKey' => $ob_property::get_rand_id(), 'userID' => $result['userTypeID'], 'propertyTypeID' => $property_type, 'propertyFeatured' => 'OFF', 'propertyPurpose' => $propertyPurpose, 'propertyCoverImage' => NULL, 'propertyAddedDate' => date("Y-m-d H:i:s"), 'propertyUpdateDate' => date("Y-m-d H:i:s"), 'propertyApprovedDate' => NULL, 'propertySoldOutStatus' => 'No', 'propertySoldOutPrice' => 0, 'propertySoldOutDate' => NULL, 'propertyLatitude' => NULL, 'propertyLongitude' => NULL, 'countryID' => 99, 'stateID' => NULL, 'cityID' => NULL, 'cityLocID' => NULL, 'communityID' => 0, 'subCommunityID' => 0, 'buildingID' => 0, 'propertyZipCode' => $ap_details[0]['pincode'], 'propertyStatus' => 'draft', 'propertyPopularity' => 0, 'propertyThreeSixtyView' => NULL, 'propertyRank' => 0, 'projectID' => $result['projectID'], 'type' => 'Property', 'isNegotiable' => $ap_details[0]['rentNegotiable'] ? 'Yes' : 'No'); // Save the property $property_id = $ob_property::save_data('rp_properties', $arr_property); ##$property_id = 520;
<form class="form-horizontal" action="?action=delete" method="post" > <div class="modal-header"> <a href="?" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></a> <h4 class="modal-title" id="myModalLabel">Delete a person</h4> </div> <div class="modal-body"> <? my_print($errors); ?> <h5>Are you sure you want to delete <?php echo $model['Name']; ?> ?</h5> </div> <div class="modal-footer"> <input type="hidden" name="id" value="<?php echo $model['id']; ?> " /> <a href="?" class="btn btn-default" data-dismiss="modal" >Cancel </a> <input type="submit" name="submit" class="btn btn-primary" value="Save changes" /> </div> </form>
<?php include_once '../Models/User.php'; $user = User::Get(); my_print($user);
public static function get_attribute_type($attr_id) { if (isset(self::$attribute_types[$attr_id])) { return self::$attribute_types[$attr_id]; } else { $query = "select attrInputType\n\t\t\t\tfrom rp_attributes ao\n\t\t\t\twhere attributeID = {$attr_id}"; $dbh = self::$dbh->prepare($query); if (!$dbh) { my_print(self::$dbh->errorInfo()); die; } //my_print($dbh->queryString); $dbh->execute(); $results = $dbh->fetchAll(PDO::FETCH_ASSOC); self::$attribute_types[$attr_id] = $results[0]['attrInputType']; return $results[0]['attrInputType']; } }
public static function update_data($table, $data, $key_field) { $ar_columns = array(); $str_columns = array(); // Todo : use a validation class to get validation massages if (!is_string($table)) { die("\$table should be a string \n"); } if (!is_array($data)) { die("\$data should be an array \n"); } if (!is_string($key_field)) { die("\$key_field should be an array \n"); } if (isset($data[$key_field])) { $key_value = $data[$key_field]; unset($data[$key_field]); } else { echo "The key field <em>{$key_field}</em> is not in the data."; die; } foreach ($data as $col_name => $col_value) { $ar_columns[] = "{$col_name} = '{$col_value}'"; } $str_columns = join($ar_columns); $ob_mapping = new Mapping(); $table_name = $ob_mapping->get_mappped_value('map_table_names', $table); $query = "UPDATE {$table_name} SET {$str_columns} WHERE {$key_field} = '{$key_value}'"; $dbh = self::$dbh->prepare($query); //my_print($query); if (!$dbh) { my_print(self::$dbh->errorInfo()); die; } $dbh->execute(); $last_id = self::$dbh->lastInsertId(); return $last_id; }
<?php include_once '../Model/person.php'; $persons = Person::Get(); my_print($persons);
<?php my_print($model);
$ob_log->write("Remote User Agents: {$hua}"); $ob_log->write(""); /*** Availble variables $ob_listing $ob_campaign */ // Get all appointments whose status is complete // To do - This should go in the Appointment class $map = new Mapping(); //my_print($map->get_all_keys('map_table_names')); // ------------------------------ Start Project of the month ------------------------------ // ##$listings = $ob_listing::get_data('l_main', 'specialListingSection', 'projectOfMonth'); $listings = $ob_listing::get_data('l_main'); my_print($listings); $listing_ids = array(); $listingUpdateDates = array(); $inventories = $ob_campaign::get_project_of_month(); foreach ($listings as $listing) { $listing_ids[] = (int) $listing['specialListingID']; $listingUpdateDates[$listing['specialListingID']] = $listing['specialListingUpdatedDate']; $listingTypes[$listing['specialListingID']] = $listing['specialListingSection']; $listingCity[$listing['specialListingID']] = $ob_campaign::get_field_value('l_cities', 'cityID', 'specialListingID', $listing['specialListingID']); } // Clean the special Listing Tables if (count($inventories)) { foreach ($listing_ids as $listing_id) { if (strtotime(date('Y-m-d')) > strtotime($listingUpdateDates[$listing_id])) { # Delete the existing date from listing $ob_listing::delete_data('l_dates', 'specialListingID', $listing_id, 'scheduleDate < CURDATE()');
ini_set('display_errors', 1); error_reporting(E_ALL); define('DEBUG_MODE', 'On'); require_once 'classes/class_logger.php'; require_once 'config/obdb.php'; require_once 'classes/class_prod_listing.php'; require_once 'classes/class_mappings.php'; // Begin script debug_message('Script begin.'); /** * Save the Agent information */ $ob_log->write("Remote IP: {$_SERVER['REMOTE_ADDR']}"); $ob_log->write("Remote User Agents: {$_SERVER['HTTP_USER_AGENT']}"); $ob_log->write(""); /*** Availble variables $ob_listing $ob_appointment */ // Get all appointments whose status is complete // To do - This should go in the Appointment class $results = $ob_listing::get_data('l_main'); $count = count($results); my_print($results); $ob_log->write("Total {$count} completed appointment found."); $app_db = NULL; $admin_dbh = NULL; $ob_log->write("Script execution complete."); exit('Script execution complete.');