Jump to content

GingerRobot

Staff Alumni
  • Posts

    4,082
  • Joined

  • Last visited

Everything posted by GingerRobot

  1. I would have thought that if you dont have am XP disk, you probably have an OEM version. Usually what happens is that there will be a recovery disk or recovery partition to allow you to reload. Take a look at what came with the computer and see if there is a recovery disk.
  2. "How to take a thread off-track by 448191" - sounds like a good read to me!
  3. Umm, well effigy did. Just yesterday in fact
  4. I like the fact the banner is plain. It's clean and proffessional imho. Though i would agree it is a little too tall.
  5. Well, the function would probably look something like: <?php function verify_ip($ip){ $parts = explode('.',$ip); if(count($parts) < 4){ return FALSE; } foreach($parts as $v){ if(!ctype_digit($parts) || $parts > 255){ return FALSE; } } return TRUE; } ?>
  6. Ok, well in that case, DataSearch IS a javascript function - it's just that most of the function comes from the output of the PHP code. However, the keywords are required by the PHP, so we cannot just pass the keyword to the javascript function. Now, i think the solution will be going back to what i said right at the beginning - you need to change the location of the frame and include the keyword in the url. So, the javscript for that would be: <script language="javascript" type="text/javascript"> window.parent.themap.location = "Map.php?action=datasearch&keyword=yourkeywordhere; </script> Then, you would use this in map.php: if(isset($_GET['action']){//action i set - dont need to check its value since its not being used for anything else $keyword = $_GET['keyword'];//since this is being used in the query, you'll need to validate this too }
  7. Perhaps it's time we saw some code? If Datasearch is a php function, then the above javascript code can't be doing anything.
  8. Alternatively, you could encode the query string and then decode it after it has been retrieved. If you google, you'll find examples of how to use javascript to encode the variables being sent with GET.
  9. Well, the idea is that you would set a variable at the top of the script with the result of the processing. This would have some default/blank value if no processing is done (i.e. the form has not been submitted) You then echo this value next to your field Oh, and one more thought: for a really good article/tutorial on form submission/handling see this two-part article by one of the moderators(roopurt18) here: http://www.rbredlau.com/drupal/node/10
  10. Well there's nothing necessarily particularly wrong with it. However, if it were me, i'd move all the processing of the form to the top of the script. It would cut down on repetition and make things cleaner. All the while you are performing the same checks on the fields, you could put them in a loop - again, just makes things tidy. My only other comment would be that instead of doing this kind of thing: if($_GET['do'] == "post") It would be better to use the isset() function. Whilst the above method 'works'; if PHP is setup to include notices in error reporting, you would recieve one, since $_GET['do'] is not always set. You could make your if statement read: if(isset($_GET['do'] && $_GET['do'] == "post") This will first check to see if the variable is set. Since the if statement contains two parts, which both most be true for the statement to be true, if the first fails the second will not be tested - therefore you wouldn't recieve a notice regarding an undefined variable. All that said, if $_GEt['do'] will only ever take the value post, you could just check to see if it is set: if(isset($_GET['do']){ }
  11. 18. I expect ill be 81 by the time they bother to upgrade.
  12. It really depends on the data you're expecting. If you wish to allow any characters through, then yes, mysql_real_escape_string() will do. If you with to allow any characters through, but want to block html tags, then you'll need to either use strip_tags() or htmlentities() (depending on wether you wish to delete them, or change all special characters to their relevant character code) first, then use mysql_real_escape_string. If you only wish to allow alphanumeric characters, check it with a regular expression/ctype_alnum() - if you do this, you woudn't need to use mysql_real_escape_string. If you're only allowing a number or integer, again check the contents - either ctype_digit(),is_numeric() etc. For the checking of integers you can also use type casting. So it really depends on what you're trying to do. In answer to your final question, there would be no problem using the function on 10 pieces of data. It's not resource intensive.
  13. Ah ok. I thought that might be the case. The joys of IE eh?
  14. You might benefit from taking a look at this article from the mysql website about storing and working with hierarchical data.
  15. If you just changed these two lines: $A[] = $row2['Values_A']; $C[] = $row2['Values_C']; To: $A[][] = $row2['Values_A']; $C[{$country[$count2]]}] = $row2['Values_C']; It should work. However, you dont need to be doing two queries. You could just do: <?php $sql = "SELECT country,Values_A,Values_C FROM tblcalc WHERE projectname='$project' ORDER BY id" $result = mysql_query($sql) or die(mysql_error()); $A = array(); $C = array(); while(list($country,$a_val,$c_cal) = mysql_fetch_row($result)){ $A[$country] = $a_val; $C[$country] = $c_val; } ?> Which would achieve the same, but with just the one query.
  16. Don't know if you're aware, but the tags don't work properly in IE - they do not scroll. My rubbish school is still using IE6
  17. Hmm, perhaps we've been getting our wires crossed a bit. DataSearch() is a javascript function? If that's the case, couldn't you just pass the variable you need as a parameter? E.g. <script language="javascript" type="text/javascript"> window.top.themap.DataSearch('keyword'); </script>
  18. You want to set a variable to false and loop until it is true - only change it's value if you find a unique id: <?php function slumpa() { $s = chr(mt_rand(97, 122)) . chr(mt_rand(65, 90)); for ($i=0; $i<20;$i++) $s.= mt_rand(0, 9); return $s; } $unique = FALSE; while($unique === FALSE){ $s= slumpa(); $result = mysql_query("SELECT COUNT(hashid) FROM medlemmar WHERE hashid='$s'"); if(mysql_result($result,0) == 0){ $unique = TRUE; } } //insert $s into the database ?> If you're just wanting to uniquely identify a user, it'd be much easier to just use an auto-increment field, however.
  19. Something like this should work: <?php $weekno='19'; $year='2008'; echo date('d-m-y',strtotime('last monday',strtotime('01/01/'.$year)+$weekno*60*60*24*7+60*60*24)); Basically, you get the time of the beginning of the year, then add on the number of seconds in the number of weeks required. You then add on one more day, otherwise a year which started on a monday would give odd results. Finally, you format it how you want it. If you're not quite sure what i mean by needing to add an extra day, then think about running this today: <?php echo date('d-m-y',strtotime('last monday')); ?> This would give the monday of last week's date - when in fact we would want today. Oh, and there is also the question of what you consider to be the first week of the year. For example, 2008 began on a Tuesday - so is the first week of the year beginning of the 7th January, or would you count that as the second week?
  20. What i was meaning was changing the location to map.php?whatever: <script language="javascript" type="text/javascript"> window.parent.themap.location = "Map.php?action=datasearch; </script> You could then obviously add any other variables that you need in Map.php to the URL too. In Map.php you'll then need to check the value of $_GET['action'] - if it's set and it equals datasearch, run the function.
  21. Not sure i follow the problem entirely, but you cannot have two actions for a form. However, if you're using frames you could do something like: 1.) Submit the form in frame 1 - this loads list.php (i believe) 2.) In list.php, include some javascript to reload frame 2 - reload the frame with the information that map.php needs in the url. p.s. Welcome to the forum. Since you're new, i wont berate you for not enclosing your code in tags
  22. Im not sure how well this would work. The use of search engines would probably lead to something which could answer the question correctly with a reasonable rate of success. For example, given the above question a script could enter the question(excluding the ...) and possible answers in turn to google and compare result numbers. With just that approach, the number of hits on google would suggest the answer is what sky? However, if you were then to place quotes around the search term, the only result for the quote is with the answer blue
  23. Thank you. There is a script in the internet that gathers various information about a target source, but requires you to open the script and change the url you are targetting, manually each time. So I wanted to find a way to simply enter the target url into a online form, rather than reupload the file each time Why not just modify the script to take the url you are wanting to gather information for from the query string?
  24. I'd say a little bit of javascript is best for that. Javascript: <script type="text/javascript"> function resetvalue(){ document.getElementById('result_ans').innerHTML = '1,700'; return true; } </script> Modify your reset button to: <input type="reset" name="Reset" value="Reset" onClick="resetvalue()" style="background-color: white; cursor: pointer; margin: 0 0 0 15px;"> And give the span tag an id: <span class="result_ans" id="result_ans"><?php echo $total ?></span>
×
×
  • 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.