Adding Two If Condtions (Doing The Same Task?!)

Fait

Seasoned Veteran
Joined
Oct 15, 2010
Messages
4,407
Reaction score
561
FP$
2,054
Hey ,

I want to add to if statements with two conditions if the username owns the post and if the user is an Administration Team Member how can i do this? (sorry for my bad englis tdoay im in an hurry I can/do speak english though)


Heres the current code
Code:
[PHP]<?php
session_start();
require "../connect.php"; 

$username = $_SESSION['username']; 
$get = $_GET['sid'];
$selection = mysql_query ("SELECT * FROM users WHERE username='$username'") or die ("Query Error");
$sel = mysql_query ("SELECT * FROM status WHERE status_id='$get' AND posted='$username'") or die ("Error");

while($row = mysql_fetch_array($selection))
if ($row['permissions']== Admin){

$updation = mysql_query ("DELETE FROM status WHERE status_id='$get'") or die ("Query Error");
$up2 = mysql_query ("DELETE FROM comments WHERE sid='$get'") or die ("Error");
if ($updation==true)
echo "Post Deleted Successfully!";
}else{
echo "You Do Not Have Permission To Delete This Post";

}
echo "<meta name='viewport' content='width=device-width' </";
?>[/PHP]
What i want is


Code:
[PHP]<?php
session_start();
require "../connect.php"; 

$username = $_SESSION['username']; 
$get = $_GET['sid'];
$selection = mysql_query ("SELECT * FROM users WHERE username='$username'") or die ("Query Error");
$sel = mysql_query ("SELECT * FROM status WHERE status_id='$get' AND posted='$username'") or die ("Error");


//mods can delete anything if needed
while($row = mysql_fetch_array($selection))
if ($row['permissions']== Admin){

//if its the post owner but not a mod, Mods can delete anything but if the user created the post
then allow them to delete it aswill
if ($row['poster']==$username_session)

$updation = mysql_query ("DELETE FROM status WHERE status_id='$get'") or die ("Query Error");
$up2 = mysql_query ("DELETE FROM comments WHERE sid='$get'") or die ("Error");
if ($updation==true)
echo "Post Deleted Successfully!";
}else{
echo "You Do Not Have Permission To Delete This Post";

}
echo "<meta name='viewport' content='width=device-width' </";
?>[/PHP]
What i want is if the user is also the post owner then they can also delete the post.

I have tried num_rows & if $row['poster']==$username_session)
but that want work with the required if statement if$row==mod)

Hope yous understand what im lookng for (i need to 2 if statements togerher doing the same task so if the user posted the post or is a mod then they can delete the post.

Thanks,

Spudster
 
Back
Top Bottom