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

    Integrare script php in script php?

    Salve a tutti,
    ho una pagina php:
    Codice PHP:
    <?php    
    if(!isset($_SESSION)){session_start();}      
    if(!isset(
    $_SESSION['utente'])){      
        
    header("location: login2.php?azione=login");     
        exit();       

    ?> 
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    <html xmlns="http://www.w3.org/1999/xhtml"> 
    <head> 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
    <title>pagina</title> 
    </head> 
    <body style="background-color:#036; width: 100%; height: 100%; display: block"> 
    <div id="barra" style="height: 8%; position: fixed; top: 0px; bottom: 0; left: 0; width: 100%; background-color: #006699; border-bottom: 1px solid #133783; position:fixed !important">  
    <p style="margin-top:1%; margin-bottom:1%; margin-left:1%; color:#FFF; font-family:'Palatino Linotype', 'Book Antiqua', Palatino, serif; font-size:150%; font-weight:bold; text-align:left">KnowEveryone [url="profile2.php"]<?php $utenteucwords($_SESSION['utente']); print "($utente)";?>[/url][url="login2.php?azione=logout"]Esci[/url]</p> 
    </div>  
    <?php  
    include 'header.php';   
    print 
    "<p class='saluto'>$utente</p>";  
    ?> 
    </div> 
    <div class="sidebar2">  
    <iframe name="visualizza" width="70%" height="80%" frameborder="1" src="bacheca_visualizza6.php" style="background-color:white; border:1px solid white" scrolling="yes"></iframe> 
    <iframe name="visualizza3" width="29%" height="80%" src="chat/chatpiccola.php"></iframe> 
    <center><iframe name="visualizza2" width="100%" height="8%" frameborder="1" src="bacheca_input.php" style="background-color:white; border:1px solid #CCCCCC; background-color:#0165B6" scrolling="no"></iframe></center>  
    </div>  
    <table border=0 width=100% cellpadding=0 cellspacing=0> 
    <div class="sidebar1">  
    <center>  
    <?php  
    error_reporting
    (E_ALL);  
    $dati mysql_query("SELECT foto FROM utenti WHERE username='".$_SESSION['utente']."'");  
    $risultatomysql_fetch_array($dati);  
    $_SESSION['foto'] = $risultato['foto'];  
    echo <<<
    EOF 
    [url="javascript:Popup('modifica_foto.php')"][img]uploads/{$risultato['foto']}[/img][/url
    EOF
    ?>  
    <iframe name="visualizza" width="65%" height="20%" frameborder="1" src="infopersonali.php" style="margin-top:10%; background-color:white; border:1px solid black"></iframe>  
    <p style="margin-top:5%">[url="modifica_dati2.php"][modifica dati][/url]</p>  
    <iframe name="visualizza" width="65%" max-height="25%" frameborder="1" src="statoprofilo.php" style="background-color:white; border:1px solid black"></iframe>  
    </div> 
    </div> 
    </body>   
    </html>
    e questa pagina:
    Codice PHP:
    <?php
    include('chat/chat.php');
    session_start();
    ?>
    <html>
    <head>
    <script type="text/javascript" src="js/jquery.js"></script>
    <script type="text/javascript" src="js/chat.js"></script>
    <link type="text/css" rel="stylesheet" media="all" href="css/chat.css" /> 
    <link type="text/css" rel="stylesheet" media="all" href="css/screen.css" /> 
    <link type="text/css" rel="stylesheet" media="all" href="css/screen_ie.css" /> 
    </head>
    <body>
    <?php
    // salvo nella sessione l'username dell'utente
    $_SESSION['username'] = $_SESSION['utente'];

    $res mysql_query("SELECT username FROM utenti WHERE stato = 1 AND username != '".$_SESSION['utente']."'");

    while (
    $row mysql_fetch_array($res)){
      
    // creo dinamicamente il link per aprire la chat
      
    echo "<a href=\"javascript:void(0)\" onclick=\"javascript:chatWith('" $row['username'] . "')\">Chatta con " $row['username'] . "</a>";
    }
    ?>
    </body>
    </html>
    Come posso fare?
    Ho già provato così:
    Codice PHP:
    <?php    
    if(!isset($_SESSION)){session_start();}      
    if(!isset(
    $_SESSION['utente'])){      
        
    header("location: login2.php?azione=login");     
        exit();       

    include(
    'chat/chat.php');
    ?> 
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    <html xmlns="http://www.w3.org/1999/xhtml"> 
    <head> 
    <script type="text/javascript" src="js/jquery.js"></script>
    <script type="text/javascript" src="js/chat.js"></script>
    <link type="text/css" rel="stylesheet" media="all" href="css/chat.css" /> 
    <link type="text/css" rel="stylesheet" media="all" href="css/screen.css" /> 
    <link type="text/css" rel="stylesheet" media="all" href="css/screen_ie.css" /> 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
    <title>pagina</title> 
    </head> 
    <body style="background-color:#036; width: 100%; height: 100%; display: block"> 
    <div id="barra" style="height: 8%; position: fixed; top: 0px; bottom: 0; left: 0; width: 100%; background-color: #006699; border-bottom: 1px solid #133783; position:fixed !important">  
    <p style="margin-top:1%; margin-bottom:1%; margin-left:1%; color:#FFF; font-family:'Palatino Linotype', 'Book Antiqua', Palatino, serif; font-size:150%; font-weight:bold; text-align:left">KnowEveryone [url="profile2.php"]<?php $utenteucwords($_SESSION['utente']); print "($utente)";?>[/url][url="login2.php?azione=logout"]Esci[/url]</p> 
    </div>  
    <?php  
    include 'header.php';   
    print 
    "<p class='saluto'>$utente</p>";  
    ?> 
    </div> 
    <div class="sidebar2">  
    <iframe name="visualizza" width="70%" height="80%" frameborder="1" src="bacheca_visualizza6.php" style="background-color:white; border:1px solid white" scrolling="yes"></iframe> 
    <iframe name="visualizza3" width="29%" height="80%" src="chat/chatpiccola.php"></iframe> 
    <center><iframe name="visualizza2" width="100%" height="8%" frameborder="1" src="bacheca_input.php" style="background-color:white; border:1px solid #CCCCCC; background-color:#0165B6" scrolling="no"></iframe></center>  
    </div>  
    <table border=0 width=100% cellpadding=0 cellspacing=0> 
    <div class="sidebar1">  
    <center>  
    <?php  
    error_reporting
    (E_ALL);  
    $dati mysql_query("SELECT foto FROM utenti WHERE username='".$_SESSION['utente']."'");  
    $risultatomysql_fetch_array($dati);  
    $_SESSION['foto'] = $risultato['foto'];  
    echo <<<
    EOF 
    [url="javascript:Popup('modifica_foto.php')"][img]uploads/{$risultato['foto']}[/img][/url
    EOF
    ?>  
    <iframe name="visualizza" width="65%" height="20%" frameborder="1" src="infopersonali.php" style="margin-top:10%; background-color:white; border:1px solid black"></iframe>  
    <p style="margin-top:5%">[url="modifica_dati2.php"][modifica dati][/url]</p>  
    <iframe name="visualizza" width="65%" max-height="25%" frameborder="1" src="statoprofilo.php" style="background-color:white; border:1px solid black"></iframe>  
    </div> 
    </div> 
    <?php
    // salvo nella sessione l'username dell'utente
    $_SESSION['username'] = $_SESSION['utente'];

    // effettuo una query su utenti
    $res mysql_query("SELECT username FROM utenti WHERE stato = 1 AND username != '".$_SESSION['utente']."'");

    while (
    $row mysql_fetch_array($res)){
      
    // creo dinamicamente il link per aprire la chat
      
    echo "<a href=\"javascript:void(0)\" onclick=\"javascript:chatWith('" $row['username'] . "')\">Chatta con " $row['username'] . "</a>";
    }
    ?>
    </body>   
    </html>
    ma nel box per la chat mi mostra, quando scrivo, undefined al posto dell'utente che invia il messaggio, come posso fare per risolvere?
    P.S. Lo script da solo funziona.
    Grazie a tutti in anticipo per il vostro aiuto,
    cicciaramba

  2. #2

    Re: Integrare script php in script php?

    Las potresti aiutarmi tu?

  3. #3

    Re: Re: Integrare script php in script php?

    Nessuno? Vi prego sto impazzendo

  4. #4

    Re: Re: Re: Integrare script php in script php?

    Originariamente inviato da cicciaramba
    Nessuno? Vi prego sto impazzendo
    Ti prego RoTeam! Se mi aiuterai ti farò 2000 emoticon

  5. #5

    Re: Re: Re: Re: Integrare script php in script php?

    Nessuno? E' urgente!!!

  6. #6

    Re: Re: Re: Re: Re: Integrare script php in script php?

    Ho fatto svariate prove tra cui anche quella di mettere assurdamente il codice così, ma non funziona:
    Codice PHP:
    <?php     
    if(!isset($_SESSION)){session_start();}       
    if(!isset(
    $_SESSION['utente'])){       
        
    header("location: login2.php?azione=login");      
        exit();        
    }  
    ?>  
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
    <html xmlns="http://www.w3.org/1999/xhtml">  
    <head>  
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  
    <title>pagina</title>  
    </head>  
    <body style="background-color:#036; width: 100%; height: 100%; display: block">  
    <div id="barra" style="height: 8%; position: fixed; top: 0px; bottom: 0; left: 0; width: 100%; background-color: #006699; border-bottom: 1px solid #133783; position:fixed !important">   
    <p style="margin-top:1%; margin-bottom:1%; margin-left:1%; color:#FFF; font-family:'Palatino Linotype', 'Book Antiqua', Palatino, serif; font-size:150%; font-weight:bold; text-align:left">KnowEveryone [url="profile2.php"]<?php $utenteucwords($_SESSION['utente']); print "($utente)";?>[/url][url="login2.php?azione=logout"]Esci[/url]</p>  
    </div>   
    <?php   
    include 'header.php';    
    print 
    "<p class='saluto'>$utente</p>";   
    ?>  
    </div>  
    <div class="sidebar2">   
    <iframe name="visualizza" width="70%" height="80%" frameborder="1" src="bacheca_visualizza6.php" style="background-color:white; border:1px solid white" scrolling="yes"></iframe>  
    <iframe name="visualizza3" width="29%" height="80%" src="chat/chatpiccola.php"></iframe>  
    <center><iframe name="visualizza2" width="100%" height="8%" frameborder="1" src="bacheca_input.php" style="background-color:white; border:1px solid #CCCCCC; background-color:#0165B6" scrolling="no"></iframe></center>   
    </div>   
    <table border=0 width=100% cellpadding=0 cellspacing=0>  
    <div class="sidebar1">   
    <center>   
    <?php   
    error_reporting
    (E_ALL);   
    $dati mysql_query("SELECT foto FROM utenti WHERE username='".$_SESSION['utente']."'");   
    $risultatomysql_fetch_array($dati);   
    $_SESSION['foto'] = $risultato['foto'];   
    echo <<<
    EOF  
    [url="java-script:Popup('modifica_foto.php')"][img]uploads/{$risultato['foto']}[/img][/url]  
    EOF;  
    ?>   
    <iframe name="visualizza" width="65%" height="20%" frameborder="1" src="infopersonali.php" style="margin-top:10%; background-color:white; border:1px solid black"></iframe>   
    <p style="margin-top:5%">[url="modifica_dati2.php"][modifica dati][/url]</p>   
    <iframe name="visualizza" width="65%" max-height="25%" frameborder="1" src="statoprofilo.php" style="background-color:white; border:1px solid black"></iframe>   
    </div>  
    </div>  
    </body>    
    </html>
    <?php 
    include('chat/chat.php'); 
    session_start(); 
    ?> 
    <html> 
    <head> 
    <script type="text/javascript" src="js/jquery.js"></script> 
    <script type="text/javascript" src="js/chat.js"></script> 
    <link type="text/css" rel="stylesheet" media="all" href="css/chat.css" />  
    <link type="text/css" rel="stylesheet" media="all" href="css/screen.css" />  
    <link type="text/css" rel="stylesheet" media="all" href="css/screen_ie.css" />  
    </head> 
    <body> 
    <?php 
    // salvo nella sessione l'username dell'utente 
    $_SESSION['username'] = $_SESSION['utente']; 

    $res mysql_query("SELECT username FROM utenti WHERE stato = 1 AND username != '".$_SESSION['utente']."'"); 

    while (
    $row mysql_fetch_array($res)){ 
      
    // creo dinamicamente il link per aprire la chat 
      
    echo "<a href=\"java-script:void(0)\" onclick=\"java-script:chatWith('" $row['username'] . "')\">Chatta con " $row['username'] . "</a>"

    ?> 
    </body> 
    </html>
    Spero di poter avere un vostro aiuto al più presto: sto impazzendo

  7. #7

    Re: Re: Re: Re: Re: Re: Integrare script php in script php?

    Nessuno che abbia qualche consiglio su come unire i codici?
    Vi prego anche solo tentativi!

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.