Advertisement
Guest User

fucking TRASH LANGUAGE

a guest
Nov 28th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.70 KB | None | 0 0
  1. <a href="<?php echo $_SERVER["PHP_SELF"]; ?>?action=adatfelvetel_form">Adatfelvétel (blog)</a><br />
  2.  
  3. <?php
  4.  
  5. if (isset($_GET["action"]) and $_GET["action"]=="adatfelvetel_form"){
  6. $form_blog_felvetel = new blogbejegyzesek();
  7. $form_blog_felvetel->felvetel_form();
  8. }
  9. if (isset($_GET["action"]) and $_GET["action"]=="cmd_update_form"){
  10. $form_blog_modositas = new blogbejegyzesek();
  11. $form_blog_modositas->cmd_update_form();
  12. }
  13.  
  14. if (isset($_GET["action"]) and $_GET["action"]=="cmd_update_vegrehajt"){
  15. $blog_modositas = new blogbejegyzesek();
  16. $blog_modositas->cmd_update_vegrehajt_muvelet();
  17. }
  18.  
  19. if (isset($_GET["action"]) and $_GET["action"]=="cmd_delete"){
  20. $torles = new blogbejegyzesek();
  21. $torles->adat_torles();
  22. }
  23.  
  24. if (isset($_GET["action"]) and $_GET["action"]=="cmd_update_aktivalas"){
  25. $aktivalas = new blogbejegyzesek();
  26. $aktivalas->adat_aktivalas();
  27. }
  28.  
  29. if (isset($_GET["action"]) and $_GET["action"]=="cmd_update_inaktivalas"){
  30. $inaktivalas = new blogbejegyzesek();
  31. $inaktivalas->adat_inaktivalas();
  32. }
  33.  
  34. if (isset($_GET["action"]) and $_GET["action"]=="cmd_insert"){
  35. $felvetel = new blogbejegyzesek();
  36. $felvetel->adatok_felvetele();
  37.  
  38. }
  39.  
  40. $tartalom = new blogbejegyzesek();
  41. $tartalom->osszes_bejegyzes();
  42.  
  43. class blogbejegyzesek{
  44.  
  45. private $servername = "localhost";
  46. private $username = "root";
  47. private $password = "";
  48. private $dbname = "fakkkkkk";
  49. private $conn = "";
  50. private $result = "";
  51. private $row = "";
  52. private $sql = "";
  53.  
  54. public function __construct(){
  55. $this->kapcsolat_nyitas();
  56. }
  57.  
  58. public function __destruct(){
  59. $this->kapcsolat_bontas();
  60. }
  61.  
  62. public function cmd_update_vegrehajt_muvelet(){
  63. $this->sql = "UPDATE
  64. bobik
  65. SET
  66. `nev` = '".$_GET['input_nev']."',
  67. `nem` = '".$_GET['input_nem']."',
  68. `foglalkozas` = '".$_GET['input_fogl']."'
  69. WHERE
  70. id = ".$_GET['input_modositando_id']."
  71. ";
  72.  
  73. if ($this->conn->query($this->sql) === TRUE) {
  74. echo "Sikeres módosítás";
  75. } else {
  76. echo "Sikertelen módosítás";
  77. }
  78. }
  79.  
  80. public function cmd_update_form(){
  81.  
  82. $this->result = $this->conn->query("SELECT * FROM
  83. bobik
  84. WHERE
  85. id = ".$_GET['modositando_id']."
  86. ");
  87.  
  88. if ($this->result->num_rows > 0) {
  89.  
  90. while($this->row = $this->result->fetch_assoc()) {
  91. //$this->row["nev"]
  92. ?>
  93. <fieldset>
  94. <legend>Adatok módosítása</legend>
  95. <form method="GET" action="<?php echo $_SERVER["PHP_SELF"]; ?>">
  96. Név:
  97. <input type="text" name="input_nev"
  98. value="<?php echo $this->row["nev"]; ?>"><br />
  99. Nem:
  100. <input type="text" name="input_nem"
  101. value="<?php echo $this->row["nem"]; ?>"><br />
  102. Foglalkozas:
  103. <input type="text" name="input_fogl"
  104. value="<?php echo $this->row["foglalkozas"]; ?>"><br />
  105.  
  106. <input type="hidden" name="input_modositando_id"
  107. value="<?php echo $this->row["id"]; ?>">
  108. <input type="hidden" name="site" value="blog">
  109. <input type="hidden" name="action" value="cmd_update_vegrehajt">
  110. <input type="submit" value="Módosítás" />
  111. </form>
  112. </fieldset>
  113. <?php
  114. }
  115.  
  116. } else {
  117. echo "Nincs felvett blogbejegyzés!";
  118. }
  119. }
  120.  
  121. public function felvetel_form(){
  122. ?>
  123. <fieldset>
  124. <legend>Adatok felvétele</legend>
  125. <form method="GET" action="<?php echo $_SERVER["PHP_SELF"]; ?>">
  126. Név:
  127. <input type="text" name="input_nev"><br />
  128. Nem:
  129. <input type="text" name="input_nem"><br />
  130. Foglalkozas:
  131. <input type="text" name="input_fogl"><br />
  132.  
  133. <input type="hidden" name="site" value="blog">
  134. <input type="hidden" name="action" value="cmd_insert">
  135. <input type="submit" value="Felvétel" />
  136. </form>
  137. </fieldset>
  138. <?php
  139. }
  140. /* public function adat_aktivalas(){
  141. if (isset($_GET['aktivalando_id']) and
  142. !empty($_GET['aktivalando_id']) and
  143. is_numeric($_GET['aktivalando_id'])
  144. ){
  145. $this->sql = "UPDATE
  146. bobik
  147. SET
  148. aktivitas = 'aktiv'
  149. WHERE
  150. id = ".$_GET['aktivalando_id']."
  151. ";
  152.  
  153. if ($this->conn->query($this->sql) === TRUE) {
  154. echo "Sikeres aktiválás!";
  155. } else {
  156. echo "Sikertelen aktiválás";
  157. }
  158. }
  159. } */
  160. /* public function adat_inaktivalas(){
  161. if (isset($_GET['inaktivalando_id']) and
  162. !empty($_GET['inaktivalando_id']) and
  163. is_numeric($_GET['inaktivalando_id'])
  164. ){
  165. $this->sql = "UPDATE
  166. bobik
  167. SET
  168. aktivitas = 'inaktiv'
  169. WHERE
  170. id = ".$_GET['inaktivalando_id']."
  171. ";
  172.  
  173. if ($this->conn->query($this->sql) === TRUE) {
  174. echo "Sikeres inaktiválás!";
  175. } else {
  176. echo "Sikertelen inaktiválás";
  177. }
  178. }
  179. } */
  180. public function adat_torles(){
  181. if (isset($_GET['torlendo_id']) and
  182. is_numeric($_GET['torlendo_id']) and
  183. !empty($_GET['torlendo_id'])
  184. ){
  185. $this->sql = "DELETE FROM bobik
  186. WHERE id = ".$_GET['torlendo_id']."
  187. ";
  188.  
  189. if ($this->conn->query($this->sql) === TRUE) {
  190. echo "Sikeres törlés!";
  191. } else {
  192. echo "Sikertelen törlés";
  193. }
  194. }
  195. }
  196.  
  197. public function adatok_felvetele(){
  198. if (isset($_GET['input_nev']) and
  199. !empty($_GET['input_nev']) and
  200. isset($_GET['input_nem']) and
  201. !empty($_GET['input_nem']) and
  202. isset($_GET['input_fogl']) and
  203. !empty($_GET['input_fogl'])
  204. ) {
  205. $this->sql = "INSERT INTO
  206. bobik
  207. (
  208. `nev`,
  209. `nem`,
  210. `foglalkozas`
  211. )
  212. VALUES
  213. (
  214. '".$_GET['input_nev']."',
  215. '".$_GET['input_nem']."',
  216. '".$_GET['input_fogl']."'
  217. )
  218. ";
  219.  
  220. if ($this->conn->query($this->sql) === TRUE) {
  221. echo "New record created successfully";
  222. } else {
  223. echo "Error: " . $this->sql . "<br>" . $this->conn->error;
  224. }
  225. }
  226. }
  227. /* public function osszes_bejegyzes_moderalasra(){
  228. $this->result = $this->conn->query("SELECT * FROM bobik");
  229.  
  230. if ($this->result->num_rows > 0) {
  231.  
  232.  
  233. while($this->row = $this->result->fetch_assoc()) {
  234. echo "<p>";
  235. echo $this->row["nev"];
  236. echo "[" . $this->row["aktivitas"] . "]&nbsp;";
  237.  
  238. $aktivalas_url = "";
  239. $aktivalas_url .= "?site=blog";
  240. $aktivalas_url .= "&action=cmd_update_aktivalas";
  241. $aktivalas_url .= "&aktivalando_id=".$this->row["id"];
  242. echo "<a href='".$_SERVER['PHP_SELF']."".$aktivalas_url."'>Aktiválás</a>&nbsp;";
  243.  
  244. $inaktivalas_url = "";
  245. $inaktivalas_url .= "?site=blog";
  246. $inaktivalas_url .= "&action=cmd_update_inaktivalas";
  247. $inaktivalas_url .= "&inaktivalando_id=".$this->row["id"];
  248. echo "<a href='".$_SERVER['PHP_SELF']."".$inaktivalas_url."'>Inaktiválás</a>&nbsp;";
  249.  
  250. echo "</p>";
  251. }
  252.  
  253. } else {
  254. echo "Nincs felvett blogbejegyzés!";
  255. }
  256. } */
  257.  
  258. public function osszes_bejegyzes(){
  259.  
  260. ?>
  261. <form method="GET" action="<?php echo $_SERVER["PHP_SELF"];?>">
  262. <input type="text" name="keresett_szo" placeholder="Keresendő kifejezés">
  263. <input type="hidden" name="action" value="keres">
  264. <input type="submit" value="Keress!">
  265. </form>
  266.  
  267. <br />
  268.  
  269. <?php
  270. if (isset($_GET["action"]) and $_GET["action"]=="keres"){
  271. if(isset($_GET["keresett_szo"]) and !empty($_GET["keresett_szo"])){
  272. $this->sql = "SELECT * FROM bobik WHERE nev like '%".$_GET['keresett_szo']."%' ORDER BY nev asc";
  273. } else {
  274. $this->sql = "SELECT * FROM bobik ORDER BY nev asc";
  275. }
  276. } else {
  277. $this->sql = "SELECT * FROM bobik ORDER BY nev asc";
  278. }
  279.  
  280.  
  281.  
  282. $this->result = $this->conn->query($this->sql);
  283.  
  284. if ($this->result->num_rows > 0) {
  285.  
  286.  
  287. while($this->row = $this->result->fetch_assoc()) {
  288. echo "<p>";
  289. echo $this->row["nev"];
  290. /* echo "[" . $this->row["aktivitas"] . "]&nbsp;"; */
  291.  
  292. $del_url = "";
  293. $del_url .= "?site=blog";
  294. $del_url .= "&action=cmd_delete";
  295. $del_url .= "&torlendo_id=".$this->row["id"];
  296. echo "<a href='".$_SERVER["PHP_SELF"]."".$del_url."'>Törlés</a>&nbsp;";
  297.  
  298. /* $aktivalas_url = "";
  299. $aktivalas_url .= "?site=blog";
  300. $aktivalas_url .= "&action=cmd_update_aktivalas";
  301. $aktivalas_url .= "&aktivalando_id=".$this->row["id"];
  302. echo "<a href='".$_SERVER['PHP_SELF']."".$aktivalas_url."'>Aktiválás</a>&nbsp;";
  303.  
  304. $inaktivalas_url = "";
  305. $inaktivalas_url .= "?site=blog";
  306. $inaktivalas_url .= "&action=cmd_update_inaktivalas";
  307. $inaktivalas_url .= "&inaktivalando_id=".$this->row["id"];
  308. echo "<a href='".$_SERVER['PHP_SELF']."".$inaktivalas_url."'>Inaktiválás</a>&nbsp;"; */
  309.  
  310. $modositas_url = "";
  311. $modositas_url .= "?site=blog";
  312. $modositas_url .= "&action=cmd_update_form";
  313. $modositas_url .= "&modositando_id=".$this->row["id"];
  314. echo "<a href='".$_SERVER['PHP_SELF']."".$modositas_url."'>Módosítás</a>&nbsp;";
  315. echo "</p>";
  316. }
  317.  
  318. } else {
  319. echo "Nincs felvett blogbejegyzés!";
  320. }
  321. }
  322.  
  323. public function osszes_bejegyzes_user(){
  324. $this->result = $this->conn->query("SELECT * FROM bobik");
  325.  
  326. if ($this->result->num_rows > 0) {
  327.  
  328.  
  329. while($this->row = $this->result->fetch_assoc()) {
  330. echo "<p>";
  331. echo $this->row["nev"];
  332. echo "[" . $this->row["aktivitas"] . "]&nbsp;";
  333. echo "</p>";
  334. }
  335.  
  336. } else {
  337. echo "Nincs felvett blogbejegyzés!";
  338. }
  339. }
  340.  
  341. public function kapcsolat_nyitas() {
  342.  
  343. $this->conn = new mysqli($this->servername, $this->username, $this->password, $this->dbname);
  344.  
  345. if ($this->conn->connect_error) {
  346. die("Connection failed: " . $conn->connect_error);
  347. } else {
  348. //echo "Kapcsolat rendben!";
  349. }
  350. $this->conn->set_charset("utf8");
  351. }
  352.  
  353. public function kapcsolat_bontas(){
  354. $this->conn->close();
  355. }
  356. }
  357.  
  358. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement