Jump to content

premiso

Members
  • Posts

    6,951
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by premiso

  1. Don't use the file? Sounds extremely pointless, unefficient and did I mention pointless? If you want the file, instead of "updating" the file, just re-create the file from the data in the database. It will probably take just a long (depending on how much data) as it would be to open the file, traverse to the correct record, pull out that record modify it then read in the file and replace that record in the file and write it back to the harddrive. if you must do that for some weird and pointless requirement, just re-create the file each time, in my opinion.
  2. Set it in the database for the user and have a dropdown menu, which is dynamically generated from the "Available language" files or database entries. They select it you save it and just reference it when you pull the user data and include / pull that data from database / file.
  3. One way, create an array of "Excluded directories" and an array of "excluded files" then use the in_array function before printing or assigning them to anything, if they are NOT in the excluded array, print / assign them. If they are continue onward and do not process them.
  4. You will most likely use the command line via the system or exec commands, as you will need access to ffmpeg to retrieve it. As far as I am aware, PHP does not have this support built into PHP. Use the commandline guide you posted, just run a system / exec command. I would store the retrieved value in the database that way you are not constantly running it on video files, if you have a database backend. Only update it if the video has been updated.
  5. For languages, most sites use templates and inside the templates are defined variables for different messages. These variables come from a database or an alternative file which has them defined. You use the same variable name, it is just defined differently depending on which file has been included or which language has been selected from the database. As far as "designer mode" no clue what you are talking about.
  6. Add some error checking to the mysql_query and see if it is throwing an error. mysql_query($dbQueryReg, $db) or trigger_error("EndTime Entry failed: " . mysql_error()); You may also put some debugging comments into that if to make sure the if is being ran.
  7. Using preg_split this should be possible. $string = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc Dr. Tom id lectus ante. Suspendisse potenti. Fusce eu ante mattis eros hendrerit imperdiet. Fusce at ante mauris, vel dapibus quam. Duis vel vestibulum neque. Aenean viverra condimentum ante, ut vulputate diam volutpat non. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Fusce nibh diam, sollicitudin at vulputate a, commodo nec ligula."; $array = preg_split("~[^D][^r]\.~", $string); print_r($array); Maybe not done the best it could be (or properly), but should work.
  8. http://www.yourhtmlsource.com/sitemanagement/urlrewriting.html You want to look into Apache's mod_rewrite to do what you want. Something like this may work, but untested: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*) index.php?tab=$1 [L] This is a very basic usage, untested but should give you an idea of what you may need.
  9. You may want to try this: http://www.php.net/manual/en/function.fgetcsv.php#26886 From the user comments. Perhaps that function will work properly for you.
  10. It would probably be better to do so. Minor over-sight of mine, thanks for pointing it out.
  11. It could possibly be that you have the actual file and the zip file parameters mixed up: Zip Manual You may try unlinking that zip file before running that command with unlink to remove the original file. Also looking into the zip area, -r could be for "replace" or for "recursive". Not really clear how to signify the differences. Instead of adding the -r, why not try removing it and switching around the parameters: <?php exec("zip /home/gggg/myfile.zip /home/gggg/myfile.txt"); ?> See how that goes for you.
  12. You never clear you session error variables after displaying the error. So everytime the page is ran it sees those as errors. Clear those out after you display them and that should solve your problem, given that your logic is correct. I kind of just glazed over that part.
  13. preg_match is perhaps one way to do it. Hope it helps!
  14. This is a json array. If your server is setup to have the json functions json_decode will work. If not, on the json_decode page in the user comments someone provided the code for the function that will act like json_decode would.
  15. Chances are your script is timing out, this is not uncommon, especially when you do multiple whiles inside whiles with updating data in a database. You should try and make your script a bit more efficient and try to move the queries outside of the loop and minimize them if possible. To avoid the issue you can try increasing the timeout with the set_time_limit 0 = never timeout. Default is 30 seconds. It goes by seconds btw.
  16. Some people use the globals for "ease of use" and not having to always add that parameter to the function. The preferred way, especially if you plan on distributing the script, is passing the variable as a parameter to the function. This way anyone should techincally be able to see how to use it and what it expects to be passed in, vs having to dig through all your code to find out which global variable it takes in etc.
  17. He didn't. You did. He was referenceing this remark by the OP:
  18. $string = "\nTesting Url ei.xxx.com?key=asd234asdf234 ok to see how it replaces.\n"; $string = preg_replace('~ei.xxx.com\?key=[a-z0-9]+~i', '_replaced_ ', $string); echo $string;
  19. curl_setopt is what you will need: curl_setopt($cURL, CURLOPT_HTTPHEADER, array ( "Content-Type: text/xml; charset=utf-8", "Expect: 100-continue" )); An example snippet.
  20. That would work until Oni-kun finds the topic and ventures it off topic with one of his rants. Which is most likely this has never been done. It would be too easy to go off topic, like I just have done for this thread. Soon enough Thorpe may come along and lock it for going so far off topic
  21. I think you would want the a:visited anchor tag as well. This sets the color to links that have been visited. http://www.ist.rit.edu/~jxs/classes/2005_Spring/320/examples/anchors.html
  22. I once helped re-write it, so I guess I had to of read it...
  23. Never seen that error before, but I am sure it has to do with how much memory it is eating up. If you can I would try and split the file into 500MB pieces then run the script for each file, making sure you save the sql file as a numbered file. A pain in the ass, but sometimes you have to do parts manually, especially when dealing with this amount of data. Unless someone has a better suggestion, I am out of ideas
  24. You are only assigning the image field to the $data array. $sql = mysql_query("SELECT image, title, price FROM products ORDER BY Rand() LIMIT 20") or die(0); while ($array = mysql_fetch_row($sql)) { $data[] = $array; } for($i=0; $i< count($data); $i++) { echo $data[$i][0] . " " . $data[$i][1] . " " . $data[$i][2] . "<br />"; } Should display the data and give you a rough idea of how it would work.
  25. So instead of using addslashes make your own function like this: function escapeMSSQL($string) { return str_replace("'", "''", $string); } Then if there are other items that need escaped you can add them there as well. I looked at the manual roughly and could not find an escape function for MSSQL, so yea. Hopefully this helps ya.
×
×
  • 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.