Jump to content

WebStyles

Members
  • Posts

    1,216
  • Joined

  • Last visited

Everything posted by WebStyles

  1. @Cyto check out urlencode too. I'm guessing it will come in handy if you're using variables with values like that.
  2. ok, so you'll need to put this at the top of the file, to prevent it from executing if the value in the file is not = 1: $controlFileName = 'cronControl.txt'; $controlFilePath = '/home/vixushr/supplierinfo/'; $controlValue = file_get_contents($controlFilePath.$controlFileName); if(trim($controlValue) != 1){ exit(); } and now you need to create two scripts, I'll call them allowCron.php and notAllowCron.php, you can put this code into functions and call from other scripts, or include these files in other scripts, whatever you want. One will set the file contents to 0, and the other will set it to 1: allowCron.php: $controlFileName = 'cronControl.txt'; $controlFilePath = '/home/vixushr/supplierinfo/'; file_put_contents($controlFilePath.$controlFileName,'1'); notAllowCron.php: $controlFileName = 'cronControl.txt'; $controlFilePath = '/home/vixushr/supplierinfo/'; file_put_contents($controlFilePath.$controlFileName,'0');
  3. man, what is the path? (c'mon! it's like the third time I've asked) I'm trying to help you, but you're making it painfully slow.. (it's 10 to midnight here, I'll be going to bed soon, so hurry up man!)
  4. what's the file's name and complete path? (did you set the proper permissions?)
  5. of course it will work, except you need to add stripslashes when echoing it: echo stripslashes($string);
  6. cool, then the code makes a bit more sense! have you created the text file? post it's name and complete path please. (also, check the file's permissions, you need to allow user www to write and also the user that executes the cron job)
  7. @AyKay47 lol, it's like I'm following you!
  8. escape the quotes. $string = "Papa\'s Home"; in this situation, you actually wouldn't have to, because I used double quotes on the outside, and a single quote inside, but if you're planning on putting this into a database you'll definitely need to escape your strings properly. look up mysql_real_escape_string, addslashes and stuff like that. good luck
  9. here's an example of the same situation: http://www.phpfreaks.com/forums/index.php?topic=339392.msg1599844#msg1599844
  10. well, if you want to know who uploaded what, then you either create folders with their usernames and upload the files into each of those folders, or you just upload them all to the same place , but keep track of the file names and who uploaded in a database. You should add some code to change the file names into something unique, or at the very least, check if the filename already exists before uploading, and add a number to the end if it does. (is_file can check the name for you.)
  11. again? This is the third post today containing the same code... Do you understand what your code does? Are you able to find the part that deals with the uploaded files? then all you need to do is change it to run x times (the amount of file that you upload), passing it a different filename every time.
  12. it's done with a timestamp, that keeps updating whenever the user performs an action or changes pages... then you check the database for all timestamps older than (3 minutes? or whatever you want) and delete those from the onlineUsers list. I have explained this several times in detail here, and so have many others. try searching the forum.
  13. @ jcbones yeah, at first I thought that too, then I figured it's better to ask than assume.
  14. if your script can't find the path, I expect these two lines are incomplete: (this is just a guess, but makes sense, read on.) unlink($_SESSION['username']."/pics/".$id); //delete pic in directory unlink($_SESSION['username']."/pics/thumbs/".$id); //delete thumbnail in the sense that an id is normally just a number, and a picture also needs to have an extension. I'm guessing they're jpeg files, so if I'm right you would need something like: (added extensions) unlink($_SESSION['username']."/pics/".$id.".jpg"); //delete pic in directory unlink($_SESSION['username']."/pics/thumbs/".$id.".jpg"); //delete thumbnail
  15. AyKay47 gave you a simple solution for that.
  16. yep, but you can just create a function to do that, something like updateTimestamp() and include it at the top of each file. all it will do is grab a timestamp and update 1 database field.
  17. man, that script is weird... are you sure it's a cron job? it expects a url variable... also, why is this repeated 7 times? if($_GET['action']=='xxxx' || ($argv[1] == 'download' && $argv[2]=='xxxx')){ xxxx_download(); }
  18. ok. this should be easy enough... the only thing you need is to create a .txt file somethere on the server, and figure out the complete path to it... lets call it cronControl.txt, and let's imagine it's in /usr/local/home/ (just for arguments sake, you'll need to replace these variables. add this to your cron script, at the start: <?php $controlFileName = 'cronControl.txt'; $controlFilePath = '/usr/local/home/'; $controlValue = file_get_contents($controlFilePath.$controlFileName); if(trim($controlValue) == 0){ exit(); } // ... rest of code follows ?> this will basically read the text file, and if the value inside is 0, it will force the script to abort. Make sense? (I'll be right back to explain the rest, in the mean time, create the text file and figure out the complete path)
  19. what is the script? do you have access to it? is it php, perl or python? it shouldn't be too hard to figure out. all you need to add to it is a line to read the text file and an if statement.
  20. you need to understand something: Cron jobs are scheduled scripts that will run at selected times. You can only terminate a job if it is running at the time you run your kill script... if the cron job only takes about half a second to execute, chances are you're never going to be able to kill it that way. killing an active job is different from disabling a cron job. If you disable a cron, you will have to re-enable it at some point. On the other hand, if you have a cron job that you sometimes do not want to execute, then it's the wrong script for the job. My advice: think things over before trying to put tape over them.
  21. then you have some reading to do... a .txt file with a 1 or a 0 inside it. folow these links to find out how to read the contents and how to change them: file_get_contents file_put_contents
  22. in that case, you need to separate the values first (because html tables are built in rows)... so you could do something like this: $cols = array(); $count = 1; foreach ($original_array as $value){ $cols[$count][] = $value; $count++ if($count == 5) $count = 1; } this will build $cols[1], $cols[2], $cols[3] and $cols[4] with the values you want for each column
  23. it's one way... but if they logged in at 9 am, and are still online 10 hours later, their friends will think they were last online at 9 am, which is not true. I normally store the last activity time, rather than the login time.
  24. I honestly have no idea what you mean by that. What is the logic (in plain english) you wish to use for deciding what goes in which column ?
  25. % is the modulus operator... ($count % 4) devides $count by 4 and returns the remainder. if the remainder is equal to 0, that means your number (in $count) is a multiple of 4, so it's time to change to a new row.
×
×
  • 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.