Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> CNB Your Account
Author Message
Eck
Hangin' Around



Joined: Apr 09, 2005
Posts: 31

PostPosted: Sat Aug 05, 2006 9:02 am Reply with quote

Hi guys,

I have a problem, When I try to promote a user to a super user. I get the message User has been promoted to Admin. Thats good but when I go back to the main page, it does not add the little admin icon next to my name. I check the nuke_author table and it has added my name. So I went into phpmyadmin checked out nuke_users table, check out my name and it still has my user_level set to 1.

I am running platinum 7.6 ( latest version )with MySQL 4.0.27 running and CNB 4.4.2. I believe it has to do with this last lines of code. Since I am not getting an email telling me I have been promoted nor is it changing my user_level. Any suggestions would be appreciated or if there is something I am missing here.

Code:
if (!$result) {

            $pagetitle = ": "._USERADMIN." - "._PROMOTEUSER;
            include("header.php");
            title(_USERADMIN." - "._PROMOTEUSER);
            amain();
            echo "<br>\n";
            OpenTable();
            echo "<center><b>"._ADDERROR."<b></center><br>";
            CloseTable();
            include("footer.php");
        } else {
            $pagetitle = ": "._USERADMIN." - "._PROMOTEUSER;
            include("header.php");
            title(_USERADMIN." - "._PROMOTEUSER);
            amain();
            echo "<br>\n";
            OpenTable();
            echo "<center><b>"._USERPROMOTED."<b></center>";
            CloseTable();
            include("footer.php");
            if ($ya_config['servermail'] == 0) {
                $message = _SORRYTO." $sitename "._HASPROMOTE;
                $subject = _ACCTPROMOTE;
                $from  = "From: $adminmail\r\n";
                $from .= "Reply-To: $adminmail\r\n";
                $from .= "Return-Path: $adminmail\r\n";
                mail($add_email, $subject, $message, $from);
            }
        }
        if ($add_radminforum == "1") { $db->sql_query("UPDATE ".$user_prefix."_users SET user_level='2' WHERE user_id='$chng_uid'"); }
    }

}else{
header("Location: ../../../index.php");
    die ();
}

I honestly believe it has to do with the statement refering to if $add_radminforum == 1 since there is not such a reference in any of the database tables. I have changed this line about 60 times to try and get it to change my user level with no luck. It adds me as an author all 60 times but will not update my user_level. So any help would be appreciated or ideas off the top of your head.

Thanks
Eck
 
View user's profile Send private message
gregexp
The Mouse Is Extension Of Arm



Joined: Feb 21, 2006
Posts: 1497
Location: In front of a screen....HELP! lol

PostPosted: Sat Aug 05, 2006 9:28 am Reply with quote

Promoting users does not add them to the nuke_authors table which is where that block grabs its info from.

if ($add_radminforum == "1") { $db->sql_query("UPDATE ".$user_prefix."_users SET user_level='2' WHERE user_id='$chng_uid'")

Now to do this, youll need to grab username, password from the users table and insert those into the authors table or tell the block to call from this table.

The block edit would be a lot safer.
I'd sudjest you tell us which block your using and I'll post the edit for you to make to make it show the admin icon.

_________________
For those who stand shall NEVER fall and those who fall shall RISE once more!! 
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
Eck







PostPosted: Sat Aug 05, 2006 9:52 am Reply with quote

Quote:
Promoting users does not add them to the nuke_authors table which is where that block grabs its info from


Ok I was under the assumption is did since you are promoting a user to Superuser in the promoteusrconf.php from the your account admin. The opening lines look as such, since it is inserting the information into the Database. I could be reading this wrong, or the understanding of it, which is quite possible. Here is the entire promoteuserconf.php I have. The credits are intact I just did not post them to save room.


Code:
if (!defined('YA_ADMIN')) { echo "CNBYA admin protection"; exit; }

if (!eregi("modules.php", $_SERVER['SCRIPT_NAME'])) {
    header("Location: ../../../index.php");
    die ();
}
if (!defined('CNBYA')) { echo "CNBYA protection"; exit; }
if ($radminsuper == 1) {

    $num = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_authors WHERE aid='$add_aid'"));
    if ($num > 0) {
        $pagetitle = ": "._USERADMIN." - "._PROMOTEUSER;
        include("header.php");
        title(_USERADMIN." - "._PROMOTEUSER);
        amain();
        echo "<br>\n";
        OpenTable();
        echo "<center><b>"._NAMEERROR."<b></center><br>";
        CloseTable();
        include("footer.php");
    } else {
   //[vecino398(curt)]  [ Only registered users can see links on this board! Get registered or login! ] -Modification-
   if   ($Version_Num >= 7.5)  {
       $add_pwd = md5($add_pwd);
        for ($i=0; $i < sizeof($auth_modules); $i++) {
            $row = $db->sql_fetchrow($db->sql_query("SELECT admins FROM ".$prefix."_modules WHERE mid='$auth_modules[$i]'"));
            $adm = "$row[admins]$add_name";
            $db->sql_query("UPDATE ".$prefix."_modules SET admins='$adm,' WHERE mid='$auth_modules[$i]'");
        }
         $add_password = check_html($add_password, 'nohtml');
         $add_aid = check_html($add_aid, 'nohtml');
         $add_name = check_html($add_name, 'nohtml');
         $add_url = check_html($add_url, 'nohtml');
         $add_email = check_html($add_email, 'nohtml');
         $add_password = check_html($add_password, 'nohtml');
         $add_radminsuper = intval($add_radminsuper);
         $add_admlanguage = check_html($add_admlanguage, 'nohtml');
     $result = $db->sql_query("insert into " . $prefix . "_authors values ('$add_aid', '$add_name', '$add_url', '$add_email', '$add_password', '0', '$add_radminsuper', '$add_admlanguage', '0')");  }
    elseif ($Version_Num >= 7.4){
   
    $add_aid = check_html($add_aid, 'nohtml');
    $add_name = check_html($add_name, 'nohtml');
    $add_url = check_html($add_url, 'nohtml');
    $add_email = check_html($add_email, 'nohtml');
    $add_password = check_html($add_password, 'nohtml');
    $add_radminarticle = intval($add_radminarticle);
    $add_radmintopic = intval($add_radmintopic);
    $add_radminuser = intval($add_radminuser);
    $add_radminsurvey = intval($add_radminsurvey);
    $add_radminlink = intval($add_radminlink);
    $add_radminfaq = intval($add_radminfaq);
    $add_radmindownload = intval($add_radmindownload);
    $add_radminreviews = intval($add_radminreviews);
    $add_radminnewsletter = intval($add_radminnewsletter);
    $add_radminforum = intval($add_radminforum);
    $add_radmincontent = intval($add_radmincontent);
    $add_radminency = intval($add_radminency);
    $add_radminsuper = intval($add_radminsuper);
    $add_admlanguage = check_html($add_admlanguage, 'nohtml');
    $result = $db->sql_query("insert into " . $prefix . "_authors values ('$add_aid', '$add_name', '$add_url', '$add_email', '$add_password', '0', '$add_radminarticle','$add_radmintopic','$add_radminuser','$add_radminsurvey','$add_radminlink','$add_radminfaq','$add_radmindownload','$add_radminreviews','$add_radminnewsletter','$add_radminforum','$add_radmincontent','$add_radminency','$add_radminsuper','$add_admlanguage')");
    }
    else {
   
    $add_aid = check_html($add_aid, 'nohtml');
    $add_name = check_html($add_name, 'nohtml');
    $add_url = check_html($add_url, 'nohtml');
    $add_email = check_html($add_email, 'nohtml');
    $add_password = check_html($add_password, 'nohtml');
    $add_radminarticle = intval($add_radminarticle);
    $add_radmintopic = intval($add_radmintopic);
    $add_radminuser = intval($add_radminuser);
    $add_radminsurvey = intval($add_radminsurvey);
    $add_radminlink = intval($add_radminlink);
    $add_radminfaq = intval($add_radminfaq);
    $add_radmindownload = intval($add_radmindownload);
    $add_radminreviews = intval($add_radminreviews);
    $add_radminnewsletter = intval($add_radminnewsletter);
    $add_radminforum = intval($add_radminforum);
    $add_radmincontent = intval($add_radmincontent);
    $add_radminency = intval($add_radminency);
    $add_radminsuper = intval($add_radminsuper);
    $add_admlanguage = check_html($add_admlanguage, 'nohtml');
    $result = $db->sql_query("insert into " . $prefix . "_authors values ('$add_aid', '$add_name', '$add_url', '$add_email', '$add_password', '0', '$add_radminarticle','$add_radmintopic','$add_radminuser','$add_radminsurvey','$add_radminsection','$add_radminlink','$add_radminephem','$add_radminfaq','$add_radmindownload','$add_radminreviews','$add_radminnewsletter','$add_radminforum','$add_radmincontent','$add_radminency','$add_radminsuper','$add_admlanguage')");
        }
      /////////////////////END/////////////////////////////   
        if (!$result) {
            $pagetitle = ": "._USERADMIN." - "._PROMOTEUSER;
            include("header.php");
            title(_USERADMIN." - "._PROMOTEUSER);
            amain();
            echo "<br>\n";
            OpenTable();
            echo "<center><b>"._ADDERROR."<b></center><br>";
            CloseTable();
            include("footer.php");
        } else {
            $pagetitle = ": "._USERADMIN." - "._PROMOTEUSER;
            include("header.php");
            title(_USERADMIN." - "._PROMOTEUSER);
            amain();
            echo "<br>\n";
            OpenTable();
            echo "<center><b>"._USERPROMOTED."<b></center>";
            CloseTable();
            include("footer.php");
            if ($ya_config['servermail'] == 0) {
                $message = _SORRYTO." $sitename "._HASPROMOTE;
                $subject = _ACCTPROMOTE;
                $from  = "From: $adminmail\r\n";
                $from .= "Reply-To: $adminmail\r\n";
                $from .= "Return-Path: $adminmail\r\n";
                mail($add_email, $subject, $message, $from);
            }
        }
        if ($add_radminforum == "1") { $db->sql_query("UPDATE ".$user_prefix."_users SET user_level='2' WHERE user_id='$chng_uid'"); }
    }

}else{
header("Location: ../../../index.php");
    die ();
}



If I go in manually and change the user_level to 2, I do get the admin icon next to my name. But accordning to the above file, it should do it for me and change the user_level. I am running the CZuser-info block.
 
gregexp







PostPosted: Sat Aug 05, 2006 11:06 am Reply with quote

Actually it looks like it does,I think my previous post was incorrect.

Whats the block code?
 
Eck







PostPosted: Sat Aug 05, 2006 1:39 pm Reply with quote

Having issues posting the entire block code. I will keep trying though, here is part of it where I found the ulevel

Code:
if ($ulevel == 2) {

                 $who_online_now .= "<br />$where<A HREF=\"modules.php?name=Your_Account&amp;op=userinfo&amp;username=$uname\"  title=\""._CZ_VIEW." $uname's "._CZ_VIEWPP."\">$uname</a>&nbsp;<img src=\"images/CZUser/admin.gif\">\n";
                 }
                 elseif ($ulevel == 3) {
                 $who_online_now .= "<br />$where<A HREF=\"modules.php?name=Your_Account&amp;op=userinfo&amp;username=$uname\"  title=\""._CZ_VIEW." $uname's "._CZ_VIEWPP."\">$uname</a></font>&nbsp;<img src=\"images/CZUser/staff.gif\">\n";
                 }
                 else {
           $who_online_now .= "<br />$where<A HREF=\"modules.php?name=Your_Account&amp;op=userinfo&amp;username=$uname\" title=\""._CZ_VIEW." $uname's "._CZ_VIEWPP."\">$uname</a></font>\n";
          }
      $who_online_now .= ( $i != $online_num[0] ? "" : "" );
      $i++;
   
      } else {
      $hidden++;
 
 
gregexp







PostPosted: Sat Aug 05, 2006 1:46 pm Reply with quote

ok is $ulevel gloabalized?
 
Eck







PostPosted: Sat Aug 05, 2006 2:39 pm Reply with quote

Thank you for your time on looking at this too. I appreciate it very much.

$ulevel is not globalized
 
Eck







PostPosted: Sat Aug 05, 2006 2:57 pm Reply with quote

Here is a link to the text file I have of it, if you want to see it, I know everyone hates looking at files, but I can promise you there is nothing funky with it.

http://www.twohits.com/mystuff/czuser.txt
 
gregexp







PostPosted: Sat Aug 05, 2006 4:02 pm Reply with quote

Ok this is definatley out of my league.

I have some ideas on a jerry rigged way to do this but would prefer to make this work OR figure out exactly whats wrong, I believe others would have a much better shot at figuring this out.

I was thinking to globalize the $uid variable and if not empty grab the userlevel fromt he database then apply the if statement but that would be a fix for just the admins.

From the look of it, you may have other problems with that code that you are not aware of because it uses the same layout to do other things.
 
Eck







PostPosted: Sat Aug 05, 2006 4:20 pm Reply with quote

Thanks for trying. All other functions work great just that one little detail. Its driving me mad. I can go set user level to 2 myself but like with anything if its there to be easy, I want the easy way. I guess thats why my girlfriend said I need counseling..HAHA!!
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> CNB Your Account

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 ©