Autor Zpráva
peter65226
Profil
Dobrý den som novačik a stiahol som login system a chcel by som mu pochopiť
Prosim napisali by ste mi ktori riadok co znamena
<?php
###########################################################
/*
GuestBook Script
Copyright (C) StivaSoft ltd. All rights Reserved.


This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see http://www.gnu.org/licenses/gpl-3.0.html.

For further information visit:
http://www.phpjabbers.com/
info@phpjabbers.com

Version:  1.0
Released: 2014-11-25
*/
###########################################################

session_name('LoginForm');
@session_start();

error_reporting(0);
include("config.php");

?>
<!DOCTYPE html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>PK Prihlasenie</title>
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <!-- Place favicon.ico and apple-touch-icon.png in the root directory -->

        <link rel="stylesheet" href="css/main.css">
        <link href='http://fonts.googleapis.com/css?family=Roboto:400,300,500' rel='stylesheet' type='text/css'>
        <link href="//netdna.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">
        <script src="js/jquery-1.8.2.min.js"></script>
        <script src="js/jquery.validate.min.js"></script>
        <script src="js/main.js"></script>
    </head>
    <body>
<?php
    $error = '';
    if(isset($_POST['is_login'])){
        $sql = "SELECT * FROM ".$SETTINGS["USERS"]." WHERE `username` = '".mysql_real_escape_string($_POST['username'])."'";
        $sql_result = mysql_query ($sql, $connection ) or die ('request "Could not execute SQL query" '.$sql);
        $user = mysql_fetch_assoc($sql_result);
        if(!empty($user)){
            $_SESSION['user_info'] = $user;
            $query = " UPDATE ".$SETTINGS["USERS"]." SET last_login = NOW() WHERE id=".$user['id'];
            mysql_query ($query, $connection ) or die ('request "Could not execute SQL query" '.$query);
        }
        else{
            $error = 'Zly Email alebo Heslo';
        }
    }
    
    if(isset($_GET['ac']) && $_GET['ac'] == 'logout'){
        $_SESSION['user_info'] = null;
        unset($_SESSION['user_info']);
    }
    if(isset($_GET['ac']) && $_GET['ac'] == 'welcome'){
        echo $_POST['username'];
    }
?>
    <?php if(isset($_SESSION['user_info']) && is_array($_SESSION['user_info'])) { ?>

        <form id="login-form" class="login-form" name="form1">

            <div id="form-content">
                <div class="welcome">
                    <?php echo $_SESSION['user_info']['name']  ?>
                    <br />
                    <center>$Ahoj na Stranke Budes Presmerovan�</center>
                    <br />
                    <?php echo $_SESSION['user_info']['content']  ?>
                    <br /><br />
                    <a href="index.php?ac=welcome" style="color:#3ec038">Logout</a>
                </div>    
            </div>
    
        </form>
        
    <?php } else { ?>
        <form id="login-form" class="login-form" name="form1" method="post" action="index.php">
            <input type="hidden" name="is_login" value="1">
            <div class="h1">PK Prihlasenie</div>
            <div id="form-content">
                <div class="group">
                    <label for="username">Meno</label>
                    <div><input id="username" name="username" class="form-control required" type="text" placeholder= Meno></div>
                </div>
                <?php if($error) { ?>
                    <em>
                        <label class="err" for="password" generated="true" style="display: block;"><?php echo $error ?></label>
                    </em>
                <?php } ?>
                <div class="group submit">
                    <label class="empty"></label>
                    <div><input name="submit" type="submit" value="Prihlasiť"/></div>
                    <div><input type="Submit" value="Registracia" onclick="window.location.href='http://pk.wz.sk/form.html'" style="width: 60%; float: center; margin-top: 40px; display: block; line-height: 17px;"></div>
                </div>
            </div>
            <div id="form-loading" class="hide"><i class="fa fa-circle-o-notch fa-spin"></i></div>
        </form>
    <?php } ?>   
    </body>
</html>
Tomášeek
Profil
peter65226:
Pokud si kliknes na cokoliv podtrzeneho v PHP kódu (např. funkce), dostaneš se do manuálu s popisem daně věci.

Doporučuji ale nějaký ucelený manuál, tutorial, knihu.

Vaše odpověď

Mohlo by se hodit


Prosím používejte diakritiku a interpunkci.

Ochrana proti spamu. Napište prosím číslo dvě-sta čtyřicet-sedm:

0