Visualizzazione dei risultati da 1 a 4 su 4

Discussione: Log In a gioco

  1. #1

    Log In a gioco

    Ciao a tutti sto creando un browser game!Questa è la pagina del gioco dove si può accedere soltanto se si è registrati e collegati!

    Codice PHP:
    <?php 
    session_start
    (); 

    //connessione al database 

    include("connect.php");    

    //struttura html 

    include("game_index.html"); 

    //inclusione delle classi 

    function __autoload($class_name) { 
    require_once 
    "classi/".$class_name.".php";    


    // nascondiamo i messaggi di errore 

    error_reporting(3); 

    // Recupero della variabile 

    $action $_GET["action"]; 
    $function $_POST["function"]; 

    // Gestione della autenticazione 

    if (!$_SESSION["user"] && !$action

        
    $_SESSION["roleid"] = 0
    header("Location: [url]http://[/url]".$_SERVER['HTTP_HOST']."/".rtrim(dirname($_SERVER['PHP_SELF'])."?action=".md5("authReq"), "/\\"));



    // la classe menu per gestire sia i menu che le action 

    $menu = new menu(); 

    // File contenente la logica di controllo 

    $controlPage $menu->getControl($action$function$_SESSION["roleid"]); 
    include(
    $controlPage); 

    // File contenente l'output 

    $formPage $menu->getForm($action$function$_SESSION["roleid"]); 
    include(
    $formPage); 

    ?>
    classe database
    Codice PHP:
    <?php 
    class database 

        var 
    $host
        var 
    $dbName
        var 
    $user
        var 
    $password
        var 
    $conn
        var 
    $result


        function 
    __construct($host$user$password$dbName
        { 
            global 
    $errorMsg

            
    $this->host $host
            
    $this->user $user
            
    $this->password $password
            
    $this->dbName $dbName

            try 
            { 
                
    // connessione 
                
    if (!$this->conn mysql_connect($this->host$this->user$this->password)) 
                throw new 
    Exception("Errore di connessione al database!"0); 
                
    // selezione db 
                
    if (!mysql_select_db($this->dbName)) 
                throw new 
    Exception("Errore nella selezione del database!"1); 
            } 
            catch (
    Exception $ex
            { 
                
    $errorMsg $ex->getMessage(); 
            } 
        } 

         

        function 
    setValue($value
        { 
            
    // eventuali escape nei valori 
            
    if (!get_magic_quotes_gpc()) 
            
    $value mysql_real_escape_string($value); 
            return 
    $value
        } 
         

        function 
    query($sql
        { 
            global 
    $errorMsg

            try 
            { 
                if (!
    $this->result mysql_query($sql$this->conn)) 
                throw new 
    Exception("Errore nella query SQL."); 
                return 
    true
            } 
            catch (
    Exception $ex
            { 
                
    $errorMsg $ex->getMessage(); 
                return 
    false
            } 
        } 



        function 
    row() 
        { 
            return 
    mysql_fetch_array($this->result); 
        } 


        function 
    row_number($sql){ 
            try 
            { 
                if (!
    $this->result mysql_query($sql$this->conn)){ 
                    throw new 
    Exception("Errore nella query SQL."); 
                }else{ 
                    
    $number =  mysql_num_rows($this->result); 
                    return 
    $number
                } 
            } 
                catch (
    Exception $ex
                { 
                    
    $errorMsg $ex->getMessage(); 
                    return 
    0
                } 
                     
        } 

    ?>
    classe menù

    Codice PHP:
    <?php 

    class menu 

        var 
    $id
        var 
    $manager
        var 
    $team
        var 
    $punti
        var 
    $livello
        var 
    $campionato
        var 
    $cash
        var 
    $vittorie
        var 
    $pareggi
        var 
    $sconfitte
        var 
    $url
        var 
    $md5
         
         
        function 
    __construct() 
        { 
             
        } 
             
        
    //// 
         
        
    function getList() 
        { 
            global 
    $db
             
            
    $sql = ("SELECT * FROM squadra_dati WHERE id = '.$id.'"); 
                         
            
    $db->query($sql); 
             
            while (
    $rowMenu $db->row()) 
            { 
                
    $id $rowMenu[id]; 
                
    $hashtable[$id] = array( 

    "id"            => $id 
    ,"manager"        => $rowMenu[manager
    ,
    "team"                => $rowMenu[team
    ,
    "punti"        => $rowMenu[punti
    ,
    "livello"          => $rowMenu[livello
    ,
    "campionato"        => $rowMenu[campionato
    ,
    "cash"                => $rowMenu[cash
    ,
    "vittorie"        => $rowMenu[vittorie
    ,
    "pareggi"        => $rowMenu[pareggi
    ,
    "sconfitte"        => $rowMenu[sconfitte
    ,
    "url"            => $rowMenu[url
    ,
    "md5"            => $rowMenu[md5]); 
            } 
            return 
    $hashtable
        } 
         
        
    //// 
         
        
    function getDetails() 
        { 
            global 
    $db
             
            
    $sql "SELECT * FROM squadra_dati WHERE id = ".$db->setValue($this->id); 
            
    $db->query($sql); 
            
    $rowMenu $db->row(); 

    $this->manager        $rowMenu[manager]; 
    $this->team             $rowMenu[team]; 
    $this->punti        $rowMenu[punti]; 
    $this->livello        $rowMenu[livello]; 
    $this->campionato    $rowMenu[campionato]; 
    $this->cash            $rowMenu[cash]; 
    $this->vittorie            $rowMenu[vittorie]; 
    $this->pareggi        $rowMenu[pareggi]; 
    $this->sconfitte    $rowMenu[sconfitte]; 
    $this->url        $rowMenu[url]; 
    $this->md5        $rowMenu[md5]; 
        } 
         
        
    //// 
         
        
    function save() 
        { 
            global 
    $db
             
        }try{ 
             
        if (
    $this->id
            { 

    $sql "UPDATE squadra_dati SET manager = '".$db->setValue($this->manager)."', "
    "team = '".$db->setValue($this->team)."', "
    "punti = '".$db->setValue($this->punti)."', "
    "livello = '".$db->setValue($this->livello)."', "
    "campionato = '".$db->setValue($this->campionato."', "
    "cash = '".$db->setValue($this->cash)."', "
    "vittorie = '".$db->setValue($this->vittorie)."', "
    "pareggi = '".$db->setValue($this->pareggi)."' "
    "sconfitte = '".$db->setValue($this->sconfitte)."' "
    "url = '".$db->setValue($this->url)."' "
    "md5 = '".$db->setValue($this->md5)."' "
    "WHERE id = ".$db->setValue($this->id); 
             
            } 
            else 
            { 

    $sql "INSERT INTO squadra_dati (manager, team, punti, livello, "."campionato, cash, vittorie, pareggi, sconfitte, url, md5) "
    "VALUES ('".$db->setValue($this->manager)."', "
                             
    "'".$db->setValue($this->team)."', "
    "'".$db->setValue($this->punti)."', "
    "'".$db->setValue($this->cash)."', "
    "'".$db->setValue($this->livello)."', "
    "'".$db->setValue($this->campionato)."', "
    "'".$db->setValue($this->cash)."', "
    "'".$db->setValue($this->vittorie)."', "
    "'".$db->setValue($this->pareggi)."', "
    "'".$db->setValue($this->sconfitte)."', "
    "'".$db->setValue($this->url)."', "
    "'".$db->setValue($this->md5)."')"
             
            } 
            if (!
    $db->query($sql)) 
                throw new 
    Exception("Errore nel salvataggio del menu"0); 
                     
            return 
    true
        } 
        catch (
    Exception $ex
        { 
            
    $errormsg $ex->getMessage(); 
            return 
    false
        } 

        function 
    delete() 

        global 
    $db
             
        try 
        { 
            
    $sql "DELETE FROM squadra_dati WHERE id =".$db->setValue($this->id); 
            if (!
    $db->query($sql)) 
                throw new 
    Exception("Errore nella cancellazione menu"1); 
        } 
        catch (
    Exception $ex
        { 
            
    $errormsg $ex->getMessage(); 
        } 

         
    //// 
         
    function getMenu($id

        global 
    $db

        
    $sql "SELECT * FROM squadra_dati "
                    
    "INNER JOIN squadra_dati ON id = id "
                    
    "INNER JOIN squadra_gest ON id = id "
             
        
    $resMenu $db->query($sql); 
        
    $i 0
        while (
    $rowMenu $db->row()) 
        { 
            
    $hashtable[$i] = array (  

    "manager"    => $rowMenu[manager
    ,
    "team"        => $rowMenu[team
    ,
    "punti"    => $rowMenu[punti
    ,
    "livello"    => $rowMenu[livello
    ,
    "campionato"    => $rowMenu[campionato
    ,
    "cash"        => $rowMenu[cash
    ,
    "vittorie"    => $rowMenu[vittorie
    ,
    "pareggi"    => $rowMenu[pareggi
    ,
    "sconfitte"    => $rowMenu[sconfitte
    ,
    "url"        => $rowMenu[url
    ,
    "md5"        => $rowMenu[md5
             
        ); 
            
    $i++; 
        } 
        return 
    $hashtable

         
    //// 
    function getSottoMenu($ruolo


        global 
    $db

        
    $sql "SELECT * FROM squadre_dati"
                    
    "INNER JOIN id ON squadra_dati = id"
                    
    "INNER JOIN id ON squadra_gest = id"
                    
    "WHERE id = 1 "
                    
    "AND id = ".$db->setValue($ruolo)." "" AND id = ".$db->setValue($this->id). 
                    
    " ORDER BY squadra_dati"
             
        
    $resMenu $db->query($sql); 
        
    $i 0
        while (
    $rowMenu $db->row()) 
        { 
            
    $hashtable[$i] = array (  
    "manager"            => $rowMenu[manager
    ,
    "team"                        => $rowMenu[team
    ,
    "punti"            => $rowMenu[punti
    ,
    "livello"            => $rowMenu[livello
    ,
    "campionato"            => $rowMenu[campionato
    ,
    "cash"                        => $rowMenu[cash
    ,
    "vittorie"            => $rowMenu[vittorie
    ,
    "pareggi"            => $rowMenu[pareggi
    ,
    "sconfitte"            => $rowMenu[sconfitte
    ,
    "url"                => $rowMenu[url
    ,
    "md5"                => $rowMenu[md5]     
            ); 
            
    $i++; 
        } 
        return 
    $hashtable

         
         
    function 
    getControl($action$func$ruolo

        global 
    $db
                     
        
    $sql "SELECT * FROM squadra_actions "
                    
    "INNER JOIN squadra_dati_action_role ON squadra_dati_idAction = id "
                    
    "WHERE squadra_dati_idRole = ".$db->setValue($ruolo); 
        
    $resMenu $db->query($sql); 
        while (
    $rowMenu $db->row()) 
        { 
            if (
    $rowMenu[md5] != ""
                
    $md5 md5($rowMenu[md5]); 
            else 
                
    $md5 ""
                             
            if (
    $action == $md5 && 
                (
    $func == "" || $func == $rowMenu[func]) && 
                
    $rowMenu[controlpage]) 
            { 
                if (
    file_exists($rowMenu[controlpage])) 
                    return 
    $rowMenu[controlpage]; 
            } 
        } 

        return 
    "/pagenotfound.html"

         
    //// 
         
    function getForm($action$func$ruolo

        global 
    $db
             
        
    $sql "SELECT * FROM squadra_actions "
                    
    "INNER JOIN squadra_actions_role ON idAction = id "
                    
    "WHERE squadra_dati_idRole = ".$db->setValue($ruolo); 
        
    $resMenu $db->query($sql); 
        while (
    $rowMenu $db->row()) 
        { 
            if (
    $rowMenu[md5] != ""
                
    $md5 md5($rowMenu[md5]); 
            else 
                
    $md5 ""
                 
            if (
    $action == $md5 && 
                (
    $func == "" || $func == $rowMenu[func]) && 
                
    $rowMenu[formpage]) 
            { 
                if (
    file_exists($rowMenu[formpage])) 
                    return 
    $rowMenu[formpage]; 
            } 
        } 
             
        return 
    "/pagenotfound.html"


    //// 
         

         
    //// 

    ?>
    Adesso se faccio log in mi dice che la pagina non esiste.Potete dirmi che errori ho fatto?

  2. #2
    In che senso ti dice che la pagina non esiste? :|

  3. #3
    Errore 404

    La pagina http://beamanager.altervista.org/gio...2ba5ae559b6df7 non è presente, questo può dipendere dal fatto che:

    La pagina non esiste più.
    Il link che hai seguito non è valido.
    La pagina è stata spostata.
    Fai attenzione alle MAIUSCOLE e MINUSCOLE, ricorda che http://sito.altervista.org/Pagina.html è diverso da http://sito.altervista.org/pagina.html

  4. #4
    Ma sei sicuro che nella cartella gioco ci sia la index.php??

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.