Jump to content

Delete


Daney11

Recommended Posts

Hey guys,

 

Im using

 

if($_GET["cmd"]=="delete")

{

$errors = array();

if ($member_level == '5') {
   $errors[] = 'Member Level Too High';
       }

if (empty($errors)) {

    $member_id = $_GET['member_id'];
    $sql = "DELETE FROM members WHERE member_id=$member_id AND member_teamid=$team_url";
    $result = mysql_query($sql, $connect) or die(mysql_error());

 

But i can delete a member with level 5 access.

Link to comment
Share on other sites

I ran your code (but modified it slightly to take out the DB stuff)

 

<?php

//  dont use this, this is just what i did to test your structure

if($_GET["cmd"]=="delete")
{
$member_level = $_GET['u'];

$errors = array();

if ($member_level == '5') 
{
   		$errors[] = 'Member Level Too High';
    }

if (empty($errors)) 
{

    	echo "HAHA DELETED";
}
}
?>

 

I called it from http://localhost/test.php?cmd=delete&u=5 ... worked fine...

 

 

MY GUESS: You didn't set $member_level = $_GET['member_level']

Link to comment
Share on other sites

Either that, or you have some other value in the $errors array, in which case it would be empty and enter the delete conditional.

 

As a side note, I would suggest that after you get this conditional working, you go back and look at the code that brings you to this page, and make it so that anyone with a members_level of 5 does not even appear in the list of players to be deleted. That will make this check redundant, although building redundancy like that into the system can be a good thing in case of an unexpected error sometime in the future.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.