Pagina 18 di 20 primaprima ... 8 16 17 18 19 20 ultimoultimo
Visualizzazione dei risultati da 171 a 180 su 198

Discussione: [PILLOLA] sessioni

  1. #171
    Utente di HTML.it L'avatar di kuarl
    Registrato dal
    Oct 2001
    Messaggi
    1,093
    [supersaibal]Originariamente inviato da |\/|atrix
    Infatti... ora funziona! Ma nella cartella temp ancora non viene salvata nessuna sessione... Come mai? Se funziona vuol dire che salva le sessioni da qualche parte giusto? [/supersaibal]
    sei sicuro che la direttiva non sia commentata? cioè che non abbia il ; davanti??

    nelle ultime versioni di php se non la si imposta viene usata la cartella temporanea di default del SO. Ad es. sotto il mio xp la trovo in
    C:\Documents and Settings\Kuarl\Impostazioni locali\Temp

  2. #172
    infatti!
    Ultimamente mi sto incritinendo...
    What is the |\/|atrix?

  3. #173

    SICUREZZA SULLE SESSIONI

    Ciao, vorrei una consulenza per la sicurezza delle sessioni.

    vorrei sapere a titolo informativo, se le sessioni sono completamente sicure, oppure è possibile (in qualche modo illegale) modificare date variabili, o id di sessione o altro...

    potete anche rispondermi qui:
    http://forum.html.it/forum/showthrea...hreadid=806852
    «Se leggi dimentichi, se vedi capisci, se fai impari» Piaget

  4. #174
    Scusate ma mi trovo in difficoltà con le sessioni.
    Quando sono in locale funzionano, con php 4.2.3 mentre in rete non vanno, php 4.3.11.
    Vorrei sapere come posso gestire le sessioni in modo compatibile con la versione del server, grazie,

    nicola

    ps ho postato anche in un altro thread ma poi ho pensato che era più appropriato questo

  5. #175

    problema con le sessioni

    Ho un problema riguardo alle sessioni.


    Il seguente codice php (application.php) è incluso in tutte le mie pagine php:

    <?
    /* application.php */
    /* turn on verbose error reporting (15) to see all warnings and errors */
    error_reporting(15);

    /* define a generic object */
    class object {};

    $CFG = new object;

    /* database configuration */
    $CFG->dbhost = "localhost";
    $CFG->dbname = "system_mymarket";
    $CFG->dbuser = "nome_utente";
    $CFG->dbpass = "password";

    /* directory configuration, if all your mymarket files are in one directory
    * you probably only need to set the wwwroot variable. valid examples are:
    *
    * $CFG->wwwroot = "http://myserver.com/mymarket";
    * $CFG->wwwroot = "http://localhost/mymarket";
    *
    * do not include the trailing slash. dirroot is the physical path on your
    * server where mymarket can find it's files. for more security, it is
    * recommended that you move the libraries and templates ($CFG->libdir
    * and $CFG->templatedir) outside of your web directories.
    */
    $CFG->wwwroot = "/mymarket_IT";
    $CFG->dirroot = dirname(__FILE__);
    $CFG->templatedir = "$CFG->dirroot/templates";
    $CFG->libdir = "$CFG->dirroot/lib";
    $CFG->imagedir = "$CFG->wwwroot/images";
    $CFG->icondir = "$CFG->imagedir/icons";
    $CFG->bannerdir = "$CFG->imagedir/banners";
    $CFG->artdir = "$CFG->imagedir/articoli";
    $CFG->support = "aaa@sito.it";
    $CFG->version = "1.72";
    $CFG->sessionname = "mymarket_IT";

    /* extended configuration */
    $CFG->showsponsor = true; // enabled banner advertising
    $CFG->currency = "€";
    $CFG->currencyfirst = true; // show the currency symbol before the price tag
    $CFG->language = "IT"; // show the language constant

    /* define database error handling behavior, since we are in development stages
    * we will turn on all the debugging messages to help us troubleshoot */
    $DB_DEBUG = true;
    $DB_DIE_ON_FAIL = true;

    /* load up standard libraries */
    require("$CFG->libdir/stdlib.php");
    require("$CFG->libdir/dblib.php");
    require("$CFG->libdir/mymarket.php");
    require("$CFG->libdir/cart.php");


    /* setup some global variables */
    $ME = qualified_me();

    /* start up the sessions, to keep things simple we just have two
    * variables, USER containing user information and CART containing
    * the user's shopping cart. */
    ini_set("session.name", $CFG->sessionname);
    session_start();
    session_register("USER");
    session_register("CART");

    /* initialize the USER object if necessary */
    if (! isset($_SESSION["USER"])) {
    $_SESSION["USER"] = array();
    }

    /* initialize the CART object if necessary */
    if (! isset($_SESSION["CART"])) {
    $_SESSION["CART"] = new Cart;
    }

    $USER = &$_SESSION["USER"];
    $CART = &$_SESSION["CART"];

    /* connect to the database */
    db_connect($CFG->dbhost, $CFG->dbname, $CFG->dbuser, $CFG->dbpass);
    ?>


    Quando voglio connettermi chiamo il seguente codice di login (login.php):

    <?
    /* login.php */

    include("application.php");

    /* form has been submitted, check if it the user login information is correct */
    if (match_referer() && isset($_POST)) {
    $user = verify_login($_POST["username"], $_POST["password"]);

    if ($user) {
    $USER["user"] = $user;
    $USER["ip"] = $_SERVER["REMOTE_ADDR"];

    /* if wantsurl is set, that means we came from a page that required
    * log in, so let's go back there. otherwise go back to the main page */
    $goto = empty($USER["wantsurl"]) ? $CFG->wwwroot : $USER["wantsurl"];

    header("Location: $goto");
    die;

    } else {
    $errormsg = "Dati non validi, prego riprovare";
    $frm["username"] = $_POST["username"];
    }
    }

    include("$CFG->templatedir/login_form.php");

    /************************************************** ****************************
    * FUNCTIONS
    ************************************************** ***************************/

    function verify_login($username, $password) {
    /* verify the username and password. if it is a valid login, return an array
    * with the username, firstname, lastname, and email address of the user */

    if (empty($username) || empty($password)) return false;

    $qid = db_query("
    SELECT username, firstname, lastname, email, priv, phone, address
    FROM users
    WHERE username = '$username' AND password = '" . md5($password) . "'
    ");

    return db_fetch_array($qid);
    }

    ?>


    Quando mi voglio disconnettere dalla sessione chiamo il seguente codice per il logout (logout.php):

    <?
    /* logout.php */

    include("application.php");

    unset($USER);
    unset($_SESSION["USER"]);
    redirect("$CFG->wwwroot", "Utente Disconnesso", 1);
    ?>


    Il problema si verifica quando io richiamo il login per riconnettermi
    è il seguente:

    Notice: Array to string conversion in /home/system/public_html/mymarket_IT/login.php on line 16

    ovvero in corrispondenza alla riga 16 c'è il seguente codice:
    $USER["user"] = $user;

    Warning: Cannot modify header information - headers already sent by (output started at /home/system/public_html/mymarket_IT/login.php:16) in /home/system/public_html/mymarket_IT/login.php on line 23

    può aiutarmi a capire l'errore.
    Grazie Antonio Martinelli

  6. #176
    Utente di HTML.it
    Registrato dal
    Oct 2001
    Messaggi
    24

    Utenti connessi

    Scusatemi, se magari sono ripetitivo, ma in parole povere non ho capito come posso tenere traccia traffico degli utenti nel mio sito:

    L'utente "pippo" entra nel mio sito ed una sessione viene aperta. Se fa il login so chi è, ma come gli associo la sessione che ha aperto quando è entrato nel sito?

    Siccome devo fare diversi aggiornamenti, è ovvio che vorrei evitare di buttare fuori gli utenti prima di aggiornare. Come faccio a sapere quante sessioni sono al momento aperte (quindi quanti utenti sono presenti) ed eventualmente i nomi di chi sono presenti?

    Grazi e in anticipo

  7. #177
    Dovresti usare le sessioni su db se ti serve un controllo personale sulle connessioni.

    Le sessioni di php sono una routine automatizzata in cui esiste un file di sessione che contiene i dati da passare alle pagine successive e che viene riesumato dal browser che presenta il SID, sia tramite il cookie di sessione oppure tramite passaggio del SID via URL.



    Il silenzio è spesso la cosa migliore. Pensa ... è gratis.

  8. #178
    Utente di HTML.it
    Registrato dal
    Oct 2001
    Messaggi
    24
    Abbi pazienza, ma dovresti andare un pò più nel dettaglio tecnico, se hai tempo... avresti degli esempi?

    Grazie in ogni caso
    Ciao

  9. #179
    Originariamente inviato da huck
    Abbi pazienza, ma dovresti andare un pò più nel dettaglio tecnico, se hai tempo... avresti degli esempi?
    http://freephp.html.it/articoli/view_articolo.asp?id=97


    Il silenzio è spesso la cosa migliore. Pensa ... è gratis.

  10. #180
    Una domanda, qual è la differenza tra "session_register(‘var’); " e $_SESSION['']??????
    Io uso la seconda
    Sistemi di allarme, telecamere, autoradio, video proiettori e altri prodotti tecnologici: fedom.it

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.