Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 14

Discussione: problema include php

  1. #1

    problema include php

    sono un novizio del php e avrei bisogno di un aiuto.

    ho una pagina in html strutturata a tabelle.
    all'interno di una cella dovrei inserire un file esterno (login.php)
    ho provato con un include
    Codice PHP:
    <?

    include "login.php";

    ?>

    ma non funziona


    come posso fare?
    Il PHP non è il mio forte e con i Phpisti Malvisti sono un webmaster malvisto

    pero' con la Letteratura Italiana me la cavicchio.... ghghg...

  2. #2
    Utente di HTML.it
    Registrato dal
    Feb 2002
    Messaggi
    867
    in una pagina html non puoi fare un include.... dovresti rinominare in php anche quella....
    No pvt per sollecitare risposte, grazie.

  3. #3
    usa l'iframe (<iframe src='login.php' height='' width=''>)
    oppure come ha detto afurly rinomina la pagina html (mettiamo sia lgn.html) in una pagina php (lgn.php), tanto l'html rimane uguale.


    Errare e' umano, ma per fare veramente casino serve la password di root.
    Coltiva Linux........Tanto windows si impianta da solo!!!!!
    PHP 4 Ever

  4. #4
    il frame nn posso metterlo altrimenti il php mi lavora solo in quel framettino....
    la pagina html l'ho rinominata in php ma non funziona quando apro la pagina si blocca nel punto in cui comincia il php
    Il PHP non è il mio forte e con i Phpisti Malvisti sono un webmaster malvisto

    pero' con la Letteratura Italiana me la cavicchio.... ghghg...

  5. #5
    postaci tutto il codice così vediamo

    Errare e' umano, ma per fare veramente casino serve la password di root.
    Coltiva Linux........Tanto windows si impianta da solo!!!!!
    PHP 4 Ever

  6. #6
    questo è il codice che devo includere nella pagina:

    Codice PHP:
     <?
    $page 
    "login.php";
    include 
    "header.php";

    if(isset(
    $_POST['task'])) { $task $_POST['task']; } elseif(isset($_GET['task'])) { $task $_GET['task']; } else { $task "main"; }
    if(isset(
    $_POST['u'])) { $u $_POST['u']; } elseif(isset($_GET['u'])) { $u $_GET['u']; } else { $u ""; }
    if(isset(
    $_POST['e_id'])) { $e_id $_POST['e_id']; } elseif(isset($_GET['e_id'])) { $e_id $_GET['e_id']; } else { $e_id ""; }
    if(isset(
    $_POST['c_id'])) { $c_id $_POST['c_id']; } elseif(isset($_GET['c_id'])) { $c_id $_GET['c_id']; } else { $c_id ""; }
    if(isset(
    $_POST['ref'])) { $ref $_POST['ref']; } elseif(isset($_GET['ref'])) { $ref $_GET['ref']; } else { $ref ""; }





    if(
    $task == "forgot") {
    echo 
    $head;
    echo 
    "
    <table width='100%' cellpadding='0' cellspacing='0'>
    <tr>
    <td valign='top' class='box'>
    <h2>
    $login1</h2>
    $login2




    <form action='login.php' method='POST'>
    [b]
    $login3[/b]

    <input type='text' class='text' name='username' maxlength='200'>
    <input type='submit' class='sbutton' name='submit' value='
    $login4' style='margin-bottom: 2px;'>
    <input type='submit' class='sbutton' name='submit' value='
    $login5' style='margin-bottom: 2px;'>
    <input type='hidden' name='task' value='sendpass'>
    </form>
    </td>
    </tr>
    </table>
    "
    ;
    echo 
    $foot;
    }





    if(
    $task == "sendpass") {
    $submit $_POST['submit'];
    $username $_POST['username'];

    $user mysql_query("SELECT * FROM bhost_users WHERE username='$username'");

    if(
    mysql_num_rows($user) != 1) {
    echo 
    $head;
    echo 
    "
    <h2>
    $login22</h2>
    $login23
    "
    ;
    echo 
    $foot;
    exit();
    }

    $user_info mysql_fetch_assoc($user);
    $password randomcode();
    $pass_encrypt crypt($password$user_info[code]);
    mysql_query("UPDATE bhost_users SET password='$pass_encrypt' WHERE u_id='$user_info[u_id]'");

    $subject str_replace("<fname>""$user_info[fname]"$admin_info[forgot_subject]);
    $subject str_replace("<lname>""$user_info[lname]"$subject);
    $subject str_replace("<username>"$user_info[username], $subject);
    $subject str_replace("<password>"$password$subject);
    $message str_replace("<fname>""$user_info[fname]"$admin_info[forgot_message]);
    $message str_replace("<lname>""$user_info[lname]"$message);
    $message str_replace("<username>"$user_info[username], $message);
    $message str_replace("<password>"$password$message);

    $forgot_headers "From: $admin_info[fname] $admin_info[lname] <$admin_info[email]>";
    mail($user_info[email], $subject$message$forgot_headers);

    if(
    $submit == "$login5") {
    header("Location: login.php");
    exit();
    }


    echo 
    $head;
    echo 
    "
    <table width='100%' cellpadding='0' cellspacing='0'>
    <tr>
    <td valign='top' class='box'>
    <h2>
    $login1</h2>
    $login11



    <form action='login.php' method='POST'>
    <input type='submit' class='sbutton' value='
    $login12'>
    </form>
    </td>
    </tr>
    </table>
    "
    ;
    echo 
    $foot;
    }







    if(
    $task == "dologin") {
    $date time();
    $username $_POST['username'];
    $password_unencrypted $_POST['password'];
    $rememberme $_POST['rememberme'];
    $ipaddress $_SERVER['REMOTE_ADDR'];

    $check mysql_query("SELECT username, password, code, verified FROM bhost_users WHERE username='$username'");
    $check_info = @mysql_fetch_assoc($check);
    $password crypt($password_unencrypted$check_info[code]);

    // NO JAVASCRIPT
    if(isset($_POST['javascript']) & $_POST['javascript'] == "no") {
    $result "<table cellpadding='0' cellspacing='0' style='margin-top: 2px;'><tr><td>$login13</td></tr></table>";
    $task "main";

    // LOGIN FAIL
    } elseif($password != $check_info[password]) {
    mysql_query("INSERT INTO bhost_log (date, username, password, ipaddress, result) VALUES ('$date', '$username', '$password', '$ipaddress', 'Failure')");
    $result "<table cellpadding='0' cellspacing='0' style='margin-top: 2px;'><tr><td>$login14</td></tr></table>";
    $task "main";
    } elseif(
    $check_info[verified] == 0) {
    mysql_query("INSERT INTO bhost_log (date, username, password, ipaddress, result) VALUES ('$date', '$username', '$password', '$ipaddress', '0')");
    $result "<table cellpadding='0' cellspacing='0' style='margin-top: 2px;'><tr><td>$login15</td></tr></table>";
    $task "main";
    } else {
    // LOGIN SUCCESS
    $user_info mysql_fetch_assoc(mysql_query("SELECT * FROM bhost_users WHERE username='$username' AND password='$password'"));
    $date time();
    mysql_query("UPDATE bhost_users SET last_login='$date' WHERE u_id='$user_info[u_id]'");
    mysql_query("INSERT INTO bhost_log (date, username, password, ipaddress, result) VALUES ('$date', '$username', '$password', '$ipaddress', '1')");
    bumplog();
    $user $user_info[username];
    $pass $user_info[password];
    $u_id $user_info[u_id];

    // REMEMBER ME
    if(isset($rememberme) AND $rememberme == "1") {
    setcookie("username""$user"time()+60*999999"/");
    setcookie("password""$pass"time()+60*999999"/");
    setcookie("u_id""$u_id"time()+60*999999"/");
    } else {
    // DONT REMEMBER ME
    setcookie("username""$user"0"/");
    setcookie("password""$pass"0"/");
    setcookie("u_id""$u_id"0"/");
    }

    // SET LOCATION
    if($ref == "1") {
    $location url("entry""$u""$e_id");
    } elseif(
    $ref == "2") {
    $location "post_comment.php?u=$u&e_id=$e_id";
    } elseif(
    $ref == "3") {
    $location "edit_comment.php?u=$u&e_id=$e_id&c_id=$c_id";
    } elseif(
    $ref == "4") {
    $location "delete_comment.php?u=$u&e_id=$e_id&c_id=$c_id";
    } else {
    $location "./manager/index.php";
    }

    header("Location: $location");
    exit();
    }
    }













    if(
    $task == "main") {
    echo 
    $head;
    echo 
    "

    <table width='100%' cellpadding='0' cellspacing='0'>
    <tr>
    <td valign='top' class='box'>

    <h2>
    $login16</h2>
    $login17



    <table cellpadding='0' cellspacing='0'>
    <form action='login.php' name='login' method='POST'>
    <tr>
    <td>
    [b]
    $login18[/b]

    <input type='text' class='text' name='username' maxlength='30'>
    </td>
    <td>
    [b]
    $login19[/b]

    <input type='password' class='text' name='password' maxlength='30'>
    </td>
    <td valign='bottom'>
    <input type='submit' class='sbutton' value='
    $login20' style='margin-bottom: 3px;'>
    </td>
    <td>
    <input type='checkbox' name='rememberme' value='1'></td>
    <td>
    <span onClick='rememberbox();'>
    $login21</span></td>
    <input type='hidden' name='task' value='dologin'>
    <input type='hidden' name='u' value='
    $u'>
    <input type='hidden' name='e_id' value='
    $e_id'>
    <input type='hidden' name='c_id' value='
    $c_id'>
    <input type='hidden' name='ref' value='
    $ref'>
    <NOSCRIPT><input type='hidden' name='javascript' value='no'></NOSCRIPT>
    </tr></table>
    $result
    </form>

    </td>
    </tr>
    </table>

    <script language='JavaScript'>
    <!-- 
    appendEvent = function(el, evname, func) {
     if (el.attachEvent) { // IE
       el.attachEvent('on' + evname, func);
     } else if (el.addEventListener) { // Gecko / W3C
       el.addEventListener(evname, func, true);
     } else {
       el['on' + evname] = func;
     }
    };
    appendEvent(window, 'load', windowonload);

    function windowonload() { document.login.username.focus(); } 
    function rememberbox() {
    if(document.login.rememberme.checked == true) {
    document.login.rememberme.checked = false;
    } else {
    document.login.rememberme.checked = true;
    }}
    // -->
    </script>
    "
    ;

    echo 
    $foot;
    }


    ?>
    Il PHP non è il mio forte e con i Phpisti Malvisti sono un webmaster malvisto

    pero' con la Letteratura Italiana me la cavicchio.... ghghg...

  7. #7
    se mi ricordo giusto con l'include tu non esegui il codice di una pagina ma lo includi e basta, prova con require, come struttura è uguale.

    Errare e' umano, ma per fare veramente casino serve la password di root.
    Coltiva Linux........Tanto windows si impianta da solo!!!!!
    PHP 4 Ever

  8. #8
    allora nell altra pagina ci ho messo

    Codice PHP:
     <? require "login.php"?>
    xo nn funziona ugualmente
    Il PHP non è il mio forte e con i Phpisti Malvisti sono un webmaster malvisto

    pero' con la Letteratura Italiana me la cavicchio.... ghghg...

  9. #9
    Che errore ti da?
    Un uomo è vecchio solo quando i rimpianti, in lui, superano i sogni. A. Einstein

  10. #10
    praticamente quando apro la pagina, genera tutto il codice ma si blocca nel punto in cui inizia il php
    Il PHP non è il mio forte e con i Phpisti Malvisti sono un webmaster malvisto

    pero' con la Letteratura Italiana me la cavicchio.... ghghg...

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.