laffin
Members-
Posts
1,200 -
Joined
-
Last visited
Everything posted by laffin
-
call_user_function - without knowing how many parameters to send
laffin replied to NeoMarine's topic in PHP Coding Help
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. -
Can i make this Text -> form box with PHP?
laffin replied to DarrenReeder's topic in PHP Coding Help
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. -
Can i make this Text -> form box with PHP?
laffin replied to DarrenReeder's topic in PHP Coding Help
U cant do this with php, u would use javascript. -
Dont understand, why just not use 2 queries? one for the pagination and one for the last 10 posts.
-
How to have a php code check to see if html value has been modifed?
laffin replied to ghurty's topic in PHP Coding Help
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. -
How to have a php code check to see if html value has been modifed?
laffin replied to ghurty's topic in PHP Coding Help
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. -
How to have a script move 30 files every time it is run?
laffin replied to ghurty's topic in PHP Coding Help
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); -
Missed the commas in implode but it does remove them same sequence numbers Edited code post with implode commas
-
How to have a script move 30 files every time it is run?
laffin replied to ghurty's topic in PHP Coding Help
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) -
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
-
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>";
-
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
-
Uhm, array_unique()
-
How to have a script move 30 files every time it is run?
laffin replied to ghurty's topic in PHP Coding Help
OP never mentioned FTP, just transfer, so it is assumed he is working on a local system structure. -
A difficult PHP question - how select from a weighted array
laffin replied to sifuhall's topic in PHP Coding Help
Refer to this post -
How to have a script move 30 files every time it is run?
laffin replied to ghurty's topic in PHP Coding Help
<?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 -
How to have a script move 30 files every time it is run?
laffin replied to ghurty's topic in PHP Coding Help
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. -
Returning an array from a simple mysql request
laffin replied to spenceddd's topic in PHP Coding Help
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 -
Returning an array from a simple mysql request
laffin replied to spenceddd's topic in PHP Coding Help
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)) .')'; -
curl_setopt($ch, CURLOPT_POSTFIELDS, array('test'=>'test');
-
and dont assign it in your query INSERT INTO users SET username='blah',password='bleh';
-
<?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>"; ?>
-
What is the best place to keep messages displayed to users?
laffin replied to simplyi's topic in PHP Coding Help
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. -
Exporting an extremely large, poorly designed database
laffin replied to SchweppesAle's topic in PHP Coding Help
Congrats -
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.