Jump to content

RussellReal

Members
  • Posts

    1,773
  • Joined

  • Last visited

Posts 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. 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

  4. 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>
    

  5. 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;

  6. 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

  7. #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..

  8. 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

×
×
  • 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.