Visualizzazione dei risultati da 1 a 3 su 3
  1. #1

    Problema con login e database

    Allora, vi spiego la mia situazione. Ho creato un form di registrazione e un form di login.
    Queste sono le tabelle del form di registrazione...

    CREATE TABLE `my_database`.`utenti_temp` (
    `codiceconferma` VARCHAR( 100 ) NOT NULL ,
    `username` VARCHAR( 60 ) NOT NULL ,
    `password` VARCHAR( 100 ) NOT NULL ,
    `email` VARCHAR( 60 ) NOT NULL
    ) ENGINE = MYISAM

    CREATE TABLE `my_database`.`utenti` (
    `id` INT NOT NULL AUTO_INCREMENT ,
    `username` VARCHAR( 60 ) NOT NULL ,
    `password` VARCHAR( 100 ) NOT NULL ,
    `email` VARCHAR( 60 ) NOT NULL ,
    PRIMARY KEY ( `id` )
    ) ENGINE = MYISAM

    E fin qui vā tutto bene. Se il login č corretto mi apre una chat fatta da me. La mia intenzione č quella che quando scrivo i messaggio in chat venga visualizzato il nick con cui ho fatto il login. Ora per far riconoscere un nick all' interno della chat ho fatto cosi...

    ho creato questa tabella

    CREATE TABLE `chat` (
    `TIME` TEXT NOT NULL ,
    `UTENTE` TEXT NOT NULL ,
    `POST` TEXT NOT NULL
    );


    la chat in questione č

    <?php
    include 'config2.php'
    ?>
    </head>
    <body>
    <script>apertura_pagina();</script>





    <table border=0 align=center id="tabella" height=200px width=500px>
    <tr>
    <td style="font-size:13px" valign=top>
    <div style="overflow: auto;width: 100%; height: 175px">
    <?php

    $query = mysql_query("SELECT * FROM `_chat` ORDER BY `TIME` ASC");

    while($result = mysql_fetch_array($query)) {
    print "".$result['UTENTE']." : ".$result['POST']."
    " ;
    }
    ?>
    </div>
    </td>
    </tr>
    <tr>
    <td height=25px style="border-color:grey;">
    <form action="" method="POST" style="margin:0px;padding=0px;">
    <input type="text" name="testo" style="width: 430px; border-style:solid; background-color:grey;" />
    <input type="hidden" name="utente" value="<?php print htmlspecialchars(@$_COOKIE['nome_utente']); ?>" />
    <input type="submit" name="submit" value="INVIA" style="border-style:solid; border-color:black;background-color:grey;" />
    </form>
    </td>
    </tr>
    </table>
    <?php
    if(!empty($_POST['testo']) && !empty($_POST['utente'])) {

    $text = mysql_real_escape_string( htmlentities( stripslashes( $_POST['testo'] )));
    $utente = mysql_real_escape_string( htmlentities( stripslashes( $_POST['utente'] )));

    mysql_query("INSERT INTO `chat` (`TIME` ,`UTENTE` ,`POST`
    )VALUES (
    NOW( ), '{$utente}', '{$text}');");

    print " <script language='JavaScript'>aggiorna()</script> ";
    }
    ?>



    e nella pagina di chat un input in js. Come posso far in modo che mi riconosce il nick con cui ho fatto il login?? Grazie a chi mi aiuta!

  2. #2
    Qualcuno sā aiutarmi? Mi spiego meglio. Cioč il form di registrazione e login funzionano perfettamente, l' unico problema e che non riesco a far impostare in automatico il nick con cui ho fatto il login per i messaggi che scrivo in chat perchč sono su due tabelle differenti. Per cui in chat c' č un input in javascript per impostare un nick.

  3. #3
    Ma questo forum č attivo??

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 © 2026 vBulletin Solutions, Inc. All rights reserved.