Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> v2.4 RN Issues
Author Message
myrtletrees
Involved
Involved



Joined: Sep 13, 2005
Posts: 259
Location: Cornfields of Indiana

PostPosted: Tue Mar 29, 2011 12:29 pm Reply with quote

What would be the MySQL command to update the nuke_users table field user_allow_viewonline and change the value for all users from 0 to 1?

Better yet, can someone provide the command so that it can be executed from a PHP script?

If not, then I can probably figure out how to add the script to a php file myself. As long as I have the actual command.
 
View user's profile Send private message
myrtletrees







PostPosted: Tue Mar 29, 2011 12:48 pm Reply with quote

Well, I've played around a little more, I guess I need someone to verify this for me.
Will this accomplish what I asked in my previous question?

Code:
   global $prefix, $db, $user_prefix, $dbErrors;

   $sql = 'UPDATE '.$prefix.'_users SET user_allow_viewonline='1'';
   sqlexec($sql);
 
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Tue Mar 29, 2011 2:22 pm Reply with quote

That should work Wink.
 
View user's profile Send private message
myrtletrees







PostPosted: Tue Mar 29, 2011 3:17 pm Reply with quote

Thanks, it didn't seem to work as a PHP script.

If I run this command in PHPmyadmin manually, it works fine:

UPDATE nuke_users SET user_allow_viewonline=1

My entire PHP script looks like this and I have it in the root directory where config.php is located.

Code:
<?php

define('INCLUDE_PATH', './');
require_once INCLUDE_PATH . 'config.php';
   global $prefix, $db, $user_prefix, $dbErrors;
   $sql = 'UPDATE '.$prefix.'_users SET user_allow_viewonline='1'';
   sqlexec($sql);
?>
 
Raven







PostPosted: Tue Mar 29, 2011 3:45 pm Reply with quote

CHANGE:
$sql = 'UPDATE '.$prefix.'_users SET user_allow_viewonline='1'';

TO:
$sql = 'UPDATE '.$prefix.'_users SET user_allow_viewonline=1';
 
wHiTeHaT
Life Cycles Becoming CPU Cycles



Joined: Jul 18, 2004
Posts: 579

PostPosted: Tue Mar 29, 2011 3:52 pm Reply with quote

notice '1' and 1

if '1' means it can be replaced with any number.

if 1 it means 1

is my notition of your code correct Raven?
 
View user's profile Send private message Send e-mail
Palbin
Site Admin



Joined: Mar 30, 2006
Posts: 2583
Location: Pittsburgh, Pennsylvania

PostPosted: Tue Mar 29, 2011 4:03 pm Reply with quote

Code:


<?php
   global $db, $prefix;
   require 'mainfile.php';
   $db->sql_query('UPDATE `' . $prefix . '_users` SET `user_allow_viewonline`="1"');
?>

_________________
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan. 
View user's profile Send private message
Raven







PostPosted: Tue Mar 29, 2011 8:59 pm Reply with quote

wHiTeHaT wrote:
notice '1' and 1

if '1' means it can be replaced with any number.

if 1 it means 1

is my notition of your code correct Raven?


'1' and 1 will both resolve as 1.
 
duck
Involved
Involved



Joined: Jul 03, 2006
Posts: 273

PostPosted: Tue Mar 29, 2011 10:27 pm Reply with quote

Palbin is most correct with reqiring mainfile instead of config but one last thing should be user_prefix instead of prefix in case they do not match.
 
View user's profile Send private message
Raven







PostPosted: Tue Mar 29, 2011 11:08 pm Reply with quote

I was only addressing the SQL syntax as the original request only said a PHP script. I took that to mean not [necessarily] in the CMS context.
 
Palbin







PostPosted: Wed Mar 30, 2011 5:23 am Reply with quote

duck wrote:
Palbin is most correct with reqiring mainfile instead of config but one last thing should be user_prefix instead of prefix in case they do not match.


Good catch.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> v2.4 RN Issues

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©