Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- require_once 'functions.php';
- if(!isset($_SESSION['name'])){
- session_destroy();
- header('Location:register.php');
- }
- ?>
- <html>
- <head>
- <title>友達一覧</title>
- <link type='text/css' rel='stylesheet' href='friend_list.css'/>
- </head>
- <body>
- <?php
- try{
- $pdo=connect();
- $sql="SELECT * from profile_table where name in (SELECT friend2 from friend_table where friend1=?)";
- $stmt=$pdo->prepare($sql);
- $stmt->execute(array($_SESSION['name']));?>
- <table>
- <caption>友達一覧</caption>
- <?php foreach($stmt as $row){?>
- <tr>
- <?php if($row['nickname']!=NULL){?>
- <th>
- <?php if($row['icon_path']==NULL){?>
- <div class='circle'>
- <img src='images/icatch.jpg'>
- </div>
- <?php }else if($row['icon_path']!=NULL){?>
- <div class='circle'>
- <img src='<?php echo $row['icon_path'];?>'>
- </div>
- <?php } ?>
- </th>
- <td>
- <div class='talk'>
- <form action='friend_talk.php' method='POST'>
- <button name='receiver' value="<?php echo $row['name']?>"><?php echo $row['nickname'];?></button>
- </form>
- </div>
- </td>
- <?php }else{ ?>
- <?php if($row['icon_path']==NULL){?>
- <th>
- <div class='circle'>
- <img src='images/icatch.jpg'>
- </div>
- <?php }else if($row['icon_path']!=NULL){?>
- <div class='circle'>
- <img src='<?php echo $row['icon_path'];?>'>
- </div>
- </th>
- <?php } ?>
- <td>
- <div class='talk'>
- <form action='friend_talk.php' method='POST'>
- <button name='receiver' value="<?php echo $row['name']?>"><?php echo $row['name'];?></button>
- </form>
- </div>
- </td>
- <?php } ?>
- <?php delete_check(); ?>
- <td>
- <form action='friend_delete.php' method='POST' onsubmit="return submitcheck()">
- <button name='delete_friend' value='<?php echo $row['name'];?>'>削除</button>
- </form>
- </td>
- </tr>
- <?php } ?>
- </table>
- <?php }catch (PDOException $e){
- echo $e->getMessage();
- exit;
- }
- ?>
- <form action='home.php' method='POST'>
- <button name='receiver' class='back'>戻る</button>
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement