Jump to content

[SOLVED] PHP Login form with admin features ERRORS


JeanieTallis

Recommended Posts

I have one error which can be seen on

http://www.myvee.co.uk

Error is

 

Fatal error: Call to a member function value() on a non-object in /home/myveeco/public_html/index.php on line 54

 

Line 54 is as follows

<td><input name="user" type="text" value="<? echo $form->value("user"); ?>" size="34" maxlength="40" /></td>

 

Errors within the admin section

 

Warning: include() [function.include]: URL file-access is disabled in the server configuration in /home/myveeco/public_html/Admin/admin.php on line 14

 

Warning: include(http://www.myvee.co.uk/include/session.php) [function.include]: failed to open stream: no suitable wrapper could be found in /home/myveeco/public_html/Admin/admin.php on line 14

 

Warning: include() [function.include]: Failed opening 'http://www.myvee.co.uk/include/session.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/myveeco/public_html/Admin/admin.php on line 14

 

Fatal error: Call to a member function isAdmin() on a non-object in /home/myveeco/public_html/Admin/admin.php on line 84

 

Line 14 is as follows

include("http://www.myvee.co.uk/include/session.php");

(I have tried include/session.php  however, errors did occur then too. session.php is in the includes directory, admin is in the Admin directory)

 

Line 84 is as follos

if(!$session->isAdmin()){
   header("Location: index.php");
}

 

(Top line is 84, but I put in the whole code snippet)

 

More errors may exist, these are all I've come across, I cant do anything without these done.

 

Thanks.

Link to comment
Share on other sites

i tried

include/session.php :/ i tried alsorts. I just dont get the problem

 

I actually tried now

/include/session.php

 

Only come up with two errors.

 

 

Warning: include() [function.include]: Failed opening '/include/session.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/myveeco/public_html/Admin/admin.php on line 14

 

Fatal error: Call to a member function isAdmin() on a non-object in /home/myveeco/public_html/Admin/admin.php on line 84

Link to comment
Share on other sites

relative, this means if you are not in the root, you use ".." to go up a folder.

To link to it if you are in http://www.myvee.co.uk/admin/ you will need to use the relative path

"../include/session.php"

 

Okay, sorted that problem, so now if you aint the admin, you get directed back to index.php.

 

The error on line 84 ain't showing up, is this because I sorted the session.php.

 

The other error, which I pointed out, was at line 54 on the index.php (first page) Which is also stated as my first error.

Link to comment
Share on other sites

so everything but the "Call to a member function value() on a non-object in /home/myveeco/public_html/index.php on line 54" is solved?

Please share the code for the class that $form is using where value() is a member.

 

I am unable to actually locate what you wanted, this is the whole code to the index page (with the error)

 <title>MyVee!</title>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<link href="Style.css" rel="stylesheet" type="text/css">
<div id="wrapper">
<div id="Layer4">
  <div style="color:WHITE;">
<script type="text/javascript">
var d=new Date()
var weekday=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var monthname=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
document.write(weekday[d.getDay()] + " ")
document.write(d.getDate() + ". ")
document.write(monthname[d.getMonth()] + " ")
document.write(d.getFullYear())
</script>
</div></div>
<div id="Layer2">
  <div id="Layer5">
    <table width="325">
      <tr>
        <td><?
/**
* User has already logged in, so display relevant links, including
* a link to the admin center if the user is an administrator.
*/
if($session->logged_in){
   echo "<h1>Logged In</h1>";
   echo "Welcome <b>$session->username</b>, you are logged in. <br><br>"
       ."[<a href=\"userinfo.php?user=$session->username\">My Account</a>]   "
       ."[<a href=\"useredit.php\">Edit Account</a>]   ";
   if($session->isAdmin()){
      echo "[<a href=\"admin/admin.php\">Admin Center</a>]   ";
   }
   echo "[<a href=\"process.php\">Logout</a>]";
}
else{
?><br />
          <?
/**
* User not logged in, display the login form.
* If user has already tried to login, but errors were
* found, display the total number of errors.
* If errors occurred, they will be displayed.
*/
if($form->num_errors > 0){
   echo "<font size=\"2\" color=\"#ff0000\">".$form->num_errors." error(s) found</font>";
}
?>
<form action="process.php" method="post">
              <table align="left" border="0" cellspacing="0" cellpadding="3">
                <tr>
                  <td>Username:</td>
                  <td><input name="user" type="text" value="<? echo $form->value("user"); ?>" size="34" maxlength="40" /></td>
                  <td><? echo $form->error("user"); ?></td>
                </tr>
                <tr>
                  <td>Password:</td>
                  <td><input name="pass" type="password" value="<? echo $form->value("pass"); ?>" size="34" maxlength="40" /></td>
                  <td><? echo $form->error("pass"); ?></td>
                </tr>
                <tr>
                  <td colspan="2" align="left"><input type="checkbox" name="remember" <? if($form->value("remember") != ""){ echo "checked"; } ?> />
                    Remember me
                    <input type="hidden" name="sublogin" value="1" />
                      <input name="submit" type="submit" value="Login" /></td>
                </tr>
                <tr>
                  <td colspan="2" align="left"><br />
                      <font size="2">[<a href="forgotpass.php">Forgot Password?</a>]</font></td>
                  <td align="right"></td>
                </tr>
                <tr>
                  <td colspan="2" align="left"><br />
                    Not registered to MyVee? <a href="register.php">Sign-Up!</a></td>
                </tr>
              </table>
            </form>
          <?
}

/**
* Just a little page footer, tells how many registered members
* there are, how many users currently logged in and viewing site,
* and how many guests viewing site. Active users are displayed,
* with link to their user information.
*/
echo "</td></tr><tr><td align=\"center\"><br><br>";
echo "<b>Member Total:</b> ".$database->getNumMembers()."<br>";
echo "There are $database->num_active_users registered members and ";
echo "$database->num_active_guests guests viewing the site.<br><br>";

include("include/view_active.php");

?>
        </td>
      </tr>
    </table>
  </div>
</div>
<div id="Layer1"></div>
<div id="Layer3">
  <p>MyVee is a brand new networking community website. This service works like any other, why don't you give us a go? You may use this website to contact your friends, or even meet new people. As many of you have heard of Bebo & Myspace & Facebook, you will enjoy this too. Works in exactly the same way. You have your very own unique profile, where people can search for you and take an interest in your page.</p>
  <p>Access on this page is limitted as you are not logged in, you must register if you haven't already do so and then login.</p>
</div>
</div>

 

Maybe you are able to tell me where I should find what your after.

Thanks for helping me.

Link to comment
Share on other sites

I'm not sure where to find what you are looking for. It seems to me that first of all $form is at no point declared any sort of object. What I think you are looking for is essentially $_POST['user'], so i'm not sure where the object comes in.

Secondly, you appear to be using a third party script. That means this topic is in the wrong place, but I could care less because I've already started helping you out. But, what that does mean is that it seems to me you cut something that was needed for the code you received. Do you have a link to where you got it from?

Link to comment
Share on other sites

http://www.evolt.org/article/PHP_Login_System_with_Admin_Features/17/60384/index.html

 

At the bottom of the article (not at the bottom of the page as theres comments) theres a download to use.

 

Sorry about putting it in the wrong place, people reply here.. so I'd get a better response.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.