Jump to content


Photo

What Do I Do :s:s


  • Please log in to reply
3 replies to this topic

#1 runnerjp

runnerjp
  • Members
  • PipPipPip
  • Advanced Member
  • 2,214 posts

Posted 29 June 2006 - 12:23 PM

hey all ok i have this php script

<?
/**
 * 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>

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

#2 lordphate

lordphate
  • Members
  • PipPipPip
  • Advanced Member
  • 154 posts

Posted 29 June 2006 - 12:37 PM

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...

#3 obsidian

obsidian
  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 29 June 2006 - 12:42 PM

[!--quoteo(post=389228:date=Jun 29 2006, 08:37 AM:name=lordphate)--][div class=\'quotetop\']QUOTE(lordphate @ Jun 29 2006, 08:37 AM) View Post[/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.
You can't win, you can't lose, you can't break even... you can't even get out of the game.

<?php
while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx

#4 hsncool

hsncool
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 29 June 2006 - 03:52 PM

[!--quoteo(post=389231:date=Jun 29 2006, 01:42 PM:name=obsidian)--][div class=\'quotetop\']QUOTE(obsidian @ Jun 29 2006, 01:42 PM) View Post[/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...
AddType application/x-httpd-php .php .html
...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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users