Advertisement
Guest User

Refactoring

a guest
Aug 6th, 2014
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.75 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.     <title></title>
  5.     <meta charset="UTF-8">
  6. </head>
  7. <body>
  8. <?php
  9. /**
  10.  * @param $select
  11.  * @return bool
  12.  */
  13. function selectTemplate($select)
  14. {
  15.     if(empty($select)){
  16.         echo 'File name is empty';
  17.         return false;
  18.     }
  19.     $file = $select . 'T.txt';
  20.     $fileContent = file_get_contents($file);
  21.     if(!$fileContent){
  22.         echo 'File not found';
  23.         return false;
  24.     }
  25.  
  26.     echo $fileContent;
  27.  
  28.     if (isset($_POST['FIO'])) {
  29.         echo 'fio:' . $_POST['FIO'];
  30.     } else{
  31.         echo 'fio not found';
  32.     }
  33. }
  34.  
  35. if (isset($_POST['submit'])) {
  36.     selectTemplate($_POST['s']);
  37. } else {
  38.     $homepage = file_get_contents('counter.txt');
  39.     echo $homepage;
  40. }
  41. ?>
  42. </body>
  43. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement