Jump to content

taith

Members
  • Posts

    1,514
  • Joined

  • Last visited

Everything posted by taith

  1. also... its much easier to do it this way... no icky stuffs... just plain and simple :-) $query=mysql_query("select todragonID,fromdragonID from dragonsmating"); while($row=mysql_fetch_array($query)){ mysql_query("update dragons set atcave='yes' where id='$row[todragonID]'"); mysql_query("update dragons set atcave='yes' where id='$row[fromdragonID]'"); } mysql_query("truncate dragonsmating");
  2. i've made this... it works... sorta... function realround($string,$decimal=2){ if(!is_numeric($string)) return $string; $string=explode(".",$string); if(count($string)==1) return $string[0]; $string[1]='1.'.$string[1]; $string[1]=round($string[1],$decimal); $string[1]=substr($string[1],2); return implode(".",$string); } any better suggestions?
  3. yes... but the scientific notation is not turnoffable... echo round(78906898968967.432324, 2); outputs "7.8906898969E+013" i need "78906898968967.43"
  4. anyone know an easy way to round massive numbers? for example... echo round(78906898968967.432324); outputs "7.8906898969E+013" which is so totally unhelpful...
  5. taith

    shipping

    aah thanks! i was lookin for "shipping comparison rates" mybad... thought they'd make a page with more then one company... lol... aparently not
  6. theres only 4 ways of transfering data from page to page get post session cookies get is by far the least secure... but is far easier... unless you... <form name=asdf action="login.php"><input type=hidden name=adf value="asdf"><a href="javascript:document.asdf.submit();">move</a></form> from there, you can then access the values from the other page without anyone tampering the $_GET
  7. header("Cache-Control: no-store, no-cache, must-revalidate"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); echo '<img src="img.jpg">'; that should disable any cache on the page, telling the browser to reload the img each opening...
  8. there isnt... however... verify everything from the url... via is_string(), is_numerical... etc...
  9. personally... i prefer the less specific ones... $username=addslashes(strip_tags($_POST[username])); $password=md5($_POST[username]); $query=mysql_query("SELECT * FROM `accounts` WHERE `username`='$username' AND `password`='$password' LIMIT 1"); $row=mysql_fetch_array($query); if(empty($row)){ $_SESSION[error]='Invalid username/password'; redirect(); }else{ $_SESSION[user]=$row; redirect(); }
  10. no... each one needs to be validated seperatly... if(empty($_POST[username]) echo "Username is a required field. <BR/> Please go <A HREF='register.php'>back</A> and fill it in."; elseif(empty($_POST[password]) echo "Password is a required field. <BR/> Please go <A HREF='register.php'>back</A> and fill it in."; elseif(empty($_POST[email]) echo "Email is a required field. <BR/> Please go <A HREF='register.php'>back</A> and fill it in."; and so on :-)
  11. if you put an ajax script, which loads the pic, that'd kill the cache, or... if you just tell the header() to not use cache... both work :-) header("Cache-Control: no-store, no-cache, must-revalidate"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); there dies any/all forms of cache out there :-)
  12. try somin like this... $goodguyhealth=100; $goodguyatt=100; $goodguydef=100; $badguyhealth=100; $badguyatt=100; $badguydef=100; while($dead!==true){ $attmodifier=$goodguyatt/$badguydef; $defmodifier=$goodguydef/$badguyatt; $goodguydamage=rand(0,$badguyatt)*defmodifier; $baddguyamage=rand(0,$goodguyatt)*attmodifier; $goodguyhealth=$goodguyhealth-$badguydamage $badguyhealth=$badguyhealth-$goodguydamage if($goodguyhealth<=0){ $dead=true; //loose exp/money... killchar(); }elseif($badguyhealth<=0){ $dead=true; //add exp/money/etc... } } or somin to that effect... havent tested the math... but it makes logical sense i think...
  13. not sure why it needs to be in the function for that... shouldnt need to be... but if you include_once(); you can put it in either/both spots... problem solved :-)
  14. <a href="wherever.php" onmouseover="javascript:document.status='';">this should suffice i would think...</a>
  15. taith

    shipping

    well... i looked for hours, couldnt find one... could you pass(post,pm,email) a link? or an example maybe?
  16. taith

    shipping

    ya... i got that much already... but in my mind, theres no way of getting say... fedex's charges for sending a package from here to anywhere... any numbers i come up with, will still vary from their real charges...
  17. change it so its like this... array("01s","04d","13h","07d","08c"); which would sort to... 01s 04d 07d 08c 13h then in your function(s) just put if($string{0}=="0") $string=substr($string,1); or whatnot :-)
  18. taith

    shipping

    not much of a coding issue i'm having... i'm building a shopping cart program and having some issues with the shipping charges, just wondering if theres anyone out there that can give me a few pointers? perhaps a base charge then a $/lb?... now... i know its vague if i use approximates, but its atleast somewhere to start...
  19. taith

    [SOLVED] ereg

    perfection! thanks :-D
  20. right... sorry $flag['1']= "test"; $flag['2']= "me"; foreach($flag as $k=>$v) $get.=$k.'='.$v; @header("Location: ".$_SERVER['HTTP_REFERER']?$get);
  21. sure... you can either declare the $file's seperatly... or automatically foreach($_SERVER['QUERY_STRING'] as $k=$v) $file[$k]=$v; if you have other stuff running through the $_GET, you prolly want to declare seperatly, or filter the variables, so you dont get any mixups :-)
  22. arrays cant be sent via $_GET... however if you $flag['1']= "test"; $flag['2']= "me"; foreach($flag as $k=>$v) $get.=$k.'='.$v; @header("Location: ".$_SERVER['HTTP_REFERER']?flag=$get); do that, the foreach changes that into a nice $_GET able string :-)
  23. i've found that some servers, on some OS's, send headers a little differently... try using this instead... its just covering more bases... <? function get_referrer(){ if(!$ref=@$HTTP_REFERER) $ref=$_SERVER['HTTP_REFERER']; return $ref; } ?> cant hurt to try :-)
  24. taith

    [SOLVED] ereg

    sorry, i know very little of ereg... but i'm trying to make a function to determine if a string is a hex or not... heres what i got sofar... function is_hex($string){ if($string{0}=="#") $string=substr($string,1); if(strlen($string)!='6') return false; if(!ereg("[a-fA-F0-9]", $string)) return false; return true; } if(is_hex("#asdf89")) echo 'true'; else echo 'false'; any idea why it keeps returning true?
  25. ya... i was trying to get away from that tho... get it targeting a new page, instead of refreshing... perhaps using ajax... set a timer to "autosave" it to a session, then preview button just java opens popup, and loads from them sessions... which is a swell idea! good idea me! *runs off, laughing like a maniac*
×
×
  • 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.