Jump to content

scootstah

Staff Alumni
  • Posts

    3,858
  • Joined

  • Last visited

  • Days Won

    29

Everything posted by scootstah

  1. if(mysql_num_rows($query3a) > 0){ Are you sure that statement is true?
  2. There is no syntax error in that line, and the code works fine for me. Post your whole code please.
  3. ChristianF, please answer, is now ConsoleCaptcha readable in your linux? I just tried with Firefox 14.0.1 in Ubuntu 12.04 and it seemed to work fine.
  4. The tutorial seems to explain it pretty well. Where are you having trouble?
  5. Yes, but if you want to pass data from Javascript to PHP you'll need to use AJAX. Using the jQuery Javascript framework makes this very easy. All you have to do is include the jQuery framework, and then: <script type="text/javascript"> $(function(){ // select an element $('div').each(function(){ // update the innerHTML var newHtml = 'This is new HTML'; $(this).html(newHtml); // send the New HTML to a PHP script $.ajax({ url : 'the_php_script.php', data : { html : newHtml }, type : 'post' }); }); }); </script> And then your PHP script: <?php if (isset($_POST['html'])) { $html = $_POST['html']; // save HTML to a database, or whatever else you want to do }
  6. A system like what?
  7. I guess you're looking for critique or problems, so here is my review: $connect = mysql_connect ('localhost', 'root', '') or die (mysql_error); mysql_select_db ('chatsystem') or die (mysql_error); If you had error reporting, you would see two errors here for undefined constants. mysql_error() is a function, not a constant. Also, you shouldn't be echo'ing out the mysql_error() here, because you will potentially leak part of your database credentials to the public. Instead, you should use the error-suppression operator (@) and create your own error. Using the error-suppression operator means that under no circumstances will mysql_connect() output anything to the screen if it fails. $connect = @mysql_connect ('localhost', 'root', '') or die ('could not establish database connection'); mysql_select_db ('chatsystem') or die ('could not establish database connection'); $name = $_GET['name']; $comments = $_GET['comments']; Again, if you had error reporting on and tried viewing this page without those indices in the URL you would get an "undefined index" error. You can also remove if ($name&&$comments){ and do it this way: if (!empty($_GET['name']) && !empty($_GET['comments'])) { $name = $_GET['name']; $comments = $_GET['comments']; $query = mysql_query ('SELECT * FROM comments'); You don't appear to be doing anything else with the data returned from this query. Why is this here? $posted = mysql_query ("INSERT INTO comments VALUES ('', '$name', '$comments')"); You are now using unsanitized input in your database query, which could lead to SQL injection or query failure due to illegal characters (such as quotes). ALL user input needs to be escaped before using it with a database. The only exception is if the column type is an integer or float, you can type cast the input to those data types first, which will strip any non-int characters. So, change your variable declarations to: $name = mysql_real_escape_string($_GET['name']); $comments = mysql_real_escape_string($_GET['comments']); }else { echo "please leave comment click <a href='index.php'>here</a> to back"; } This "error" isn't really descriptive of what went wrong (missing or empty "name" or "comments" from the query string). echo $rows; This is going to result in "Array". Why is this here? Also, consider using POST instead of GET. GET is used for GETting things, POST is used for POSTing things.
  8. Nice, Phil Sturgeon argued with him too.
  9. Heh, reminds me of when people used to join Ventrilo with a bunch of special characters in their phonetic. "left-square-bracket left-square-bracket right-square-bracket asterisk circumflex-accent left-square-bracket has joined the channel"
  10. If it worked on a screen reader, it would probably defeat the whole purpose.
  11. Yes, I am on Windows 7. What console font in your operation system? I can add this font name in my forum right now. Like Jesi said, add "monospace" to the end of the font-family list. That way if somebody doesn't have any of the fonts, it will use the default monospace font specified on their system. EDIT: But, you should host a font and use that to make sure it renders (close to) the same for everyone. Also keep in mind that people can zoom text, which might break your captcha.
  12. I haven't weighed in all the options, but you could use the first letter as the index key. Then you don't need to make any comparisons. $array = array('amber', 'billy', 'bob', 'charlie', 'chester', 'damian', 'edgar', 'earl'); foreach($array as $a) { $foo[strtolower($a[0])][] = $a; } echo '<pre>' . print_r($foo,true) . '</pre>'; Array ( [a] => Array ( [0] => amber ) [b] => Array ( [0] => billy [1] => bob ) [c] => Array ( [0] => charlie [1] => chester ) [d] => Array ( [0] => damian ) [e] => Array ( [0] => edgar [1] => earl ) )
  13. You realize that you are running 36 queries minimum, right? That's ridiculous when you could do this in one query. MySQL supports regex. It's a little slow, but probably better than 36 queries. Something like this: SELECT * FROM merchant WHERE merchant_name REGEXP '^[0-9a-z]' ORDER BY merchant_name ASC EDIT: I'm not sure what you mean by grouping, but you can use GROUP BY to group rows or group them into arrays with PHP.
  14. You forgot the DateTime constructor. $date = 1346078003; should be $date = new DateTime(1346078003); The manual would have told you this. http://us2.php.net/datetime
  15. I don't think any small locking device that is made for a notebook would be very secure. For instance, those little portable safes can easily be opened by dropping it or smashing the lock with a hammer. Is it possible to put the contents on a tablet or laptop and use encryption?
  16. Congrats.
  17. Because each actual image is static, you can get a 'signature' for them (filename, filesize, and/or actual binary data of the image) that lets you map the question to the correct image. You would need to dynamically alter the images each time they are output, varying the size/color/name... so that any one actual image has a random signature each time it is used. And even then, if enough effort was exerted, you could probably write something that could trace the images and choose that way. Even if you change colors or size, the outline would be roughly the same.
  18. The text can be parsed into "1 + 3", which is then easily solvable. Some people work 9-5 cracking CAPTCHA's, this kind of stuff is trivial.
  19. You're not going to get captcha without GD, sorry. The whole idea of captcha is supposed to be hard for computers to read, but easy for humans to read. As OCR software gets better and better, this is slowly turning the other way around. But, if you have straight up text on your website it's not really going to do anything for you. There are a number of other solutions like answering questions or solving math problems. You could maybe randomly generate a little colored box and ask what color it is. Although, that might not work for color blind people.
  20. Use Recaptcha. You don't need the graphic libraries to use it.
  21. Yeah, but then you'd have to fetch everything for JavaScript to work with.
  22. You're using "data2" but the table is "data", and you have set no aliases.
  23. SELECT * FROM table WHERE clasif = 'fruit'; SELECT * FROM table WHERE out = 'lbs If you want to do it without a page reload you'll need to use AJAX.
  24. Oh god. Stop right there, you're doing something terribly wrong.
×
×
  • 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.