| |
| | |

CodersClub

 Forgot password?
 Register
Search
View: 3999|Reply: 0
Collapse the left

rename magic

[Copy link]

 Korea, Republic of

Post time: 2012-03-02 08:10
| Show all posts |Read mode
I introduce a useful magic that user can change ID although I don't know the author.
Upload magic_rename.php into source/class/magic folder below code.
and upload two gif file into static/image/magic folder.

  1. <?php

  2. /**
  3. *      by Quote
  4. */

  5. if(!defined('IN_DISCUZ')) {
  6.         exit('Access Denied');
  7. }

  8. class magic_rename {

  9.         var $version = '1.0';
  10.         var $name = 'Rename Card';
  11.         var $description = 'You can change your user name';
  12.         var $price = '20';
  13.         var $weight = '20';
  14.         var $useevent = 1;
  15.         var $targetgroupperm = false;
  16.         var $copyright = '<a href="http://www.lkong.net" target="_blank">copyright</a>';
  17.         var $magic = array();
  18.         var $parameters = array();
  19.         function getsetting(&$magic) {
  20.         }

  21.         function setsetting(&$magicnew, &$parameters) {
  22.         }

  23.         function usesubmit() {
  24.                 global $_G;
  25.                 if(empty($_G['gp_newusername'])) {
  26.                         showmessage("You did not enter a new user!");
  27.                 }
  28.                 $newusername = trim($_G['gp_newusername']);
  29.                 if(strlen($newusername) < 3) {
  30.                           showmessage('A new user is too short');
  31.                 }
  32.                 if(strlen($newusername) > 15) {
  33.                           showmessage('A new user name is too long');
  34.                 }
  35.                 $guestexp = '\xA1\xA1|\xAC\xA3|^Guest|^\xD3\xCE\xBF\xCD|\xB9\x43\xAB\xC8';
  36.                 $censorexp = '/^('.str_replace(array('\\*', "\r\n", ' '), array('.*', '|', ''), preg_quote(($censoruser = trim($censoruser)), '/')).')$/i';
  37.                 if(preg_match("/^\s*$|^c:\\con\\con$|[%,\*"\s\t\<\>\&]|$guestexp/is", $newusername) || ($censoruser && @preg_match($censorexp, $newusername))) {
  38.                           showmessage('profile_username_illegal');
  39.                 }

  40.                 $query = DB::query("SELECT uid FROM ".DB::table('ucenter_members')." WHERE username ='$newusername'");
  41.                         if(DB::num_rows($query)) {
  42.                                   showmessage('This username is already taken!');
  43.                 } else {

  44.                 $tables = array(
  45.                         'ucenter_members' => array('id' => 'uid', 'name' => 'username'),

  46.                         'common_block' => array('id' => 'uid', 'name' => 'username'),
  47.                         'common_invite' => array('id' => 'fuid', 'name' => 'fusername'),
  48.                         'common_member' => array('id' => 'uid', 'name' => 'username'),
  49.                         'common_member_security' => array('id' => 'uid', 'name' => 'username'),
  50.                         'common_mytask' => array('id' => 'uid', 'name' => 'username'),
  51.                         'common_report' => array('id' => 'uid', 'name' => 'username'),

  52.                         'forum_thread' => array('id' => 'authorid', 'name' => 'author'),
  53.                         'forum_post' => array('id' => 'authorid', 'name' => 'author'),
  54.                         'forum_activityapply' => array('id' => 'uid', 'name' => 'username'),
  55.                         'forum_groupuser' => array('id' => 'uid', 'name' => 'username'),
  56.                         'forum_pollvoter' => array('id' => 'uid', 'name' => 'username'),
  57.                         'forum_postcomment' => array('id' => 'authorid', 'name' => 'author'),
  58.                         'forum_ratelog' => array('id' => 'uid', 'name' => 'username'),

  59.                         'home_album' => array('id' => 'uid', 'name' => 'username'),
  60.                         'home_blog' => array('id' => 'uid', 'name' => 'username'),
  61.                         'home_clickuser' => array('id' => 'uid', 'name' => 'username'),
  62.                         'home_docomment' => array('id' => 'uid', 'name' => 'username'),
  63.                         'home_doing' => array('id' => 'uid', 'name' => 'username'),
  64.                         'home_feed' => array('id' => 'uid', 'name' => 'username'),
  65.                         'home_feed_app' => array('id' => 'uid', 'name' => 'username'),
  66.                         'home_friend' => array('id' => 'fuid', 'name' => 'fusername'),
  67.                         'home_friend_request' => array('id' => 'fuid', 'name' => 'fusername'),
  68.                         'home_notification' => array('id' => 'authorid', 'name' => 'author'),
  69.                         'home_pic' => array('id' => 'uid', 'name' => 'username'),
  70.                         'home_poke' => array('id' => 'fromuid', 'name' => 'fromusername'),
  71.                         'home_share' => array('id' => 'uid', 'name' => 'username'),
  72.                         'home_show' => array('id' => 'uid', 'name' => 'username'),
  73.                         'home_specialuser' => array('id' => 'uid', 'name' => 'username'),
  74.                         'home_visitor' => array('id' => 'vuid', 'name' => 'vusername'),

  75.                         'portal_article_title' => array('id' => 'uid', 'name' => 'username'),
  76.                         'portal_comment' => array('id' => 'uid', 'name' => 'username'),
  77.                         'portal_topic' => array('id' => 'uid', 'name' => 'username'),
  78.                         'portal_topic_pic' => array('id' => 'uid', 'name' => 'username'),
  79.                 );

  80.                 foreach($tables as $table => $conf) {
  81.                         DB::query("UPDATE ".DB::table($table)." SET `$conf[name]`='$newusername' WHERE `$conf[id]`='$_G[uid]'");
  82.                 }


  83.                         usemagic($this->magic['magicid'], $this->magic['num']);
  84.                         updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, 'uid', $_G['uid']);
  85.                         showmessage('Successful in changing the username!', dreferer(), array(), array('showdialog' => 1, 'locationtime' => 1));
  86.                 }
  87.         }

  88.         function show() {
  89.                 magicshowtype('top');
  90.                 magicshowsetting("Please enter your user name:", 'newusername','', 'text');
  91.                 magicshowtype('bottom');
  92.         }


  93. }

  94. ?>
Copy the Code



This post contains more resources

You have to Login for download or view attachment(s). No Account? Register

x
You have to log in before you can reply Login | Register

Points Rules

Archive|Mobile|Dark room|CodersClub

Top.Mail.Ru
Top.Mail.Ru

2024-06-26 05:20 GMT+3 , Processed in 0.023828 sec., 8 queries .

Powered by Discuz! X3.4 Release 20230520

© 2001-2024 Discuz! Team.

MultiLingual version, Rev. 4301, © codersclub.org

Quick Reply To Top Return to the list