Did load including: footer, tabs, new editentry.php and user.php

master
Rubenwardy 2012-08-25 23:36:52 +01:00
parent 853660f773
commit d3175d41ee
18 changed files with 292 additions and 62 deletions

View File

@ -20,10 +20,10 @@ To Do
* (done) More mods in demo
* (done)BBCode
* (work in progress) Keep up-to-date
* user creation
* (done) user creation
* Search mod names and descriptions
* wrap desc text
* edit posts
* (almost done) edit posts
Database
========

View File

@ -4,10 +4,12 @@ $page_title="Add a Mod";
include "scripts/pageheader.php";
require_login();
include "scripts/addentry.php";
if ((include('scripts/addentry.php'))==1){
echo "Entry already exists.<br /><br />";
}
?>
Help: <a href="help/markup.php" target="_blank">Description Markup</a> - <a href="help/tags.php" target="_blank">Tags</a>
Help: <a href="help/markup.php" target="_blank">Description Markup</a> - <a href="help/tags.php" target="_blank">Tags</a>. Not creating? Make sure you fill in all *ed sections.
<hr />
<form method="post" action="<?php echo curPageURL();?>">
<?php
@ -42,7 +44,7 @@ if (is_member_moderator($_SESSION['user'])==true){
<!--Depends and Basename-->
<tr>
<td>Depends (seperated by ","): <input type="text" size="30" name="mod_dep" value="<?php echo $depend;?>"></td>
<td>Depends (seperated by "," - no space): <input type="text" size="30" name="mod_dep" value="<?php echo $depend;?>"></td>
<td>Mod Namespace: <input type="text" size="30" name="mod_base" value="<?php echo $basename;?>"></td>
</tr>
@ -52,11 +54,11 @@ if (is_member_moderator($_SESSION['user'])==true){
<tr>
<td>
<input type="radio" name="mod_tag_type" value="mod"> Mod
<input type="radio" name="mod_tag_type" value="modpack"> Mod Pack
<input type="radio" name="mod_tag_type" value="mdpack"> Mod Pack
<input type="radio" name="mod_tag_type" value="texture"> Texture Pack
</td>
<td>
Other keywords: <input type="text" size=30 name="mod_tag_msc" value="<?php echo $tags_msc;?>">
Other Tags: <input type="text" size=30 name="mod_tag_msc" value="<?php echo $tags_msc;?>">
</td>
</tr>
@ -70,6 +72,7 @@ Other keywords: <input type="text" size=30 name="mod_tag_msc" value="<?php echo
</table>
</form>
</div>
</body>
</html>
<?php
include "scripts/pagefooter.php";
?>

123
editentry.php Normal file
View File

@ -0,0 +1,123 @@
<?php
include "scripts/setup.php";
$page_title="Edit a Mod";
require_login();
$id=$_GET['id'];
if (is_numeric($id)==false){
SQLerror("Non Integer","Non integers are not allowed in the id field. <br /> <a href=\"index.php\">Back to home</a>");
}
include "scripts/pageheader.php";
$res = mysql_query("SELECT * FROM mods WHERE mod_id=$id",$handle) or SQLerror("MySQL Query Error","Error on searching database.mods.mod_id for '$id'");
$row = mysql_fetch_row($res) or die("row error");
if (is_member_moderator($_SESSION['user']) || $_SESSION['user']==$row[3]){
}else{
SQLerror("Editing Denied","You do not own that entry, and you are not a moderator");
}
// --------------------------
// Load Variables
// --------------------------
$name=$_POST['name'];
if ($name=="")
$name=$row[1];
$version=$_POST['version'];
if ($version=="")
$version=$row[2];
$owner=$row[3];
$desc=$_POST['desc'];
if ($desc=="")
$desc=$row[4];
$tags=$_POST['mod_tag'];
if ($tags=="")
$tags = $row[7];
$license=$_POST['mod_lic'];
if ($license=="")
$license=$row[8];
$file=$_POST['mod_file'];
if ($file=="")
$file=$row[9];
$depend=$_POST['mod_dep'];
if ($depend=="")
$depend=$row[10];
$basename=$_POST['mod_base'];
$basename=$row[11];
// --------------------------
// End of loading variable
// --------------------------
?>
Help: <a href="help/markup.php" target="_blank">Description Markup</a> - <a href="help/tags.php" target="_blank">Tags</a>
<hr />
<form method="post" action="<?php echo curPageURL();?>">
<table width="100%">
<!--Tags, License, File, Depend, Basename-->
<!--Mod Name and Version-->
<tr>
<td width="60%">Mod Name: <input type="text" size="50" name="mod_name" value="<?php echo $name;?>"></td>
<td width="40%">Version: <input type="text" size="30" name="mod_version" value="<?php echo $version;?>"></td>
</tr>
<!--Description-->
<tr>
<td colspan="2">
<p><textarea name="mod_desc" cols="105" rows="15">
<?php echo $desc;?>
</textarea></p>
</td>
</tr>
<!--License and File-->
<tr>
<td>File URL: <input type="text" size="50" name="mod_file" value="<?php echo $file;?>"></td>
<td>License: <input type="text" size="30" name="mod_lic" value="<?php echo $license;?>"></td>
</tr>
<!--Depends and Basename-->
<tr>
<td>Depends (seperated by "," - no space): <input type="text" size="30" name="mod_dep" value="<?php echo $depend;?>"></td>
<td>Mod Namespace: <input type="text" size="30" name="mod_base" value="<?php echo $basename;?>"></td>
</tr>
<!--Tags-->
<tr><td colspan="2"><br /><br /><center><b>Tags</b> Users use tags to search and find mods</center></td></tr>
<tr>
<td colspan="2" width="100">
Tags: <input type="text" size=100 name="mod_tags" value="<?php echo $tags;?>">
</td>
</tr>
<tr>
<td colspan=2>
<br /><br /><center>
<input type="submit" value="Save Mod" />
</center>
</td>
</tr>
</table>
</form>
<?php
include "scripts/pagefooter.php";
?>

View File

@ -1,9 +1,23 @@
<?php
include "../scripts/setup.php";
$title="Mark Up - Help";
$page_title="Mark Up - Help";
include "../scripts/pageheader.php";
?>
<p><table>
<tr><th width=30%>Code</th><th>Description</th><th>Example</th></tr>
<tr><td>[img]url_for_img[/img]</td><td>Adds an image</td><td><img heigh=""
<tr bgcolor="#FFFFBD"><td>[b]bold[/b]</td><td>Bold</td><td><b>bold</b></td></tr>
<tr><td>[i]italic[/i]</td><td>Italic</td><td><i>italic</i></td></tr>
<tr bgcolor="#FFFFBD"><td>[u]underline[/u]</td><td>Under Lined</td><td><u>underline</u></td></tr>
<tr><td>[h]header[/h]</td><td>Header (title)</td><td><h1>header</h1></td></tr>
<tr bgcolor="#FFFFBD"><td>[tag]</td><td>Header (title)</td><td><h1>header</h1></td></tr>
<tr><td>[code]The code[/code]</td><td>Adds a code box</td><td><code>The code</code></td></tr>
<tr bgcolor="#FFFFBD"><td>[img]url_for_img[/img]</td><td>Adds an image, If the width is smaller or equal to 900, use this one</td><td><img height="20" src="../images/header.png"></td></tr>
<tr><td>[img]url_for_img[/img-enforce]</td><td>Adds an image. If the width is bigger than 900, use this one</td><td><img height="20" src="../images/header.png"></td></tr>
<tr bgcolor="#FFFFBD"><td>[url=the_links_url=url]The Link Text[/url]</td><td>Adds an hyperlink</td><td><a href="the_links_url">The Links Text</a></td></tr>
<tr><td>[list]<br />[*]An Item[/*]<br />[*]Another Item[/*]<br />[/list]</td><td>A list</td><td><ul><li>An Item</li><li>Another Item</li></ul></td></tr>
</table>
<?php
include "../scripts/pagefooter.php";
?>

View File

@ -1,26 +1,40 @@
<?php
include "../scripts/setup.php";
$title="Tags - Help";
$page_title="Tags - Help";
include "../scripts/pageheader.php";
?>
<p><table>
<tr><th width=30%>Tag</th><th>Description</th></tr>
<tr><td>mod</td><td>A Mod (use radio buttons</td></tr>
<tr><td>modpack</td><td>A Mod Pack (use radio button)</td></tr>
<tr><td>texture</td><td>A Mod Pack (use radio button)</td></tr>
<tr><td>deco</td><td>Adds basic decorating blocks to the game</td></tr>
<tr bgcolor="#FFFFBD"><td>mod</td><td>A Mod (use "type" radio buttons</td></tr>
<tr><td>mpack</td><td>A Mod Pack (use "type" radio button)</td></tr>
<tr bgcolor="#FFFFBD"><td>texture</td><td>A Texture Pack (use "type" radio button)</td></tr>
<tr><td>sound</td><td>Adds Sounds to the game</td></tr>
<tr bgcolor="#FFFFBD"><td>deco</td><td>Adds basic decorating blocks to the game</td></tr>
<tr><td>fun</td><td>fun mods for the game (mesecons, chess, carts)</td></tr>
<tr><td>server</td><td>Mods ideal for servers</td></tr>
<tr bgcolor="#FFFFBD"><td>server</td><td>Mods ideal for servers</td></tr>
<tr><td>food</td><td>Mods that add Food</td></tr>
<tr bgcolor="#FFFFBD"><td>growing</td><td>Mods that add Plants and Growing</td></tr>
<tr><td>mobs</td><td>Mods that add Mobs</td></tr>
<tr><td>3d</td><td>Mods that use nodeboxes</td></tr>
<tr bgcolor="#FFFFBD"><td>3d</td><td>Mods that use nodeboxes</td></tr>
<tr><td>envir</td><td>Changes the MapGen</td></tr>
<tr bgcolor="#FFFFBD"><td>biome</td><td>Adds a new biome to the game</td></tr>
<tr><td>comic-txt</td><td>Comic/Cartoon style textures</td></tr>
<tr><td>real-txt</td><td>Realistic style textures</td></tr>
<tr bgcolor="#FFFFBD"><td>real-txt</td><td>Realistic style textures</td></tr>
<tr><td>hd-txt</td><td>d</td></tr>
<tr><td>0.4.2</td><td>for 0.4.2-rc1</td></tr>
<tr><td>0.4.1</td><td>for 0.4.1</td></tr>
<tr><td>0.4</td><td>for 0.4</td></tr>
<tr bgcolor="#FFFFBD"><td>0.4.2</td><td>for 0.4.2-rc1 *</td></tr>
<tr><td>0.4.1</td><td>for 0.4.1 *</td></tr>
<tr bgcolor="#FFFFBD"><td>0.4</td><td>for 0.4 *</td></tr>
</table></p>
And make up your own for search box searching.
<br />
* Which versions your mod/texture pack works on. You may add more than one of these tags
<?php
include "scripts/pagefooter.php";
?>

View File

@ -25,13 +25,15 @@
listSearch("mod","All Mods","All Mods",$handle);
listSearch("mpack","All Mod Packs","All Mod Packs",$handle);
listSearch("texture","All Texture Packs","All Texture Packs",$handle);
listSearch("sound","All Sound Packs and Sound Mods","All Texture Packs",$handle);
listSearch("sound","All Sound Packs","All Sound Packs and Sound Mods",$handle);
seperator(4);
listSearch("deco","Block Adder Mods","Adds basic decorating blocks to the game (eg: moreblocks, homedecor)",$handle);
listSearch("fun","Fun Mods","Fun mods for the game (eg: Chess, Mesecons)",$handle);
listSearch("server","Server Interaction Mods","Mods ideal for servers (eg: antigrief, money)",$handle);
listSearch("food","Food Mods","Mods that add food",$handle);
listSearch("growing","Growing Mods","Mods that add Plants",$handle);
listSearch("mobs","Mob Mods","Mods that add Mobs",$handle);
listSearch("3d","3D Object Mods","Mods that use NodeBoxes",$handle);
@ -40,19 +42,19 @@
listSearch("biome","Biome Mods","Adds a new biome to the game",$handle);
seperator(4);
listSearch("comic-txt","Comic Style","Cartoon Style Texture Packs",$handle);
listSearch("real-txt","Realistic","Realistic Styled Texture Packs",$handle);
listSearch("hd-txt","HD","HD Texture packs",$handle);
listSearch("comic-txt","Comic Style Textures","Cartoon Style Texture Packs",$handle);
listSearch("real-txt","Realistic Textures","Realistic Styled Texture Packs",$handle);
listSearch("hd-txt","HD Textures","HD Texture packs",$handle);
seperator(4);
listSearch("0.4.2","0.4.2","for 0.4.2-rc1",$handle);
listSearch("0.4.1","0.4.1","for 0.4 Stable",$handle);
listSearch("0.4","0.4","for 0.4",$handle);
echo "</table>";
//listSearch("0.3","0.3","for 0.3",0);
//listSearch("old_minetest","Older","for older versions of minetest",0);
include "scripts/pagefooter.php";
?>
</div>
</body>
</html>

View File

@ -31,4 +31,8 @@ echo "<p>$message</p>";
Username: <input type="text" name="user"><br />
Password: <input type="password" name="pass"><br />
<input type="submit" value="Log In">
</form>
</form>
<?php
include "scripts/pagefooter.php";
?>

View File

@ -6,4 +6,10 @@ font-family:"Arial",arial,arial;
#userbar
{
color:#FFFFFF;
}
h1
{
margin:0;
margin-bottom:.5em;
}

View File

@ -41,6 +41,9 @@ if ($owner=="")
$date = date("F j, Y, g:i a");
$tags = "$tags_type,$tags_msc,";
if (entry_exists($name,$handle))
return 1;
mysql_query("INSERT INTO mods (name,version,owner,description,tags,likes,dislikes,license,file,depend,basename,date_released)
VALUES ('$name','$version','$owner','$desc','$tags',0,0,'$license','$file','$depend','$basename','$date')");

View File

@ -11,7 +11,8 @@ $result=str_replace("=url]","\">",$result);
$result=str_replace("[/url]","</a>",$result);
$result=str_replace("\n","<br />",$result);
$result=str_replace("[tab]","&#41;",$result);
$result=str_replace("\t","&#9;",$result);
$result=str_replace("[tab]","&#9;",$result);
$result=str_replace("[h]","<h1>",$result);
$result=str_replace("[/h]","</h1>",$result);

View File

@ -5,12 +5,12 @@ if (is_numeric($id)==false){
SQLerror("Non Integer","Non integers are not allowed in the id field. <br /> <a href=\"index.php\">Back to home</a>");
}
$res = mysql_query("SELECT * FROM posts WHERE topic=$id",$handle) or SQLerror("MySQL Query Error","Error on searching database.mods.tags for '$id'");
$res = mysql_query("SELECT * FROM posts WHERE Topic=$id",$handle) or SQLerror("MySQL Query Error","Error on searching database.posts for '$id'");
// Get posts loop
while ($hash = mysql_fetch_assoc($res)){
echo "<tr><td>User: {$hash['owner']}</td>";
echo "<td>{$hash['post']}</td><td></td></tr>";
echo "<tr><td>User: {$hash[1]}</td>";
echo "<td>{$hash[2]}</td><td></td></tr>";
}
echo "</table>";

View File

@ -1,3 +1,5 @@
<p>
<img src="<?php echo $serverpath;?>/images/header.png" width="900" height="50" border="0" alt="" style="left:0px;">
</div>
</body>
</html>

View File

@ -25,19 +25,21 @@
if (is_logged_in()){
echo $_SESSION['user']." - <a href=\"$serverpath/logout.php\"><font color=\"#FFFFFF\"><u>Log Out</u></font></a>";
}else{
echo "<a href=\"$serverpath/login.php\"><font color=\"#FFFFFF\"><u>Login</u></font></a>";
echo "<a href=\"$serverpath/login.php\"><font color=\"#FFFFFF\"><u>Login</u></font></a> - ";
echo "<a href=\"$serverpath/signup.php\"><font color=\"#FFFFFF\"><u>Sign Up</u></font></a>";
}
?></div>
?></div>
<div id="userbar" style="text-align:left;position:relative;left:10px;top:55px;width:180px;height=30px;"><?php
echo "<a href=\"$serverpath/index.php\"><font color=\"#FFFFFF\"><u>Home</u></font></a>";
echo "<a href=\"$serverpath/index.php\"><font color=\"#FFFFFF\"><u>Home</u></font></a> - ";
echo "<a href=\"$serverpath/user.php\"><font color=\"#FFFFFF\"><u>User List</u></font></a>";
?></div>
<div style="position:relative;left:570px;top:80px;width:400px;">
<div style="position:relative;left:670px;top:80px;width:400px;">
<form method="get" action="<?php echo $serverpath;?>/search.php">
Search Mods: <input type="text" name="id"> <input type="submit" value="Search">
<input type="text" name="id"> <input type="submit" value="Search">
</form>
</div>
<!--Content Div-->
<div style="position:relative;left:5px;top:110px;width:900px;">
<div style="position:relative;left:5px;top:80px;width:900px;">

View File

@ -92,6 +92,9 @@ function addUser($user,$pass,$passcon,$email,$handle){
return 0;
}
if ($pass==$passcon){
if (user_exists($user,$handle))
return 4;
$pasw=sha1($pass);
if ($pasw=="")
return 3;
@ -106,4 +109,17 @@ function addUser($user,$pass,$passcon,$email,$handle){
return 2;
}
}
function user_exists($user,$handle){
$qu = mysql_real_escape_string ($user);
$res = mysql_query("SELECT * FROM users WHERE name='$qu'",$handle);
return mysql_num_rows($res);
}
function entry_exists($name,$handle){
$qu = mysql_real_escape_string ($name);
$res = mysql_query("SELECT * FROM mods WHERE name='$qu'",$handle);
return mysql_num_rows($res);
}
?>

View File

@ -1,11 +1,10 @@
<?php
include "scripts/setup.php";
$page_title="Home - Minetest Mods";
include "scripts/pageheader.php";
$query=$_GET['id'];
include "scripts/loadmods.php";
?>
</div>
</body>
</html>
$page_title="Search for $query";
include "scripts/pageheader.php";
include "scripts/loadmods.php";
include "scripts/pagefooter.php";
?>

View File

@ -20,15 +20,32 @@ if ($res==2)
if ($res==3)
$message="Account Creation Failed";
if ($res==4)
$message="User already exists";
?>
<table><tr><td width="50%">
<?php
echo "<p>$message</p>";
?>
<form method="post" action="signup.php">
Email: <input type="email" name="email"><br />
Username: <input type="text" name="user"><br />
Password: <input type="password" name="pass"><br />
Confirm: <input type="password" name="passcon"><br />
<b>Email:</b> <input type="email" name="email"><br /><br />
<b>Username:</b> <input type="text" name="user"><br /><br />
<b>Password:</b> <input type="password" name="pass"><br /><br />
<b>Confirm:</b> <input type="password" name="passcon"><br /><br />
<input type="submit" value="Create">
</form>
</form>
<td><td width="50%">
<h2>Sign Up for a Minetest Mod Forum account</h2>
<h3>Vote</h3>
Vote on which mod, mod pack, texture pack or sound pack is the best
<h3>Add a Mod</h3>
Add a mod, mod pack, texture pack or sound pack to this database
<h3>Secure</h3>
Your password is safe with SHA-1 encrypton.
</td></tr>
</table>
<?php
include "scripts/pagefooter.php";
?>

18
user.php Normal file
View File

@ -0,0 +1,18 @@
<?php
include "scripts/setup.php";
$page_title="Users";
include "scripts/pageheader.php";
?>
<p>
<p>
<p>
<p>
Nothing here yet...
</p>
</p>
</p>
</p>
<?php
include "scripts/pagefooter.php";
?>

View File

@ -14,13 +14,19 @@ $page_title="View mod - {$row[1]}";
include "scripts/pageheader.php";
include "scripts/formatcode.php";
echo "<table width=\"100%\"><tr><td><a href=\"{$row[9]}\">Download</a></td><td>";
if (is_member_moderator($_SESSION['user']) || $_SESSION['user']==$row[3]){
$links="<a href=\"editentry.php?id=$id\">Edit</a>";
}else{
$links="";
}
echo "<table width=\"100%\"><tr bgcolor=\"#FFFFBD\"><td><a href=\"{$row[9]}\">Download</a></td><td>";
echo "<h1 align=center>{$row[1]} - by <a href=\"user.php?name={$row[3]}\">{$row[3]}</a></h1></td>";
echo "<td width=100>{$row[2]}</td></tr>";
echo "<tr><td colspan=3>".formatbb($row[4])."</td><tr>";
echo "<tr><td colspan=3><p>".formatbb($row[4])."</p></td><tr>";
echo "<tr height=30 bgcolor=\"#FFFFBD\"><td colspan=3 style=\"text-align:right;\">$links&#32;&#32;&#32;&#32;</td></tr>";
include "scripts/loadposts.php";
?>
</div>
</body>
</html>
include "scripts/pagefooter.php";
?>