Jump to content

taith

Members
  • Posts

    1,514
  • Joined

  • Last visited

Everything posted by taith

  1. oy... enough of this... improvising time! [code] <? if($dir = @opendir("news/")){ while(($file = readdir($dir)) !== false){   if($file != ".." && $file != "."){   $date=date ("YmHis.", filemtime($filename));   $filelist['$date'] = $file;   } } closedir($dir); } ?> <form> <select name="selected_dir" > <?php ksort($filelist); while(list ($key, $val) = each ($filelist)){ echo "<option>$val</option>"; } ?> </select> </form> [/code] hows that work? you might need a different sort...
  2. heres how you get the time of when the file was made [code] date("F d Y H:i:s", filemtime($file)); [/code]
  3. just as a suggestion... its ALOT faster to use glob() to get files :-) [code] <? $filelist=glob("news/*.txt"); ?> [/code]
  4. prolly the easiest way of doin this... is storing the date in a database as date(z); then pull it out, if it doesnt equal today, run script, update database.
  5. this'll give you the url of where you are... [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]; } ?> [/code] and prolly the easiest way of getting the title, would be setting it as a var first... [code] $title="title"; echo "<title>$title</title>"; echo "<a href=\"get_url()\">$title</a>"; [/code]
  6. yes, you would need to set 3 seperate cookies... unfortuanatly .php cannot set an array as a cookie :-(
  7. php doesnt have access to the files on your computer(as far as i know), it only communicates with the browser specifically... meaning it has access to the headers... and if your using static ip addresses... tha'd prolly be your best bet...
  8. no... only ./.. to go back multiple folders you'd use [code] ../../images/x.jpg [/code] or the likes :-D
  9. when searching files... . <-- same directory .. <-- back one directory... good thing i remember my dos lol
  10. taith

    Cookies

    ok... and whats on line 27 of checklogin.php?
  11. taith

    Cookies

    aah... you have to put that BEFORE anything is outputed (echo/print)...
  12. i'm sorry... thats not vague enough... can you try to be a little less specific?
  13. taith

    Cookies

    wonderful thing bout variables, once data is set, " ' are no longer necessary... you can use em... but not necessary... [code] $time = 60 * 60 * 24 * 60 + time(); #two months setcookie($_POST['myusername'],$myusername,$time); setcookie("$_POST['myusername']","$myusername","$time"); #same thing, dont use ' or it'll take the $time as a string, not a variable. [/code]
  14. no... when the press "back", it loads the file from cache, you can do it if you have cache set off... by on the new page set a session var, then on your form page, detect for it...
  15. taith

    Hide URL

    hows this for a suggestion... [code] switch($_GET[op]){ default: require_once('main.php'); break; case "x": require_once('x.php'); break; } [/code] then just use <a href=".?op=x"></a> and hence, no address bar except domain and the ?op=*
  16. [code]<? #top of index.php session_start(); (isset($_COOKIE[Lang])) ? require_once('lang/'.$_COOKIE[Lang].'.php') : require_once('lang/english.php'); #restoffile... ?>[/code]
  17. lol... top of the index.php
  18. this isnt tested... but it should work... foreach is MUCH faster and easier with arrays :-) [code] <? $checkboxArray = array( 1=>"$rigger", 2=>"$anhugger", 3=>"$systemfacade"); foreach($checkboxArray as $k => $v){ if($v == "on") $checkboxArray[$k] = "YES"; else $checkboxArray[$k] = "NO"; } ?> [/code]
  19. [code] <? (isset($_COOKIE[Lang])) ? require_once('lang/'.$_COOKIE[Lang].'.php') : require_once('lang/english.php'); ?> [/code] then all ya gotta do is set that cookie "Lang" to any language it wants, and it will load that language file :-)
  20. just a hint... when starting the game... start small... then build... dont try and build it full size from the getgo...
  21. [code]for($ii = 0; $ii < mysql_numrows($result); $ii++) { echo "<h1>"; echo mysql_result($result,$ii,"Topic"); echo "</h1>"; echo "<p>"; echo wordwrap(nl2br(mysql_result($result,$ii,"Txt")),"20","<br>"); #i'm assuming this is your text echo "</p>"; echo "<p>"; echo mysql_result($result,$ii,"Sender"); echo " - "; echo mysql_result($result,$ii,"Time"); echo "</p>"; }[/code]
  22. $newtext = wordwrap($text, 20, "<br />");
  23. when you ?><div><? or the likes... you dont need to echo it... and this is much easier :-) [code] <? if(isset($reg_error) echo '<p class="error">'; ?> [/code]
  24. [code] <head> <?include_once("header.php")?> <?include("db.php")?> <title><?=$cfg["name"];?></title> </head> <body> <?php // Get all the data from the " pp_files" table $result = mysql_query("SELECT * FROM pp_files") or die(mysql_error());  echo "<center><table border='0' width='50%'>"; // keeps getting the next row until there are no more to get while($row = mysql_fetch_array($result)){ if($i==0){   $i=1;   $class='#C0C0C0'; }else{   $i=0;   $class='#CCCCCC'; } echo "<tr>";   echo "<td bgcolor='$class'>";    echo "<a href='videos.php?id=".$row[id]."'>";    echo "<font color='#00000' '><strong>".$row['name']."</strong><br>";    echo $row['description']."<br>";    echo $row['date']."<br>";    echo $row['creator']."<br></font>";    echo "</tr>"; } echo "</table>"; echo "</center>"; ?> <?include("footer.php")?> </body> </html> [/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.