Advertisement
Guest User

Untitled

a guest
Aug 24th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.01 KB | None | 0 0
  1. <?php
  2. session_start();
  3. require_once 'functions.php';
  4. if(!isset($_SESSION['name'])){
  5. session_destroy();
  6. header('Location:register.php');
  7. }
  8. ?>
  9. <html>
  10. <head>
  11. <title>友達一覧</title>
  12. <link type='text/css' rel='stylesheet' href='friend_list.css'/>
  13. </head>
  14. <body>
  15. <?php
  16. try{
  17. $pdo=connect();
  18. $sql="SELECT * from profile_table where name in (SELECT friend2 from friend_table where friend1=?)";
  19. $stmt=$pdo->prepare($sql);
  20. $stmt->execute(array($_SESSION['name']));?>
  21. <table>
  22. <caption>友達一覧</caption>
  23. <?php foreach($stmt as $row){?>
  24. <tr>
  25. <?php if($row['nickname']!=NULL){?>
  26. <th>
  27. <?php if($row['icon_path']==NULL){?>
  28. <div class='circle'>
  29. <img src='images/icatch.jpg'>
  30. </div>
  31. <?php }else if($row['icon_path']!=NULL){?>
  32. <div class='circle'>
  33. <img src='<?php echo $row['icon_path'];?>'>
  34. </div>
  35. <?php } ?>
  36. </th>
  37. <td>
  38. <div class='talk'>
  39. <form action='friend_talk.php' method='POST'>
  40. <button name='receiver' value="<?php echo $row['name']?>"><?php echo $row['nickname'];?></button>
  41. </form>
  42. </div>
  43. </td>
  44. <?php }else{ ?>
  45. <?php if($row['icon_path']==NULL){?>
  46. <th>
  47. <div class='circle'>
  48. <img src='images/icatch.jpg'>
  49. </div>
  50. <?php }else if($row['icon_path']!=NULL){?>
  51. <div class='circle'>
  52. <img src='<?php echo $row['icon_path'];?>'>
  53. </div>
  54. </th>
  55. <?php } ?>
  56. <td>
  57. <div class='talk'>
  58. <form action='friend_talk.php' method='POST'>
  59. <button name='receiver' value="<?php echo $row['name']?>"><?php echo $row['name'];?></button>
  60. </form>
  61. </div>
  62. </td>
  63. <?php } ?>
  64. <?php delete_check(); ?>
  65. <td>
  66. <form action='friend_delete.php' method='POST' onsubmit="return submitcheck()">
  67. <button name='delete_friend' value='<?php echo $row['name'];?>'>削除</button>
  68. </form>
  69. </td>
  70. </tr>
  71. <?php } ?>
  72. </table>
  73. <?php }catch (PDOException $e){
  74. echo $e->getMessage();
  75. exit;
  76. }
  77. ?>
  78. <form action='home.php' method='POST'>
  79. <button name='receiver' class='back'>戻る</button>
  80. </form>
  81. </body>
  82. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement