Server IP : 172.16.15.8 / Your IP : 3.138.135.201 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/bdstamour/public_html/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<?php session_start(); ob_start(); if (isset($_SESSION['username'])) { ?> <TITLE> FirstStep </TITLE><link rel="stylesheet" type="text/css" href="research.css"> <BODY> <CENTER><H2>Notifications</H2><HR> <?php $host = 'localhost'; $user = 'bdstamour'; $passw = 'cs480'; $database = 'bdstamour'; $connect = mysqli_connect($host, $user, $passw); mysqli_select_db($connect, $database); $usernamesesh = $_SESSION['username']; $confirm = $_POST['confirm']; $IDs = $_SESSION['IDs']; $query = "select id from FirstStep2 where username='$usernamesesh'"; $UserArray = mysqli_fetch_array(mysqli_query($connect, $query)) or die(mysqli_error($connect)); $UserID = $UserArray[0]; if(isset($_POST['GotIt'])) { $sql1 = "select User2ID from Partners where User1ID='$UserID' and Status='0'"; $res = mysqli_query($connect, $sql1) or die(mysqli_error($connect)); $sql2 = "select User2ID from Partners where User1ID='$UserID' and Status='2'"; $res2 = mysqli_query($connect, $sql2) or die(mysqli_error($connect)); if(mysqli_num_rows($res) != 0) { while($row = mysqli_fetch_row($res)) { $sqll1 = "delete from Partners where User1Id='$UserID' and User2ID='$row[0]' and Status='0'"; mysqli_query($connect, $sqll1) or die(mysqli_error($connect)); } } if(mysqli_num_rows($res2) != 0) { while($row = mysqli_fetch_row($res2)) { $sqll2 = "update Partners set Status='3' where User1Id='$UserID' and User2ID='$row[0]'"; mysqli_query($connect, $sqll2) or die(mysqli_error($connect)); } } print "No more partnership notifications at this time."; } elseif(isset($_POST['Submit'])) { $accept = array(); $reject = array(); for($i=0; $i<count($confirm); $i++) { if($confirm[$i] == 'accept') { $accept[] = $IDs[$i]; } else { $reject[] = $IDs[$i]; } } if(count($accept) ==0) { print "You didn't accept any partnership requests."; } else { print "You accepted partnership request(s) from: "; print '<table border=1>'; print '<th>First Name<th>Last Name<th>Username'; for($n=0; $n<count($accept); $n++) { $sql = "select first, last, username from FirstStep2 where id='$accept[$n]'"; $result = mysqli_query($connect, $sql) or die(mysqli_error($connect)); while ($row = mysqli_fetch_row($result)) { print "<tr>"; foreach($row as $field) { print "<td>$field</td>"; } print "</tr>"; } mysqli_query($connect, "update Partners set Status='2' where User1ID='$accept[$n]' and User2ID='$UserID'"); } print "<p>"; } ?> </table> <HR> <table> <BODY> <?php if(count($reject) ==0) { print "You didn't reject any partnership requests."; } else { print "You rejected partnership request(s) from: "; print '<table border=1>'; print '<th>First Name<th>Last Name<th>Username'; for($n=0; $n<count($reject); $n++) { $sql = "select first, last, username from FirstStep2 where id='$reject[$n]'"; $result = mysqli_query($connect, $sql) or die(mysqli_error($connect)); while ($row = mysqli_fetch_row($result)) { print "<tr>"; foreach($row as $field) { print "<td>$field</td>"; } print "</tr>"; } mysqli_query($connect, "update Partners set Status='0' where User1ID='$reject[$n]' and User2ID='$UserID'"); } print "<p>"; } } ?> </table> <?php } else { ?> <CENTER> <?php print "You are not logged in. Please <A HREF=FirstStepIndex.php>login.</A><p>"; print "<A HREF=NewUser.php>Not registered? Let's get started!</A><p>"; } ?> <HR> </HTML> <?php include("date.php"); ?>