Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- if(!isset($_SESSION['userName'])) //without being logged in you can not do anything
- {
- session_destroy();
- header("location:index.php");
- }
- if(isset($_POST['logout']))
- {
- header("location:logout.php"); // log out
- }
- $result=mysqli_query($con, "select * from Users where `userName` ='$userName'");
- $row = mysqli_fetch_array($result);
- $id = $row['id_cust']; //gets the username from the session vairables and then will allow it to search the result for their id
- include 'database_connector.php'; // databse information
- if(isset($_POST['delete'])) // if checkbox in any row will delete
- {
- foreach($_POST['checkbox'] as $id)
- {
- $result=mysqli_query($con,"delete from Sports where `id` ='$id'");
- if($result)
- echo "Successfully deleted";
- }
- }
- if(isset($_POST['update'])){ //if updata is selected with a radio button will keep the
- $date1=$_POST['date']; //values in the variables and pass them to update.php
- $event1=$_POST['event'];
- $team1a=$_POST['Team 1'];
- $team2a=$_POST['Team 2'];
- $place1=$_POST['Place'];
- $price1=$_POST['Price'];
- header("location:update.php");
- }
- $currenttime=date("Y-m-d");
- ?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <link href="index.css" rel="stylesheet" type="text/css" /> <!--css sytle sheet-->
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Users Page</title>
- </head>
- <body>
- <div id="floatleft"> <!-- float scoreboard to the left and the sign in to the right -->
- <iframe src="//www.gamechanger.io/team-52c86f6d1645cf08a4c3ff43/scoreboard?g=5&p=5131254a45506d60704191af" width="728" height="90" scrolling="no" frameborder="0"></iframe>
- </div>
- <div id="signin">
- [ <a href="signup.php">Sign Up</a> ]
- [ <a href="signin.php">Sign In</a> ]
- [ <a href="logout.php">Log Out</a> ]
- </div>
- <div id="clear"></div> <!-- clear alignment -->
- <div class="navbar"> <!-- Float nav bar to the left and table to the right -->
- <ul>
- <li><a href="concerts.php" target="_self">Concert</a></li>
- <li><a href="restaurants.php" target="_self">Restaurant</a></li>
- <li><a href="sports.php" target="_self">Sports</a></li>
- <li><a href="users.php" target="_self">Users</a></li>
- <li><a href="addconcert.php" target="_self">Add Concerts</a></li>
- <li><a href="addrestaurants.php" target="_self">Add Restaurants</a></li>
- <li><a href="addsports.php" target="_self">Add Sports</a></li>
- </ul>
- </div>
- <div id="results">
- <?php
- $result=mysqli_query($con, "select * from Sports where `date` >= '$currenttime' LIMIT 0, 30");
- echo "<table>";
- echo "<tr>
- <th>Update</th>
- <th>Delete</th>
- <th>Date</th>
- <th>Event Type</th>
- <th>Team 1</th>
- <th>Team 2</th>
- <th>Place</th>
- <th>Price</th>
- </tr>";
- while($rows=mysqli_fetch_array($result)){
- ?>
- <tr>
- <td align="center"><input name="radio[]" type="radio" value="<? echo $rows['id']; ?>"></td>
- <td align="center"><input name="checkbox[]" type="checkbox" value="<? echo $rows['id']; ?>"></td>
- <td><? echo $rows['Date']; ?></td>
- <td><? echo $rows['event']; ?></td>
- <td><? echo $rows['Team 1']; ?></td>
- <td><? echo $rows['Team 2']; ?></td>
- <td><? echo $rows['Place']; ?></td>
- <td><? echo $rows['Price']; ?></td>
- </tr>
- }
- <?php
- }
- echo "</table>"
- ?>
- <form name="update" action="users.php" method="post">
- <input type="submit" value="delete" name="delete" />
- <input type="submit" value="update" name="update" />
- </form>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement