Server IP : 172.16.15.8 / Your IP : 18.222.20.3 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/kvtillotson/public_html/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<?php session_start(); //File Name: assig2twoQuaAct.php //Purpose: solutions for quadratic equation //Student Name: Kristin Tillotson $pass = $_SESSION['passwd']; if($pass != "hw22") { print "<center><H2><font color=red>Nope. What are you even doing on this page? </H2><font color=black><A HREF=assig2two.html> Back to Login </center>"; } else { ?> <font color=green> <CENTER> <H2> Solution(s) for Quadratic Equation: ax<SUP>2</SUP>+bx+c=0 </H2> <HR> </font> <?php $a = $_POST['aVar']; $b = $_POST['bVar']; $c = $_POST['cVar']; $d = $b*$b - 4*$a*$c; // debugging // print "a = $a, b = $b, c = $c<P>"; if($d<0) { print "No real solution."; } else if($d==0) { $x = -$b/(2*$a); $x = number_format($x, 2); print "The solution is $x.<BR>"; } else { $x1 = (-$b + sqrt($d))/(2*$a); $x1 = number_format($x1, 1); $x2 = (-$b - sqrt($d))/(2*$a); $x2 = number_format($x2, 1); print "The first solution is $x1.<BR>"; print "The second solution is $x2.<BR>"; } ?> </center> <A HREF=index.html> Course Home </A> | <A HREF=assig2.html> Assignment 2 </A> | <A HREF=assig2two.html> Back to Login </A> <?php } ?>