master
Rubenwardy 2013-02-20 19:05:59 +00:00
parent ae2dc75dd3
commit 23a129c84e
7 changed files with 62 additions and 18 deletions

View File

@ -8,6 +8,8 @@ include "scripts/pageheader.php";
echo "<h1>Admin</h1>\n"; echo "<h1>Admin</h1>\n";
progressBar(25,400,"25%");
$id=$_GET['id']; $id=$_GET['id'];
$mode=$_GET['mode']; $mode=$_GET['mode'];

View File

@ -15,7 +15,7 @@ include "scripts/pageheader.php";
$res = mysql_query("SELECT * FROM mods WHERE mod_id=$id",$handle) or SQLerror("MySQL Query Error","Error finding entry $id"); $res = mysql_query("SELECT * FROM mods WHERE mod_id=$id",$handle) or SQLerror("MySQL Query Error","Error finding entry $id");
$row = mysql_fetch_array($res) or die("row error"); $row = mysql_fetch_array($res) or die("row error");
if (is_member_moderator($_SESSION['user'],$handle) || $_SESSION['user']==$row[3]){ if (is_member_moderator($_SESSION['user'],$handle) || $_SESSION['user']==$row['owner']){
}else{ }else{
SQLerror("Deleting Denied","You do not own that entry, and you are not a moderator"); SQLerror("Deleting Denied","You do not own that entry, and you are not a moderator");
} }

1
scripts/progress.php Normal file
View File

@ -0,0 +1 @@
function

View File

@ -4,6 +4,11 @@ require_once "settings.php";
session_start(); session_start();
function is_member_moderator($user,$handle){ function is_member_moderator($user,$handle){
global $forum_user;
if ($forum_user['username']==$user){
return ($forum_user['group_id']==1);
}else{
$user_p=getUser($user,$handle); $user_p=getUser($user,$handle);
if (!$user_p){ if (!$user_p){
return 0; return 0;
@ -14,6 +19,9 @@ function is_member_moderator($user,$handle){
}else{ }else{
return false; return false;
} }
}
} }
function SQLerror($title,$msg){ function SQLerror($title,$msg){
@ -51,7 +59,7 @@ require FORUM_ROOT.'include/common.php';
if ($forum_user['username']!="Guest"){ if ($forum_user['username']!="Guest"){
if (user_exists($forum_user['username'],$handle)==false){ if (user_exists($forum_user['username'],$handle)==false){
addUser($forum_user['username'],"x","x",$forum_user['email'],$handle); addUser($forum_user['username'],$forum_user['group_id'],$handle);
} }
login($forum_user['username']); login($forum_user['username']);
}else{ }else{
@ -94,6 +102,21 @@ function login($user){
$_SESSION['user']=$user; $_SESSION['user']=$user;
} }
function addUser($user,$level,$handle){
if ($user==""){
return 0;
}
if (user_exists($user,$handle))
return 4;
$res=mysql_query("INSERT INTO users (name,level) VALUES ('$user','$level')");
if ($res==1){
return 1;
}else{
return 3;
}
}
function getUser($user,$handle){ function getUser($user,$handle){
$us= mysql_real_escape_string ($user); $us= mysql_real_escape_string ($user);
$res = mysql_query("SELECT * FROM users WHERE name='$us'",$handle) or die("query error"); $res = mysql_query("SELECT * FROM users WHERE name='$us'",$handle) or die("query error");
@ -175,4 +198,14 @@ function tagLinks($tags){
return $result; return $result;
} }
function progressBar($percent,$length,$caption){
echo "<div class=\"progressbar\" style=\"width: ".$length."px;\">";
echo "<div class=\"progressbar_inner\" style=\"width: ".(($percent/100)*$length)."px;\"></div>";
echo "<div class=\"progress_caption\">$caption</div>";
echo "</div>";
}
?> ?>

View File

@ -250,4 +250,22 @@
margin: 0; margin: 0;
padding: 1em 0 2em 0; padding: 1em 0 2em 0;
background: #ffffff; background: #ffffff;
}
.progressbar{
background: #cccccc;
height:20px;
display:block;
}
.progressbar_inner{
background: #61ad6d;
height:20px;
display:block
}
.progress_caption{
position:relative;
top:-18px;
text-align:center;
width:100%;
} }

View File

@ -9,7 +9,7 @@ $id=$_GET['id'];
if ($id==""){ if ($id==""){
include "scripts/pageheader.php"; include "scripts/pageheader.php";
echo "<table width=\"100%\"><tr><th colspan=2>Username</th></tr>\n"; echo "<table width=\"100%\"><tr><th colspan=2>Username</th></tr>\n";
$res = mysql_query("SELECT * FROM users ORDER BY level DESC",$handle) or SQLerror("MySQL Query Error","Error on getting database.users"); $res = mysql_query("SELECT * FROM users",$handle) or SQLerror("MySQL Query Error","Error on getting database.users");
$alternate=1; $alternate=1;
// Get projects loop // Get projects loop
while ($hash = mysql_fetch_assoc($res)){ while ($hash = mysql_fetch_assoc($res)){
@ -30,26 +30,12 @@ while ($hash = mysql_fetch_assoc($res)){
} }
$res = mysql_query("SELECT * FROM users WHERE id=$id",$handle) or SQLerror("MySQL Query Error","Error on getting database.users"); $res = mysql_query("SELECT * FROM users WHERE id=$id",$handle) or SQLerror("MySQL Query Error","Error on getting database.users");
$hash = mysql_fetch_assoc($res); $hash = mysql_fetch_assoc($res);
switch($hash['level'])
{
case 0:
$level=" normal member";
break;
case 1:
$level=" vertified member";
break;
case 2:
$level="n admin";
break;
}
$page_title="{$hash['name']} - Users"; $page_title="{$hash['name']} - Users";
include "scripts/pageheader.php"; include "scripts/pageheader.php";
echo "<h1>{$hash['name']}</h1>"; echo "<h1>{$hash['name']}</h1>";
echo "{$hash['name']} is a{$level}.";
echo "<br /><p><a href=\"user.php\">Back to User List</a></p><br />"; echo "<br /><p><a href=\"user.php\">Back to User List</a></p><br />";
$query=$id; $query=$id;

View File

@ -112,6 +112,10 @@ echo "<h1>Similar Code Part of 0.4.4</h1>Only use this for versions before this.
tabCol("Tags",tagLinks($row['tags'])); tabCol("Tags",tagLinks($row['tags']));
echo "</tbody></table></p>\n"; echo "</tbody></table></p>\n";
echo "<div style=\"margin-left:20px;margin-bottom:20px;\">";
progressBar($row['progress'],260,$row['progress']."% completed");
echo "</div>";
if ($links!=""){ if ($links!=""){
echo "<div class='bar_title'>\n"; echo "<div class='bar_title'>\n";