Jump to content
MakeWebGames

Integrating PHP into HTML


Recommended Posts

Posted (edited)

Hey guys , So since my first post (in the welcome section) I have been playing about with designs and trying to use them with MCCODES free .

Now i successfully integrated the form for the login into my html however i dont know if the rest of the mccode garbage is required or not.

So a question to you extremely intelligent people is that do i need all of the other php code on the login page or not . And if it is required what is needed and how do i put it into html( this part might not make sense , basically what im trying to say is where do it put it , does it go in the head tags or body tags etc)

Thanks for your help in advance!

- - - Updated - - -

The script that i am using :

 

<?php
/*
MCCodes FREE
login.php Rev 1.1.0c
Copyright (C) 2005-2012 Dabomstew

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/

session_start();
print
       <<<EOF
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="css/game.css" type="text/css" rel="stylesheet" />
<script src="js/login.js" type="text/javascript" language="JavaScript"></script>
<title>{GAME_NAME}</title>
</head>
<body onload="getme();" bgcolor="#C3C3C3">
<img src="logo.png" alt="Your Game Logo" />
EOF;
$ip = ($_SERVER['REMOTE_ADDR']);
if (file_exists('ipbans/' . $ip))
{
   die(
           "<b><span style='color: red; font-size: 120%'>
           Your IP has been banned, there is no way around this.
           </span></b>
           </body></html>");
}
$year = date('Y');
print
       <<<EOF
   <h3>
     > {GAME_NAME} Log-In
   </h3>
   <table width="80%">
     <tr>
       <td width="50%">
         <fieldset>
           <legend>About {GAME_NAME}</legend>
           {GAME_DESCRIPTION}
         </fieldset>
       </td>
       <td>
         <fieldset>
           <legend>Login</legend>
           <form action="authenticate.php" method="post" name="login" onsubmit="return saveme();" id="login">
             Username: <input type="text" name="username" /><br />
             Password: <input type="password" name="password" /><br />
             Remember me?<br />
             <input type="radio" value="ON" name="save" />Yes <input type="radio" name=
             "save" value="OFF" checked="checked" />No
             <input type="submit" value="Submit" />
           </form>
         </fieldset>
       </td>
     </tr>
   </table><br />
   <h3>
     <a href='register.php'>REGISTER NOW!</a>
   </h3><br />
   <div style="font-style: italic; text-align: center">
     Powered by codes made by Dabomstew. Copyright © {$year} {GAME_OWNER}.
   </div>
 </body>
</html>
EOF;

 

All the code in red is what i have input into my HTML page.

I cant find the code insert thing.

Edited by KyleMassacre
added code tags
Posted

oops i just realized that you had highlighted stuff in there my bad but please use code tags or php tags when posting code. Its easy on the eyes and you can just:

/*wrap stuff like this*/
//in comments like so//

To answer your question, the answer is no, you dont need to put php in html. But would it be php?

PHP can be anywhere within your html in the head, body, script tags just make sure you open and close your php script with

<?php // this is opening it up for me to write some PHP
$var = "this is some of my PHP here";
echo $var;
//this is going to close my php
?>
<html>
   <head>
       <?php //see here is some PHP in the head. Notice the open and closing PHP tags
       <title><?php echo $set["game_name"]; ?></title>
   </head>
   <body>
       <?php echo "this is php in the body of my html page"; ?>
   </body>
</html>

 

See something like that. But in your login you posted they used some heredoc or nowdoc or whatever its called

Posted

Thanks for your replies i figured it out .

Thanks for the advise , i will use code tags from now on when posting code but the problem is i don't know how to insert the code tags.

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.   Paste as plain text instead

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