Jump to content

taith

Members
  • Posts

    1,514
  • Joined

  • Last visited

Everything posted by taith

  1. uuh... other way around... styles first ;-)
  2. <? $url = $_POST['redurl']; header('Location:'. $url); exit; ?>
  3. i dunno... i didnt make it for classes... maybe thats the issue?
  4. personally... i make a functions folder... with an index, which glob()s and require_once()'s all the files in that folder, and inside, i have each of my functions seperated(1 per file(for the most part, i think in have one file with 4... but there all dependant on eachother))... for example... get_url.php <? 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']; } ?> thats it. the one with 4 files, is a navigation script i made, allowing you to add/remove topics, and groups, and output... 4 parts of the same program... but thats just me... makes debuging a breeze!... dont have to count lines of code, looking to find that you forgot a {...
  5. <?php function randomkeys($length){ $pattern="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; for($i=0; $i<$length; $i++) $key.=$pattern{rand(0,61)}; return $key; } function addNewUser($username, $password, $email){ $time=time(); if(strcasecmp($username, ADMIN_NAME) == 0) $ulevel=ADMIN_LEVEL; else $ulevel=USER_LEVEL; $key=randomkeys(30); $q="INSERT INTO ".TBL_USERS." VALUES ('$username', '$password', '0', $ulevel, '$email', $time, $key)"; return mysql_query($q, $this->connection); } ?>
  6. in 2 years, i've never had any issues with my referrer script... and if you just want an unreachable page... just... header('Location: '.get_referrer());
  7. boo javascript! lol okok... it has its uses... one of which, isnt automated redirects... <? function get_referrer(){ return (!$ref=@$HTTP_REFERER) ? $_SERVER['HTTP_REFERER'] : $ref; } switch(get_referrer()){ case "http://www.google.com": header('Location: google.php'); break; } exit; ?>
  8. index.php <? require_once('common.php'); $body.='<table>'; $body.=' <tr>'; $body.=' <td><span class=text>text</span></td>'; $css.='.text{ text-align:center; }'; $head.='<meta keywords="i like cheese">'; $body.=' </tr>'; #i can set cookies in here, sessions, whatever i need $body.='</table>'; require_once('template.php'); ?> template.php <head> <?=$head?> <style> <?=$css?> </style> </head> <table> <tr> <td><?=$body?></td> </tr> </table> i might also say... this saves ALOT of space on the server... as your using the same template page again and again and again... also is pretty fast!
  9. wow... theres alot of confusion for such a simple switch! lol <?php if(empty($bodytag)) $bodytag='main'; ?> <body class="<?=$bodytag?>"> then on any page you want to change the class, just give $bodytag a value...
  10. if it were me... i'd just set up some statistic handeling for a week... and put them in order of which one was used more often... lol from experience... i'd have to agree name username department
  11. if they turn off cookies, it turns off any/every form of cookies... javascript, php, meta...
  12. personally... i learned my programming so i template... i dealt with this all the time(and got fed up )... setcookie(); $head.=''; $body.='<span class="asdf">text</span>'; require_once('template.php'); then on your template page <?=$head?> <table> <tr> <td><?=$body?></td> </tr> </table> basically... your not outputing any data, until it hits the template page, where all your variables get output :-) you can do stuff in/out of order and nothing really cares(html/css wise)... lol... as long as your css is a varialbe being output, and your body uses them css, everythings happy
  13. declaring the string an int... $string=213hlsdf34; $int=(INT)$string;
  14. yup! just store the counter into the database... instead of in a session :-)
  15. sorry... i dont fully understand modulo... but i think this'd work... $_SESSION[counter]++; if(($_SESSION[counter]%2)==0) header('Location: '); else header('Location: ');
  16. foreach($_POST[reason] as $val){ $reason[].='\'reason\'=`'.$val.'`'; } $reason=implode('||',$reason); foreach($_POST[region] as $val){ $region[].='\'region\'=`'.$val.'`'; } $region=implode('||',$region); mysql_query("SELECT * FROM `table` WHERE (($reason) && ($region))");
  17. somin like this should do :-) <?php function split($string, $limit, $add){ for($i=0;$i<=strlen($string);$i++){ $k++; if($k==$limit){ $string2.=$add; $k=0; } $string2.=$string{$i}; } return trim($string2); } ?>
  18. sorry guys... i'm going to simplify that with glob() http://ca3.php.net/manual/en/function.glob.php it'll grab any/all files in a directory with a * and all php files with a *.php... it acts similar to the dos version(i feel old... stop laughing )
  19. taith

    finding urls

    wow... sweet THANKS!
  20. not tested... but i think it'll work... lol <?php $out=array(); function get_all($dir){ $files=glob($dir); if(empty($files)) return array(); foreach($files as $file){ if(is_dir($file)) $out=array_merge($out,get_all($file.'/*')); else $out[]=$file; } return $out; } print_r(get_all('../divinelive/*')); ?> sorry... edited... now it works... lol then you just do a foreach(){} to grab the filetime(), and remove accordingly :-)
  21. huge security risk... for example... anybody could type in ?month=12&year=2006&security=1|0|1|1... and if you have a $_SESSION[security], it just got changed to 1|0|1|1, and if you use that way of securing... they then can have full access... or whatnot...
×
×
  • 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.