Facebook
From t, 7 Months ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 236
  1. <?php
  2. header("Content-Type: application/json; Charset-UTF-8");
  3.  
  4. $tc = $_GET['tc'];
  5.  
  6. $host = "localhost";
  7. $dbname = "101m";
  8. $username = "root";
  9. $password = "";
  10.  
  11. $db = new PDO("mysql:host=$host;dbname=$dbname;charset=utf8", $username, $password);
  12.  
  13. $sql2 = "SELECT * FROM 101m WHERE TC=? LIMIT 1";
  14. $stmt2 = $db->prepare($sql2);
  15. $stmt2->bindParam(1, $tc);
  16. $stmt2->execute();
  17. $result2 = $stmt2->fetch(PDO::FETCH_ASSOC);
  18. $stmt2->closeCursor();
  19.  
  20. $dogumtarihi = null;
  21.  
  22. if ($result2) {
  23.     $dogumtarihi = $result2["DOGUMTARIHI"];
  24. } else {
  25.     $dogumtarihi = "";
  26. }
  27.  
  28. $dateParts = explode(".", $dogumtarihi);
  29.  
  30. if (count($dateParts) === 3) {
  31.     $dogum_gunu = $dateParts[0];
  32.     $dogum_ayi = $dateParts[1];
  33.     $dogum_yili = $dateParts[2];
  34.  
  35.     $url = "https://unisis.uludag.edu.tr/YazOkulu/YazOkulu/YazMisafirVarYokOgrenciGetir?dogumAy=$dogum_ayi&dogumGun;=$dogum_gunu&dogumYil;=$dogum_yili&tcKimlikNo;=$tc&_=1690816945197"; // coded by dexus
  36.  
  37.     $curl = curl_init($url);
  38.     curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  39.     curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
  40.     curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
  41.     $resp = curl_exec($curl);
  42.      
  43.     if ($resp === false) {
  44.         $error_response = array(
  45.             "error" => "cURL Hatası: " . curl_error($curl)
  46.         );
  47.         echo json_encode($error_response);
  48.     } else {
  49.         echo $resp;  
  50.     }
  51.  
  52.     curl_close($curl);
  53. } else {
  54.     $error_response = array(
  55.         "error" => "Sistem hatası veya TC sini girdiğiniz kişi şuanda üniversite okumuyor."
  56.     );
  57.     echo json_encode($error_response);
  58. }
  59. ?>