HostIssues Community Forums  
Go Back   HostIssues Community Forums > Hosting, Design & Development > Design & Development > Scripts & Tutorials

Notices

Scripts & Tutorials The official AeonCube products and other scripts, code snippets and tutorials.

Reply
 
Thread Tools
  #1  
Old February 24th, 2007, 11:08 AM
j-lucas j-lucas is offline
AeonCube Administrator
 
Join Date: Aug 2006
Location: United Kingdom
Posts: 1,364
[free] Easy Calculator [v1.0]

Add a simple to use calculator for your users to add up sums online.

Click here to download
__________________
HostMediaUK : Low Cost Hosting | Linux PHP Hosting | Windows ColdFusion Hosting | ASP Hosting | Reseller Hosting | Dedicated Servers
AeonCube Networks : Web Design, ColdFusion Development and Web Hosting
Reply With Quote
  #2  
Old April 4th, 2007, 10:22 PM
johnson johnson is offline
Member
 
Join Date: Apr 2007
Location: Billingham
Posts: 70
Yeh once again very handy for a hosting website who offers lots of products online and there users can add up there bill if the hosting company dont have a shopping cart system installed on there server.
Reply With Quote
  #3  
Old April 6th, 2007, 04:24 PM
tehforum tehforum is offline
Frequent Visitor
 
Join Date: Apr 2007
Posts: 21
But you would except a hosting site to have ecommerce or something like that
Reply With Quote
  #4  
Old April 7th, 2007, 01:16 PM
johnson johnson is offline
Member
 
Join Date: Apr 2007
Location: Billingham
Posts: 70
thats why i said f the company dont have a shopping cart system !! Read
Reply With Quote
  #5  
Old April 8th, 2007, 08:30 PM
Black Ice Black Ice is offline
Valued Member
 
Join Date: Oct 2006
Posts: 154
Meh mine's better

PHP Code:
<html>
<head>
<!--  Made by Zezikaro !-->
<title>Calculator for Dummys</title>
</head>
<body>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<fieldseT>
<legend>Please Enter Your Numbers</legend>
    <p>Input one : 
      <input type="text" name="input"><? echo $input?>
      <br /> 
      <br />
    Input 2 : 
    <input type="text" name="input2">
  </p>
    <p>Select which you would like to do:
      <SELECT name="mode" size=1>
        <OPTION selected value="add"> Addition </OPTION>
        <OPTION value="minus"> Minus </OPTION>
        <OPTION value="multiply"> Multiply </OPTION>
        <OPTION value="square"> Square route of input one </OPTION>
      </SELECT>
<br />
      <input name="submit" type="submit" value="submit">
        </p>
        </fieldset>
</form>
<?php
if(isset($_POST['submit'])){
    
$input $_POST['input'];
$input2 $_POST['input2'];

    if(empty(
$input) || empty($input2)){
        echo 
'You have not provided all the information';
    } elseif(!
ereg ("([0-9])"$input)){
        echo 
'Please enter Numbers only';
    } elseif( 
$HTTP_POST_VARS['mode'] === 'minus'){
        echo 
$input $input2;
    } elseif( 
$HTTP_POST_VARS['mode'] === 'add') {
        echo 
$input $input2;
    } elseif( 
$HTTP_POST_VARS['mode'] === 'multiply') {
        echo 
$input $input2;
    } elseif( 
$HTTP_POST_VARS['mode'] === 'square') {
        echo 
sqrt($input);
    } else {
        echo 
'You have not given the correct information';
    }
}
?>


</body>
</html>
one file
Reply With Quote
  #6  
Old April 9th, 2007, 10:12 PM
johnson johnson is offline
Member
 
Join Date: Apr 2007
Location: Billingham
Posts: 70
Mines Better

Mines Better And Easier
PHP Code:
<?

if ($submit)
{
    if ((!
$one) || (!$two) || (!$calc))
    {
    echo(
"<font face=\"Tahoma\" size=\"2\" color=\"#FF0000\"><b>Oops, you forgot to supply some information.  Please correct the problem below.</b></font><br>");
    } else if ((!
ereg("[0-9]",$one)) || (!ereg("[0-9]",$two))) {
    echo(
"<font face=\"Tahoma\" size=\"2\" color=\"#FF0000\"><b>Please restrict your input to only numbers.</b></font><br>");
    } else {
    
    if (
$calc == "add") {
    
$total $one $two;
    } else if (
$calc == "sub") {
    
$total $one $two;
    } else if (
$calc == "mult") {
    
$total $one $two;
    } else if (
$calc == "div") {
    
$total $one $two;
    } else if (
$calc == "mod") {
    
$total $one &#37; $two;
    
}
    
printf("The answer is: <b>%.2f"$total "<br>");
    }
}

?>

<FORM METHOD="post" ACTION="calc.php">
<P><font face="Tahoma" size="2"><b>Input value 1: <br><INPUT TYPE="text" NAME="one" SIZE=20></b></font></p>

<p><font face="Tahoma" size="2"><b>Mathematical operation:</b></font><br>

<font face="Tahoma" size="2">
<input TYPE="radio" NAME="calc" VALUE="add">add 
<input TYPE="radio" NAME="calc" VALUE="sub"> subtract 
<input TYPE="radio" NAME="calc" VALUE="mult">multiply 
<input TYPE="radio" NAME="calc" VALUE="div"> divide
<input TYPE="radio" NAME="calc" VALUE="mod"> modulus
</b></font><br><br>

<font face="Tahoma" size="2"><b>Input value 2: <br><INPUT TYPE="text" NAME="two" SIZE=20></b></font></p>

<P><INPUT TYPE="submit" NAME="submit" VALUE="Do Calculation"></p>

</FORM>

</BODY>
</HTML>
Reply With Quote
  #7  
Old April 10th, 2007, 11:21 AM
Black Ice Black Ice is offline
Valued Member
 
Join Date: Oct 2006
Posts: 154
Quote:
Originally Posted by johnson View Post
Mines Better And Easier
PHP Code:
<?

if ($submit)
{
    if ((!
$one) || (!$two) || (!$calc))
    {
    echo(
"<font face=\"Tahoma\" size=\"2\" color=\"#FF0000\"><b>Oops, you forgot to supply some information.  Please correct the problem below.</b></font><br>");
    } else if ((!
ereg("[0-9]",$one)) || (!ereg("[0-9]",$two))) {
    echo(
"<font face=\"Tahoma\" size=\"2\" color=\"#FF0000\"><b>Please restrict your input to only numbers.</b></font><br>");
    } else {
    
    if (
$calc == "add") {
    
$total $one $two;
    } else if (
$calc == "sub") {
    
$total $one $two;
    } else if (
$calc == "mult") {
    
$total $one $two;
    } else if (
$calc == "div") {
    
$total $one $two;
    } else if (
$calc == "mod") {
    
$total $one $two;
    }
    
printf("The answer is: <b>%.2f"$total "<br>");
    }
}

?>

<FORM METHOD="post" ACTION="calc.php">
<P><font face="Tahoma" size="2"><b>Input value 1: <br><INPUT TYPE="text" NAME="one" SIZE=20></b></font></p>

<p><font face="Tahoma" size="2"><b>Mathematical operation:</b></font><br>

<font face="Tahoma" size="2">
<input TYPE="radio" NAME="calc" VALUE="add">add 
<input TYPE="radio" NAME="calc" VALUE="sub"> subtract 
<input TYPE="radio" NAME="calc" VALUE="mult">multiply 
<input TYPE="radio" NAME="calc" VALUE="div"> divide
<input TYPE="radio" NAME="calc" VALUE="mod"> modulus
</b></font><br><br>

<font face="Tahoma" size="2"><b>Input value 2: <br><INPUT TYPE="text" NAME="two" SIZE=20></b></font></p>

<P><INPUT TYPE="submit" NAME="submit" VALUE="Do Calculation"></p>

</FORM>

</BODY>
</HTML>

You didn't even make the script did you??


Parse error: syntax error, unexpected '}' in C:\Program Files\xampp\htdocs\WWW\calculator\Copy of calculator.php on line 22
Reply With Quote
  #8  
Old April 10th, 2007, 04:10 PM
RainCT's Avatar
RainCT RainCT is offline
Valued Member
 
Join Date: Sep 2006
Location: Catalonia
Posts: 213
I really don't see much difference, also Johnson's one won't work on server with magic globals OFF (what is more secure).
__________________
RainCT, Eurion Networks
AeonCube Support and AeonCube User System Developer
Reply With Quote
  #9  
Old April 10th, 2007, 06:55 PM
Watdaflip Watdaflip is offline
Forum Administrator
 
Join Date: Sep 2006
Location: Cincinnati, Ohio USA
Posts: 260
You know, I find it easier to just use the calculator on the computer.... or the one sitting on my desk
Reply With Quote
  #10  
Old April 11th, 2007, 12:21 PM
RainCT's Avatar
RainCT RainCT is offline
Valued Member
 
Join Date: Sep 2006
Location: Catalonia
Posts: 213
Quote:
Originally Posted by Watdaflip View Post
You know, I find it easier to just use the calculator on the computer.... or the one sitting on my desk
Me too
__________________
RainCT, Eurion Networks
AeonCube Support and AeonCube User System Developer
Reply With Quote
  #11  
Old April 11th, 2007, 03:31 PM
johnson johnson is offline
Member
 
Join Date: Apr 2007
Location: Billingham
Posts: 70
Yeh me to lol and the calculator script shud work i have tested it on my server sevral times to fix a couple of things on it aswell ill show you a live demo if you want ? www.getmepastnow.com/calc.php click that for the demo and i think u find it does work.
Reply With Quote
  #12  
Old April 11th, 2007, 03:34 PM
johnson johnson is offline
Member
 
Join Date: Apr 2007
Location: Billingham
Posts: 70
And black ice have you uploaded ti to a actual server C:\Program Files\xampp\htdocs\WWW\calculator sounds to me like its on a computer
Reply With Quote
  #13  
Old April 11th, 2007, 03:40 PM
RainCT's Avatar
RainCT RainCT is offline
Valued Member
 
Join Date: Sep 2006
Location: Catalonia
Posts: 213
Quote:
Originally Posted by johnson View Post
And black ice have you uploaded ti to a actual server C:\Program Files\xampp\htdocs\WWW\calculator sounds to me like its on a computer
You can run any PHP script like on a server installing Apache with PHP on it. The easiest way to do this is probably XAMPP, that will install Apache, PHP4, PHP5, MySQL and a lot more with a few clicks and configure them automatically.
__________________
RainCT, Eurion Networks
AeonCube Support and AeonCube User System Developer
Reply With Quote
  #14  
Old December 7th, 2008, 04:13 PM
asass asass is offline
Lurker
 
Join Date: Dec 2008
Posts: 1
I can't download the script, is it because I have 0 post ?, I will make this post and try download again.
Reply With Quote
  #15  
Old December 7th, 2008, 05:25 PM
Primus's Avatar
Primus Primus is offline
AeonCube Administrator
 
Join Date: Aug 2006
Location: Turku, Finland
Posts: 1,875
No, all registered users can download.

The link is old and you can get it here; http://forum.aeoncube.com/local_links.php?catid=7
Reply With Quote
  #16  
Old December 9th, 2008, 08:45 AM
j-lucas j-lucas is offline
AeonCube Administrator
 
Join Date: Aug 2006
Location: United Kingdom
Posts: 1,364
The download link has now been updated on the first post, sorry about that.
Enjoy!
__________________
HostMediaUK : Low Cost Hosting | Linux PHP Hosting | Windows ColdFusion Hosting | ASP Hosting | Reseller Hosting | Dedicated Servers
AeonCube Networks : Web Design, ColdFusion Development and Web Hosting
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 06:09 AM.


Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
© 2001-2009 AeonCube Networks A Registered UK Trading Company Skin design and concept by Attitude