Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [PHP][HTML]Łaczenie kodu HELP
Forum PHP.pl > Forum > Przedszkole
micgok
Mam takie pytanie jak polaczyc taki skrypt w jeden :



  1. <?
  2. require_once('./config.php'); // załaczamy plik config.php
  3.  
  4. function usun($data){
  5.  
  6. GLOBAL $dbc;
  7. if (ini_get('magic_quotes_gpc')){
  8. $data = stripslashes($data);
  9. }
  10.  return mysql_real_escape_string($data, $dbc);
  11. }
  12.  
  13. if (isset($_POST['submit'])){
  14.  
  15. if (empty($_POST['login'])){
  16. $message .= '<font class="blad">Nie podałeś loginu</font><br />';
  17. $l = FALSE;
  18. }else{
  19. $l = usun($_POST['login']);
  20. }
  21.  
  22. if (empty($_POST['haslo'])){
  23. $message .= '<font class="blad">Nie podałeś hasła</font><br />';
  24. $h = FALSE;
  25. }else{
  26. $h = usun($_POST['haslo']);
  27. }
  28.  
  29.  
  30. if ( $l && $h ){
  31.  
  32. $query = "SELECT username, access FROM user WHERE username='$l' AND haslo=password('$h')";
  33. $result = mysql_query($query);
  34. $row = mysql_fetch_array ($result, MYSQL_ASSOC);
  35.  
  36. if($row){
  37. $_SESSION['username'] = $row['username'];
  38. $_SESSION['access'] = $row['access'];
  39. $_GET['cmd'] = 'ok';
  40. header ("Location: admin.php?cmd={$_GET['cmd']}"); // przekierowuje nas na jaka strone chcemy
  41. }else{
  42. $message .= '<font class="blad">Błędne hasło lub login</font><br />';
  43. }
  44. }else{
  45. $message .= '<font class="blad">Spróbuj jeszcze raz</font>';
  46. }
  47. }
  48. ?>



i

  1. <form method="post" action="<? echo $_SERVER['PHP_SELF']; ?>">
  2. <table align="center" border="0">
  3. <tr>
  4. <td align="right" class="uni_01">Login:</td>
  5. <td><input type="text" name="login" size="30"></td>
  6. </tr>
  7. <tr>
  8. <td align="right" class="uni_01">hasło:</td>
  9. <td><input type="text" name="haslo" size="30"></td>
  10. </tr>
  11. <tr>
  12. <td align="right" class="uni_01"> </td>
  13. <td>
  14. <p align="center"><input style="font-weight: bold;" type="submit" name="submit" value="loguj">
  15. </td></tr>
  16. </table>
  17. </form>




i




  1. <div align="center">
  2. <? if(isset($message)){
  3. echo $message;
  4. }
  5. ?>
  6. </div>



i

  1. <?
  2.  
  3. if($_SESSION['access'] != 'root'){
  4. @header ("Location: index.php");
  5. }
  6.  
  7. echo 'dziala:)';
  8.  
  9. ?>



pozdrawiam
Goric
Erm...
  1. <?php
  2. include("plik1.php");
  3. include("plik2.html");
  4. include("plik3.html");
  5. include("plik4.php");
  6. ?>
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.