Hi all i am new to all this and looking for a bit of help please and i am sorry if i have posted this in the wrong part of the site
i am trying to add a bit where you can delete a member from a forum site i have made
This is data base
this is where it shows members
this is the page when you have deleted a member
all i get is
i am greatful of all the help if anyone can help me please thanks very much
i am trying to add a bit where you can delete a member from a forum site i have made
This is data base
PHP Code:
CREATE TABLE `users` (
`id` bigint(20) NOT NULL,
`username` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
`avatar` text NOT NULL,
`signup_date` int(10) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
PHP Code:
<?php
include('config.php');
?>
<!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=utf-8" />
<link href="<?php echo $design; ?>/style.css" rel="stylesheet" title="Style" />
<title>List of users</title>
</head>
<body>
<div class="header">
<a href="<?php echo $url_home; ?>"><img src="<?php echo $design; ?>/images/logo.png" alt="Members Area" /></a>
</div>
<div class="content">
This is the list of members:
<table>
<tr>
<th>Id</th>
<th>Username</th>
<th>Email</th>
</tr>
<?php
//We get the IDs, usernames and emails of users
$req = mysql_query('select id, username, email from users');
while($dnn = mysql_fetch_array($req))
{
?>
<tr>
<td class="left"><?php echo $dnn['id']; ?></td>
<td class="left"><a href="profile.php?id=<?php echo $dnn['id']; ?>"><?php echo htmlentities($dnn['username'], ENT_QUOTES, 'UTF-8'); ?></a></td>
<td class="left"><?php echo htmlentities($dnn['email'], ENT_QUOTES, 'UTF-8'); ?></td>
<td class="left"><a href="delete_member.php?id=<?php echo $dnn1['id']; ?>"><img src="<?php echo $design; ?>/images/delete.png" alt="Delete" /></a></td>
</tr>
<?php
}
?>
</table>
</div>
<div class="foot"><a href="<?php echo $url_home; ?>">Go Home</a> </div>
</body>
</html>
PHP Code:
<?php
//This page let delete a member
include('config.php');
if(isset($_GET['id']))
{
$id = intval($_GET['id']);
$dn1 = mysql_fetch_array(mysql_query('select count(id) as nb1, username from id where id="'.$id.'" group by id'));
if($dn1['nb1']>0)
{
if(isset($_SESSION['username']) and $_SESSION['username']==$admin)
{
?>
<!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=utf-8" />
<link href="<?php echo $design; ?>/style.css" rel="stylesheet" title="Style" />
<title>Delete a member - <?php echo htmlentities($dn1['usernamename'], ENT_QUOTES, 'UTF-8'); ?> - Forum</title>
</head>
<body>
<div class="header">
<a href="<?php echo $url_home; ?>"><img src="default/images/logo.png" alt="Forum" /></a>
</div>
<div class="content">
<?php
$nb_new_pm = mysql_fetch_array(mysql_query('select count(*) as nb_new_pm from pm where ((user1="'.$_SESSION['userid'].'" and user1read="no") or (user2="'.$_SESSION['userid'].'" and user2read="no")) and id2="1"'));
$nb_new_pm = $nb_new_pm['nb_new_pm'];
?>
<div class="box">
<div class="box_left">
<a href="<?php echo $url_home; ?>">Forum Index</a> > <?php echo htmlentities($dn1['username'], ENT_QUOTES, 'UTF-8'); ?> > Delete the category
</div>
<div class="box_right">
<a href="list_pm.php">Your messages(<?php echo $nb_new_pm; ?>)</a> - <a href="profile.php?id=<?php echo $_SESSION['userid']; ?>"><?php echo htmlentities($_SESSION['username'], ENT_QUOTES, 'UTF-8'); ?></a> (<a href="login.php">Logout</a>)
</div>
<div class="clean"></div>
</div>
<?php
if(isset($_POST['confirm']))
{
if(mysql_query('delete from username where id="'.$id.'"') and mysql_query('delete from username where parent="'.$id.'"'))
{
?>
<div class="message">The member have successfully been deleted.<br />
<a href="<?php echo $url_home; ?>">Go to the forum index</a></div>
<?php
}
else
{
echo 'An error occured while deleting Member.';
}
}
else
{
?>
<form action="delete_member.php?id=<?php echo $id; ?>" method="post">
Are you sure you want to delete this member?
<input type="hidden" name="confirm" value="true" />
<input type="submit" value="Yes" /> <input type="button" value="No" onclick="javascript:history.go(-1);" />
</form>
<?php
}
?>
</div>
<div class="foot"><a href="https://twitter.com/"><img src="../images/t.png" width="100" height="85" alt="?????"></a><a href="https://www.facebook.com/"><img src="../images/f.png" width="100" height="85" alt="??????"></a><br><br>Copyright site name © 2014. Designed by <a href="http://urswebdesign.co.uk/copyright.html">urswebdesign</a></div>
</body>
</html>
<?php
}
else
{
echo '<h2>You must be logged as an administrator to access this page: <a href="login.php">Login</a> - <a href="signup.php">Sign Up</a></h2>';
}
}
else
{
echo '<h2>The member you want to delete doesn\'t exist.</h2>';
}
}
else
{
echo '<h2>The ID of the member you want to delete is not defined.</h2>';
}
?>
PHP Code:
The member you want to delete doesn't exist.
i am greatful of all the help if anyone can help me please thanks very much
Comment