Jump to content

taith

Members
  • Posts

    1,514
  • Joined

  • Last visited

Everything posted by taith

  1. require('filepath'); include('filepath'); require_once('filepath'); include_once('filepath');
  2. are you sure your a) using a php file, and b) your server supports php?
  3. no... php can only include/require files from the same domain... same goes with the database... however... if you use .txt files as databases... potentially you can network multiple domains...
  4. nope! unlink() is only for removing files... rmdir() removes directories
  5. ya... mine goes both ways... 04 --> april --> 04 its helpful for calendars, and all that likeness :-)
  6. well... sorta... you can detect if the site is there(i have a function for this at home... email me, i'll send it to you later), but you'd have to have some very interesting code to tell wether any webpage is "up"
  7. there we go... rechanged it :-) <? function switch_month($m){ while($m{0}=="0") $m=substr($m,1); $m=strtolower($m); switch($m){ case "1": return "january"; break; case "2": return "february"; break; case "3": return "march"; break; case "4": return "april"; break; case "5": return "may"; break; case "6": return "june"; break; case "7": return "july"; break; case "8": return "august"; break; case "9": return "september"; break; case "10": return "october"; break; case "11": return "november"; break; case "12": return "december"; break; case "january": return "1"; break; case "february": return "2"; break; case "march": return "3"; break; case "april": return "4"; break; case "may": return "5"; break; case "june": return "6"; break; case "july": return "7"; break; case "august": return "8"; break; case "september": return "9"; break; case "october": return "10"; break; case "november": return "11"; break; case "december": return "12"; break; } } echo switch_month(rand(1,12)); ?>
  8. i upgraded this to a switch() at home... but i dont have it here :-) it works perfectly well enough :-) <? function switch_month($m){ while($m{0}=="0") $m = substr($m,1); $m = strtolower($m); if($m==1) $M="january"; if($m==2) $M="february"; if($m==3) $M="march"; if($m==4) $M="april"; if($m==5) $M="may"; if($m==6) $M="june"; if($m==7) $M="july"; if($m== $M="august"; if($m==9) $M="september"; if($m==10) $M="october"; if($m==11) $M="november"; if($m==12) $M="december"; if($m==january) $M="1"; if($m==february) $M="2"; if($m==march) $M="3"; if($m==april) $M="4"; if($m==may) $M="5"; if($m==june) $M="6"; if($m==july) $M="7"; if($m==august) $M="8"; if($m==september) $M="9"; if($m==october) $M="10"; if($m==november) $M="11"; if($m==december) $M="12"; return $M; } ?>
  9. where are you defining these variables?
  10. here ya go :-) <? function filter_charlimit($string, $length="50"){ if(strlen($string)<$length) return $string; else return trim(substr($string, 0, $length)).'...'; } echo filter_charlimit("i'm way to long to show the whole string in a wee tiny little textbox",20); ?> basically... if $string is longer then $length, it cuts off the first $length characers and adds '...' if not, it returns the string untouched :-)
  11. $query=mysql_query("SELECT lesson_planning, objective_led_planning, starters, plenaries, structure_and_pace, questioning, explanations, differentiation, marking, monitoring_progress, group_work, positive_classroom_management, positive_behaviour_management, using_lsas_effectively, gifted_and_talented, speaking_and_listening, ict, engagement_enjoyment FROM pl_teach_learn WHERE username = $username LIMIT 1");
  12. you just need to limit the queries... $query=mysql_query("SELECT field, name, etc FROM `table` WHERE `field`='1' LIMIT 1"); $query=mysql_query("SELECT field, name, etc FROM `table` WHERE `field`='1'");
  13. aah yes... i had issues with this before... easiest way is like this... echo '<table>'; $query=mysql_query("SELECT * FROM `table` LIMIT 1"); $row=mysql_fetch_array($query); echo '<tr>'; foreach($row as $k=>$v){ echo '<td>'.$k.'</td>'; } echo '</tr>'; $query=mysql_query("SELECT * FROM `table`"); while($row=mysql_fetch_array($query)){ echo '<tr>'; foreach($row as $k=>$v){ echo '<td>'.$v.'</td>'; } echo '</tr>'; } echo '</table>'; not tested... but should work :-)
  14. aah... found it rephrased on php.net... basically... it returns a %age of the similarity between the two strings :-) <?php function compare_strings($str1, $str2){ $count=0; $str1=ereg_replace("[^a-z]", ' ', strtolower($str1)); while(strstr($str1, ' ')) $str1 = str_replace(' ', ' ', $str1); $str1=explode(' ', $str1); $str2=ereg_replace("[^a-z]", ' ', strtolower($str2)); while(strstr($str2, ' ')) $str2 = str_replace(' ', ' ', $str2); $str2=explode(' ', $str2); if(count($str1)<count($str2)){ $tmp=$str1; $str1=$str2; $str2=$tmp; unset($tmp); } for($i=0; $i<count($str1); $i++) if(in_array($str1[$i], $str2)) $count++; return $count/count($str2)*100; } ?>
  15. on line 3 of careers-red.php, your echo/print/outputing something... your session_start(); has to be at the VERY BEGINNING... top of everything.
  16. i have this function at home... drop me an email :-) msnmgr majikmarkr@hotmail.com or email mark@divinedesigns.ca ;-)
  17. extract($_POST); thats SO unsecure... switch($_POST[PlayerNumber]){ case "4": echo "4 players"; break; case "5": echo "5 players"; break; case "6": echo "6 players"; break; case "7": echo "7 players"; break; default: echo "error again... grr"; break; }
  18. also... just as forwarning... $_SESSION[test]='test'; $test='blah'; echo $_SESSION[test]; // outputs blah which can be useful for hackers... i HIGHLY suggest against storing strings into $_SESSION...however... if you store your user info like this... $query();//your login query here $row=mysql_fetch_array($query); if(!empty($row)){ $_SESSION[user]=$row; unset($_SESSION[user][password]); } that way... you just if(is_array($_SESSION[user])&&!empty($_SESSION[user])){} you have access to all of your user information, and dont have to deal with hackers (arrays cant be transfered to $_SESSION[] through $_GET/$_POST nearly as easily...)
  19. function mask_ip($ip){ return substr($ip, 0, strpos($ip, strrchr($ip, "."))).'.*'; }
  20. true... also... the session_id() is a random based string alpha numeric... even if they find a way to change it, they got at least 1/1000000000 chance of getting somebody else's sessid... when it comes to those odds... if your going to try and hack it... i say... bring it... lol
  21. when you do the login... if you save it into the $_SESSION[user]=$row; your createing an arrayed array, which is "hard" to abuse through conventional methods... if you want... after you do the login... unset() the data which needs to be secured... email, password, ip address, phpsessid, etc... so it doesnt exist in that array... but quite honestly... if you log into your account, you get your information... which is accessable to you regardless, and if you have hackers, who cares if they hack into their own account? lol... i'm pretty sure, if they can login, they know their own information already... and if they cannot log into an account, the $_SESSION[user] wont have any information... either way... their not going to have any access to any information they wouldnt have anyways...
  22. just as a subnote here... transfering data through $_GET is VERY unsecure... using textboxes/areas and $_POST is 100X more secure...
  23. this should suffice :-) <?php $file="downloads/" . $category . "_" . $item . ".txt"; $fh=@fopen($file, 'r'); if(!$fh) echo 'Error: Can't find description'; else{ $description = fread($fh, filesize($file)); fclose($fh); echo $description; } ?>
  24. i always use linux servers... this works perfectly :-) <? 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']; } ?>
  25. yes... but that adds ,'s in... i need realnumbers... true, i can remove them easy enough... question comes in... why does round() give scientific notation by default? shouldnt that be a seperate option?
×
×
  • 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.