Jump to content

kicken

Gurus
  • Posts

    4,704
  • Joined

  • Last visited

  • Days Won

    179

Everything posted by kicken

  1. Since your table names have a - in them, you have to quote them with backticks (`). With out them the - will be treated as a minus and cause a syntax error. As a tip, you should not use any special characters in your table or column names. Stick with a-z, 0-9, and _.
  2. That is the source of your output. You're telling curl to be verbose about what it is doing.
  3. You need to make a more accurate test case that reproduces the problem. Either of those lines work just fine for me if I toss in some quick sample HTML and run it.
  4. Wrong forum, I've moved it for you. Also, cross posted @ http://forums.devshed.com/php-development-5/php-ssh2-connection-in-windows-using-php-951259.html
  5. My android phone seems to provide the option to take a picture (or several other things) for file inputs. This is definitely something that would be device/browser specific and not something you have control over. For desktop browser, there is a new JS API called getUserMedia that can be used to access a users webcam/microphone. You could look into doing something with that, however support is a bit lacking still last time I played with it. As far as I am aware, flash provides the ability to access the webcam and mic as well, but I don't know anything about how it would actually be accomplished.
  6. Rather than do part of the json manually, and part with json_encode, just do the whole thing with json_encode: public function __toString(){ return json_encode(array('robots' => $this->robots)); } There isn't really a need for the call to checkBotList there. You call it from getRobots() right after you call checkFile so it'd just get done twice. Also you still have the hard-coded url in the fopen call rather than calling $this->url like I think you intended. Constructor functions do not return a value, nor should they cause a script to suddenly exit. Throw an exception to indicate that error that way the user can choose to ignore (or do something about) it if they wish. if(!is_dir($this->lfPath) && !mkdir($this->lfPath)){ throw new RuntimeException("error creating directory! PHP must have write permissions for this folder -- $lfPath"); } There is no need for the is_array check there. If $mixed is an array, then typecasting it to an array does nothing and $mixed is unchanged. If $mixed is a string, typecasting to an array is the same as doing $mixed=array($mixed);. Having a method named get* generally implies that it returns something. I'd suggest either you have that method return a value, or rename it, perhaps to updateBots. Lastly, in your docblock you might include an example or two of how exactly this class is supposed to be used.
  7. That code relies on your vin column being defined as a UNIQUE index. Without that it will happily keep inserting duplicate rows.
  8. What you can do depends on what kind of access you have. If you have FTP/SSH/SFTP/SCP access you should be able to download the entire site easily. If you can upload PHP scripts, you can create a script to zip all the files into an archive and download that. If all you have is the hosts's tools you're at the mercy of what they can do.
  9. explode the list by comma to separate each email out. foreach over each email and then locate the position of the @ sign with strpos. substr the email from position 0 to the position of the @ sign to extract the firstname.lastname explode the firstname.lastname part on the period to separate them and use list to assign them to variables.
  10. Something like this would only download the file if it has changed, otherwise you get a not modified response: function downloadRobots($local){ if (file_exists($local)){ $mtime = filemtime($local); $ctx = stream_context_create(array( 'http' => array( 'header' => "If-modified-since: ".gmdate(DATE_RFC1123, $mtime) ) )); } else { $ctx = stream_context_create(); } $fp = fopen("http://www.robotstxt.org/db/all.txt", 'rb', false, $ctx); $output = stream_get_contents($fp); $meta = stream_get_meta_data($fp); if (strpos($meta['wrapper_data'][0], ' 200 ') !== false){ file_put_contents($local, $output); } fclose($fp); } You'd still send a request each time but the response would be smaller if no changes were made. You could expand it further to not send the request until the cache file is over x age.
  11. Since your divs are all set to a fixed width/height, just make the container a fixed width/height that will enclose all of the divs. http://cssdesk.com/7wLnS (updated)
  12. That is 100% wrong. Either you transcribed it from the tutorial incorrectly, or the tutorial is wrong. The string 'postal_code' will never equal the string 'name'. Unset() does not work with __get/__set, so either they do that to highlight the fact that it doesn't work, or it is a mistake. As for the other two questions, fix the class and re-try.
  13. If actually want the loading image to only display if there is a delay, you need to do as mentioned and use a flag + setTimeout to do that. I tend to just show the loading image regardless, as it is easier. If the request goes quickly it only shows for a second, if it shows at all. If the request is slow then it shows until it is complete. $('#click').on('click', function(){ $('#content').html('<img src="/images/loading.gif">'); $.post("http://localhost/my_hiden_url.php/", function(data) { $('#content').html(data); }); });
  14. You'd probably be better off just floating the divs rather than trying to use inline-block. I'd guess that the issue may be related to the whitespace between your div tags, but do not know for sure. http://cssdesk.com/7wLnS
  15. You need a way to extract and replace specific records from the file. Exactly how that would be done depends on the format of the file in question. If it's as simple as one record per line, you could just use file to break the file into records, and extract the correct one from the array for editing. To save you'd split the file into records again, replace the correct array entry, then re-write the array to the file. Once you have two functions created, one allowing you to extract a specific record, and one to replace a specific record, building the form and PHP to handle it is easy.
  16. No, it relies on linux system commands and conventions. If you are trying to run it via CLI, just set_time_limit(0). If you want to run it through your server you'd probably want ignore_user_abort(true) as well and some kind of output. Trying to execute a long-running script through the web server is generally not a good idea to start with.
  17. In JS, everything except the basic types (string, bool, number) are passed as references. There is no significant difference between the two options you presented.
  18. If he wanted to do it manually, he could just go to the site and use file->save as, no need to fiddle around in the js console trying to extract the html. For what he wants, he will need to use something like PHP to download the URL content and then extract the data.
  19. This sounds like an email you should send off to the HTML5 Builder support people so perhaps they can improve their product to your desires. We have nothing to do with said application and can't do anything about your issues. I would venture to guess that very few, if anyone, here uses that program. Most of the newbies seem to use Dreamweaver and the more advanced users tend to write their HTML/PHP/JS them selves rather than use some kind of wysiwyg editor.
  20. For simple alerts/confirmations I just do a dynamic div. Something like: function jqAlert(msg){ $('<div>').html(msg).dialog({modal: true, close: function(){ $(this).dialog('destroy').remove(); }}); } For something like a form I usually do a dynamic div like above but set the content to an iframe which then loads the form. You could alternativly just use jquery's .load() method to load the document directly into the div though.
  21. The answer is another table. You'd have user_team contain just one row with the team's info (team id, name, rank, user id, etc) then another table, say user_team_players which contains 10 rows for the different players, using team id rather than user id to link things.
  22. As has been said, you'd have to have a dictionary of valid words to compare against. There isn't any other way to check if a particular string of letter is a "real word". There are free dictionary lists on the internet, do a little google'ing and you can find them. Once you have one, import it into another table in your DB and then you can use an INNER JOIN against it to filter the invalid tags.
  23. Your going to need to be a bit more specific on what you want to do. __clone and the clone keyword are for creating duplicates of an object, but both are still the same class. If you want a difference class you'd need to write your own method to achieve that.
  24. Based on your example, explode() the string into individual words, array_reverse the result to reverse the order of the words, then implode it back together again. No need to loop the array or use strrev.
  25. As an example of "..put[ting] the data in a different place", take a basic template class for example: class Template { protected $mVars=array(); public function __get($nm){ return isset($this->mVars[$nm])?$this->mVars[$nm]:null; } public function __set($nm,$v){ $this->mVars[$nm] = $v; } public function display($file){ extract($this->mVars); include($file); } } $tpl = new Template(); $tpl->Name = 'kicken'; $tpl->Date = date('Y-m-d'); $tpl->display('somefile.tpl'); The class stores all the variables to be used in the template inside the $mVars property. However, by using __get/__set you allow a user to get/set the variables as if they were real properties on the object. By shoving all the variables inside an array rather than directly on the object you prevent the possibility of someone accidentally overwriting some other property that the class might depend on.
×
×
  • 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.