Jump to content

smith.james0

Members
  • Posts

    124
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

smith.james0's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. I have only just got round to changing it, thanks
  2. Thanks, do you have any ideas how I could check my array so the hour matches the array key? James
  3. 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
  4. How did you decode that? I have looked on Google but there are no explanations James
  5. 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
  6. 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
  7. 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
  8. 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
  9. Would that go after setTimeout("$.fancybox.close()", 1000); James
  10. 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
  11. 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
  12. 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
  13. I can not get over flow hidden to work, can anyone point out my error? http://jsfiddle.net/N9c25/ James
  14. I have tried Category2=(.*\D) and it works, thanks for pointing that out James
×
×
  • 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.