Jump to content

laffin

Members
  • Posts

    1,200
  • Joined

  • Last visited

Everything posted by laffin

  1. Without example code, you will be given the most common answer. U want to call a variable function with a variable amount of params. However, you dont mention how u get the function name or the params. so u have gotten the same answer over and over.
  2. No Ajax is required, this is more of a dynamic form situation. Since form elements can be disabled, and javascript can add other form elements and enable elements. its just a matter of piecing together all the parts. U can try google: javascript dynamic forms to get an idea of what ppl have done.
  3. U cant do this with php, u would use javascript.
  4. Dont understand, why just not use 2 queries? one for the pagination and one for the last 10 posts.
  5. Yes, and in order to bypass that check? even if encoded? all one has to do is append it to the page after the </html> tag or put it into a html comment. so it will still appear in the output buffer, but not get displayed.
  6. I think he is asking, how to make certain parts of his php code non-editable and required. and seriously there is no way to accomplish this, unless you encode some required functions. but even than, if u give up the main code, there will be ways to bypass the system. if I was you, i would use the separate code/display, so clients can edit the display but not the code, and encode the code.
  7. last lines should have been if(!$ctr) rmdir($origdirectory); } ?> the script runs from the PWD (Present Working Directory) if running from CRON, I would make them full path directories $origdirectory='/my/logs/' . date('mdy').'/'; $destdirectory='/my/working/process/'; MadTechie's code is approx the same (cept his is recursive, it handles sub-folders) you would have to change these lines $target = "/my/working/folder/"; mvr("/my/logs/$folder/",$target);
  8. Missed the commas in implode but it does remove them same sequence numbers Edited code post with implode commas
  9. Than check my post which was above $Three's. It does just that. move 30 files at a time, when no more files are in the directory, it removes the directory. however, it doesnt recurse thru sub-directories (only does the top level)
  10. True, But [quote]MoBlock is a linux console application that blocks connections from/to hosts listed in a file in peerguardian format (guarding.p2p). which is a firewall
  11. I think I see $nums=array(10,11,20,22,30,33,40,44); echo 'My Nums: '. implode(','$nums) ."<br>"; foreach($nums as $key=>$val) { $remove=true; for($i=1;$i<strlen($val);$i++) { if(substr($val,0,1)!=substr($val,$i,1)) { $remove=false; break; } } if($remove) unset($nums[$key]); } echo 'My Nums: '. implode(','$nums) ."<br>";
  12. Most of windows stuff is stored in the registry. and thats a pain. your best bet is to use another firewall, one that works on both systems. I would suggest using something like PeerGaurdian which does use a txt file for a blocklist, is open source, and you can get the txt file schema Windows Linux Peer Gaurdian file format
  13. Uhm, array_unique()
  14. OP never mentioned FTP, just transfer, so it is assumed he is working on a local system structure.
  15. <?php $origdirectory=date('mdy').'/'; $destdirectory='process/'; if(is_dir($origdirectory)) { $dh=opendir($origdirectory); $ctr=0; while($ctr<30 && $file=readdir($dh)) { if(is_file($origdirectory.$file)) { rename($origdirectory.$file,$desdirectory.$file); $ctr++; } } closedir($dh); if(!$ctr) rmdir($origdirectory); ?> Edit: added file check, directory check, and orginal directory removal
  16. how about make it simple rename($oldfolder,$newfolder); u can rename folders into different directories rename('cache/current','backup/yesterday') on windows beware, you cant move folders across drives.
  17. I think this will require a database redesign. You can do what you ask, but it will involve FULL TEXT SEARCH as well as multiple wild card searches. If I understand correctly, I would add two more tables. to your database with something like Table PortfolioItemCategories pid INTEGER NOT NULL, category INTEGER NOT NULL, PRIMARY KEY (pid,category) Table PortfolioItemSkills pid INTEGER NOT NULL, skill INTEGER NOT NULL, PRIMARY KEY (pid,skill) where pid is the index of PortfolioItems entry so you can retreive the categories/skills with a much simpler sql statement, that wont use text pattern searching. which would be a lot faster
  18. first how is your db table look like? are skills and categories items numerics? and are they unique? but it sounds more like the query should be $queryPortfolioSkillsCats ='SELECT * FROM PortfolioItems WHERE skills IN (' . implode(',',array(12,31,1,86)) .') OR categories IN ('. implode(',',array(12,31,1,86)) .')';
  19. curl_setopt($ch, CURLOPT_POSTFIELDS, array('test'=>'test');
  20. and dont assign it in your query INSERT INTO users SET username='blah',password='bleh';
  21. <?php $list_items=32; $items_per_cell=5; $max_cols=5; for($i=0;$i<$list_items;$i++) $category[$i]="Category{$i}"; $cols=($list_items/$items_per_cell) + ($list_items % $items_per_cell?1:0); $rows=($cols/$max_cols) +($cols%$max_cols?1:0); $cur_item=0; echo "<table>"; for($i=0;$i<$rows;$i++) { if($i) echo "<br><br>"; echo "<tr>\n"; for($j=0;$j<$max_cols;$j++) { echo "<td><ul>\n"; for($k=$cur_item;$k<($cur_item+5);$k++) { if($k<$list_items) echo "<li>{$category[$k]}</li>\n"; else echo " "; } $cur_item=$k; echo "</ul></td>\n"; } echo "</tr>\n"; } echo "</table>"; ?>
  22. Only problem, is than the file becomes huge, and you will wasting memory on strings that arent on a particular page. so you may opt for creating different page strings and a general strings.
  23. he doesnt need to understand how it works, just that it works as described, the bit positions are easier to manage as well. especially if used with arrays. As I said that wasnt a tutorial, more of a quick start up using bit flags. Using a quick start up is a lot easier than trying to write your own code, or maintaining the values of each bit position. and learning bit/octals/decimal/hexadecimal numbering systems in order to get a project going is a bit overkill. Most of the time, one understands better whats going on by using premade tools, than trying to read and discover on their own. Just like computers, you dont need to understand how they work in order to use them, but it sure helps if your building your own.
×
×
  • 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.