????JFIF??x?x????'
Server IP : 79.136.114.73 / Your IP : 18.119.0.35 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/appsrv.astacus.se/apps/school/www_old_temp/FoodForNeedy/ |
Upload File : |
<?php require_once('connection.php'); $name = $_GET['Name']; $latitude = $_GET['Latitude']; $longitude = $_GET['Longitude']; $noOfPlates = $_GET['NoOfPlates']; $macAddress = $_GET['MacAddress']; $phoneNo = $_GET['PhoneNo']; $sql = "SELECT Id, NoOfPlatesPending, NoOfPlatesTotal, Date FROM tblDonor WHERE MacAddress=$macAddress AND Status=0"; $result = mysqli_query($connection, $sql); $id = 0; $noOfPlatesPending = 0; $noOfPlatesTotal = 0; $dateDB = ""; $isInsert = true; date_default_timezone_set("Asia/Kolkata"); $currentDateTime = date("Y-m-d H:i:s"); echo "currentDate: " .$currentDateTime ."<br>"; $currentDateWithoutTime = explode (" ", $currentDateTime)[0]; echo "currentDateWithoutTime: " .$currentDateWithoutTime ."<br>"; if ($result->num_rows > 0) { while($row = mysqli_fetch_array($result))//Here only one row will be returned { $dateDB = $row['Date']; $dateWithoutTimeDB = explode (" ", $dateDB)[0]; echo "dateWithoutTimeDB: " .$dateWithoutTimeDB ."<br>"; if (strcmp($currentDateWithoutTime, $dateWithoutTimeDB) == 0)//Equal { echo "date matched" ."<br>"; $isInsert = false; $noOfPlatesPending = $row['NoOfPlatesPending']; $noOfPlatesTotal = $row['NoOfPlatesTotal']; $id = $row['Id']; break; } } } echo "noOfPlatesPending: " .$noOfPlatesPending ."<br>"; if ($isInsert == true) { echo "if" ."<br>"; $sql = "INSERT INTO tblDonor(Name, Latitude, Longitude, NoOfPlatesPending, NoOfPlatesTotal, MacAddress, PhoneNo, Date) VALUES($name, $latitude, $longitude, $noOfPlates, $noOfPlates, $macAddress, $phoneNo, '$currentDateTime')"; } else { echo "else" ."<br>"; $noOfPlatesPendingFinal = $noOfPlatesPending + $noOfPlates; $noOfPlatesTotalFinal = $noOfPlatesTotal + $noOfPlates; $sql = "UPDATE tblDonor SET NoOfPlatesPending=$noOfPlatesPendingFinal, NoOfPlatesTotal=$noOfPlatesTotalFinal, Date='$currentDateTime' WHERE Id=$id AND MacAddress=$macAddress AND Status=0"; } mysqli_query($connection, $sql); mysqli_close($connection); ?>