Pzdr
login1.php:
<?php include("../config.php"); require_once('Smarty/Smarty.class.php'); $smarty = new Smarty; $smarty->template_dir = "Style/"; $smarty->compile_dir ='Smartownia/templates_c/'; $smarty->config_dir = 'Smartownia /configs/'; $smarty->cache_dir = 'Smartownia /cache/'; //connect do bazy $login = $smarty -> assign('login', $_POST['login']); $password = $smarty -> assign('password', $_POST['password']); $sql = "SELECT id FROM users WHERE login='".$login."' and password='".$password."'"; $_SESSION['zalogowany'] = 1; return true; } else { } } //sprawdza czy zalogowany, jesli nie to pokazuje formularz logowania if ($_SESSION['zalogowany'] == 0) { $smarty -> display('login1.tpl'); } else { } ?>
i login1.tpl:
<?php {if $smarty.post.submit} {$smarty.post.login} {$smarty.post.password} {else} <form id="logowanie" method="post" action="{$smarty.server.php_self}"> <b>Zaloguj się</b><br> Login:<br> <input id ="login" type ="text" name ="login" size="8" maxlength ="20"><br> <br> Hasło:<br> <input id ="password" type ="password" name ="password" size="8" maxlength ="15"><br> <br> <input id ="zaloguj" type ="submit" name ="zaloguj" value ="Zaloguj"> </form> {/if} ?>