Jump to content

RussellReal

Members
  • Posts

    1,773
  • Joined

  • Last visited

Everything posted by RussellReal

  1. function roundP5($num) { if ($d = stristr($num,'.')) { $place = substr($d,1); if (strlen($place) == 1) $place = $place * 10; $zpad = str_repeat('0',strlen($place) - 2); $main = substr($num,0,strpos($num,'.',0)); if (!$main) $main = 0; if ($place >= ("75".$zpad)) { $place = 0; $main = $main + 1; } elseif ($place >= ("25".$zpad)) { $place = 5; } elseif ($place < ("25".$zpad)) { $place = 0; } return $main.".".$place; } return false; } this is working.. I just tested it
  2. try this.. its not tested <?php function roundP5($num) { if ($d = stristr($num,'.')) { $place = substr($d,1); if (strlen($place) == 1) $place = $place * 10; $zpad = str_repeat('0',strlen($place) - 2); $main = stristr($d,'.',true); if (!$main) $main = 0; if ($place >= ("75".$zpad)) { $place = 0; $main++; } elseif ($place >= ("25".$zpad)) { $place = 5; } elseif ($place < ("25".$zpad)) { $place = 0; } return $main.$place; } return false; } ?>
  3. ok deno.. I'm putting 1 together right now..
  4. you mean $key would be a numeric salt.. or would be converted to a number and then used as salt? manually salted algorithms don't really work with systems where a user will log in and out lots of times, because you'll have an extra task of being able to match the password again if you want to confirm the user for being authentic
  5. and only after a floating point E.G. "."
  6. assuming you're using DATE fields in sql DELETE FROM `events` WHERE `eventEnd` < NOW()
  7. you'd need to use javascript.. but include a button somewhere under or to th eside of the button incase a user has disabled JavaScript.. but you'd do something like this: <script type="text/javascript"> function _switch(obj) { //either submit the form (which you could do from onChange .submit() // or set the new url manually.. top.location = "http://new.url.com/?whatever="+obj.value; } </script> <select name="whatever" onChange="_switch(this)"> <option value="1">Whatever</option> </select>
  8. you know you could just do foreach ($_FILES as $k => $v) { // and use $v instead of $_FILES['whatever'] }
  9. its either that or manually escape things lol
  10. you could still do echo <<<'LaLa' <?php echo "test";?> LaLa;
  11. mine grabs the port in the second backreference..
  12. for ($i = 0; $e = ${'imagefile'.$i}; $i++) { //use $e instead of $imagefile and use the same code here }
  13. preg_match_all("/((?:1?[0-9]{1,2}|2(?:5[0-5]|[0-4][0-9])\.){3}(?:1?[0-9]{1,2}|2(?:5[0-5]|[0-4][0-9])))\d+?)/",$matches);
  14. test.php?test=whatever does not "hide" any links all that does is send the value "whatever" to the file "test.php" and this value is accessed within test.php as $_GET['test'] the variable assigned in the url "test=whatever"
  15. you mean say you have a file whatever.php and you call it like php whatever.php you want it to READ out to you the contents of whatever.php or do you want in the middle of some script,. to spit out some php code..? assuming its the second one.. nowdoc would make the most sense e.g echo <<<'LaLa' <?php $e = "HOWDY!!"; echo $e; ?> LaLa;
  16. Content-Length in regards to what premiso advised.. and set_time_limit(999); you could set that to 0 incase the user is on dialup and is seriously slow lol
  17. str_replace()? lol and have an array like $replace = array("<<<><><>>>google.script<<<><><>>>","<<<><><>>>woopra.script<<<><><>>>"); $with = array("<script src='google.js' type='text/javascript' />","<script src='woopra.js' type='text/javascript' />"); replace($replace,$with,$content); but this method is akward lol
  18. com objects for the weighing machine (don't ask me to write it for you I am not experienced with com objects) and for securing your PHP files' contents.. that is pretty much impossible mainly because no matter HOW you try to GET the data to the user whether by sending it from a remote server, or trying to jumble the code where it is really hard to interpret how it works.. the code will still be accessible to the end user 1 way or another. how you would go about semi-securing your files... you'd probably want to look into an actual programming language where you COMPILE your code so the language code gets shifted into machine code.. but even then it can STILL be de-compiled
  19. use < instead of < and use > instead of > <pre><php ... ... .. .. ?></pre>
  20. 1.. you could basically read whatever file you want.. like if you want to show the code to lets say.. dothat.php you could just do <?php $f = fopen($file = "dothat.php",'r'); $text = fread($f,filesize($file)); fclose($f); echo htmlEntities($f); ?>
  21. #1 don't do echo "$varname" #2 I don't think you need to terminate single line php things but.. I usually do.. try <?php echo $varname; ?> I do not see if you'er even setting $varname but if you arn't that would be your problem as I'm assuming php isn't spitting out parse errors and double quotes WILL evaluate a variable..
  22. you mean like.. for the vitamin products? like.. Name: Vitamin X Price: $15.99/cont. Description: Vitamin X, take 3 of these right before sexual intercourse to experience the best XXX imaginable. (I hope I don't get banned for that.. LOL) if so, than yes you can do that make a mysql table id - int - auto_increment - primary key - name - text - - price - text - - description - text - - then just put all the vitamins names price and description into the database then when you list them.. list them by ID for example product.php?id=10 then inside of product.php you'd do "SELECT * FROM `products` WHERE `id` = '{$_GET['id']}'" as your query and then mysql_fetch_assoc the result resource and then put $theRowVar['price'] wherever the price should show up, same method for name and description goodluck
  23. ok.. thank you so much, that made my life alot easier I have been helping here for like 2 months or so or a month I'm not exactly sure.. and so like I was on now and was like.. "Hey why not ask and see if its possible", so I asked.. lol and I've been puzzled over this since like a year ago already.. so, thank you very much for your reply
  24. like.. for example: <?php class TestCallback { private $variable; private function handleWalk($theValue) { echo "<h1><b>{$this->variable}</b></h1><br />"; echo $theValue.'<br />'; } public function goTest() { $this->variable = 'TEST!!!'; $abc = array('lol','omg'); array_walk($abc,'$this->handleWalk'); } } $t = new TestCallBack(); $t->goTest(); ?> NOW I know that won't work since, when the callback is triggered.. it will not know what $this is, but if I did like TestCallBack::handleWalk instead of $this->handleWalk it will most likely work.. I want callback functions to be able to be a method within the $this object inside my class.. if I'm making any sence.. in other words.. I want to keep it all within the class, instead of another class to extend the main class in order to do this
  25. <?php function zwalk(&$element) { $element = strrev($element); } $original = '0111001101101101'; $originalArray = explode(' ',trim(chunk_split($original,4,' '))); array_walk($originalArray,'zwalk'); echo implode('',$originalArray); ?>
×
×
  • 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.