Server IP : 172.16.15.8 / Your IP : 3.144.103.20 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/www/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<?php session_start(); ob_start(); if (isset($_SESSION['username'])) { ?> <HTML> <HEAD> <TITLE>FirstStep </TITLE><link rel="stylesheet" type="text/css" href="research.css"> </HEAD> <CENTER> <H2> Partners </H2> <HR> <?php $host = 'localhost'; $user = 'bdstamour'; $passw = 'cs480'; $database = 'bdstamour'; $connect = mysqli_connect($host, $user, $passw); mysqli_select_db($connect, $database); $partners=$_POST["partners"]; $ppl = $_SESSION['ppl']; $usernamesesh = $_SESSION['username']; $requested = array(); if(count($partners) == 0) print "You didn't request any partnerships."; else { print "<p>You requested partnership(s) with: "; $i=0; print '<table border=1>'; print '<th>First Name<th>Last Name<th>Username'; for($n=0; $n<count($ppl); $n++) $requested[$n] = $ppl[$n][2]; print "<tr>"; foreach($ppl[$i] as $item) print "<td>$item</td>"; print "</tr>"; $i++; print "<p><p>"; ?> </table> <?php $taken = array(); for($n=0; $n<count($requested); $n++) { $UserIDArray = mysqli_fetch_array(mysqli_query($connect, "select id from FirstStep2 where username='$usernamesesh'")); $UserID = $UserIDArray[$n]; $UserRequestedID = mysqli_fetch_array(mysqli_query($connect, "select id from FirstStep2 where username='$requested[$n]'")); $UserReqID = $UserRequestedID[$n]; $result = mysqli_query($connect, "select * from Partners where User1ID='$UserID' and User2ID='$UserReqID' and (Status='1' or Status='3' or Status='2')"); $rslt = mysqli_query($connect, "select * from Partners where User1ID='$UserReqID' and User2ID='$UserID' and (Status='1' or Status='3' or Status='2')"); if(mysqli_num_rows($result)==0 && mysqli_num_rows($rslt)==0) { mysqli_query($connect, "insert into Partners (User1ID, User2ID, Status) values ('$UserID', '$UserReqID', '1')"); print "<p>The users will be informed and will confirm or reject your request."; } else { $taken[$n] = $UserRequestedID[$n]; $sql = mysqli_query($connect, "select first, last, username from FirstStep2 where id='$taken[$n]'"); print "<p><p><p>However, these users have already been requested, sent you a request, or is already your business partner."; $i=0; print '<table border=1>'; print '<th>First Name<th>Last Name<th>Username'; $row = mysqli_fetch_row($sql); print "<tr>"; foreach($row as $item) print "<td>$item</td>"; print "</tr>"; $i++; print "<p><p>"; } $UserRequestedID = array(); } ?> </table> <?php } ?> <?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> <?php include("date.php"); ?> </HTML> </CENTER> </BODY>