Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2003
    Posts
    5

    Unanswered: Undfined Variable

    /////////////////////////////////////////////////
    // SYSTEM: WINDOWS XP PRO
    // HTTP: APACHE 2.0.46
    // PHP: 4.3.2
    //
    // ATTACHEDFILE: Phpmanger (php script)
    /////////////////////////////////////////////////

    PROBLEM IS -> UNDEFINED VARIABLE - PhpManger Script.

    nOTE: You might need to copy and paste this post into a text editor
    and TURN OFF word wrap.

    COMMENT: I am having a small problem with "Undefined Variable" when submitting a form.
    I was wondering if someone could help me resolve this issue. I'm not a programmer by far,
    but do understand a little bit of perl, php & html. Below you will find Apache's
    error_log and a copy of the form that is used to submit. Also I've included the *.sql
    file used to build the MySql Database definitions.

    INFORMATIONAL: The $adminname and $password was inserted into the database (phpmanger_db) along
    with all other definitions according to the "phpmanger.sql" file. I noticed only the password
    was only Md5 encrypted inside the database. Maybe this is the way its suppose to be?

    ASSUMPTION: I'm assuming there is something wrong with the _setcookie functions?
    At first I thought I should define a definate defined variables as such:

    $adminname = "superman";

    then I tried to define;

    setcookie ("logonname", "admin");
    setcookie ("logonid", "1");

    But If I did this then anyone could possible log in?

    so, I'm lost. Any help would be greatly appreciated. The index.php below was left at its' orignal state.

    /////////////////
    // APACHE_ERROR
    /////////////////

    APACHE ERROR_LOG.TXT

    [client XX.XX.XXX.XXX] PHP Notice: Undefined variable: adminname in D:\usr\www\website1\htdocs\phpmanager\admin\index. php on line 26, referer: http://www.website1.com/phpmanager/admin/index.php
    [client XX.XX.XXX.XXX] PHP Notice: Undefined variable: password in D:\usr\www\website1\htdocs\phpmanager\admin\index. php on line 27, referer: http://www.website1.com/phpmanager/admin/index.php
    [client XX.XX.XXX.XXX] PHP Notice: Undefined variable: submit in D:\usr\www\website1\htdocs\phpmanager\admin\index. php on line 44, referer: http://www.website1.com/phpmanager/admin/index.php
    [client XX.XX.XXX.XXX] PHP Notice: Undefined variable: PHP_SELF in D:\usr\www\website1\htdocs\phpmanager\templates\de fault\admin\stafflogin.inc on line 4, referer: http://www.website1.com/phpmanager/admin/index.php

    ///////////////////////////////////////////////////////////////
    // INDEX.PHP - FORM
    // This is the form that is being used as a LOGIN to phpmanager
    ///////////////////////////////////////////////////////////////

    <?php
    ////////////////////////////////////////////////////////////////////////
    // //
    // - phpManager, Copyright 2002 Taysoft - //
    // //
    // All scripts contained within are protected by international //
    // copyright law. Any unauthorised copying or distribution of //
    // this software will be dealt with accordingly. //
    // //
    // Subsequently, the copyright message must not be //
    // removed from the software. A fee of US$200 is payable to //
    // remove the copyright message. Additionally, phpManager is //
    // distributed as a single domain license (Single IP). You will //
    // be required to purchase another license if you wish to install //
    // on another domain. //
    // Please note: Removal of the copyright message does NOT give //
    // you distribution rights to the software. All you are paying //
    // for is to remove the copyright message to give a more professional //
    // look for your clients. //
    // //
    ////////////////////////////////////////////////////////////////////////

    setcookie ("logonname", "");
    setcookie ("logonid", "");

    setcookie ("logonname", $adminname);
    setcookie ("logonid", md5($password));

    include ("/usr/www/exoticphotogallery/htdocs/phpmanager/variables.php");
    include ("$rootdirectory/languages/$language");

    ?>

    <html>
    <head>
    <title><?php echo $clientmanagerlogin_title ?></title>
    <LINK rel="stylesheet" type="text/css" href="../templates/<?php echo $template ?>/styles.css">
    </head>
    <body>

    <?php

    // --------------------------------------------------- IF SUBMIT IS CLICKED ---------------------------------------------------------------
    if ($submit){
    if (!$adminname && !$password){ // IF NO USERNAME AND PASSWORD
    ?>
    <table width="570" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td width="570" height="360" align="center" class="main">
    <?php echo $login_userpass ?>
    </td>
    </tr>
    </table>
    <?php
    echo "<script>window.setTimeout('changeurl();',2000 ); function changeurl(){history.go(-1);}</script>";
    } elseif ($adminname && !$password){ // IF NO PASSWORD
    ?>
    <table width="570" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td width="570" height="360" align="center" class="main">
    <?php echo $login_pass ?>
    </td>
    </tr>
    </table>
    <?php
    echo "<script>window.setTimeout('changeurl();',2000 ); function changeurl(){history.go(-1);}</script>";
    } elseif (!$adminname && $password){ // IF NO USERNAME
    ?>
    <table width="570" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td width="570" height="360" align="center" class="main">
    <?php echo $login_user ?>
    </td>
    </tr>
    </table>
    <?php
    echo "<script>window.setTimeout('changeurl();',2000 ); function changeurl(){history.go(-1);}</script>";
    } else { // VERIFY USERNAME AND PASSWORD
    $secureuser = md5($adminname);
    $encryptedpassword = md5($password);
    $sql = "SELECT * FROM staff WHERE adminname='$adminname' AND password='$encryptedpassword'";
    $result = mysql_query($sql);
    if(mysql_num_rows($result)) { // IF VERIFIED
    $myrow = mysql_fetch_array($result);
    $id = $myrow["id"];
    $access = $myrow["access"];
    ?>
    <table width="570" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td width="570" height="360" align="center" class="main">
    <?php echo $login_thankyou ?> <?php echo $adminname ?>.
    </td>
    </tr>
    </table>
    <?php
    if ($access=="breach"){
    echo "<script>window.setTimeout('changeurl();',2000 ); function changeurl(){window.location='http://www.yahoo.com';}</script>";

    } else {
    echo "<script>window.setTimeout('changeurl();',2000 ); function changeurl(){window.location='index2.php';}</script>";
    }
    } else {
    ?>
    <table width="570" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td width="570" height="360" align="center" class="main">
    <?php echo $login_error ?>
    </td>
    </tr>
    </table>
    <?php
    echo "<script>window.setTimeout('changeurl();',2000 ); function changeurl(){history.go(-1);}</script>";
    }
    }
    } else {
    // ----------------------------------------------- END IF SUBMIT IS CLICKED ---------------------------------------------------------------

    // ----------------------------------------------- PAGE FORMATTING STARTS HERE ---------------------------------------------------------------

    include ("../templates/$template/admin/stafflogin.inc"); //

    }

    ?>

    </body>
    </html>

    ////////////////////////////
    // phpmanger sql
    ///////////////////////////

    Included in zipfile.

    I'm posting this here because for some reason I"m unable to
    loggin to authros forum and I need to get this running ASAP.

  2. #2
    Join Date
    Jul 2003
    Posts
    5
    THIS IS THE FORM'S SOURCE CODE WHEN GOING TO THE URL
    http://mysite.com/index.php

    It looks like something is missing to me? I dont know if this form is suppose to process itself or call anothor file *.inc or *.php to process?
    It should't tho because its suppose to connect to a database and verify
    the Username and Password.

    TAKE A LOOK AT THE <form method="post" action="">

    Shouldn't there be somthing in the quotations (action="") ??

    Maybe this is why the form is not being processed?



    <html>
    <head>
    <title>phpManager - Staff Login</title>
    <LINK rel="stylesheet" type="text/css" href="../templates/default/styles.css">
    </head>
    <body>

    <table width="570" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td width="570" height="360" align="center" class="main">
    <form method="post" action="">
    <table border="0" cellspacing="0" cellpadding="2">
    <tr>
    <td align="right" class="main">
    Username: <input type="text" class="formfield" name="adminname">
    </td>
    </tr>
    <tr>
    <td align="right" class="main">
    Password: <input type="password" class="formfield" name="password">
    </td>
    </tr>
    <tr>
    <td align="center">
    <input type="Submit" name="submit" value="Login" class="formfield">
    </td>
    </tr>
    </table>
    </form>
    </td>
    </tr>
    </table>
    </body>
    </html>


    Also here is the Stafflogin.inc that the script calls. Take
    a look at the line in blue:


    <table width="570" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td width="570" height="360" align="center" class="main">
    <form method="post" action="<?php echo $PHP_SELF ?>">
    <table border="0" cellspacing="0" cellpadding="2">
    <tr>
    <td align="right" class="main">
    Username: <input type="text" class="formfield" name="adminname">
    </td>
    </tr>
    <tr>
    <td align="right" class="main">
    Password: <input type="password" class="formfield" name="password">
    </td>
    </tr>
    <tr>
    <td align="center">
    <input type="Submit" name="submit" value="Login" class="formfield">
    </td>
    </tr>
    </table>
    </form>
    </td>
    </tr>
    </table>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •