taith
Members-
Posts
1,514 -
Joined
-
Last visited
Everything posted by taith
-
lol true that... but in my mind... every scrap of time saved, is well worth its while...
-
yours works perfectly ken... thanks! not as fast as the other one should be tho...
-
doesnt matter if its +1/+2 and the $pos is always returning the same... offset or no...
-
$pos=strpos($string1,'`',$i) yes.. however the $i there is an offset... it should find the first one, set the offset to the right, and search again...
-
basically it takes the colors(`*) (translated elsewhere) and moves them onto another string in the exact same locations... so... echo copycolours("t`fest","echo"); ouptuts e`fcho but if i echo copycolours("t`fes`dt","echo"); it should output e`fch`do but it loops indefinatly...
-
[code] <? $var=$_POST[name]; ?> <form method="GET" action="?"> Username: <input name="name" type="text" size="30" class="box" value="<?=$var?>"> <input type="submit" value="Calc"> [/code]
-
[code] <? function copycolours($string1,$string2){ $i=0; while($pos=strpos($string1,'`',$i)!==false){ $pre=substr($string2,0,$pos); $colour=substr($string1,$pos,$pos+1); $post=substr($string2,-$pos+2); $string2=$pre.$colour.$post; $i=$pos+2; } return $string2; } echo copycolours("t`fest","echo"); #i work echo copycolours("t`fe`tst","echo"); #i crash everyrthing ?> [/code]
-
[code] <? $var=$_POST[name]; ?> <form method="GET" action="?"> Username: <input name="name" type="text" size="30" class="box"> <input type="submit" value="Calc"> [/code]
-
My first php program, and I'm very close to giving up
taith replied to Shiry's topic in PHP Coding Help
what package do you have with geocities? only the pro pack is php enabled... -
Secure, accessible, customisable php mailer script?
taith replied to Gilmore's topic in PHP Coding Help
heres one i made... [code] <? function get_filetype($filepath,$extension=4){ return substr($filepath, -$extension); } function email($to, $subject, $text, $from="", $file=""){ if(is_array($to)) $to = implode(", ",$to); if(empty($to)) return FALSE; if(empty($subject)) $subject="N/A"; $subject=strip_tags($subject); $text = wordwrap($text, 77, "<br />\n"); if(file_exists($file)){ switch(get_filetype($file,3)){ case ".rm": $type="audio/x-realaudio"; break; case ".qt": $type="video/quicktime"; break; } switch(get_filetype($file)){ case ".avi": $type="video/avi"; break; case ".doc": $type="application/msword"; break; case ".gif": $type="image/gif"; break; case ".jpg": $type="image/jpeg"; break; case ".mov": $type="video/mov"; break; case ".mpg": $type="video/mpeg"; break; case ".pdf": $type="application/pdf"; break; case ".png": $type="image/png"; break; case ".ram": $type="audio/x-pn-realaudio"; break; case ".tar": $type="application/x-tar"; break; case ".wav": $type="audio/wav"; break; case ".zip": $type="application/x-zip-compressed"; break; } switch(get_filetype($file,5)){ case ".html": $type="text/html"; break; case ".mpeg": $type="video/mpeg"; break; } if(!isset($type)) $type="text/plain"; $content = fread(fopen($file,"r"),filesize($file)); $content = chunk_split(base64_encode($content)); $name = basename($file); } $uid = strtoupper(md5(uniqid(time()))); $header = "From: $from\nReply-To: $from\n"; $header .= "MIME-Version: 1.0\n"; $header .= "Content-Type: multipart/mixed; boundary=$uid\n"; $header .= "--$uid\n"; $header .= "Content-Type: text/html\n"; $header .= "--$uid\n"; if(file_exists($file)){ $header .= "Content-Type: $type; name=\"$name\"\n"; $header .= "Content-Transfer-Encoding: base64\n"; $header .= "Content-Disposition: attachment; filename=\"$name\"\n\n"; $header .= "$content\n"; $header .= "--$uid--"; } if(mail($to, $subject, $text, $header)) return TRUE; else return FALSE; } ?> [/code] i think tha's sorta what your lookin for :-) -
you'd want to use javascript [code] <? function popup($text, $link, $name="myWindow", $height="300", $width="300", $resizable="0", $status="0", $class=""){ return '<a href="#" onclick=\'javascript: window.open("'.$link.'", "'.$name.'", "status='.$status.', height='.$height.', width='.$width.', resizable='.$resizable.'")\' class='.$class.'>'.$text.'</a>'; } ?> [/code]
-
because i use dozens of colours... and it must be dynamic...
-
[code] $result = mysql_query("SELECT MAX(id) FROM mail"); $row = mysql_fetch_array($result); echo $row['MAX(id)']; [/code]
-
never mind... got it working :-)
-
what this should be doing... is removing the `d and `e from that string... however... its giving me some odd error "Fatal error: Allowed memory size of 26214400 bytes exhausted (tried to allocate 8388612 bytes)" [code] <? function strip_colours($string){ while(stristr($string, '`')){ $pos=strpos($string,'`'); $string=substr($string, 0, $pos-1).substr($string, $pos+2); } return $string; } echo strip_colours('`dhe`ello'); ?> [/code]
-
yes... but the whole idea here is inforcing templates... [code] <? $body=test; $required=array('body','head'); $handle = @fopen("test.html", "r"); if($handle){ while(!feof($handle)) $buffer[] = fgets($handle, 4096); fclose($handle); } foreach($buffer as $line){ if(strstr($line, '<!--')&&strstr($line, '-->')){ $len=strlen($line); $before=substr($line, 0, strpos($line,"<!--")); $mid = substr($line, strpos($line,"<!--")+4); $mid=substr($mid,0,strpos($line,"-->")-10); $mid=trim($mid); $i[$mid]=true; $after=substr($line,strpos($line,"-->")+3); $temp .= $before.$$mid.$after; }$temp .= echo $line; } foreach($required as $k){ if(!isset($i[$k])) $failed=true; } if($failed){ $temp=''; require('template/default.php'); } ?> [/code] script isnt tested... but thats the jist...
-
[code] <? switch ($ACT){ case ""; echo"<form method='POST' action='$PHPSELF?ACT=VALUE'> <input name='pri1' type='checkbox' value='ON'> <input name='pri2' type='checkbox' value='ON'><br /> <input name='pri3' type='checkbox' value='ON'><br /> <p><input type='submit' value='Submit' name='B1'><input type='reset' value='Reset' name='B2'></p> </form>"; break; case "VALUE"; $checkboxes=3; for($i=0;$i<=$checkboxes;$i++) if(isset($_POST[pri.$i])) echo "$i is CHECKED<br>"; break; } ?> [/code]
-
also... i had this once... if the file permissions on the folder your moving it too arnt set properly, it wont move... even though php may say it did...
-
here we go... for all who wanted to see... [code] <? $body=test; $handle = @fopen("test.html", "r"); if($handle){ while(!feof($handle)) $buffer[] = fgets($handle, 4096); fclose($handle); } foreach($buffer as $line){ if(strstr($line, '<!--')&&strstr($line, '-->')){ $len=strlen($line); $before=substr($line, 0, strpos($line,"<!--")); $mid = substr($line, strpos($line,"<!--")+4); $mid=substr($mid,0,strpos($line,"-->")-10); $mid=trim($mid); $after=substr($line,strpos($line,"-->")+3); echo $before.$$mid.$after; }else echo $line; } ?> [/code] then in test.html [code] <table> <tr> <td><!-- body --></td> </tr> </table> [/code]
-
ok... lets simplify it down a bit... [code] <div><!-- body --></div> [/code] and gets recongized as [code] <div><?=$body?></div> [/code]
-
not so funny... i use this all the time... [code] <form method='POST' action='$PHPSELF?ACT=VALUE'> <input name='pri' type='checkbox' value='ON'> <p><input type='submit' value='Submit' name='B1'><input type='reset' value='Reset' name='B2'></p> </form> if($_POST[pri]==on) echo 'on'; else echo 'off'; [/code]
-
say we have template.html [code] <!-- Body --> <table> <tr> <td></td> </tr> </table> [/code] i want somthing that can load that file, then alter it(in realtime) to input variables [code] <!-- Body --> <table> <tr> <td><?=$var?></td> </tr> </table> [/code] any suggestions?
-
wouldnt it be much easier with a cookie? or a session? [code] setcookie("cookie[two]", "cookietwo"); setcookie("cookie[one]", "cookieone"); [/code] then have it write at the end?
-
your quite welcome :-D
-
[code] $i = rand(1,29); if(strlen($i)==1) $i = '0'.$i; [/code]