taith
Members-
Posts
1,514 -
Joined
-
Last visited
Everything posted by taith
-
well... if you think about it... they got a 10/1500 chance of getting one of them... thats 1/150, so if you load 150 times, so if you load the page every few seconds... you could very easily find one in 10 minutes...
-
now... this could work... however switch, is SOOO much faster for stuff like this :-) [code] $randevent=rand(0,1500); $event=""; switch($randevent){ case "0": $rare1=1; $event="Your villagers have uncovered the eye of evil stone..."; break; case "250": $rare2=1; $event="Your villagers have uncovered the jewel of death stone..."; break; case "350": $rare3=1; $event="Your villagers have uncovered the stone of fear..."; break; case "450": $rare4=1; $event="Your villagers have uncovered the dragons eye stone..."; break; case "550": $rare5=1; $event="Your villagers have uncovered the statue of eden..."; break; case "650": $rare6=1; $event="Your villagers have uncovered the priest of lier stone..."; break; case "750": $rare7=1; $event="Your villagers have uncovered the sphere of sin stone..."; break; case "850": $rare8=1; $event="Your villagers have uncovered the knights of satan stone..."; break; case "950": $rare9=1; $event="Your villagers have uncovered the weather witch stone..."; break; case "1500": $rare10=1; $event="Your villagers have uncovered the gods of war stone..."; break; } [/code]
-
the date(z) is from 0-365 (including loop years) just name your images one of them numbers, and on that day, i'll show... then you just [code] <? $comic=$_GET['comicnum']; if(empty($comic)) $comic = date(z); echo '<img alt="alt text" src="'.$comic.'.jpg">'; $pd=$comic -1; $nd=$comic +1; echo '<a href="?comic='.$pd.'">Previous</a> <a href="?comic='.$nd.'">Next</a>'; ?> [/code]
-
sweet deal :-) thanks... and you had an extra ";" [code] <?php function filter_censor($censor,$badwords=array()){ foreach($badwords as $badword){ $censor = str_ireplace($badword, str_pad("",strlen($badword),"*"), $censor); } return $censor; } $badword[]="hello"; echo filter_censor("Hello hello",$badword); ?> [/code]
-
*solved* Dynamic Dropdowns using PHP - Tutorial/code ??
taith replied to swatisonee's topic in PHP Coding Help
how about something like this? [code] <? include("protect.php"); $cid = $_GET["cid"]; echo $cid; mysql_connect("localhost", $dbname, $dbpasswd ) or die ("Unable to connect to server."); mysql_select_db($database) or die ("Unable to select database."); $result1 = mysql_query("SELECT * FROM `Customers` WHERE `CID`= $cid "); $myrow1 = mysql_fetch_array($result1); $company = $myrow1["Company"]; ?> <form enctype='multipart/form-data' action='add_custadd2.php?cid=<?=$cid?>&userid=<?=$userid?>' method='post'> <table border="1" cellspacing="1" style="border-collapse: collapse" bordercolor="#000066" width="95%" cellpadding="5"> <tr><font face="Verdana" size="2">COMPANY <td><input type=hidden name="company" value="<?=$company?>"><input type=text name="company" value="<?=$company?>" disabled="true"> </td> <tr>Country</td><select size="1" onchange="document.location.href=this.value"><option value="">[Select One]</option> <? $result = mysql_query("SELECT * FROM `Countries` ORDER BY `Country` asc "); while($myrow = mysql_fetch_array($result)){ if($row[country]==$_GET[country]) echo '<option selected value="?country='.$myrow[country].'">'.$myrow[country].'</option>'; else echo '<option value="?country='.$myrow[country].'">'.$myrow[country].'</option>'; } echo '</select>'; ?> </td> </tr> <?if(!empty($_GET[country])){?> <tr> <td>Towns<br> <select name="tid"><option value="">[Select One] <? $resulta = mysql_query("SELECT * FROM `Towns` WHERE `ctid` = $ctid ORDER BY `ctid` asc "); while($myrowa = mysql_fetch_array($resulta)){ echo '<option value=%d>%s, %s".', '.$myrowa["TID"].', '.$myrowa["Town"].','. $myrowa["State"]; } echo "</select>\n"; ?> </td> </tr> <?}?> </table> [/code] -
displaying intermediate page / message during wait times
taith replied to flyingboz's topic in PHP Coding Help
another option would be to have a javascript/dhtml window that just shows once you click submit... or something to that effect... -
i think you're looking for something like this... [code] $result = mysql_query("select * from XXXXX "); if(mysql_num_rows($result)==0){ echo "No Records Found !"; }else{ while($row = mysql_fetch_array($result)){ echo $row['name']. " - ". $row['age']; } } [/code]
-
date(z) is the number of days since jan 1 , somewhere between 1-365. date(z) also compensates for leap years... just put a row into your mysql for "date", and have it fill in date(z) coming to think of it... if you go this way... you'd also want [code] $date=date(z)+1; mysql_query("DELETE FROM example WHERE date>'$date1'"); [/code] so it'd go around newyears...
-
[code] $date=date(z)-3; mysql_query("DELETE FROM example WHERE date<'$date1'"); [/code] how bout this?
-
oops
-
no problem... i try ;-) for any specific questions... feel free to pm me :-)
-
anything that is dynamic without reloading the page, is probably done in javascript
-
*solved* Dynamic Dropdowns using PHP - Tutorial/code ??
taith replied to swatisonee's topic in PHP Coding Help
since .php is only loaded once, you'd have to reload the page inbetween each selection... you'd probly want a to intermingle javascript and .php together to get something like this [code] <select size="1" onchange="document.location.href=this.value"> <option value="'.$PHP_SELF.'.?country='.$countryname.'">'.$countryname.'</option> </select> <? switch($_GET[country]){ case "countryname": echo '<select size="1" onchange="document.location.href=this.value">'; echo '<option value="'.$PHP_SELF.'.?country='.$countryname.'">'.$countryname.'</option>'; echo '</select>'; break; } ?> [/code] or something to that effect... -
[code] $_POST['upass'] = md5($_POST['upass']); [/code] that cant happen... put [code] $pass= md5($_POST['upass']);. [/code] then [code] $query="select * from user where uname='".$_POST['uname']."' and pw='".$pass."' "; [/code]
-
no... not really any other way of doing it... other then typing it over, or changing the other pages...
-
true... however this one is much easier to connect with a mysql database... :-)
-
ok :-) basically speaking... [code] $head = " <html> <head> <LINK href='../lib/style.css' rel='stylesheet' type='text/css'> <title>TITLE</title> </head> <body> <center> <div id='wrapper'> <div id='topnav'> <div class='nav'>"; include('../lib/userlogin.php'); $head .= "</div> </div> <div id='header'> <a href='../index.php'><img src='../images/logo.png' border='0' alt='aaa' title='aaa'>[/url] </div> <div id='mainnav'> <a href='../index.php'><img src='../images/01home.jpg' alt='Home' border='0' height='49' width='191' />[/url]<a href='../plans.php'><img src='../images/02plans.jpg' alt='Plans' border='0' height='49' width='197' />[/url]<a href='#'><img src='../images/03forums.jpg' alt='Forums' border='0' height='49' width='201' />[/url]<a href='#'><img src='../images/04support.jpg' alt='Support' border='0' height='49' width='211' />[/url] </div> <div id='menu'>"; include('../admin/lib/nav.php'); $head .= "</div> <div id='content'> <div class='ads'> <p><center><? include('../lib/ads.php'); ?></center></p> </div>"; [/code] then in the nav.php etc. have that info also encompased by the "$head .= "
-
no, its not possible... the only ip address that .php has access to, is the one sent along with the headers, no access to their internal ip's :-(
-
[code] $variable = '<span class="price">$'.$PrintPrice.'</span>'; [/code]
-
unfortunatly, this cannot be in side of a variable... [code] <? include('../admin/lib/nav.php'); ?> [/code] what you'd want to do is end the variable, and in that file, have that information there appended to the $head...
-
on some systems i've found... that session_destroy(); has no effect, try putting this... or perhaps just unset(); all of your main session variables... [code] <? @session_destroy(); @session_end(); header("location:back.php") ?> [/code]
-
easiest way i've found is to drop this to the top of your file [code] if(isset($_COOKIE[lang])) require_once('lang/'.$_COOKIE[lang].'.php'); else require_once('lang/english.php'); [/code] then in your english.php [code] define("HOME","Home"); [/code] or dutch.php [code] define("HOME","Huiswaarts"); [/code] etc. then in your code, you simply just [code] <a href="home.php"><?=HOME?></a> [/code] or whatnot... then all you have to do is set the cookie to change languages...
-
the only other way of doing it, is by cookies, very effective i've found...
-
okie :-D is fixed and works perfectly :-D anyone that wants to use it... feel free :-P [code] <? function filter_censor($censor,$badwords=array()){ foreach($badwords as $badword){ for($i=0;$i<strlen($badword);$i++) $x .= "*"; $censor = str_ireplace($badword, $x, $censor); unset($x); } return $censor; } $badword[]="hello"; echo filter_censor("Hello hello",$badword); ?> [/code]
-
ok... got that fixed... however it is still only blocking 1 word [code]<? function filter_censor($censor,$badwords=array()){ foreach($badwords as $badword){ if(strpos($censor, $badword)){ for($i=0;$i<strlen($badword);$i++) $x .= "*"; $censor = str_replace($badword, $x, $censor); } } return $censor; } $badword[]="hello"; echo filter_censor("Hello hello",$badword); ?>[/code]