Advertisement
WILDAN_IZZUDIN

CHANGE LANGUAGE WITH PHP SESSION

Feb 14th, 2018
612
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.65 KB | None | 0 0
  1. <?php
  2. /* PHP Script
  3. Change Language With PHP (Session)
  4. Created By Wildan Izzudin.
  5.     (c) 2018 Underxploit
  6. */
  7. error_reporting(0);
  8. session_start();
  9. function pac($str) {
  10.     echo $str;
  11. }
  12.  
  13. // --- Konfigurasi Bahasa :v --- //
  14. if($_SESSION['bahasa'] == 'inggris') {
  15. $var = array(
  16.     '1' => 'One',
  17.     '2' => 'Two',
  18.     '3' => 'Three',
  19.     'change' => 'Change Language With PHP',
  20.     'quote' => 'PHP is a minor evil perpetrated and created by incompetent amateurs, whereas Perl is a great and insidious evil, perpetrated by skilled but perverted professionals.',
  21.     'love' => 'I Love You :*');
  22. } else if($_SESSION['bahasa'] == 'gaul') {
  23. $var = array(
  24.     '1' => 'Tu',
  25.     '2' => 'Wa',
  26.     '3' => 'Ga',
  27.     'change' => 'Ubah Bahasa Pake PHP',
  28.     'quote' => '2 3 Tutup Botol, Muka Lu Kaya Kontol',
  29.     'love' => 'PepeQue :*');
  30. } else { // else ini adalah bahasa default :v
  31. $var = array(
  32.     '1' => 'Satu',
  33.     '2' => 'Dua',
  34.     '3' => 'Tiga',
  35.     'change' => 'Mengubah Bahasa Dengan PHP',
  36.     'quote' => 'PHP adalah kejahatan kecil yang dilakukan dan diciptakan oleh amatir yang tidak kompeten, sedangkan Perl adalah kejahatan besar dan berbahaya, yang dilakukan oleh profesional yang terampil namun menyimpang.',
  37.     'love' => 'Aku Sayang Kamu :*');
  38. }
  39.  
  40. // --- Konten --- //
  41. pac('<html><head><title>'.$var[change].'</title><meta name="viewport" content="width=device-width, initial-scale=1">');
  42. pac('<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"/>');
  43. pac('<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Cabin"/>');
  44. pac('<style>
  45. *{ box-sizing: border-box; }
  46. *:focus { outline: 0; }
  47. body {
  48.     max-width:400px;
  49.     background: #191919;
  50.     font-family: "Cabin";
  51.     font-size:14px;
  52.     color:#1D9D73;
  53.     margin:auto;
  54. }
  55. select {
  56.     font-family: "Cabin";
  57.     padding:6px;
  58.     width:100%;
  59.     font-size:14px;
  60.     border:1px solid #222;
  61.     background:none;
  62.     color:#1D9D73;
  63.     -webkit-appearance: none;
  64.    -moz-appearance: none;
  65.    text-indent: 1px;
  66.    text-overflow: "";
  67. }
  68. button {
  69.     font-family: "Cabin";
  70.     padding:8px;
  71.     width:100%;
  72.     font-size:14px;
  73.     border:1px solid #222;
  74.     background:none;
  75.     color:#1D9D73;
  76. }
  77. button:hover, select:hover {
  78.     border:1px solid #1D9D73;
  79.     transition: all 0.5s;
  80.     padding:6px;
  81. }
  82. hr {
  83.     border: 0;
  84.     height: 1px;
  85.     background-image: -webkit-linear-gradient(left, #1D9D73, #1D9D73, #1D9D73);
  86.     background-image: -moz-linear-gradient(left, #1D9D73, #1D9D73, #1D9D73);
  87.     background-image: -ms-linear-gradient(left, #1D9D73, #1D9D73, #1D9D73);
  88.     background-image: -o-linear-gradient(left, #1D9D73, #1D9D73, #1D9D73);
  89. }
  90. ::selection {
  91.     background-color: rgba(201,223,255,0.2);
  92.     color: #ffffff;
  93. }
  94. ::-moz-selection {
  95.     background-color: rgba(201,223,255,0.1);
  96.     color: #ffffff;
  97. }
  98. h3 {
  99.     font-weight: normal;
  100.     font-size:15px;
  101. }
  102. table { width:100%; }
  103. .wrap { margin:10px; }
  104. </style>');
  105.  
  106. pac('</head><body>');
  107. pac('<center><br><br>
  108. <h3>'.$var[change].'</h3></center><div class="wrap">');
  109. pac('<hr>');
  110.  
  111. pac('- '.$var[1].'<br> - '.$var[2].'<br> - '.$var[3].'<br> - '.$var[love]);
  112.  
  113. pac('<br><br><center>'.$var[quote].'</center><br>');
  114.  
  115. pac('<hr>');
  116.  
  117.  
  118. if(isset($_POST['change'])) {
  119.     $_SESSION['bahasa'] = $_POST['lang'];
  120.     header('Location: '.$_SERVER['PHP_SELF']);
  121. }
  122.  
  123. pac('<form action="" method="post">
  124.     <table>
  125. <td style="width:80px"><select name="lang">
  126.         <option value="indonesia">Indonesia</option>
  127.         <option value="inggris"');if($_SESSION['bahasa'] == 'inggris'){ pac('selected');}pac('>Inggris</option>
  128.         <option value="gaul"'); if($_SESSION['bahasa'] == 'gaul') { pac('selected');}pac('>Gaul</option>
  129.     </select></td><td style="width:20%"><button name="change" type="submit"><i class="fa fa-globe"></i></button></td></table>');
  130. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement