Visualizzazione dei risultati da 1 a 3 su 3

Discussione: Aiutatemi perfavore

  1. #1
    Utente di HTML.it
    Registrato dal
    Oct 2006
    Messaggi
    115

    Aiutatemi perfavore

    Allora io ho 5 pagine che sono le seguenti

    config.inc.php:
    <?php
    $server = $_SERVER["laoshi"];
    if($server == "127.0.0.1"){
    $user = "laoshi";
    $pwd = "*****";
    $host = "localhost";
    $db = "my_laoshi";
    }
    else{
    $user = "laoshi";
    $pwd = "*****";
    $host = "localhost";
    $db = "my_laoshi";
    }

    ?>
    -----------------------

    poi ho givemsg.php

    -------------------------------
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

    <html>
    <head>
    <title>Messaggia</title>

    <script language="javascript">
    <!--
    function controllaform(ff) {
    for (var i=0; i<ff.length; i++) {
    if (ff.elements[i].value == "") {
    alert("Il form non è completo, completate tutti i campi.");
    return false;
    }
    }
    return true;
    }
    -->
    </script>

    </head>
    <body bgcolor="#f8e8aa">

    <?php
    include("config.inc.php");
    $cn = @mysql_connect($host,$user,$pwd);
    @mysql_select_db($db,$cn);

    $ip = $_SERVER['REMOTE_ADDR'];
    $selid = "SELECT id FROM useronchat WHERE ip='$ip'";
    $_selid= @mysql_query($selid,$cn);
    $nselid= @mysql_num_rows($_selid);
    if($nselid!=0){
    $selus = @mysql_fetch_array($_selid);
    $idu = $selus['id'];
    }
    ?>

    <form action="givemsg.php" method="post" onSubmit="return controllaform(this);">
    <input type="hidden" name="iduse" value="<?php echo $idu; ?>"/>
    <input type="text" name="testo" maxlength="249"/><input type="submit" name="send" value="Invia msg"/>
    </form>

    <?php
    if(isset($_POST['send'])){
    $testo = $_POST['testo'];
    $iduse = $_POST['iduse'];

    $seln = "SELECT username FROM useronchat WHERE id='$iduse'";
    $_seln= @mysql_query($seln,$cn);
    $nseln= @mysql_num_rows($_seln);
    if($nseln==1){
    $seln_ = @mysql_fetch_array($_seln);
    $nome = $seln_['username'];
    }
    $temp =$testo;
    $testo = "[USERNAME] $nome >>> [/USERNAME] ". $temp . "[/B]";

    $datai = date("YmdHis");
    $insm = "INSERT INTO msgonchat(id,iduser,messaggio,datains) VALUES('','$iduse','$testo','$datai')";
    $_insm = @mysql_query($insm,$cn);

    $nao = date("YmdHis");
    $upde = "UPDATE useronchat SET dataentrata='$nao'";
    $_upde= @mysql_query($upde,$cn);
    }
    ?>

    </body>
    </html>
    --------------------------------------------

    poi ho msgchat.php

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

    <html>
    <head>


    <title>Chat PHP by Keratox</title>

    <style type="text/css">
    <!--
    @import url('style.inc.php');
    -->
    </style>

    <meta http-equiv="Refresh" content="3;URL=msgchat.php">

    </head>
    <body bgcolor="#000">

    <?php
    include("config.inc.php");
    $cn = @mysql_connect($host,$user,$pwd);
    @mysql_select_db($db,$cn);

    $selmsg = "SELECT * FROM msgonchat ORDER BY datains DESC LIMIT 0,100";
    $_selmsg = @mysql_query($selmsg,$cn);
    $nselmsg = @mysql_num_rows($_selmsg);
    if($nselmsg>0){
    $i=0;
    while($msg=@mysql_fetch_array($_selmsg)){

    $iduser = $msg['iduser'];
    $mess = $msg['messaggio'];
    $mess = str_replace("<","&lt;",$mess);
    $mess = str_replace(">","&gt;",$mess);
    $mess = str_replace("","",$mess);
    $mess = str_replace("
    ","
    ",$mess);

    $mess = str_replace("[USERNAME]","<font class=\"testo3\">",$mess);
    $mess = str_replace("[/USERNAME]","</font>",$mess);

    $sus = "SELECT username FROM useronchat WHERE id='$iduser'";
    $_sus=mysql_query($sus,$cn);
    $sus_=@mysql_fetch_array($_sus);
    $nome = $sus_['username'];

    if($i%2==0){
    $color = "#FF0000";
    }
    else{
    $color = "#00FF00";
    }
    echo " <font color=\"color:$color;\">$mess</font>
    ";

    $i++;

    }
    }

    ?>

    </body>
    </html>
    -------------------------------------------



    il problema è il seguente se vado su givemsg.php scrivo un messagio clikko su invia mi dice il form non è completo compilare tutti i campi qualcuno mi sa dire perchè?

  2. #2
    1)Titolo errato
    2)il problema è chiaramente javascript..
    http://codecanyon.net/category/all?ref=Manuelandro
    And I bet she told a million people that she'd stay in touch, Well all the little promises they dont mean much,When theres
    memories to be made

  3. #3
    leggi il regolamento

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.