Jump to content

Recommended Posts

hey all ok i have this php script

[code]<?
/**
* Main.php
*
* This is an example of the main page of a website. Here
* users will be able to login. However, like on most sites
* the login form doesn't just have to be on the main page,
* but re-appear on subsequent pages, depending on whether
* the user has logged in or not.
*
* Written by: Jpmaster77 a.k.a. The Grandmaster of C++ (GMC)
* Last Updated: August 26, 2004
*/
include("include/session.php");
?>

<html>
<title>WERUN2WIN</title>
<body>

<table>
<tr><td>


<?
/**
* User has already logged in, so display relavent 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>] &nbsp;&nbsp;"
       ."[<a href=\"useredit.php\">Edit Account</a>] &nbsp;&nbsp;";
   if($session->isAdmin()){
      echo "[<a href=\"admin/admin.php\">Admin Center</a>] &nbsp;&nbsp;";
   }
   echo "[<a href=\"process.php\">Logout</a>]";
}
else{
?>

<h1>Login</h1>
<?
/**
* 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 type="text" name="user" maxlength="30" value="<? echo $form->value("user"); ?>"></td><td><? echo $form->error("user"); ?></td></tr>
<tr><td>Password:</td><td><input type="password" name="pass" maxlength="30" value="<? echo $form->value("pass"); ?>"></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"; } ?>>
<font size="2">Remember me next time &nbsp;&nbsp;&nbsp;&nbsp;
<input type="hidden" name="sublogin" value="1">
<input 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? <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>


</body>
</html>[/code]

do i add this as a html to my website so i can get it onto my homepage that i have created and do i use it as php script sending users from my homepage to this page.... if that makes sence?? thanks :D
Link to comment
https://forums.phpfreaks.com/topic/13200-what-do-i-do-ss/
Share on other sites

As i believe, you cannot name a page that has php in the script as a .html i believe that it MUST be a .php and i'd name it as index.php and get rid of your index.html but that's just me :| My Opinion means nothing for i am a n00bie ;) maybe use an if statement to have the users(if logged in) see the members information while the not logged in users see the basic login here page...or soemthing like that..but as i said..my opinion means nothing...
Link to comment
https://forums.phpfreaks.com/topic/13200-what-do-i-do-ss/#findComment-50797
Share on other sites

[!--quoteo(post=389228:date=Jun 29 2006, 08:37 AM:name=lordphate)--][div class=\'quotetop\']QUOTE(lordphate @ Jun 29 2006, 08:37 AM) [snapback]389228[/snapback][/div][div class=\'quotemain\'][!--quotec--]
As i believe, you cannot name a page that has php in the script as a .html i believe that it MUST be a .php and i'd name it as index.php and get rid of your index.html but that's just me :| My Opinion means nothing for i am a n00bie ;) maybe use an if statement to have the users(if logged in) see the members information while the not logged in users see the basic login here page...or soemthing like that..but as i said..my opinion means nothing...
[/quote]

as for the comment about the .html vs. .php, it is possible to have your server parse HTML pages as PHP so that you can name all your pages HTML, but you have to modify your server configuration files, so it's usually not recommended to do so.
Link to comment
https://forums.phpfreaks.com/topic/13200-what-do-i-do-ss/#findComment-50800
Share on other sites

[!--quoteo(post=389231:date=Jun 29 2006, 01:42 PM:name=obsidian)--][div class=\'quotetop\']QUOTE(obsidian @ Jun 29 2006, 01:42 PM) [snapback]389231[/snapback][/div][div class=\'quotemain\'][!--quotec--]
as for the comment about the .html vs. .php, it is possible to have your server parse HTML pages as PHP so that you can name all your pages HTML, but you have to modify your server configuration files, so it's usually not recommended to do so.
[/quote]


yeh, thats true...

if u have access to your servers httpd.conf file, u just have to add this line...
[code]AddType application/x-httpd-php .php .html[/code]
...the chances are, u've already got the "application/x-httpd-php .php" part of that line, so just add a ".html" to the end.

BUT, u all heard obsidian say
"but you have to modify your server configuration files, so it's usually not recommended to do so."

but this isnt nesesarily true.
simply create a text file named ".htaccess" and add that same line into that.
this will give you the same effect without doing any server modifications. u'll have to put this file into evry dir that u have pages in.
Link to comment
https://forums.phpfreaks.com/topic/13200-what-do-i-do-ss/#findComment-50874
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.