Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > General > Member Archives
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
hack: active cookie Details »»
hack: active cookie
Version: , by Sun Boy Sun Boy is offline
Developer Last Online: Nov 2010 Show Printable Version Email this Page

Version: Unknown Rating:
Released: 04-29-2003 Last Update: Never Installs: 0
 
No support by the author.

hello every one
as all of you know this command and what it's do in sql
Code:
update user  SET cookieuser='1'
but there is a problem with this command..
it's not do it for all users we have

so i make up a hack from my own but i need a help from you to finish it ( file name is cookies.php in admin folder )

PHP Code:
<?php
error_reporting
(7);

if (
function_exists("set_time_limit")==and get_cfg_var("safe_mode")==0) {
  @
set_time_limit(1200);
}

//suppress gzipping
$nozip=1;

require(
"./global.php");
require(
"./config.php");

adminlog();

cpheader();

//
######################################################

if ($action=="updatecookie") {
  if (isset(
$perpage)==or $perpage=="") {
    
$perpage=50;
  }
  if (isset(
$startat)==or $startat=="") {
    
$startat=0;
  }

  echo 
"<p>User
ids:</p>"
;

  
$updatecookieuserquery=$DB_site->query("SELECT *
         
;         
  FROM user
         
;         
  WHERE user.userid>=
$startat
         
;         
  AND user.userid<
$finishat
         
;         
  AND user.open<>10
         
;         
  GROUP BY user.userid
         
;         
  ORDER BY userid DESC"
);
  while (
$updatecookieuser=$DB_site->fetch_array($updatecookieuserquery)) {

    
$userid=$updatecookieuser[userid];

    echo 
"Processing user <b>$us
erid</b><br>\n"
;
    
flush();
    
$getpost=$DB_site->query_first("SELECT * FROM user 
;WHERE userid='
$updatecookieuser[userid]' ORDER BY userid A
SC LIMIT 1"
);
    
$DB_site->query("UPDATE user SET cookieu
ser='1' WHERE userid='
$updatecookieuser[userid]'");
  }
  if (
$checkmore=$DB_site->query_first("SELECT userid FROM user
 WHERE userid>=
$finishat")) {
    
cpredirect("cookies.php?s=$session[sessionhash]&action=updatecookie&startat=$f
inishat&perpage=
$perpage");
    echo 
"<p><a href=\"cookies.php?s=$session[sessionhash]&action=updatecookie&startat=$f
inishat&perpage=
$perpage\">Click here to contin
ue updating users cookies</a></
p>"
;
  } else {
    echo 
"<p>cookies updated in user
table!</p>"
;
    
cpredirect("cookies.php",1);
  }
}

cpfooter();
?>

what do you think ?

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 04-29-2003, 02:10 PM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Today at 12:35 PM Sun Boy said this in Post #1
hello every one
as all of you know this command and what it's do in sql
Code:
update user SET cookieuser='1'
but there is a problem with this command..
it's not do it for all users we have
What do you mean? This SQL command will overwrite everyone's cookieuser settings and will set it as 1.

Your problem is probably not the SQL command itself but what happens afterwards. Even if you run the command, your users will be able to reset it to 0 in their user cp or while registering if you don't modify relevant templates.

So there is nothing wrong with the SQL command and you don't need a hack to run this command in the db.
Reply With Quote
  #3  
Old 04-29-2003, 04:50 PM
Sun Boy Sun Boy is offline
 
Join Date: Feb 2003
Posts: 48
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

so what sholud i do to make it '1' for all the users ?
Reply With Quote
  #4  
Old 04-29-2003, 05:08 PM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

run the query update user SET cookieuser=1 then edit your register and usercp templates and remove relevant sections so that your users can not edit them back. (make them hidden form fields)
Reply With Quote
  #5  
Old 04-30-2003, 06:40 AM
Sun Boy Sun Boy is offline
 
Join Date: Feb 2003
Posts: 48
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

how about this ?
Code:
<?php
error_reporting(7);

if (function_exists("set_time_limit")==1 and get_cfg_var("safe_mode")==0) {
  @set_time_limit(1200);
}

//suppress gzipping
$nozip=1;

require("./global.php");
require("./config.php");

adminlog();

cpheader();

// ##################################################################

  if (isset($perpage)==0 or $perpage=="") {
    $perpage=1000;
  }
  if (isset($startat)==0 or $startat=="") {
    $startat=0;
  }
  $finishat=$startat+$perpage;

  echo "<p>User ids:</p>";

  $users=$DB_site->query("SELECT userid,usertitle,usergroupid,customtitle,posts FROM user WHERE userid>=$startat AND userid<$finishat ORDER BY userid DESC");
  while ($user=$DB_site->fetch_array($users)) {
    unset($sql);
    $userid=$user[userid];

    // update user stuff
    if ($user[cookieuser]==0)
    $DB_site->query("UPDATE user SET cookieuser='1' WHERE userid='$user[userid]'");

    echo "Processing user <b>$user[userid]</b><br>\n";
    flush();
  }
  if ($checkmore=$DB_site->query_first("SELECT userid FROM user WHERE userid>=$finishat")) {
    cpredirect("cookies.php?s=$session[sessionhash]&startat=$finishat&perpage=$perpage");
    echo "<p><a href=\"cookies.php?s=$session[sessionhash]&startat=$finishat&perpage=$perpage\">Click here to continue updating users</a></p>";
  } else {
    echo "<p>User cookies updated!</p>";
  }


cpfooter();
?>
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:02 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04046 seconds
  • Memory Usage 2,259KB
  • Queries Executed 18 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (3)bbcode_code
  • (1)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (4)postbit
  • (5)postbit_onlinestatus
  • (5)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete