Jump to content

taith

Members
  • Posts

    1,514
  • Joined

  • Last visited

Everything posted by taith

  1. either would work... php a little better prolly... you'd create the checkbox, then on your login page, see if its checked, if yes, setcookie()
  2. for example... [code] <s c r i p t> var images = document.images; foreach(images as image) image.style.width=image.width; </s c r i p t> [/code] not tested... but it should work... you'd also need to put that at the very bottom of the page...
  3. your missing a } at the very very end... [code]<?php include_once('top_html.php'); ?> <TD bgcolor=#000000 style="border: 1px solid #363636"> <?php if($step == 'npc'){ //NPC Battle if($action == 'normal'){   //Query For NPC Stats   $query2="select npc_name, npc_power, npc_level, npc_speed, npc_dexterity, npc_health, npc_max_health, npc_gold from npcs where npc_id='$search'";   $result2=mysql_query($query2) or die (mysql_error());   $num_rows=mysql_num_rows($result2);   $row=mysql_fetch_array($result2);   $npc_name=($row['npc_name']);   $npc_power=($row['npc_power']);   $npc_speed=($row['npc_speed']);   $npc_dexterity=($row['npc_dexterity']);   $npc_health=($row['npc_health']);   $npc_max_health=($row['npc_max_health']);   $npc_gold=($row['npc_gold']);   $npc_level=($row['npc_level']);   //Query For NPC Stats End   //information for the battle formula   //power is determined by *ing it by 5 then taking it away from dex.   //dexterity is determined by *inf it by a random number.   //the random number is between 1 and 10 and then divided by 10.   //both players will have a chance to attack randomly throughout the battle   //this is determined by their speed.   //that will be divided by the oponents dexterity and then *sed by 100 to give a percent.   //that percent will be the chance they have of hitting more often.   //however they will never have more than 80% chance of hitting more.   //if the npc class is Necromancer they will have a chance of a skeleton attacking.   //this will be determined by overall level of npc that will be turned into a percent.   //if npc class is Mage they will have a chance of casting a spell.   //if class fire mage - fire ball, frost mage - ice blast, white mage - heal, black mage - destruction.   //the chance of casting magic will be determined by overall level   //if class is thief they will have a chance of stealing extra gold during the battle.   //if class is warrior they will have the chance of doing battle charge during battle and hitting for extra damage.   //THIS IS NOT THE ACTUAL BATTLE, THESE WILL NEED PLACING IN THE WHILE LOOP.   //NPC's Formula   //$npc_power_1 = ($npc_power*2);   //$npc_rand_1 = rand(1,10);   //$npc_rand_2 = ($npc_rand_1/10);   //$npc_dexterity_1 = ($npc_dexterity*$rand_2);   //$npc_speed_1 = (($npc_speed/$npc_dexterity)*100);   //$npc_damage = ($npc_dexterit_1-$npc_power_1);   //if ($npc_damage < '0') {$npc_damage = '0';}   //Necro Class random numbers   //$npc_necro_rand = rand(1,100);   //mage class random numbers   //$npc_mage_rand =  rand(1,100);   //thief class random numbers   //$npc_thief_rand = rand(1,100);   //warrior class random numbers   //$npc_warrior_rand = rand(1,100);   //end NPC formula   //Player's Formula   //$player_power_1 = ($power*5);   //$player_rand_1 = rand(1,10);   //$player_rand_2 = ($player_rand_1/10);   //$player_dexterity_1 = ($dexterit/$rand_2);   //$player_speed_1 = (($speed/$dexterity)*100);   //$player_damage = ($player_dexterit_1-$player_power_1);   //if ($player_damage < '0') {$player_damage = '0';}   //Necro Class random numbers   //$player_necro_rand = rand(1,100);   //mage class random numbers   //$player_mage_rand =  rand(1,100);   //thief class random numbers   //$player_thief_rand = rand(1,100);   //warrior class random numbers   //$player_warrior_rand = rand(1,100);   //end Players formula    //If Win and check if level.   //if ($npc_health < '1')   //{   //$gold_gain = rand(10,25);   //$exp_gain_rand = rand(90,100);   //$level_difference = ($npc_level-$level);   //if ($level_difference < 0){$level_difference = '0';}   //$exp_gain = ($exp_gain_rand*$level_difference);   //$sql2="UPDATE accounts SET gold=gold+$gold_gain, level_exp=level_exp+$exp_gain, npc_wins=npc_wins+1 WHERE char_id='$char_id'";   //if(mysql_query($sql2))   //echo "You won $npc_name. You gain $gold_gain gold and $exp_gain exp. ";   //if ($level_exp > $level_exp_need)   //{   //$sql2="UPDATE accounts SET exp='0', level_exp_need=$exp_need_1, battle_points=battle_points+3, level=level+1 WHERE char_id='$char_id'";   //if(mysql_query($sql2))   //echo "You also gained a level. You recieve 3 Battle points.";   // }   //die(include_once('bottom_html.php'));   //}   //End If Win   //If Lose   //if ($npc_health < '1')   //{   //$gold_lose = rand(10,25);   //$sql2="UPDATE accounts SET gold=gold+$gold_lose, npc_wins=npc_wins-1 WHERE char_id='$char_id'";   //if(mysql_query($sql2))   //echo "You lost to $npc_name. You lose $gold_lose gold..";   //die(include_once('bottom_html.php'));   //}   //End If Lose      //END ALL NOTES.   //THIS IS THE BATTLE.   while($health>0 && $npc_health>0){   //Formula's In The Loop   //NPC's Formula   $npc_power_1 = ($npc_power*2);   $npc_rand_1 = rand(1,10);   $npc_rand_2 = ($npc_rand_1/10);   $npc_dexterity_1 = ($npc_dexterity*$npc_rand_2);   $npc_speed_1 = (($npc_speed/$dexterity)*100);   $npc_damage = ($npc_power_1-$player_dexterity_1);   $npc_damage = round($npc_damage);   if($npc_damage < '0'){ $npc_damage='0'; }   //Necro Class random numbers   $npc_necro_rand = rand(1,100);   //mage class random numbers   $npc_mage_rand =  rand(1,100);   //thief class random numbers   $npc_thief_rand = rand(1,100);   //warrior class random numbers   $npc_warrior_rand = rand(1,100);   //end NPC formula   //Player's Formula   $player_power_1 = ($power*2);   $player_rand_1 = rand(1,10);   $player_rand_2 = ($player_rand_1/10);   $player_dexterity_1 = ($dexterity/$player_rand_2);   $player_speed_1 = (($speed/$npc_dexterity)*100);   $player_damage = ($player_power_1-$npc_dexterity_1);   $player_damage = round($player_damage);   if($player_damage<'0'){ $player_damage='0'; }   //Necro Class random numbers   $player_necro_rand = rand(1,100);   //mage class random numbers   $player_mage_rand =  rand(1,100);   //thief class random numbers   $player_thief_rand = rand(1,100);   //warrior class random numbers   $player_warrior_rand = rand(1,100);   //end Playersformula   //End In Loop Formula's   //determine who strikes first using the speed.   if($player_speed_1 > $npc_speed_1){     $sql2="UPDATE npcs SET npc_health=npc_health-$player_damage WHERE npc_id='$search'";     if(mysql_query($sql2)) echo "<font color=\"Green\">You Attacked $npc_name for $player_damage life.</font>";     $npc_health_1=($npc_health-$player_damage);     if($npc_health_1 < 1){     $gold_gain = rand(10,25);     $exp_gain_rand = rand(90,100);     $level_difference = ($npc_level-$level);     if($level_difference<0){ $level_difference='0'; }     $exp_gain = ($exp_gain_rand*$level_difference);     $sql2="UPDATE accounts SET gold=gold+$gold_gain, level_exp=level_exp+$exp_gain, npc_wins=npc_wins+1 WHERE char_id='$char_id'";     if(mysql_query($sql2))     echo "You won $npc_name. You gain $gold_gain gold and $exp_gain exp.";     if($level_exp > $level_exp_need){       $sql2="UPDATE accounts SET exp='0', level_exp_need=$exp_need_1, battle_points=battle_points+3, level=level+1 WHERE char_id='$char_id'";       if(mysql_query($sql2)) echo "You also gained a level. You recieve 3 Battle points.";     }     die(include_once('bottom_html.php'));     }   }   //End the first attack.   //into the battle   //Player gets first hit   echo "<font color=\"Green\">You Attacked $npc_name for $player_damage life.</font>";   //update npc life   $sql2="UPDATE npcs SET npc_health=npc_health-$player_damage WHERE npc_id='$search'";   if(mysql_query($sql2)) $npc_health_1=($npc_health-$player_damage);   if($npc_health_1 < 1){     $gold_gain = rand(10,25);     $exp_gain_rand = rand(90,100);     $level_difference = ($npc_level-$level);     if($level_difference<0){ $level_difference='0'; }     $exp_gain = ($exp_gain_rand*$level_difference);     $sql2="UPDATE accounts SET gold=gold+$gold_gain, level_exp=level_exp+$exp_gain, npc_wins=npc_wins+1 WHERE char_id='$char_id'";     if(mysql_query($sql2))     echo "You won $npc_name. You gain $gold_gain gold and $exp_gain exp.";     if($level_exp > $level_exp_need){     $sql2="UPDATE accounts SET exp='0', level_exp_need=$exp_need_1, battle_points=battle_points+3, level=level+1 WHERE char_id='$char_id'";     if(mysql_query($sql2)) echo "You also gained a level. You recieve 3 Battle points.";     }     die(include_once('bottom_html.php'));   }   echo "<font color=\"Red\">$npc_name attacked you for $npc_damage life.</font>";   //update player health.   $sql2="UPDATE accounts SET health=health-$npc_damage WHERE char_id='$char_id'";   if(mysql_query($sql2)) $health_1=($health-$npc_damage);   //If Lose   if($health_1<1){     $gold_lose = rand(10,25);     $sql2="UPDATE accounts SET gold=gold-$gold_lose, npc_losses=npc_losses+1, health='0' WHERE char_id='$char_id'";     if(mysql_query($sql2)) echo "You lost to $npc_name. You lose $gold_lose gold.";     die(include_once('bottom_html.php'));   }   //End If Lose    } } } ?> </TD> <?php include_once('bottom_html.php'); ?>[/code]
  4. then you would either need to specify the width/height... or use some javascript to force it not to change...
  5. if you have high numbers you can speed it up a bit like this... [code] $result=mysql_query("SELECT MAX(id), MIN(id) from table"); $row=mysql_fetch_array($result); for($i=$row['MIN(id)'];$i<$row['MAX(id)'];$i++) if($_POST[name$i]=="on") mysql_query("DELETE FROM table WHERE id='$id'"); [/code]
  6. it really depends on the program your using... what i suggest, is create an admin account, and a user account to see both of the controls they have...
  7. for example... [code] for($i=0;$i<20;$i++) echo '<input type=checkbox name="name'.$i.'">'; [/code] [code] $result=mysql_query("SELECT MAX(id) from table"); $row=mysql_fetch_array($result); for($i=0;$i<$row['MAX(id)'];$i++) if($_POST[name$i]=="on") mysql_query("DELETE FROM table WHERE id='$id'"); [/code] not tested... but it should work :-) assuming the checkboxes are being created by the table in the first place of course lol :-)
  8. meaning on the spots you want to go to put [code] <a name="test"></a> [/code] then in your header() add #test or wherever you want to go...
  9. only way to do that is using html anchors...
  10. taith

    MD5 help

    that does seem to be the easiest way of doing it... us a randomkeygen like... [code] function randomkeys($length){ $pattern = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; for($i=0;$i<$length;$i++) $key .= $pattern{rand(0,62)}; return $key; } [/code] set that generated key to the database, and email it to them, and allow them to change it on the page...
  11. taith

    MD5 help

    no. not at the moment lol... and dont expect it for a long while... lol
  12. taith

    MD5 help

    lol... theres dozens of encriptions out there that have already cracked... its only a matter of time before md5() joins the ranks... it'll probably be a long long time... but its not impossible...
  13. taith

    MD5 help

    no. there is no way (as of yet) to decrypt md5()
  14. yes... that function changes [code] <script> --> &lt;script&gt; [/code] if you were wanting to remove all tags, you'd want the strip_tags() function...
  15. not tested... but it should work :-) [code] <form method="post"> <table> <tr>   <td>Date:</td>   <td><input type = "text" name="date" >Please enter as YYYY/MM/DD</td> </tr> <tr>   <td>Announcement:</td>   <td><label><textarea name="notes"></textarea></label></td> </tr> <tr>   <td></td>   <td><input type="submit" name="submit" value="Add Announcement"></td> </tr> </table> </form> <?php if(isset($_POST['submit'])){ $host = "$lang_dbhost"; $user = "$lang_dbuser"; $pass = "$lang_dbpass"; $db = "$lang_dbase"; $date = empty($_POST['date']) ? die ("ERROR: Enter the Date") : mysql_escape_string($_POST['date']); $notes = empty($_POST['notes']) ? die ("ERROR: Enter the Announcement") : mysql_escape_string($_POST['notes']); $notes = rawcode($notes); $connection = mysql_connect($host, "$user, $pass) or die ("Unable to connect!"); mysql_select_db($db) or die ("Unable to select database!"); $query = "INSERT INTO news (date, text) VALUES ('$date', '$notes')"; $result = mysql_query($query) or die ("Error in query: $query. ".mysql_error()); echo "Staff Announcement Added"; mysql_close($connection); } function rawcode($string){ return addslashes(htmlspecialchars("$string", ENT_QUOTES)); } ?> [/code]
  16. then something else is wrong... that function does work properly
  17. <? function rawcode($string){ return addslashes(htmlspecialchars("$string", ENT_QUOTES)); } ?>
  18. yes... you should have the questions/answers pointed to a category, just switch them...
  19. works here also... and the HTTP_REFERRER is sent along with the headers, so any/all new browsers (anything after ie4) should support it... and it will only work for links, going directly there or refreshing without cache wont work.
  20. do yourself a favor... use this... saves SOOO much time ;-) [code] <? function redirect($filename=".?op=main",$delay="0",$die="0"){ if((!headers_sent())&&($delay=="0")) header('Location: '.$filename); elseif($delay=="0"){   echo '<script type="text/javascript">';   echo 'window.location.href="'.$filename.'";';   echo '</script>';   echo '<noscript>';   echo '<meta http-equiv="refresh" content="0;url='.$filename.'" />';   echo '<noscript>'; }else echo '<meta http-equiv="refresh" content="'.$delay.';url='.$filename.'" />'; if($die=="0") exit; } ?> [/code] [code] if(!empty($_SESSION[edit])) redirect("yourpage.php?op=$_SESSION[edit]#youranchor"); [/code] like that?
  21. taith

    overflow

    ya... i know its supposed to... but it never ever ever ever  has :-(
  22. enjoy [code]<? function get_referrer(){ if(!$ref=@$HTTP_REFERER) $ref=$_SERVER['HTTP_REFERER']; return $ref; } echo get_referrer(); ?>[/code]
  23. the include() attaches files, it doesnt anchor to the webpage itself for that, you'll need to either header() there, or have a link on the page to it.
×
×
  • 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.