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
https://forums.phpfreaks.com/topic/94862-delete/
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
https://forums.phpfreaks.com/topic/94862-delete/#findComment-485917
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
https://forums.phpfreaks.com/topic/94862-delete/#findComment-485921
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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