
smith.james0
Members-
Posts
124 -
Joined
-
Last visited
Everything posted by smith.james0
-
I have only just got round to changing it, thanks
-
Thanks, do you have any ideas how I could check my array so the hour matches the array key? James
-
Hi, I am sure that the solution is easy but it's flummoxed me! I have a python script that sometimes doesn't record the temperature so I end up with 23 readings instead of 24 per day, or less. My php script reads the date from the db and puts it into a array to use in a graph. My problem is that I need to check the correct temperature reading go with the correct hour of the day. Array ( [0] => Array ( [0] => 00 [1] => 4.30 ) [1] => Array ( [0] => 01 [1] => 4.30 ) [2] => Array ( [0] => 02 [1] => 4.10 ) [3] => Array ( [0] => 03 [1] => 4.00 ) [4] => Array ( [0] => 05 [1] => 3.70 ) etc etc.. Above [0][0] is the time and [0][1] is the temperature, what I need is for the time to match the array key. So in [4][0] the time is 05 but the key is 04 i.e... Array ( [0] => Array ( [0] => 00 [1] => 4.30 ) [1] => Array ( [0] => 01 [1] => 4.30 ) [2] => Array ( [0] => 02 [1] => 4.10 ) [3] => Array ( [0] => 03 [1] => 4.00 ) [4] => Array ( [0] => 04 [1] => ) [5] => Array ( [0] => 05 [1] => 3.70 ) This is the code I use to make the array while($row = $result->fetch_array()) { $inside[] = $row; $date = strtotime($inside[$i][Time]); $inside[$i][4] = date('G', $date); $inside[$i][2] = $inside[$i][0]; unset($inside[$i][Temp]); unset($inside[$i][Time]); unset($inside[$i][1]); unset($inside[$i][0]); ++$i; } I can get it to check the time against the key, but I can not get it to correct the key to the time. Can anyone help?? Many thanks James
-
How did you decode that? I have looked on Google but there are no explanations James
-
Thanks for that, I will change it. The "true" and the "false" are used incase "ID" is void, if true select the ID from db, if false pick an ID at random to select from db. James
-
Thanks for the answers for the variable thats passed in the url I have a function to check if it's kosher. function checkID($id){ $ID = mysql_real_escape_string($id); $ID = strip_tags($ID); if (is_numeric($ID) != TRUE){ $return[1] = "false"; }else{ $return[1] = "true"; $return[2] = $ID; } return $return; } Where I use words in a url variable, I check to see if the words appears in a array of allowed words. If it appears then I use the word to query the db. if (in_array($Category, $Category_array)) { $sql_Category = $Category; } What do you think? James
-
Over the last few weeks I have had people trying to access the following urls and some similar index.php?option=com_jce&task=plugin&plugin=imgmanager&file=imgmanager&method=form&cid=20&6bc427c8a7981f4fe1f5ac65c1246b5f=cf6dd3cf1923c950586d0dd595c8e20b by BOT for JCE /includes/exit.php?ID=999999.9 /*!30000union all select 0x31303235343830303536,0x31303235343830303536,0x31303235343830303536,0x31303235343830303536,0x31303235343830303536,0x31303235343830303536,0x31303235343830303536,0x3130323 /index.php?option=com_jce&task=plugin&plugin=imgmanager&file=imgmanager&method=form&cid=20&6bc427c8a7981f4fe1f5ac65c1246b5f=cf6dd3cf1923c950586d0dd595c8e20b what are these urls trying to do and should I be worried? James
-
I have tried this if(data == "true") { $("#email").fadeOut("fast", function(){ $(this).before("<p><strong>Your email have been sent</strong></p>"); setTimeout("$.fancybox.close()", 1000); document.getElementById("#email").reset(); }); } The script seams slower, but it doesn't reset the fields James
-
Would that go after setTimeout("$.fancybox.close()", 1000); James
-
I am using modal box, the problem I have is that after the form has been submitted, I open it again it displays the "thank you" message. I need to reset the form, after the form has been submitted so it can be used again without refreshing the page. function validateEmail(emaila) { var reg = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; return reg.test(emaila); } function validateEmail(emailb) { var reg = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; return reg.test(emailb); } $(document).ready(function() { $(".modalbox").fancybox(); $("#email").submit(function() { return false; }); $("#sendemail").on("click", function(){ var plant = document.getElementById('emaillink'); var pageid = plant.dataset.id; var pagetitle = plant.dataset.title; var emailvala = $("#emaila").val(); var emailvalb = $("#emailb").val(); var msgval = $("#name").val(); var msglen = msgval.length; var mailvalida = validateEmail(emailvala); var mailvalidb = validateEmail(emailvalb); if(mailvalida == false) { $("#emaila").addClass("error"); } else if(mailvalida == true){ $("#emaila").removeClass("error"); } if(mailvalidb == false) { $("#emailb").addClass("error"); } else if(mailvalidb == true){ $("#emailb").removeClass("error"); } if(msglen < 4) { $("#name").addClass("error"); } else if(msglen >= 4){ $("#name").removeClass("error"); } if(mailvalida == true && mailvalidb == true && msglen >= 4) { // if both validate we attempt to send the e-mail // first we hide the submit btn so the user doesnt click twice $("#sendemail").replaceWith("<em>sending...</em>"); $.ajax({ type: 'POST', url: 'includes/share/sendmessage.php?pageid=' + pageid +'&title=' + pagetitle +'', data: $("#email").serialize(), success: function(data) { if(data == "true") { $("#email").fadeOut("fast", function(){ $(this).before("<p><strong>Your email have been sent</strong></p>"); setTimeout("$.fancybox.close()", 1000); }); } } }); } }); }); I have tried using document.forms["#email"].reset(); but I can not get it to work. Can anyone help? James
-
I am trying to make the script work so that when you click a html link, it displays the info box on google map. My links is <a href="javascript:void(0);" onclick="infoOpen('1');">open it</a> (This is number one, of 250+) my code is var map = new google.maps.Map(document.getElementById('map'), { zoom: 6, center: new google.maps.LatLng(53.839564,-4.306641), mapTypeId: google.maps.MapTypeId.ROADMAP }); var infowindow = new google.maps.InfoWindow(); var marker, i; for (i = 0; i < locations.length; i++) { marker = new google.maps.Marker({ position: new google.maps.LatLng(locations[i][1], locations[i][2]), map: map, icon: 'http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld='+locations[i][3]+'|FF0000|000000' }); function infoOpen(i) { google.maps.event.trigger(marker[i],'click'); } google.maps.event.addListener(marker, 'click', (function(marker, i) { return function() { infowindow.setContent(locations[i][0]); infowindow.open(map, marker); } })(marker, i)); } </script> if I mess around with infoOpen i can get it to open the 250th box but i can not click anything else. Can anyone tell me what I am doing wrong? James
-
I am trying to find some information to help me create a script to allow inline editing, like phpadmin. I have little experience of javascript, so its a learning curve! So far I have found this http://www.infotuts.com/inline-editing-html-table-jquery-ajax-php/ but this is fixed at 3 columns and 4 rows, how would I make it reflect my database table? Can anyone help? James
-
Thanks for the reply
-
I can not get over flow hidden to work, can anyone point out my error? http://jsfiddle.net/N9c25/ James
-
I have tried Category2=(.*\D) and it works, thanks for pointing that out James
-
I wish to change http://www.beekeepinglinks.co.uk/categories.php?Category2=Education to http://www.beekeepinglinks.co.uk/categories.php?Category=Education James
-
I am using the following code RewriteCond %{QUERY_STRING} id=(\d+) RewriteRule included/bee\.php$ http://www.beekeepinglinks.co.uk/bee.php?ID=%1 [R=301,L] RewriteCond %{QUERY_STRING} Category2=(\d+) RewriteRule categories\.php$ http://www.beekeepinglinks.co.uk/categories.php?Category=%1 [R=301,L] The second statement wont work, but I can not understand why, can anyone help? James
-
Thanks for that, I used {$url} James
-
I have the following code, the php bit below is to change $url between & and ? for the script if(isset($_GET[Category])){ $url = "&"; }else{ $url = "?"; } The $url is then put after the location.href+\" so it will read bee.php?lats or if there is another variable bee.php?something&lats <script> if(navigator.geolocation) { navigator.geolocation.getCurrentPosition(successFunction,errorFunction); function successFunction(position) { var lat = position.coords.latitude; var lon = position.coords.longitude; document.location = location.href+\"$url lats=\" + lat + \"&lons=\" + lon; } } function errorFunction(position) { var error = 'Yes'; document.location = location.href+\"$url error=\" + error; } </script> The problem I have is for the $url to work I have to have a space after it, which means I get bee.php? lats which doesn't work. How could I get around this? James
-
Update, the code above only works with Safari, Firefox won't redirect. Why would it work for one and not the other? James
-
I changed it to the following at it works RewriteCond %{QUERY_STRING} id=(\d+) RewriteRule included/bee\.php$ http://www.beekeepinglinks.co.uk/bee.php?ID=%1 [R=301,L]
-
Thanks, but it's redirecting to the following address causing a 404 error http://www.beekeepinglinks.co.uk/home/xr2457b/public_html/beekeepinglinks.co.uk/bee.php?id=385 James
-
I have also tried this RewriteEngine on RewriteCond %{QUERY_STRING} ?id=(/d+) RewriteRule ^included/bee\.php$ bee.php?id=%1 [R=301,L] but that stops the whole site working..... James
-
Evening I need to set up a redirect from /included/bee.php?id=XXX to /bee.php?ID=XXX But I need to keep the variable as well, the variable does change case it's not a typo. I have tried this, but it's not working. RewriteEngine On RewriteRule ^/bee.php?ID=([^/d]+)?$ /included/bee.php?id=$1 [L,QSA] Can anyone point me in the right direction? James
-
hmmm my expression was really wrong thanks Psycho for the extra bit of code, could you explain how I would go about changing multiple references? James