Well, since I am working through PHP, it can display any web page VERY easily.
So, if anyone gives me a HTML copy, I can get it straight into the game.
My dwarves list is actually(or will be) a 255 char string where each 5 chars is parsed into a dwarf ID(corresponds to the dwarf table)
I will have to add an admin rights option to the table now.
Then bannage, and deletion.
I REALLY need someone to make a good index page though.
Since I will be busy with the back end and database.
Oh, and heres the codes:
logout.php<?php session_start();$_SESSION["id"]="";$_SESSION["username"]="";?>
<meta http-equiv="REFRESH" content="0;url=index.html">
login.php<?php session_start();$SQLcon=mysql_connect("localhost","DFBBGtest");mysql_select_db("DFBBGtestDatabase");if($_POST["submit"])
{
$user=$_POST["name"];
$pass=sha1($_POST["pass"]);
$sqlQuery="SELECT id FROM users WHERE name = '$user' AND password = '$pass' ";
$loggedOn=mysql_query($sqlQuery);
if(mysql_num_rows($loggedOn)==1)
{
$dat=mysql_fetch_array($loggedOn,MYSQL_ASSOC);
$_SESSION["id"]=$dat["id"];
$_SESSION["username"]=$user;
?>
<meta http-equiv="REFRESH" content="0;url=game.php">
<?php
}else{ ?>
<body bgcolor=666666>
<CENTER><table border=1 bgcolor=cccccc><tr><td><CENTER><br>Invalid username or password!<br>
<form action="login.php" method="post">
<input type="text" name="name"><br>
<input type="password" name="pass"><br>
<input type="submit" name="submit" value="login"></CENTER></td></tr></table><table border=1 bgcolor=cccccc><tr><td><a href=index.html>Return to index</a></td></tr></table></CENTER>
</body>
<?php }}else{?>
<body bgcolor=666666>
<CENTER><table border=1 bgcolor=cccccc><tr><td><CENTER>
<form action="login.php" method="post">
Name:<br>
<input type="text" name="name"><br>
Password:<br>
<input type="password" name="pass"><br>
<input type="submit" name="submit" value="login">
</form></CENTER></td></tr></table><table border=1 bgcolor=cccccc><tr><td><a href=index.html>Return to index</a></td></tr></table></CENTER>
</body>
<?php } ?>
register.php<?PHP
session_start();
?><body bgcolor=666666>
<CENTER><table border=1 bgcolor=cccccc><tr><td><CENTER><?php
if($_POST["submit"])
{
if(!$_POST["name"])echo("You must enter a name!");
else if(!$_POST["pass"])echo("You must enter a password!");
else if($_POST["pass"]!=$_POST["pass2"])echo("You must retype the same password!");
else
{
$SQLcon=mysql_connect("localhost","DFBBGtest");
mysql_select_db("DFBBGtestDatabase");
$name=$_POST["name"];
$sqlQuery="SELECT id FROM users WHERE name = '$name' ";
$result=mysql_query($sqlQuery);
if(mysql_num_rows($result)==1)
{?>
Username is already in use.
<?php }else{
$pass=sha1($_POST["pass"]);
$sqlQuery="INSERT INTO users(name,password) VALUES ('$name','$pass')";
mysql_query($sqlQuery);
?>
<meta http-equiv="REFRESH" content="0;url=login.php">
<?php
exit;
}}
echo('<form action="register.php" method="post">');
echo('Username <input type="text" align=right name="name" value="');
echo($_POST["name"]);
echo('">'); ?><br>
Password <input type="password" align=right name="pass"><br>
Repeat Password <input type="password" align=right name="pass2"><br>
<input type="submit" name="submit" value="done">
</CENTER></td></tr></table><table border=1 bgcolor=cccccc><tr><td><a href=index.html>Return to index</a></td></tr></table></CENTER></body>
<?php }else{ ?>
<form action="register.php" method="post">
Username <input type="text" align=right name="name"><br>
Password <input type="password" align=right name="pass"><br>
Repeat Password <input type="password" align=right name="pass2"><br>
<input type="submit" name="submit" align=center value="done"></CENTER>
</td></tr></table><table border=1 bgcolor=cccccc><tr><td><a href=index.html>Return to index</a></td></tr></table></CENTER></body>
<?php }?>
game.php(needs much work)<?php session_start();if(!$_SESSION["id"]){?>
<h1>Sorry, but you are not logged in, you are not able to access this page unlss you log in.</h1>
<?php exit;}else{ ?>
<body bgcolor=999999>
<div style="float:left;position:absolute;top:5px;left:160px;right:100%;bottom:100%;background-color=888888">
test
</div>
<div style="float:left;position:absolute;top:5px;left:5px;width:150px;height=95%;background-color=b0b0b0">
<img src="images/logo.png">
</div>
<div style="float:left;position:absolute;top:160px;left:10px;width:140px;background-color=b0b0b0">
Dwarf Fortress Browser Based Game<br><br>Logged in as <?php echo(htmlspecialchars($_SESSION["username"]));?>
</div>
</body>
<?php }?>
index.html(needs even more work than game.php)<body bgcolor=999999>
<a href=register.php>Register</a><br>
<a href=login.php>Login</a><br>
<a href=game.php>Play</a><br>
<a href=logout.php>Logout</a><br>
</body>