Jump to content

taith

Members
  • Posts

    1,514
  • Joined

  • Last visited

Everything posted by taith

  1. HA! i wish i could get mac addresses... unfortunatly their not sent along with the headers... :-( what i do, is set an autoincreasing id on the users(log/password), and have that also put into each database also, for added security, put a security field in your users and put in (0.0.0.0) then explode it into $security[];... if that makes any sence...
  2. as far as i know... only by putting it there [code] <a href="#?op=<?=$_COOKIE[var]?>"> [/code]
  3. enjoy. [code] <? 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]
  4. look into a game by the name of "legend of the green dragon"... it has pretty swell coding... i learned quite a few many things from it :-)
  5. location is derived from an ip address. from complex(big) functions and arrays. http://www.geobytes.com/IpLocator.htm there are also a few free ones out there...(i have one) ;-)
  6. heres what i use to return the full url... its quick... and simple... also listens to querys... [code] <? function get_url(){ if(!empty($_SERVER[QUERY_STRING])) return 'http://'.$_SERVER[SERVER_NAME].$_SERVER[PHP_SELF].'?'.$_SERVER[QUERY_STRING]; else return 'http://'.$_SERVER[SERVER_NAME].$_SERVER[PHP_SELF]; } echo get_url(); ?> [/code]
  7. [code] function tempvar($variable, $testvariable) { if($variable == $testvariable) return 'selected="selected"'; } [/code]
  8. . <-- same folder .. <-- parent folder so yes... "../../link.jpg" would send you 2 folders down and directed to that jpg
  9. what i usually use is a random key, stored in database, and updated ever time the page loads... or just force them to login every time they reopen... [code] <? function randomkeys($length){ $pattern = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; for($i=0;$i<$length;$i++) $key .= $pattern{rand(0,62)}; return $key; } ?> [/code] and before puting ANYTHING into a database... use [code] <? function stripalltags($string){ $tam=strlen($string); $newstring=""; $tag=0; for($i=0; $i<$tam; $i++){   if($string{$i} == '<'){   $tag++;   continue;   }   if($string{$i} == '>'){   if($tag) $tag--;   continue;   }   if($tag==0) $newstring .= $string{$i}; } return $newstring; } ?> [/code]
  10. yes... good read... however the code completly conflicts with the rest of my programming...
  11. they are linking to the folder, not to the file, when you link to a folder, the index.php is automatically retrieved, but is not shown in the addressbar.
  12. [code] function bignumbers($i){ if(strlen($i)<=3) return $i; if(strpos(",",$i)===false) $i=number_format($i); $a=array('','K','M'); $i=explode(",", $i); $c=count($i); return $i[0].$a[$c-1]; } echo bignumbers('100000'); echo bignumbers('100,000'); [/code]
  13. instead of $_SESSION[var]="val"; you'd want [code] setcookie($var,$val,$time); [/code] cookies are not browser dependant, so you can store any invaluable information there... however... if you know what your doing and can alter cookies... they CAN be insecure...
  14. [code] echo date(z).'/'.date(Y); [/code] date(z) counts from 0-365 (includes leap year)
  15. you need to change the permisson on the folder your moving to to 777
  16. no idea about books... but try www.tizag.com
  17. here ya go... i just made this for ya... [code] <? function bignumbers($i){ if(strlen($i)<=3) return $i; $a=array('','K','Mil'); $i=explode(",", $i); $c=count($i); return $i[0].$a[$c-1]; } echo bignumbers('1,000,000'); echo bignumbers('1,000'); echo bignumbers('1'); ?> [/code]
  18. try this... see if it gives you any errors... [code]mysql_query("UPDATE users SET `status`='1' WHERE `hash`='$hash'") or die(mysql_error);[/code]
  19. $_SESSION is tied to the browser specifically... if you close/open it, all $_SESSION are back to defaults... if you want to have something persistant... use cookies...
  20. [code] <?php $images=array('vulgare.png', 'blueberry.png' ,'kantarell.png',); echo "<table class=\"sidebartable\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\" >"; for($counter = 0; $counter <= 4; $counter++){ $image=$images[rand(0,3)]; echo "<tr><td>"; echo"<img src=$image>"; echo "</td></tr>"; } ?> </table> [/code] EDITED BY thorpe; Please use long <?php tags within the [ code ] blocks, this enables syntax highlghting. You should be using it within your code anyway!
  21. [code] <? $target_folder = "gallery"; $filename = basename($_FILES['newfile']['name']); $target_path = "$target_folder/$filename"; $filetype = pathinfo("$filename"); $filetype = $filetype['extension']; if(($filetype=="jpg")||($filetype=="jpeg")||($filetype=="gif")||($filetype=="png")||($filetype=="bmp")||($filetype=="tiff")||($filetype=="tga")||($filetype=="pub")){ if(move_uploaded_file($_FILES['newfile']['tmp_name'], $target_path)) echo "The file $filename has been uploaded"; } ?> [/code] old script of mine... but i'm sure you can customize...
  22. [code] <INPUT TYPE=file NAME="html_file"> [/code]
  23. [code] <? function dbconnect($host, $username, $password, $database){ global $link; $link = mysql_connect("$host","$username","$password"); mysql_select_db("$database"); } ?> [/code] that way you can call the function, it will connect, and your user/password dont leave the function.
  24. $text can be a thumbnail or text $link can be to a file, or a picture [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]
×
×
  • 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.