Visualizzazione dei risultati da 1 a 10 su 10

Discussione: fatal error

  1. #1
    Utente di HTML.it
    Registrato dal
    Jan 2005
    Messaggi
    579

    fatal error

    allora avrei un campo che si identifica da solo attraverso questo cod:

    echo "<input type=\"text\" name=\"autore\" readonly=\"true\" value=\"".$aUser[username]."\" />

    \n\n";

    e questa è la sessione rimango loggato:

    <?php
    include_once("include/config.php");
    include_once("include/auth.lib.php");

    list($status, $user) = auth_get_status();

    if($status == AUTH_LOGGED & auth_get_option("TRANSICTION METHOD") == AUTH_USE_LINK){
    $link = "?uid=".$_GET['uid'];
    }else $link = '';
    ?>

    e questo è l'errore che mi fà:


    Fatal error: Call to undefined function: auth_get_status() in /membri2/starfinger/lli/new.php on line 5

    la quinta riga sarebbe questa:

    list($status, $user) = auth_get_status();

    grazie
    l'uomo è tutto ciò che non può essere

    http://www.ebug.it Discussioni da web Designer

    http://www.ebug.it/?p=354 e Dart Fener dove lo mettiamo lol

  2. #2
    Utente di HTML.it L'avatar di deleted_id_48586
    Registrato dal
    Nov 2002
    Messaggi
    1,732
    viene richiamata una funzione "auth_get_status()" che non è stata definita in precedenza.
    Controlla

  3. #3
    Utente di HTML.it
    Registrato dal
    Jan 2005
    Messaggi
    579
    nelle pagine incluse????
    l'uomo è tutto ciò che non può essere

    http://www.ebug.it Discussioni da web Designer

    http://www.ebug.it/?p=354 e Dart Fener dove lo mettiamo lol

  4. #4
    quando usi include() devi essere sicuro della "posizione" dei file che richiami.. specialmente se non sono nella stessa directory

  5. #5
    Utente di HTML.it
    Registrato dal
    Jan 2005
    Messaggi
    579
    auth.lib contiene questo:

    <?php

    $_AUTH = array(
    "TRANSICTION METHOD" => AUTH_USE_COOKIE
    );

    function auth_set_option($opt_name, $opt_value){
    global $_AUTH;

    $_AUTH[$opt_name] = $opt_value;
    }

    function auth_get_option($opt_name){
    global $_AUTH;

    return is_null($_AUTH[$opt_name])
    ? NULL
    : $_AUTH[$opt_name];
    }

    function auth_clean_expired(){
    global $_CONFIG;

    $result = mysql_query("SELECT creation_date FROM ".$_CONFIG['table_sessioni']." WHERE uid='".auth_get_uid()."'");
    if($result){
    $data = mysql_fetch_array($result);
    if($data['creation_date']){
    if($data['creation_date'] + $_CONFIG['expire'] <= time()){
    switch(auth_get_option("TRANSICTION METHOD")){
    case AUTH_USE_COOKIE:
    setcookie('uid');
    break;
    case AUTH_USE_LINK:
    global $_GET;
    $_GET['uid'] = NULL;
    break;
    }
    }
    }
    }

    mysql_query("
    DELETE FROM ".$_CONFIG['table_sessioni']."
    WHERE creation_date + ".$_CONFIG['expire']." <= ".time()
    );
    }

    function auth_get_uid(){

    $uid = NULL;

    switch(auth_get_option("TRANSICTION METHOD")){
    case AUTH_USE_COOKIE:
    global $_COOKIE;
    $uid = isset($_COOKIE['uid']) ? $_COOKIE['uid'] : NULL;
    break;
    case AUTH_USE_LINK:
    global $_GET;
    $uid = isset($_GET['uid']) ? $_GET['uid'] : NULL;
    break;
    }

    return $uid ? $uid : NULL;
    }

    function auth_get_status(){
    global $_CONFIG;

    auth_clean_expired();
    $uid = auth_get_uid();
    if(is_null($uid))
    return array(100, NULL);

    $result = mysql_query("SELECT U.name as name, U.surname as surname, U.username as username, U.password as password
    FROM ".$_CONFIG['table_sessioni']." S,".$_CONFIG['table_utenti']." U
    WHERE S.user_id = U.id and S.uid = '".$uid."'");

    if(mysql_num_rows($result) != 1)
    return array(100, NULL);
    else{
    $user_data = mysql_fetch_assoc($result);
    return array(99, array_merge($user_data, array('uid' => $uid)));
    }
    }

    function auth_login($uname, $passw){
    global $_CONFIG;

    $result = mysql_query("
    SELECT *
    FROM ".$_CONFIG['table_utenti']."
    WHERE username='".$uname."' and password=MD5('".$passw."') and temp = '0'"
    );

    if(mysql_num_rows($result) != 1){
    return array(AUTH_INVALID_PARAMS, NULL);
    }else{
    $data = mysql_fetch_array($result);
    return array(AUTH_LOGEDD_IN, $data);
    }
    }

    function auth_generate_uid(){

    list($usec, $sec) = explode(' ', microtime());
    mt_srand((float) $sec + ((float) $usec * 100000));
    return md5(uniqid(mt_rand(), true));
    }

    function auth_register_session($udata){
    global $_CONFIG;

    $uid = auth_generate_uid();

    mysql_query("
    INSERT INTO ".$_CONFIG['table_sessioni']."
    (uid, user_id, creation_date)
    VALUES
    ('".$uid."', '".$udata['id']."', ".time().")
    "
    );
    if(!mysql_insert_id()){
    return array(AUTH_LOGEDD_IN, $uid);
    }else{
    return array(AUTH_FAILED, NULL);
    }
    }

    function auth_logout(){
    global $_CONFIG;

    $uid = auth_get_uid();

    if(is_null($uid)){
    return false;
    }else{
    mysql_query("
    DELETE FROM ".$_CONFIG['table_sessioni']."
    WHERE uid = '".$uid."'"
    );
    return true;
    }
    }
    ?>


    config questo:

    <?php

    error_reporting(E_ALL);

    $_CONFIG['host'] = "localhost";
    $_CONFIG['user'] = "";
    $_CONFIG['pass'] = "";
    $_CONFIG['dbname'] = "my_starfinger";

    $_CONFIG['table_sessioni'] = "sessioni";
    $_CONFIG['table_utenti'] = "utenti";

    $_CONFIG['expire'] = 60;
    $_CONFIG['regexpire'] = 24; //in ore

    $_CONFIG['check_table'] = array(
    "username" => "check_username",
    "password" => "check_global",
    "name" => "check_global",
    "surname" => "check_global",
    "indirizzo" => "check_global",
    "occupazione" => "check_global",
    "mail" => "check_global"
    );

    function check_username($value){
    global $_CONFIG;

    $value = trim($value);
    if($value == "")
    return "Il campo non può essere lasciato vuoto";
    $query = mysql_query("
    SELECT id
    FROM ".$_CONFIG['table_utenti']."
    WHERE username='".$value."'");
    if(mysql_num_rows($query) != 0)
    return "Nome utente già utilizzato";

    return true;
    }

    function check_global($value){
    global $_CONFIG;

    $value = trim($value);
    if($value == "")
    return "Il campo non può essere lasciato vuoto";

    return true;
    }


    //--------------
    define('AUTH_LOGGED', 99);
    define('AUTH_NOT_LOGGED', 100);

    define('AUTH_USE_COOKIE', 101);
    define('AUTH_USE_LINK', 103);
    define('AUTH_INVALID_PARAMS', 104);
    define('AUTH_LOGEDD_IN', 105);
    define('AUTH_FAILED', 106);

    define('REG_ERRORS', 107);
    define('REG_SUCCESS', 108);
    define('REG_FAILED', 109);

    $conn = mysql_connect($_CONFIG['host'], $_CONFIG['user'], $_CONFIG['pass']) or die('Impossibile stabilire una connessione');
    mysql_select_db($_CONFIG['dbname']);
    ?>


    l'errore me lo trovi???

    grazie
    l'uomo è tutto ciò che non può essere

    http://www.ebug.it Discussioni da web Designer

    http://www.ebug.it/?p=354 e Dart Fener dove lo mettiamo lol

  6. #6
    ma function auth_get_status() non ha parametri?

  7. #7
    Utente di HTML.it
    Registrato dal
    Jan 2005
    Messaggi
    579
    quali parametri???
    l'uomo è tutto ciò che non può essere

    http://www.ebug.it Discussioni da web Designer

    http://www.ebug.it/?p=354 e Dart Fener dove lo mettiamo lol

  8. #8
    auth_get_status($parametro)

  9. #9
    Anche io ho sto provando ad implementare il sistema di autenticazione proposto da freephp.it solo che sono ancora in fase di "analisi" del codice.
    Mi sono fermato a questa query che proprio (vuoi per le mie lacune in materia) non riesco proprio a comprendere.
    Qualcuno potrebbe spiegare come funziona questa query?
    Grazie...

    $result = mysql_query("SELECT U.name as name, U.surname as surname, U.username as username, U.password as password
    FROM ".$_CONFIG['table_sessioni']." S,".$_CONFIG['table_utenti']." U
    WHERE S.user_id = U.id and S.uid = '".$uid."'");
    Collaborazione - Lealtà - Rispetto
    questo avrete da me, questo pretendo da voi!

  10. #10
    Originariamente inviato da Micheleb
    Anche io ho sto provando ad implementare il sistema di autenticazione proposto da freephp.it solo che sono ancora in fase di "analisi" del codice.
    Mi sono fermato a questa query che proprio (vuoi per le mie lacune in materia) non riesco proprio a comprendere.
    Qualcuno potrebbe spiegare come funziona questa query?
    Grazie...

    $result = mysql_query("SELECT U.name as name, U.surname as surname, U.username as username, U.password as password
    FROM ".$_CONFIG['table_sessioni']." S,".$_CONFIG['table_utenti']." U
    WHERE S.user_id = U.id and S.uid = '".$uid."'");
    E' un normale SELECT dove U sta ad indicare la tabella utenti ed S la tabella sessioni!!

    Per starfinger: ti ricordo che i file devo essere all'interno della stessa directory per funzionare perfettamente!!

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.