Jump to content

MiCR0

Members
  • Posts

    114
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

MiCR0's Achievements

Member

Member (2/5)

0

Reputation

  1. I think you mean substr() however sure I could do that however if there is a better way as this will loop 100,000 of times
  2. I want to round off an integer vaule to 10-6 grd from 52.71666666 to 52716666 0.926888888 to 926888 does anyone know a simple way to do this?
  3. I have found how to do this in perl foreach (@{$r->{data}{array}}) { if (length($_->{latitude})) { print " <item rdf:about=\"$_->{objectno}\">\n"; print " <title>$_->{objectno} - $_->{objectname}</title>\n"; print " <description>$_->{postext}</description>\n"; print " <georss:point>"; if ($_->{latitude} =~ /(\d+).*?(\d+).*?(\d+\.\d*)\s+([sN])/) { my $latitude = $1+$2/60+$3/3600; $latitude *= -1 if ($4 eq 'S'); print $latitude; } print ' '; if ($_->{longitude} =~ /(\d+).*?(\d+).*?(\d+\.\d*)\s+([EW])/) { my $longitude = $1+($2/60+$3/3600); $longitude *= -1 if ($4 eq 'W'); print $longitude; } print "</georss:point>\n"; print " </item>\n"; } }
  4. I am trying to work out how to convert DMS to WGS84 I have the coordinate in mysql like latitude longitude 52°39'03.1 N 0°40'36.1 E 52°46'45.2 N 0°06'59.9 W Any help would be great thanks.
  5. I am trying to work out how to convert DMS to WGS84 I have the coordinate in mysql like latitude longitude 52°39'03.1 N 0°40'36.1 E 52°46'45.2 N 0°06'59.9 W I need to make them WGS84 and I find a functions <?php function DMStoDEC($deg,$min,$sec) { // Converts DMS ( Degrees / minutes / seconds ) // to decimal format longitude / latitude return $deg+((($min*60)+($sec))/3600); } function DECtoDMS($dec) { // Converts decimal longitude / latitude to DMS // ( Degrees / minutes / seconds ) // This is the piece of code which may appear to // be inefficient, but to avoid issues with floating // point math we extract the integer part and the float // part by using a string function. $vars = explode(".",$dec); $deg = $vars[0]; $tempma = "0.".$vars[1]; $tempma = $tempma * 3600; $min = floor($tempma / 60); $sec = $tempma - ($min*60); return array("deg"=>$deg,"min"=>$min,"sec"=>$sec); } I had a go at it doing $lat = explode("°",$data->latitude); $lat2 = explode("'",$lat[1]); $lat3 = explode(" ",$lat2[1]); $longitude = explode("°",$data->longitudeitude); $longitude2 = explode("'",$longitude[1]); $longitude3 = explode(" ",$longitude2[1]); echo $lat['0'].'-'.$lat2[0].'-'.$lat3[0]; echo '<br/>'; echo $longitude['0'].'-'.$longitude[0].'-'.$longitude[0]; echo DMStoDEC($lat['0'],$lat2[0],$lat3[0]); echo DMStoDEC($longitude['0'],$longitude2[0],$longitude3[0]); ?> I am stuck any help would be great.
  6. I am trying to work out how to work out rank on google results. I so far have the results of the first page however can not work out how to get to the next page. <?phpfunction google_search_api($args, $referer = 'google.php', $endpoint = 'web'){$url = "http://ajax.googleapis.com/ajax/services/search/".$endpoint;if ( !array_key_exists('v', $args) ) $args['v'] = '1.0';$url .= '?'.http_build_query($args, '', '&');$ch = curl_init();curl_setopt($ch, CURLOPT_URL, $url);curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);// note that the referer *must* be setcurl_setopt($ch, CURLOPT_REFERER, $referer);$body = curl_exec($ch);curl_close($ch);//decode and return the responsereturn json_decode($body);}$rez = google_search_api(array( 'q' => 'test',));print_r($rez);?> Now I working off the http://code.google.com/intl/en/apis/ajaxsearch/documentation/reference.html#_class_GSearch What I am trying to do is build is http://www.further.co.uk/tools/search-position-check/ I am almost there with doing it with bing results function bingrank($keyword,$domain){$rank = '0';$urls = array();for($i=0;$i<10;$i++){ $rn=$i=='0'?'':$i; $query = "http://www.bing.co.uk/search?q=".urlencode($keyword)."&first=".$rn."1"; $result_page = file_get_contents($query); preg_match_all('/class="sb_tlst"><h3><a href="(.*?)"/',$result_page,$matches); foreach($matches[1] AS $url){ $urlst = str_replace('www.', "", preg_replace('(^http://|/$)','',$url)); $urlsz = explode("/", $urlst); $urls[] = $urlsz[0]; if ($urlsz[0] == $domain){ return $i+1; } }}return 'N/F';} Any advice or help would be great.
  7. Quick Look Line: 21 missing ; Line: 37 missing ;
  8. That is the code when the user submits the data back to the server as in when they fill out the form and select from the drop down menus. That part of the code will work out they they selected and make it into a Unix timestamp. Check out http://php.net/manual/en/function.mktime.php You save that time stamp to MYSQL fine and then when your looking to display it check out http://www.php.net/manual/en/function.date.php to get into readable format.
  9. I never seen a captive portal done in PHP before but I am sure there is ways of doing it the only thing I can think of right now would be to PHP & iptables. check out http://www.andybev.com/index.php/Using_iptables_and_PHP_to_create_a_captive_portal hope that helps
  10. Post all your code, No not fully understand what your doing.
  11. Hi there, For a project like this your find as time go's on, the record as well as data is forever expanding and changing therefore you need to start as you mean to go on. break all data apart and build tables for each part and then when you have done this your find adding more or chaneging the data a 2 sec job. You need to start with Makes and build a 2 record table. INDEX_ID and MAKES INDEX_ID is the index Auto Increments unique ID MAKES would be charvar(30) KTM etc when you have added all of them records then start the same way on the next table Build all reusable data like the about. now making a form from all of the in them tables will be the next step. As for saveing it to speed things up and save time your user record would be like index_id *key and then MAKES 12 (REF FROM MAKES table) If you do your project this way when you add/change to MAKES tables everything is done simple. Start building your tables in PhpMyAdmin and then ask about how to build a form you interact with the data
  12. Sorry I used a function there which i did not include function GetMonthString($n){ $timestamp = mktime(0, 0, 0, $n, 1, 2010); return date("F", $timestamp); }
  13. if you do the form like this nice and fast $display .= '<select name="DateOfBirth_Day"> <option value="" >- Day -</option>'; for ($i = 1; $i <= 31; $i++) { if ($_POST['DateOfBirth_Day'] == $i){ $display .= '<option value="'.$i.'" selected>'.$i.'</option>'; } else{ $display .= '<option value="'.$i.'" >'.$i.'</option>'; } } $display .='</select> / M <select name="DateOfBirth_Month"> <option value="" >- Month -</option>'; for ($i = 1; $i <= 12; $i++) { if ($_POST['DateOfBirth_Month'] == $i){ $display .= '<option value="'.$i.'" selected>'.GetMonthString($i).'</option>'; } else{ $display .= '<option value="'.$i.'" >'.GetMonthString($i).'</option>'; } } $display .= '</select> <select name="DateOfBirth_Year"> <option value="" >- Year -</option>'; $thisyear = date('Y'); $now = $thisyear - 6; $end = $thisyear - 100 ; for ($now; $now >= $end; $now--) { if ($_POST['DateOfBirth_Year'] == $now){ $display .= '<option value="'.$now.'" selected>'.$now.'</option>'; } else{ $display .= '<option value="'.$now.'" >'.$now.'</option>'; } } $display .= '</select> '; echo $display ; Now you need to deal with the post etc $ageTime = mktime(0, 0, 0, $_POST['DateOfBirth_Day'], $_POST['DateOfBirth_Month'], $_POST['DateOfBirth_Year']); I like Unix timestamp but there are many ways you can do it.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.