Jump to content

Orio

Staff Alumni
  • Posts

    2,491
  • Joined

  • Last visited

    Never

Everything posted by Orio

  1. I see nothing wrong with the code. (Except the fact you have a block opened after the includes with no if/loop). Let me get this straight again. Your problem is that you are getting a fail/success message on the very first page load? (Even when the form is yet to be submitted) Orio.
  2. I don't think there's much difference.. It is mainly using curl and preg_match() I think, so that should be the same in php4. Orio.
  3. Can you show the full code so I could understand better? Orio.
  4. What do you mean by that? The value returned by mysql_query() is returned only after the query was/wasn't executed. So if you get true returned, that means the query executed successfully. Can you explain what's currently wrong? Orio.
  5. Your if is wrong. You are checking if the result is not true, instead of checking if it is true. Should be: <?php //Execute SQL Statement and store results as a recordset $result= mysql_query($sql) or die (mysql_error()); if ( $result === true ) { echo "Contact successfully added."; } else { echo "Please try again."; } ?> Orio.
  6. That function is way too puffed with unneeded stuff. Try this: <?php function http_exists($url) //$url must be valid, starts with http:// { $headers = get_headers($url) if($headers === FALSE) return FALSE; return (strtolower($headers[0]) == 'http/1.1 404 not found'); } ?> Orio.
  7. Try using $path in your header instead of $filename. Also, you are risking yourself here. You are taking user input and placing it right inside a SQL query. This way, people can enter malicious inputs that can damage your database. This is a security hole, and it has to be fixed. There are tons of articles and tutorials about this issue, just google for it. Orio.
  8. What do you mean by "File type"? It's extension? It's MIME type? Be a bit more specific please. Orio.
  9. Check out the Competition Board. Competition #2 was building a text-based mmorpg, and all submissions are open source so feel free to download and learn from them. Orio.
  10. After reading some examples, I think this is what you're looking for: <?php $zip = zip_open("test.zip"); $count = 0; if ($zip) { while ($zip_entry = zip_read($zip)) $count++; zip_close($zip); } echo $count; ?> Orio.
  11. Although I've never used these, I am sure you'll be able to do that using the zip file functions. Orio.
  12. That will match "everything BUT numbers". Also you need only one "+" (or "*", depends on what you're looking for). Anyway, it should look like this: <?php if(preg_match("/^[0-9]+$/", $num_input)) echo "Valid input"; ?> Orio.
  13. That's a mistake. Using strlen() is much more efficient than using preg_match(). <?php $len = strlen($pass); if($len < 4 || $len > 12) echo "Bad pass!"; ?> Orio.
  14. lol I tried to check out the site now, and got a (PHP) error. I'll check it later. Orio.
  15. It should do exactly that, what browser/OS are you using? FF, XP Pro. It seems you've made changes any way. Can't find the save lol. Guess it's under development or something. I'll see what I can do. What resolution are you viewing it at? 1152 x 864 Orio.
  16. Yeah, but I guess at some point you'll either get an internal 500 error or as SemiApocalyptic said, you'll get a "maximum execution time" error. You can test it, but either way you have choose the answers wisely so you'll have no doubts about the correct answer. Orio.
  17. Cool I really like it. A few suggestions: [*] Capitalization. It looks more professional when all the links (Such as "about", "privacy", "save" etc') start with a capital letter. [*] After loading a saved pad, I think it's better if the user/pass form will close and the links will come back up (Just like the save form disappears after saving). [*] In the beginning, I didn't see the save/load/clear links. Only saw those on the left. Maybe putting boxes around the links would have helped me see them sooner (I saw them only because I looked for them). Although I am not sure boxes will do good with the forms. But I think the links should take more of the visitor's attention. The boxes in the middle are designed neatly and nicely imo, but the links are small and not visible. Some styling changes? I don't know. [*] The most difficult problem to fix... In FF when I press save/load, the form overrides part of the boxes. In IE7 the boxes are moved to the left. I think the behavior in IE is ok (although it's not perfect, but nothing is ), maybe you could tweak it a bit so FF will act the same? But I must say I really like the idea, keep up the good work. Orio.
  18. As far as I understand, this question is a part of a quiz / test, and not a question asked in some board or for help. So a good question for this piece of code would be: What would the following code produce? And if it's a multi choice question some possible options could be: [*] 10 Times "Hello" each, in a new line [*] An error, because echo has to come with parentheses around it's parameters. [*] Nothing. [*] An internal sever error. etc' Orio.
  19. Memboost is a open source ram optimizer. Check it's web site, maybe you'll find your answer there. Or just go to the source Orio.
  20. You should also add the "i" modifier for opening tags like <?PHP. Orio.
  21. In the end of your pattern you have the closing < /b>. The function thinks that that slash you have in </b> is closing the pattern, so it thinks b is a modifier. The solution- simply escape that slash: <?php $pattern = "/^<p><b>\d[.]( )?(\d\w\s)+<\/b>$/"; ?> Orio.
  22. Yep cx323 is right.. It's a place for array_merge() and not the "+" operator since only array_merge() appends the values of arrays that use numeric keys and doesn't overwrite. The line should be: $valid_chars = array_merge(range(65,90) , range(97,122) , range(48,57)); Orio.
  23. It seems like using preg_match() is faster here... Try checking the Filter library, maybe you could find something over there. Orio.
  24. My server is down so I can't test it or find out if it's faster the using preg_replace(). But try it: <?php function only_alpha_num($str) { $valid_chars = range(65,90) + range(97,122) + range(48,57); //A-Z + a-z + 0-9 $len = strlen($str); for($i=0, $new_str = ""; $i< $len; $i++) $new_str .= (in_array(ord($str[$i]), $valid_chars)) ? $str[$i] : ''; return $new_str; } ?> Orio.
  25. The main function you're looking for is gethostbyaddr(). Orio.
×
×
  • 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.