laffin
Members-
Posts
1,200 -
Joined
-
Last visited
Everything posted by laffin
-
U prolly looking at resizing the watermark as well as the image. as the watermark is gonna be a percentage of the actual image. Image -> Resize Watermark -> Generate -> Resize Overlay Images
-
PHP Files don't get parsed
laffin replied to terrorsathan's topic in PHP Installation and Configuration
more than likely uploadfolder is not allowed to run cgi/php. -
PHP Files don't get parsed
laffin replied to terrorsathan's topic in PHP Installation and Configuration
sounds more like a web server configuration problem. -
now topic said, keeping track of pages, yet u describe a last 10 users. so question is are u tracking users or page views.
-
yer looking at resizing or scaling an image down. found a tutorial for ya Image resizing
-
depends if u want user to see the output of the scripts or not. if they are generated images, u can use the <IMG tag, so user can see the generated output. if u dun want user to see the scripts output, u can use fopen('url'), however keep in mind of the timeout.
-
function prc($mathes) { return '<a href="'.BASEDIR."user?id=$matches[1]">'. getUserName($matches[1]) . '</A>'; } $text = preg_replace_callback('#\[user=(.*?)\]#si', 'prc', $text);
-
$host=parse_url ( $to , PHP_URL_HOST ); will return the hostname than ya can use strstr or preg_replace for the removal of www. portion.I wud opt for preg_replace $host=preg_replace("/^(www|www[0-9])?\.?([\w\.]*)$/i",'\2',$host);
-
illegal, as the replacement string in preg_replace is to be static (same thing, nothing dynamic) u will want to go with preg_replace_callback, so u can stick in the extra function getusername into the replacement string
-
[SOLVED] I need some guidance on comparing dates
laffin replied to jim.davidson's topic in PHP Coding Help
<?php header('Content-type: text/plain'); $date_written = strtotime($row_GetArticle['date_written']); if($date_written < strtotime('-1 Year')) echo "Over"; else echo "Under"; echo " a year old"; ?> -
than continue using the options preg_match offers $title = "Abit IL9 Pro (Retail, RAID, Gb-LAN, Sound, ATX) - €54322,57322"; preg_match('/- € (\d+,\d+)/si', $title, $price); print_r($price); $price[0] will display the whole match string as u have seen already $price[1] will display the price value
-
store multiple variables with a selection form (checkbox)
laffin replied to jammer's topic in PHP Coding Help
Checkbox shudn display any text, just a check box. so the value, can be the product id code instead of the product price. on the processing page u can than pull both price/description from the db from the id. -
have the script check for the existance of a file to abort operations. if it exists, remember to unlink the file before aborting. the creation of the file can be done thru another script. so ya want to have a read/write directory.
-
as thorpe suggested use normalization seperate the plots of land into there own db. TABLE ( userid position crop end_time ) KEY `userplot` (userid,position) than ya can grab userid and position from the table. and build a positional array. $res=mysql_query("SELECT position WHERE userid=$uid") while($row=mysql_fetch_row($res)) { $plots[$row[0]]=true; } notice that the position of the crop is not a value. thus making a simple check if a plot is used by if(isset($plots[5])) echo "Plot 5 is used"; else echo "Plot 5 is not used";
-
How should I be filtering/validating these GET variables?
laffin replied to cgm225's topic in PHP Coding Help
directory names, shud go further down the directory root, so ya want to avoid '..' which ya can check with realpath function class names, if u know what to expect, store them in an array and do a comparison check, in_array function -
oops in my haste messed up the conversion to using preg_replace_callback it shud be $sul=preg_replace_callback('#<td class=\"(.*?)\" align=(.*?)>#',' UpdCounter', $sul)
-
use preg_replace_callback <?php $counter=0; function UpdCounter($matches) { global $counter; return "JAZZ" .++$counter. $matches[1]; } $sul=preg_replace_callback('#<td class=\"(.*?)\" align=(.*?)>#',' JAZZ ', $sul) ?>
-
Is this a good idea? (Sessions & Cookies manipulation) read
laffin replied to Demonic's topic in PHP Coding Help
why not just implement the sessions in your own fashion. Thus bypassing sessions entirely -
Correct According to php doc on date function So it shud start at 00:01 am Monday
-
maybe using sumfin like $which=(intval(date("W")))&1; it takes the week number (52 weeks in a year), and strips off all higher numbers besides 1. so giving u 2 states 0 or 1.
-
check boxes dun work as 0 or 1. they work as not set or set which can also be dun as a boolean check (wich is what u are after) if(isbox) btw, you never set the array group_row
-
it should get deleted Automatically After 30 Days
laffin replied to anushka's topic in PHP Coding Help
store the last on into his acct and do this periodically with a mysql query check $res=mysql_query("SELECT id FROM users WHERE TO_DAYS(NOW()) - TO_DAYS(last_on) >= 30"); -
I provided a simple example in another thread Form Validation
-
Most systems use number based values for user levels User = 1 Moderator =5 Editor = 10 Admin = 20 than doing comparison checks for the user level is pretty basic comparison. but if ya want lots more flexibility. u will want to look into bit flags for different activities (Note values are power of 2) Read = 1 Post = 2 Delete = 4 Hide = 8 Edit = 16 and using bit testing to see if a user can preform that action or not, a lot more complex, offers more flexibility.
-
u can always use the $_GLOBAL['my_global_var']