Jump to content

MiCR0

Members
  • Posts

    114
  • Joined

  • Last visited

    Never

Everything posted by MiCR0

  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.
  14. Your a Star Daniel Thank you.
  15. I am trying to work out a Discount system maths logic for an MYSQL statment, and I can not get my head into Gear so any help would be great. I am working on a system where the user inputs 20% or -20% and then it querys 35,000 products and updates them with the new price now becuase the records are so big I have a problem so its a one statment job. (cost * 0.20) adds on 20% Update products SET cost = (cost* 0.20) WHERE bradletter='A'; // adds 20% to the price I think the above is correct how would you remove 20%? thanks MiCR0
  16. you need to post all of the code in order for use to see the problem.
  17. Hi all Well after 15 years of programming you would think that I have seen it all however today I got a new client and there website moved too us and after looking at the code to say I was shocked would be an understatement…. There are so many rouge programmers out there we need something, this guy could not even do an if statement correctly and only operators he knows is equal to. 400 pages of pure crap and about as must functionally as a dustbin. We need some sort of PHP free certification for a programmer that can be done online for free and awarded for free. And not for a company but for a programmer and an online check system, this is about the 20th rouge programmer I came across this year.. What are your views
  18. It is working on 2 of the computers here but not the other 2 and i have checked the settings the sessions is not saving on 2 of the computers any ideas?
  19. what I can not work out is that is was all working for 6 months fine until the other day have been checking the server out but nonethink looks to be wrong.
  20. it's DB eSession as in stores session data in a MySQL database rather than files
  21. This is a very odd problem I am facing here any advice would be great. I am using DB eSession http://phpclasses.fonant.com/browse/package/1624.html The session works on some computers but not all its very odd. it working on my FF and IE fine But i go onto the other computer same versions of FF & IE I login and then it go's to the loged in page however if you then go to any other page or refresh that page the session is lost. Have reset all IE anf FF settings on them to default all. So far it working on 2 computers out of 5 any ideas would be great as I am totaly losted.
  22. I seen on websites Ajax using for Masked Edit on Date textbox. i am trying to make one for IP Address like ___.___.___.___ I am not worry about input validation as will be doing this in php. Anyone know how this is done or ever where I can find this information out from?
  23. Tons of problems in this 1st your trying to echo out inside a table code look into </td> and </tr> of a table. </tr> table is still running this unless you output inside the <td>OUTPUT</td> your have problems on the rending side of html. Next error You have the STRING $contentOutput which means this page is already have a PHP start at the top maybe so you do not need to start it again. Last problem You look to be editing someones code and if this was done by a professional this would more then likely be an return therefore this will make problems trying to echo inside a return as it will just echo outside the top of the page and also maybe a session error, therefor you need to follow his logic with the personal code. I recommend finding the end of that table which shown as </table> and then add a new line after the "';" $contentOutput .= '<a title="Bold : [b ][/b ]" onmousedown="addTags(\'[b ]\',\'[/b ]\')" style="background-color:#F7F7F7; font-size:10pt; border: outset white 1px;"> <b>B</b> </a>';
×
×
  • 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.