예제 #1
0
                 $targetPath = "uploads/" . $image_name;
                 // Target path where file is to be stored
                 move_uploaded_file($sourcePath, $targetPath);
                 // Moving Uploaded file
                 //echo "<span id='success'>Image Uploaded Successfully...!!</span><br/>";
             }
         }
     } else {
         echo "invalid_file";
     }
 } else {
     $image_name = mysql_real_escape_string(trim($_POST['image']));
 }
 /* file processing code end here*/
 $map_address = $location . "," . $city . "," . $state . "," . $country;
 $lat_long = Get_LatLng_From_Google_Maps($map_address);
 $add_user = "******" . $title . "' ,short_description='" . $short_description . "' ,price='" . $price . "' ,image='" . $image_name . "' ,";
 $add_user .= " long_description='" . $long_description . "' ,address='" . $location . "' ,created_at='" . $date . "' ,user_id='0' ,opening_time='" . $time_start . "', ";
 $add_user .= " city='" . $city . "',state='" . $state . "' ,country='" . $country . "' ,latt='" . $lat_long['lat'] . "' ,longt='" . $lat_long['lng'] . "',activity_level='" . $activity_level . "' WHERE id='" . $add_id . "' ";
 $mysql_user = mysql_query($add_user) or die(mysql_error());
 if ($mysql_user) {
     //$id=mysql_insert_id();
     /*Insert advertise opening and closing timing with particular day*/
     /* $ad_time="Update ad_timing set open='".$time_start."'  WHERE ad_id='".trim($add_id)."' ";
     		$mysql_time = mysql_query($ad_time) or die(mysql_error());
     		if($mysql_time)
     		{
     			echo "success";
     		} else
     		{
     			echo "error";
예제 #2
0
}
if (isset($_POST['submit'])) {
    $nlname = $_POST['name'];
    $nlname = strtoupper($nlname);
    $naddress = $_POST['address'];
    $newaddress = urlencode($naddress);
    $nphone = $_POST['phone'];
    $nzip = $_POST['zip'];
    $ndesc = $_POST['message'];
    $ndesc = strtoupper($ndesc);
    $nlink = $_POST['link'];
    $nestd = $_POST['estd'];
    $nemail = $_POST['email'];
    $nowner = $_POST['owner'];
    $nowner = strtoupper($nowner);
    $coordinates = Get_LatLng_From_Google_Maps($newaddress);
    $lati = $coordinates['lat'];
    $long = $coordinates['lng'];
    if (is_uploaded_file($_FILES['file']['tmp_name'][0])) {
        for ($t = 0; $t < 5; $t++) {
            if (!is_uploaded_file($_FILES['file']['tmp_name'][$t])) {
                $nimage[$t] = "defaultlab.jpg";
                $name2[$t] = 'defaultlab.jpg';
                $nimage[$t] = file_get_contents($nimage[$t]);
                $nimage[$t] = base64_encode($nimage[$t]);
            } else {
                $nimage[$t] = addslashes($_FILES['file']['tmp_name'][$t]);
                $name2 = addslashes($_FILES['file']['name'][$t]);
                $nimage[$t] = file_get_contents($nimage[$t]);
                $nimage[$t] = base64_encode($nimage[$t]);
            }
    $jsondata = json_decode($data, true);
    // If the json data is invalid, return empty array
    if (!check_status($jsondata)) {
        return array();
    }
    $LatLng = array('lat' => $jsondata["results"][0]["geometry"]["location"]["lat"], 'lng' => $jsondata["results"][0]["geometry"]["location"]["lng"]);
    return $LatLng;
}
echo "starting";
$sql = "Select id,address from labbranch";
$result = mysql_query($sql);
while ($row = mysql_fetch_row($result)) {
    $add = $row[1];
    $aid = $row[0];
    $add = str_replace(' ', '+', $add);
    $coordinates = Get_LatLng_From_Google_Maps($add);
    $lati = $coordinates['lat'];
    $long = $coordinates['lng'];
    $s = mysql_query("UPDATE labbranch SET latitude='{$lati}', longitude='{$long}' WHERE id='{$aid}'");
    echo 'success' . $aid . '';
}
echo "all done success";
/* 
* Check if the json data from Google Geo is valid 
*/
function check_status($jsondata)
{
    if ($jsondata["status"] == "OK") {
        return true;
    }
    return false;