taith
Members-
Posts
1,514 -
Joined
-
Last visited
Everything posted by taith
-
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...
-
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.
-
Needed: code to return path of web page, including title
taith replied to tuco's topic in PHP Coding Help
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] -
yes, you would need to set 3 seperate cookies... unfortuanatly .php cannot set an array as a cookie :-(
-
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...
-
requiring from another directory below current...?
taith replied to AbydosGater's topic in PHP Coding Help
no... only ./.. to go back multiple folders you'd use [code] ../../images/x.jpg [/code] or the likes :-D -
requiring from another directory below current...?
taith replied to AbydosGater's topic in PHP Coding Help
when searching files... . <-- same directory .. <-- back one directory... good thing i remember my dos lol -
ok... and whats on line 27 of checklogin.php?
-
aah... you have to put that BEFORE anything is outputed (echo/print)...
-
i'm sorry... thats not vague enough... can you try to be a little less specific?
-
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]
-
'Page Expired' message when a user uses their browser's 'back' button?
taith replied to Jack.Straw's topic in PHP Coding Help
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... -
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=*
-
[code]<? #top of index.php session_start(); (isset($_COOKIE[Lang])) ? require_once('lang/'.$_COOKIE[Lang].'.php') : require_once('lang/english.php'); #restoffile... ?>[/code]
-
lol... top of the index.php
-
right at the very top :-P
-
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]
-
[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 :-)
-
just a hint... when starting the game... start small... then build... dont try and build it full size from the getgo...
-
[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]
-
$newtext = wordwrap($text, 20, "<br />");
-
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]
-
[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]