Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> How To's
Author Message
transit
Regular
Regular



Joined: Jun 01, 2010
Posts: 69

PostPosted: Wed Jun 23, 2010 10:05 pm Reply with quote

I have RN 2.40.1 installed.

I am trying to create an Admin to run my site for me however I do not want to make them a Super Admin and have them mess up some key things because they really don't know what they are doing!

I noticed that in the Admin panel it is split up into two tables

- Administration Menu
- Modules Administration

The problem is that there are 3 things I need him to have access to:

- Tricked Out Slider v. 1
- Messages
- Nuke SEO 1.0 BETA

Any help would be greatly appreciated!

I don't really care if I need to go into the DB to make changes to permissions or whether their is code fixes for the above. It only needs to be set up once anyways.

Thanks!
 
View user's profile Send private message
montego
Site Admin



Joined: Aug 29, 2004
Posts: 9457
Location: Arizona

PostPosted: Sat Jun 26, 2010 8:23 am Reply with quote

The following blog post will help you out here:
[ Only registered users can see links on this board! Get registered or login! ]

I had done this for Messages for one of my sites long back.

_________________
Where Do YOU Stand?
HTML Newsletter::ShortLinks::Mailer::Downloads and more... 
View user's profile Send private message Visit poster's website
transit







PostPosted: Sat Jun 26, 2010 11:44 am Reply with quote

Works like a charm!

Adding other ones is as simple as replacing im guessing:

MODADM_MESSAGES

with

MODADM_YOURNUKEMODNAMEHERE

and

'.php?op=messages'

with

'.php?op=nukemodnamehere'

Other than that I think the code should work regardless of the module? Am I correct?
 
montego







PostPosted: Sun Jun 27, 2010 3:22 pm Reply with quote

It should, but I haven't really thought that statement through. Laughing Let me know if you find one that does not work and I'll try and help you out.
 
transit







PostPosted: Sun Jun 27, 2010 6:01 pm Reply with quote

Ok I got thru till admin/modules file on your guide there.

I am doing doing a conversion for nukeSEO v 1.0 beta.

this is the text within nukeSEO.php within the admin/modules/nukeSEO.php

Code:


$textrowcol = "rows='10' cols='50'";
if($Version_Num > "7.6") { $textrowcol = "rows='15' cols='75'"; }
$getAdmin = $db->sql_fetchrow($db->sql_query("SELECT * FROM `".$prefix."_authors` WHERE `aid`='$aid'"));
if ($getAdmin['radminsuper'] == 1) {
  switch($op) {


What should I change it to?
I didn't want to dig in there and mess up all the syntax Razz
 
Palbin
Site Admin



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

PostPosted: Sun Jun 27, 2010 6:41 pm Reply with quote

transit wrote:
Ok I got thru till admin/modules file on your guide there.

I am doing doing a conversion for nukeSEO v 1.0 beta.

this is the text within nukeSEO.php within the admin/modules/nukeSEO.php

Code:


$textrowcol = "rows='10' cols='50'";
if($Version_Num > "7.6") { $textrowcol = "rows='15' cols='75'"; }
$getAdmin = $db->sql_fetchrow($db->sql_query("SELECT * FROM `".$prefix."_authors` WHERE `aid`='$aid'"));
if ($getAdmin['radminsuper'] == 1) {
  switch($op) {


What should I change it to?
I didn't want to dig in there and mess up all the syntax Razz


Code:


$textrowcol = "rows='10' cols='50'";
if($Version_Num > "7.6") { $textrowcol = "rows='15' cols='75'"; }

$module_name = basename(substr(__FILE__, 0, -16));

$aid = substr($aid, 0,25);

$query = $db->sql_query('SELECT title, admins FROM ' . $prefix . '_modules WHERE title="' . $module_name . '"');
list($title, $admins) = $db->sql_fetchrow($query);
$db->sql_freeresult($query);

$query2 = $db->sql_query('SELECT aid, radminsuper FROM ' . $prefix . '_authors WHERE aid="' . $aid . '"');
list($aname, $radminsuper) = $db->sql_fetchrow($query2);
$db->sql_freeresult($query2);

$admins = explode(',', $admins);
$auth_user = 0;
for($i=0; $i < sizeof($admins); $i++) {
   if($aname == $admins[$i] && !empty($admins)) {
      $auth_user = 1;
   }
}

if($radminsuper == 1 || $auth_user == 1) {
  switch($op) {


This could probably be optimized a bit, but this is basically what you want.

_________________
"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
transit







PostPosted: Mon Jun 28, 2010 12:40 pm Reply with quote

I took the tutorial here: [ Only registered users can see links on this board! Get registered or login! ]
and pasted in my own code that I have changed thus far (with pablin's addition at the bottom of my post) The only thing I am wondering is if I have typed something below wrong... OR there are more files within admin/modules/nukeSEO/ that need to be edited (or are those for ShortLinks?!)

Heres the modified tutorial:

Open up the file:

Within the modules/nukeSEO/admin directory, place a file called case.php with the following code in it:

Code:


   <?php
   
   if (!defined('MODADM_NUKESEO')) define('MODADM_NUKESEO', 'nukeSEO');
   
   ?>


Also within this same directory, place a file called links.php with the following code in it:

Code:


<?php
   if (!defined('ADMIN_FILE')) {
       die('Access Denied');
   }
   global $admin_file;
   adminmenu($admin_file.'.php?op=nukeSEO', _NUKESEO, 'nukeSEO.gif');
   
   ?>


Also within this same directory, place a file called index.php with the following code in it (yes, essentially a file with no PHP code between the tags):

Code:


   <?php
   
   ?>


Open up the file:

admin/case/case.nukeSEO.php

After this code here:

Code:


   if (!defined('ADMIN_FILE')) {
       die('Access Denied');
   }


Add this line of code before the “switch” statement:

Code:


   if (!defined('MODADM_NUKESEO')) define('MODADM_NUKESEO', 'nukeSEO');


Now, this is where the differences in code between RavenNuke(tm) and PHP-Nuke patched might be slightly different. Open the following file:

admin/modules/messages.php

Find this code here:

Code:


$textrowcol = "rows='10' cols='50'";
if($Version_Num > "7.6") { $textrowcol = "rows='15' cols='75'"; }
$getAdmin = $db->sql_fetchrow($db->sql_query("SELECT * FROM `".$prefix."_authors` WHERE `aid`='$aid'"));
if ($getAdmin['radminsuper'] == 1) {
  switch($op) {


And simply replace it with this:

Code:


$textrowcol = "rows='10' cols='50'";
if($Version_Num > "7.6") { $textrowcol = "rows='15' cols='75'"; }

$module_name = basename(substr(__FILE__, 0, -16));

$aid = substr($aid, 0,25);

$query = $db->sql_query('SELECT title, admins FROM ' . $prefix . '_modules WHERE title="' . $module_name . '"');
list($title, $admins) = $db->sql_fetchrow($query);
$db->sql_freeresult($query);

$query2 = $db->sql_query('SELECT aid, radminsuper FROM ' . $prefix . '_authors WHERE aid="' . $aid . '"');
list($aname, $radminsuper) = $db->sql_fetchrow($query2);
$db->sql_freeresult($query2);

$admins = explode(',', $admins);
$auth_user = 0;
for($i=0; $i < sizeof($admins); $i++) {
   if($aname == $admins[$i] && !empty($admins)) {
      $auth_user = 1;
   }
}

if($radminsuper == 1 || $auth_user == 1) {
  switch($op) {


After all of this I see the module as "Inactive" within the Modules list, and then I add the Module nukeSEO to permissions for the admin. But when I log in and click the link within the admin panel for the admin that I set up it goes to a blank white page that says:

Access Denied


Any help would be greatly appreciated!
 
transit







PostPosted: Mon Jul 05, 2010 9:57 pm Reply with quote

Bump Smile Any thoughts? Still havent figured this out. The above is the modified tutorial of montego to add in the same for nukeSEO. (The changes and files I created to show you what code I am trying to use for the change) But something must be wrong since I am getting an Access Denied and a _NUKESEO showing up in the admin panel since it is obviously not pulling properly from the lang file as well.
 
kguske
Site Admin



Joined: Jun 04, 2004
Posts: 6432

PostPosted: Wed Jul 21, 2010 7:49 am Reply with quote

This will require some effort. I understand what you want to do, but it will take some time to review this in detail.

_________________
I search, therefore I exist...
nukeSEO - nukeFEED - nukePIE - nukeSPAM - nukeWYSIWYG
 
View user's profile Send private message
nuken
RavenNuke(tm) Development Team



Joined: Mar 11, 2007
Posts: 2024
Location: North Carolina

PostPosted: Wed Jul 21, 2010 9:42 am Reply with quote

I'm not sure if this is a typo or not, but you said open and edit admin/modules/messages.php but you are wanting to edit admin/modules/nukeSEO.php

_________________
Tricked Out News 
View user's profile Send private message Send e-mail Visit poster's website
nuken







PostPosted: Wed Jul 21, 2010 10:35 am Reply with quote

Try this code instead

Code:
$textrowcol = "rows='10' cols='50'";

if($Version_Num > "7.6") { $textrowcol = "rows='15' cols='75'"; }

$row = $db->sql_fetchrow($db->sql_query('SELECT `title`, `admins` FROM `'.$prefix.'_modules` WHERE `title`=\''.MODADM_NUKESEO.'\''));
   $row2 = $db->sql_fetchrow($db->sql_query('SELECT `name`, `radminsuper` FROM `'.$prefix.'_authors` WHERE `aid`=\''.$aid.'\''));
   $admins = explode(',', $row['admins']);
   $auth_user = 0;
   for($i=0; $i < sizeof($admins); $i++) { if($row2['name'] == $admins[$i] AND $row['admins'] != '') { $auth_user = 1; } }
   if($row2['radminsuper'] == 1 || $auth_user == 1) {
   switch($op) {



also, your links.php should look like this

Code:
<?php

   if (!defined('ADMIN_FILE')) {
       die('Access Denied');
   }
   global $admin_file;
   adminmenu($admin_file.'.php?op=nukeSEO', nukeSEO, 'nukeSEO.jpg');
   
   ?>
 
transit







PostPosted: Thu Jul 22, 2010 8:29 am Reply with quote

Genius nuken Smile Works like a charm Smile

One last kind of related question, say for basic admin functionality, would it be too hard and would all i have to do is create an admin folder for Docs 1.0 by nukecoder and make a links.php and a case.php and point it to the actual module since there is no ACP options for that module and rather just edit delete functions within it. My site just doesnt have left or right blocks nor the nukeNAV, so I wanted to create a quick link from the ACP for my lower level admins to the Docs module (no need to create ACP editing for such a simple module).

Thoughts? Or have I hopelessy babbled and lost all of you Smile
 
Guardian2003
Site Admin



Joined: Aug 28, 2003
Posts: 6799
Location: Ha Noi, Viet Nam

PostPosted: Fri Jul 23, 2010 3:23 pm Reply with quote

You don't need to to do that. If they are logged in as an admin, they will see the administration links within the module itself.
 
View user's profile Send private message Send e-mail
transit







PostPosted: Sun Jul 25, 2010 11:05 am Reply with quote

Yeah but the module is not visable and the left and right blocks as well as nukeNAV are completely turned off, I just need a link in the ACP so that the direct link doesnt have to be typed in everytime. Help?
 
spasticdonkey
RavenNuke(tm) Development Team



Joined: Dec 02, 2006
Posts: 1693
Location: Texas, USA

PostPosted: Sun Jul 25, 2010 12:02 pm Reply with quote

transit wrote:
Yeah but the module is not visable and the left and right blocks as well as nukeNAV are completely turned off, I just need a link in the ACP so that the direct link doesnt have to be typed in everytime. Help?


I did up a quicky block for you. Save as block-Docs.php, upload, activate and set as center down and view = admin only, and they will have a list of all documents Smile

Code:


<?php

if ( !defined('BLOCK_FILE') ) {
   Header('Location: ../index.php');
   die();
}

global $prefix, $db;

$content = '';
$sql = 'SELECT id, title FROM '.$prefix.'_docs';
$result = $db->sql_query($sql);
while (list($id, $title) = $db->sql_fetchrow($result)) {
   $id = intval($id);
   $title = check_html($title, 'nohtml');
   $content .= '<strong><big>&middot;</big></strong>&nbsp;<a style="white-space:nowrap;" href="modules.php?name=Docs&amp;do=show_doc&amp;id='.$id.'">'.$title.'</a> ';
}
?>
 
View user's profile Send private message Visit poster's website
transit







PostPosted: Mon Jul 26, 2010 12:41 am Reply with quote

Perfect Smile

The last thing to intergrate this all together is I need to have the words "Site Administration" pop up on the top of the theme header when logged into the admin panel only. Then just simply have it link to admin.php

I need to have it in the theme.php I guess because I need it on every page when logged in since I don't use blocks nor the nukenav and dont want to go back to the home screen each time when working on the site. Thoughts?

Thanks alot guys!

Below is my theme.php

Code:
<?php


/************************************************************/
/* IMPORTANT NOTE FOR THEMES DEVELOPERS!                    */
/*                                                          */
/* When you start coding your theme, if you want to         */
/* distribute it, please double check it to fit the HTML    */
/* 4.01 Transitional Standard. You can use the W3 validator */
/* located at http://validator.w3.org                       */
/* If you don't know where to start with your theme, just   */
/* start modifying this theme, it's validate and is cool ;) */
/************************************************************/

/************************************************************/
/* Theme Colors Definition                                  */
/*                                                          */
/* Define colors for your web site. $bgcolor2 is generaly   */
/* used for the tables border as you can see on OpenTable() */
/* function, $bgcolor1 is for the table background and the  */
/* other two bgcolor variables follows the same criteria.   */
/* $texcolor1 and 2 are for tables internal texts           */
/************************************************************/

$bgcolor1 = "#FEFFE0";
$bgcolor2 = "#FEFFE0";
$bgcolor3 = "#FEFFE0";
$bgcolor4 = "#FEFFE0";
$textcolor1 = "#000000";
$textcolor2 = "#000000";

include("themes/Trott/tables.php");

/************************************************************/
/* Function themeheader()                                   */
/*                                                          */
/* Control the header for your site. You need to define the */
/* BODY tag and in some part of the code call the blocks    */
/* function for left side with: blocks(left);               */
/************************************************************/

function themeheader() {
    global $user, $banners, $sitename, $slogan, $cookie, $prefix, $db;
    cookiedecode($user);
    $username = $cookie[1];
    if ($username == "") {
        $username = "Anonymous";
    }
    echo "<body bgcolor=\"#FEFFE0\" text=\"#000000\" link=\"#00000\" vlink=\"#000000\" alink=\"#000000\">";
    if ($banners == 1) {
   include("banners.php");
    }
    $topics_list = "<select name=\"new_topic\" onChange='submit()'>\n";
    $topics_list .= "<option value=\"\">All Topics</option>\n";
    $toplist = $db->sql_query("select topicid, topictext from ".$prefix."_topics order by topictext");
    while(list($topicid, $topics) = $db->sql_fetchrow($toplist)) {
    if ($topicid==$topic) { $sel = "selected "; }
   $topics_list .= "<option $sel value=\"$topicid\">$topics</option>\n";
   $sel = "";
    }
    if ($username == "Anonymous") {
   $theuser = "&nbsp;&nbsp;<a href=\"account-new_user.html\">Create an account";
    } else {
   $theuser = "&nbsp;&nbsp;Welcome $username!";
    }
    $public_msg = public_message();
    $tmpl_file = "themes/Trott/header.html";
    $thefile = implode("", file($tmpl_file));
    $thefile = addslashes($thefile);
    $thefile = "\$r_file=\"".$thefile."\";";
    eval($thefile);
    print $r_file;
    blocks(left);
    $tmpl_file = "themes/Trott/left_center.html";
    $thefile = implode("", file($tmpl_file));
    $thefile = addslashes($thefile);
    $thefile = "\$r_file=\"".$thefile."\";";
    eval($thefile);
    print $r_file;
}

/************************************************************/
/* Function themefooter()                                   */
/*                                                          */
/* Control the footer for your site. You don't need to      */
/* close BODY and HTML tags at the end. In some part call   */
/* the function for right blocks with: blocks(right);       */
/* Also, $index variable need to be global and is used to   */
/* determine if the page your're viewing is the Homepage or */
/* and internal one.                                        */
/************************************************************/

function themefooter() {
    global $index, $foot1, $foot2, $foot3, $copyright, $totaltime;
    if ($index == 1) {
   $tmpl_file = "themes/Trott/center_right.html";
   $thefile = implode("", file($tmpl_file));
   $thefile = addslashes($thefile);
   $thefile = "\$r_file=\"".$thefile."\";";
   eval($thefile);
   print $r_file;
   blocks(right);
    }
    $footer_message = "$foot1<br>$foot2<br>$foot3<br>$copyright<br>$totaltime";
    $tmpl_file = "themes/Trott/footer.html";
    $thefile = implode("", file($tmpl_file));
    $thefile = addslashes($thefile);
    $thefile = "\$r_file=\"".$thefile."\";";
    eval($thefile);
    print $r_file;
}

/************************************************************/
/* Function themeindex()                                    */
/*                                                          */
/* This function format the stories on the Homepage         */
/************************************************************/

function themeindex ($aid, $informant, $time, $title, $counter, $topic, $thetext, $notes, $morelink, $topicname, $topicimage, $topictext) {
    global $anonymous, $tipath;
    $ThemeSel = get_theme();
    if (file_exists("themes/$ThemeSel/images/topics/$topicimage")) {
   $t_image = "themes/$ThemeSel/images/topics/$topicimage";
    } else {
   $t_image = "$tipath$topicimage";
    }
    if ($notes != "") {
   $notes = "<br><br><b>"._NOTE."</b> <i>$notes</i>\n";
    } else {
   $notes = "";
    }
    if ("$aid" == "$informant") {
   $content = "$thetext$notes\n";
    } else {
   if($informant != "") {
       $content = "<a href=\"modules.php?name=Your_Account&amp;op=userinfo&amp;username=$informant\">$informant</a> ";
   } else {
       $content = "$anonymous ";
   }
   $content .= ""._WRITES." <i>\"$thetext\"</i>$notes\n";
    }
    $posted = ""._POSTEDBY." ";
    $posted .= get_author($aid);
    $posted .= " "._ON." $time $timezone ($counter "._READS.")";
    $tmpl_file = "themes/Trott/story_home.html";
    $thefile = implode("", file($tmpl_file));
    $thefile = addslashes($thefile);
    $thefile = "\$r_file=\"".$thefile."\";";
    eval($thefile);
    print $r_file;
}

/************************************************************/
/* Function themearticle()                                  */
/*                                                          */
/* This function format the stories on the story page, when */
/* you click on that "Read More..." link in the home        */
/************************************************************/

function themearticle ($aid, $informant, $datetime, $title, $thetext, $topic, $topicname, $topicimage, $topictext) {
    global $admin, $sid, $tipath;
    $ThemeSel = get_theme();
    if (file_exists("themes/$ThemeSel/images/topics/$topicimage")) {
   $t_image = "themes/$ThemeSel/images/topics/$topicimage";
    } else {
   $t_image = "$tipath$topicimage";
    }
    $posted = ""._POSTEDON." $datetime "._BY." ";
    $posted .= get_author($aid);
    if ($notes != "") {
   $notes = "<br><br><b>"._NOTE."</b> <i>$notes</i>\n";
    } else {
   $notes = "";
    }
    if ("$aid" == "$informant") {
   $content = "$thetext$notes\n";
    } else {
   if($informant != "") {
       $content = "<a href=\"modules.php?name=Your_Account&amp;op=userinfo&amp;username=$informant\">$informant</a> ";
   } else {
       $content = "$anonymous ";
   }
   $content .= ""._WRITES." <i>\"$thetext\"</i>$notes\n";
    }
    $tmpl_file = "themes/Trott/story_page.html";
    $thefile = implode("", file($tmpl_file));
    $thefile = addslashes($thefile);
    $thefile = "\$r_file=\"".$thefile."\";";
    eval($thefile);
    print $r_file;
}

/************************************************************/
/* Function themesidebox()                                  */
/*                                                          */
/* Control look of your blocks. Just simple.                */
/************************************************************/

function themesidebox($title, $content) {
    $tmpl_file = "themes/Trott/blocks.html";
    $thefile = implode("", file($tmpl_file));
    $thefile = addslashes($thefile);
    $thefile = "\$r_file=\"".$thefile."\";";
    eval($thefile);
    print $r_file;
}

?>
 
spasticdonkey







PostPosted: Mon Jul 26, 2010 7:09 am Reply with quote

could you post your themes/Trott/header.html file as well?
 
transit







PostPosted: Mon Jul 26, 2010 10:43 am Reply with quote

header.html Smile

Code:


<div rel="favicon.ico" onselectstart="return false;" style="-moz-user-select: none;">
<TABLE WIDTH=766 BORDER=0 CELLPADDING=0 CELLSPACING=0 align="center">
   <TR><TD><IMG SRC="themes/Trott/images/top.jpg" WIDTH=766 HEIGHT=190 ALT=""></TD></TR>
   <TR>
      <TD WIDTH=766 HEIGHT=46 valign="top">
      <TABLE WIDTH=766 BORDER=0 CELLPADDING=0 CELLSPACING=0>
   <TR>
      <TD><IMG SRC="themes/Trott/images/m.jpg" WIDTH=15 HEIGHT=46 ALT=""></TD>
      <TD><a href="index.html"><IMG SRC="themes/Trott/images/m1.jpg" ALT="" WIDTH=92 HEIGHT=46 border="0"></a></TD>
      <TD><a href="info-3.html"><IMG SRC="themes/Trott/images/m2.jpg" ALT="" WIDTH=91 HEIGHT=46 border="0"></a></TD>
      <TD><a href="Destinations/list.php?cat_id=4"><IMG SRC="themes/Trott/images/m3.jpg" ALT="" WIDTH=91 HEIGHT=46 border="0"></a></TD>
      <TD><a href="faq-1-Frequently+Asked+Questions.html"><IMG SRC="themes/Trott/images/m4.jpg" ALT="" WIDTH=91 HEIGHT=46 border="0"></a></TD>
      <TD><a href="forms.html"><IMG SRC="themes/Trott/images/m5.jpg" ALT="" WIDTH=91 HEIGHT=46 border="0"></a></TD>
      <TD><a href="contactus.html"><IMG SRC="themes/Trott/images/m6.jpg" ALT="" WIDTH=91 HEIGHT=46 border="0"></a></TD>
      <TD><a href="info-28.html"><IMG SRC="themes/Trott/images/m7.jpg" ALT="" WIDTH=91 HEIGHT=46 border="0"></a></TD>
      <TD><a href="links.html.html"><IMG SRC="themes/Trott/images/m8.jpg" ALT="" WIDTH=91 HEIGHT=46 border="0"></a></TD>
      <TD><IMG SRC="themes/Trott/images/mm.jpg" WIDTH=22 HEIGHT=46 ALT=""></TD>
   </TR>
</TABLE>
      </TD>
   </TR>
   <TR><TD><IMG SRC="themes/Trott/images/top_line.jpg" WIDTH=766 HEIGHT=7 ALT=""></TD></TR>
   <TR>
      <TD WIDTH=762 HEIGHT=446 valign="top">
      <TABLE WIDTH=762 BORDER=0 CELLPADDING=0 CELLSPACING=0>
   <TR>
      <TD background="themes/Trott/images/left.jpg" valign="top" WIDTH=17><img src="themes/Trott/images/spacer.gif" width="17" alt=""></TD>
      <TD WIDTH=731 HEIGHT=446 valign="top" style="background:#FEFFE0 ">
      <table width="731" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="188" valign="top"><img src="themes/Trott/images/spacer.gif" alt="" width="165" height="1">
 
spasticdonkey







PostPosted: Mon Jul 26, 2010 11:23 am Reply with quote

OK, lets see if this works. I going to assume your admins won't need to visit the Contact Us link, so we'll replace that if they are logged in as admin. You will need to create a new image (themes/Trott/images/ADMIN.jpg) the same size as the Contact Us image (themes/Trott/images/m6.jpg)

just the themeheader function for your theme
Code:
function themeheader() {

    global $user, $banners, $sitename, $slogan, $cookie, $prefix, $db, $admin;
    cookiedecode($user);
    $username = $cookie[1];
    if ($username == "") {
        $username = "Anonymous";
    }
    echo "<body bgcolor=\"#FEFFE0\" text=\"#000000\" link=\"#00000\" vlink=\"#000000\" alink=\"#000000\">";
    if ($banners == 1) {
   include("banners.php");
    }
    $topics_list = "<select name=\"new_topic\" onChange='submit()'>\n";
    $topics_list .= "<option value=\"\">All Topics</option>\n";
    $toplist = $db->sql_query("select topicid, topictext from ".$prefix."_topics order by topictext");
    while(list($topicid, $topics) = $db->sql_fetchrow($toplist)) {
    if ($topicid==$topic) { $sel = "selected "; }
   $topics_list .= "<option $sel value=\"$topicid\">$topics</option>\n";
   $sel = "";
    }
    if ($username == "Anonymous") {
   $theuser = "&nbsp;&nbsp;<a href=\"account-new_user.html\">Create an account";
    } else {
   $theuser = "&nbsp;&nbsp;Welcome $username!";
    }
   if (is_admin($admin)) {
      $specialLINK = '<a href="admin.php"><IMG SRC="themes/Trott/images/ADMIN.jpg" ALT="" WIDTH=91 HEIGHT=46 border="0"></a>';
   } else {
      $specialLINK = '<a href="contactus.html"><IMG SRC="themes/Trott/images/m6.jpg" ALT="" WIDTH=91 HEIGHT=46 border="0"></a>';
   }
    $public_msg = public_message();
    $tmpl_file = "themes/Trott/header.html";
    $thefile = implode("", file($tmpl_file));
    $thefile = addslashes($thefile);
    $thefile = "\$r_file=\"".$thefile."\";";
    eval($thefile);
    print $r_file;
    blocks(left);
    $tmpl_file = "themes/Trott/left_center.html";
    $thefile = implode("", file($tmpl_file));
    $thefile = addslashes($thefile);
    $thefile = "\$r_file=\"".$thefile."\";";
    eval($thefile);
    print $r_file;
}


and in your header.html template, find
Code:
<TD><a href="contactus.html"><IMG SRC="themes/Trott/images/m6.jpg" ALT="" WIDTH=91 HEIGHT=46 border="0"></a></TD>

replace with
Code:
<TD>$specialLINK</TD>


hopefully that will work. Is this theme based on fisubice?
 
transit







PostPosted: Wed Jul 28, 2010 11:02 am Reply with quote

Made a little modification to it here:

Code:


function themeheader() {
    global $user, $banners, $sitename, $slogan, $cookie, $prefix, $db, $admin;
    cookiedecode($user);
    $username = $cookie[1];
    if ($username == "") {
        $username = "Anonymous";
    }
    echo "<body bgcolor=\"#FEFFE0\" text=\"#000000\" link=\"#00000\" vlink=\"#000000\" alink=\"#000000\">";
    if ($banners == 1) {
   include("banners.php");
    }
    $topics_list = "<select name=\"new_topic\" onChange='submit()'>\n";
    $topics_list .= "<option value=\"\">All Topics</option>\n";
    $toplist = $db->sql_query("select topicid, topictext from ".$prefix."_topics order by topictext");
    while(list($topicid, $topics) = $db->sql_fetchrow($toplist)) {
    if ($topicid==$topic) { $sel = "selected "; }
   $topics_list .= "<option $sel value=\"$topicid\">$topics</option>\n";
   $sel = "";
    }
    if ($username == "Anonymous") {
   $theuser = "&nbsp;&nbsp;<a href=\"account-new_user.html\">Create an account";
    } else {
   $theuser = "&nbsp;&nbsp;Welcome $username!";
    }
   if (is_admin($admin)) {
      $specialLINK = '<td><a href="admin.php"><IMG SRC="themes/Trott/images/SiteAdmin.jpg" ALT="" border="0"></a>
                             <a href="Destinations/admin/login.php"><IMG SRC="themes/Trott/images/DestinationsAdmin.jpg" ALT="" border="0"></a></td>
                             <td><div align="right">Welcome $username!&nbsp;&nbsp;[ <a href="admin.php?op=logout">Logout</a> ]</div></td>';
   } else {
      $specialLINK = '<td><div align="right"><a href="admin.php">Login</a></div></td>';
   }
    $public_msg = public_message();
    $tmpl_file = "themes/Trott/header.html";
    $thefile = implode("", file($tmpl_file));
    $thefile = addslashes($thefile);
    $thefile = "\$r_file=\"".$thefile."\";";
    eval($thefile);
    print $r_file;
    blocks(left);
    $tmpl_file = "themes/Trott/left_center.html";
    $thefile = implode("", file($tmpl_file));
    $thefile = addslashes($thefile);
    $thefile = "\$r_file=\"".$thefile."\";";
    eval($thefile);
    print $r_file;
}


Since I have two seperate scripts for an admin to log into. I also decided since I need a login button as well to simply put it at the very top of the theme in the right hand corner.

The one question I had was I don't think the value for the adminuser is $username so what is the correct value to put in my "specialLINK"?
 
spasticdonkey







PostPosted: Wed Jul 28, 2010 1:11 pm Reply with quote

what you have there will display the admin logon link to everyone, is that what you intended? Not sure why you would need to welcome the admin by name..? I've never done that, or remember seeing it done, so can't really say how to accomplish... it's probably a bad idea security wise as well
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> How To's

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 ©