Vraag & Antwoord

Webprogrammeren & scripting

PHP Session script

Anoniem
melvyn
1 antwoord
  • Eerst werkte dit sessionscript, maar nu krijg ik alleen maar het highlight script als ik het uitvoer, alsof die automatisch inlogt maar dat is hij niet.
    A.P. Troost[quote:e0ed6ab568]<?php

    session_start();

    if ($action == "logout")
    {
    session_destroy();
    echo "<meta http-equiv=refresh content="2; URL=$PHP_SELF">";
    }

    $style = "style="font-face: verdana; font-size= 9px" ";

    if ($username == "user" && $password == "pass")
    {
    session_register("ingelogd");
    echo "<meta http-equiv=refresh content="1; URL=$PHP_SELF">";
    }

    if (session_is_registered("ingelogd"))
    {
    function highlight($php)
    {
    ob_start();
    @highlight_string($php);
    $code = ob_get_contents();
    ob_end_clean();
    return $code;
    }
    $script = $_SERVER["SCRIPT_FILENAME"];
    $fp = fopen($script, "r");
    $contents = fread($fp, filesize($script));
    fclose($fp);
    $contents = highlight($contents);
    echo nl2br($contents);
    exit;
    } else {

    echo "<table cellpadding=0 cellspacing=0 border=0>\n";
    echo " <form method=post>\n";
    echo " <tr>\n";
    echo " <td>\n";
    echo " <font size=1 face=verdana>Username:\n";
    echo " </td>\n";
    echo " <td>\n";
    echo " &<input type=text $style name=username>\n";
    echo " </td>\n";
    echo " </tr>\n";
    echo " <tr>\n";
    echo " <td>\n";
    echo " <font size=1 face=verdana>Wachtwoord:\n";
    echo " </td>\n";
    echo " <td>\n";
    echo " &<input type=password $style name=password>\n";
    echo " </td>\n";
    echo " </tr>\n";
    echo "</table>\n";
    echo "<br><input style="font-face: verdana; font-size: 9px" type=submit value=" Login! ">\n";

    }
    ?>[/quote:e0ed6ab568]

Beantwoord deze vraag

Dit is een gearchiveerde pagina. Antwoorden is niet meer mogelijk.