kb9nha
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Sun Aug 10, 2008 9:00 pm |
|
Susann, I completely unistalled the NS that comes with RN CMS (no matter how I tried I can't adjust the NS settings) then installed the latest version of NS (version 2.6.01). During the installation, I renamed both the sample.staccess & sample.ftaccess to .staccess & .ftaccess then CHMOD both to 666. The installation looks OK. I can now adjust the settings. There are 2 edit core files I omited editing prior to installation, the (admin.php) & the (index.php - inside Your Account module). Somehow, the scripts to change doesn't match that to look for & change in the edit core file instruction. Below are the files I'm referring to:
My admin.php
Code:<?php
/************************************************************************/
/* PHP-NUKE: Advanced Content Management System */
/* ============================================ */
/* */
/* Copyright (c) 2002 by Francisco Burzi */
/* http://phpnuke.org */
/* */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License. */
/************************************************************************/
/************************************************************************/
/* Raven - http://ravenphpscripts.com http://ravenwebhosting.com */
/* 10/19/2006 - Brought up to or as near to XHTML standards as possible.*/
/* */
/************************************************************************/
define('ADMIN_FILE', true);
require_once('mainfile.php');
if(isset($aid)) {
if($aid AND (!isset($admin) OR empty($admin)) AND $op!='login') {
unset($aid);
unset($admin);
die('Access Denied');
}
}
get_lang('admin');
function create_first($name, $url, $email, $pwd, $user_new) {
global $prefix, $user_prefix, $db;
$first = $db->sql_numrows($db->sql_query('SELECT * FROM '.$prefix.'_authors'));
if ($first == 0) {
$pwd = md5($pwd);
$the_adm = 'God';
$email = validate_mail($email);
$db->sql_query('INSERT INTO '.$prefix."_authors VALUES ('$name', '$the_adm', '$url', '$email', '$pwd', '0', '1', '')");
if ($user_new == 1) {
$user_regdate = date('M d, Y');
$user_avatar = 'gallery/blank.gif';
$commentlimit = 4096;
if ($url == 'http://') { $url = ''; }
$db->sql_query('INSERT INTO '.$user_prefix.'_users (user_id, username, user_email, user_website, user_avatar, user_regdate, user_password, theme, commentmax, user_level, user_lang, user_dateformat) '."VALUES (NULL,'$name','$email','$url','$user_avatar','$user_regdate','$pwd','$Default_Theme','$commentlimit', '2', 'english','D M d, Y g:i a')");
}
login();
}
}
global $admin_file;
$the_first = $db->sql_numrows($db->sql_query('SELECT * FROM '.$prefix.'_authors'));
if ($the_first == 0) {
if (!$name) {
include_once('header.php');
title("$sitename: "._ADMINISTRATION);
OpenTable();
echo '<center><b>'._NOADMINYET.'</b></center><br /><br />'
.'<form action="'.$admin_file.'.php" method="post">'
.'<table border="0">'
.'<tr><td><b>'._NICKNAME.':</b></td><td><input type="text" name="name" size="30" maxlength="25" /></td></tr>'
.'<tr><td><b>'._HOMEPAGE.':</b></td><td><input type="text" name="url" size="30" maxlength="255" value="http://" /></td></tr>'
.'<tr><td><b>'._EMAIL.':</b></td><td><input type="text" name="email" size="30" maxlength="255" /></td></tr>'
.'<tr><td><b>'._PASSWORD.':</b></td><td><input type="password" name="pwd" size="11" maxlength="40" /></td></tr>'
.'<tr><td colspan="2">'._CREATEUSERDATA.' <input type="radio" name="user_new" value="1" checked="checked" />'._YES.' <input type="radio" name="user_new" value="0" />'._NO.'</td></tr>'
.'<tr><td><input type="hidden" name="fop" value="create_first" />'
.'<input type="submit" value="'._SUBMIT.'" />'
.'</td></tr></table></form>';
CloseTable();
include_once('footer.php');
}
switch($fop) {
case 'create_first':
create_first($name, $url, $email, $pwd, $user_new);
break;
}
die();
}
if (isset($aid) && (ereg('[^a-zA-Z0-9@_.]',trim($aid)))) {
die('Begone');
}
if (isset($aid)) { $aid = substr($aid, 0,25);}
if (isset($pwd)) { $pwd = substr($pwd, 0,40);}
if ((isset($aid)) && (isset($pwd)) && (isset($op)) && ($op == 'login')) {
/*****[BEGIN]******************************************
[ Base: GFX Code v1.0.0 ]
******************************************************/
if (!isset($gfx_check)) {$gfx_check = '';}
if (!security_code_check($gfx_check, array(1,5,6,7))) {
/*****[END]********************************************
[ Base: GFX Code v1.0.0 ]
******************************************************/
Header('Location: '.$admin_file.'.php');
die();
}
if(!empty($aid) AND !empty($pwd)) {
$pwd = md5($pwd);
$result = $db->sql_query('SELECT pwd, admlanguage FROM '.$prefix.'_authors WHERE aid=\''.$aid.'\'');
list($rpwd, $admlanguage) = $db->sql_fetchrow($result);
$admlanguage = addslashes($admlanguage);
if($rpwd == $pwd) {
$admin = base64_encode("$aid:$pwd:$admlanguage");
setcookie('admin',$admin,time()+2592000);
unset($op);
}
}
}
$admintest = 0;
if(isset($admin) && !empty($admin)) {
$admin = addslashes(base64_decode($admin));
$admin = explode(':', $admin);
$aid = addslashes($admin[0]);
$pwd = $admin[1];
$admlanguage = $admin[2];
if (empty($aid) OR empty($pwd)) {
$admintest=0;
$alert = '<html>'."\n";
$alert .= '<title>'._A_INTRUDER_MSG.'</title>'."\n";
$alert .= '<body bgcolor="#FFFFFF" text="#000000">'."\n\n".'<br /><br /><br />'."\n\n";
$alert .= '<center><img src="images/eyes.gif" border="0" /><br /><br />'."\n";
$alert .= '<font face="Verdana" size="+4"><b>'._A_GETOUT.'</b></font></center>'."\n";
$alert .= '</body>'."\n";
$alert .= '</html>'."\n";
die($alert);
}
$aid = substr("$aid", 0,25);
$result2 = $db->sql_query('SELECT name, pwd FROM '.$prefix.'_authors WHERE aid=\''.$aid.'\'');
if (!$result2) {
die('Selection from database failed!');
} else {
list($rname, $rpwd) = $db->sql_fetchrow($result2);
if($rpwd == $pwd && !empty($rpwd)) {
$admintest = 1;
}
}
}
$ops = array('mod_authors', 'modifyadmin', 'UpdateAuthor', 'AddAuthor', 'deladmin2', 'deladmin', 'assignstories', 'deladminconf'); // Raven: 10-23-2006
if(!isset($op)) {
$op = 'adminMain';
} elseif(in_array($op, $ops) AND $rname != 'God') {
die('Illegal Operation');
}
$pagetitle = '- '._ADMINMENU;
if ($admintest && ($op != "logout")) {
asec_checkAdminAccess();
}
/*********************************************************/
/* Login Function */
/*********************************************************/
function login() {
global $gfx_chk, $admin_file;
include_once('header.php');
// mt_srand ((double)microtime()*1000000);
// $maxran = 1000000;
// $random_num = mt_rand(0, $maxran);
OpenTable();
echo '<center><font class="title"><b>'._ADMINLOGIN.'</b></font></center>';
CloseTable();
echo '<br />';
OpenTable();
echo '<form action="'.$admin_file.'.php" method="post">'
.'<table border="0">'
.'<tr><td>'._ADMINID.'</td>'
.'<td><input type="text" name="aid" size="20" maxlength="25" /></td></tr>'
.'<tr><td>'._PASSWORD.'</td>'
.'<td><input type="password" name="pwd" size="20" maxlength="40" /></td></tr>';
/*****[BEGIN]******************************************
[ Base: GFX Code v1.0.0 ]
******************************************************/
echo security_code(array(1,5,6,7), 'normal');
/*****[END]********************************************
[ Base: GFX Code v1.0.0 ]
******************************************************/
echo '<tr><td><input type="hidden" name="op" value="login" />'
.'<input type="submit" value="'._LOGIN.'" />'
.'</td></tr></table>'
.'</form>';
CloseTable();
include_once('footer.php');
}
function deleteNotice($id) {
global $prefix, $db, $admin_file;
$id = intval($id);
$db->sql_query('DELETE FROM '.$prefix.'_reviews_add WHERE id = \''.$id.'\'');
Header('Location: '.$admin_file.'.php?op=reviews');
}
/*********************************************************/
/* Administration Menu Function */
/*********************************************************/
function adminmenu($url, $title, $image) {
global $counter, $admingraphic, $Default_Theme;
$ThemeSel = get_theme();
if (file_exists('themes/'.$ThemeSel.'/images/admin/'.$image)) {
$image = 'themes/'.$ThemeSel.'/images/admin/'.$image;
} else {
$image = 'images/admin/'.$image;
}
if ($admingraphic == 1) {
$img = '<img src="'.$image.'" border="0" alt="'.$title.'" title="'.$title.'" /></a><br />';
$close = '';
} else {
$img = '';
$close = '</a>';
}
echo '<td align="center" valign="top" width="16%"><font class="content"><a href="'.$url.'">'."$img<b>$title</b>$close".'<br /><br /></font></td>';
if ($counter == 5) {
echo '</tr><tr>';
$counter = 0;
} else {
$counter++;
}
}
function GraphicAdmin() {
global $aid, $admingraphic, $language, $admin, $prefix, $db, $counter, $admin_file;
$newsubs = $db->sql_numrows($db->sql_query('SELECT qid FROM '.$prefix.'_queue'));
$row = $db->sql_fetchrow($db->sql_query('SELECT radminsuper FROM '.$prefix.'_authors WHERE aid=\''.$aid.'\''));
$radminsuper = intval($row['radminsuper']);
if ($radminsuper == 1) {
OpenTable();
echo '<center><a href="'.$admin_file.'.php"><font class="title">'._ADMINMENU.'</font></a>';
echo '<br /><br /></center>';
echo'<table align="center" border="0" width="100%" cellspacing="1"><tr>';
$linksdir = dir('admin/links');
$menulist = '';
while($func=$linksdir->read()) {
if(substr($func, 0, 6) == 'links.') {
$menulist .= "$func ";
}
}
closedir($linksdir->handle);
$menulist = explode(' ', $menulist);
sort($menulist);
for ($i=0; $i < sizeof($menulist); $i++) {
if(!empty($menulist[$i])) {
$sucounter = 0;
include_once($linksdir->path."/$menulist[$i]");
}
}
adminmenu($admin_file.'.php?op=logout',_ADMINLOGOUT, 'logout.gif');
if ($counter==0) echo '<td></td>'; //Added by Raven 7/1/2007 to fix a warning in xhtml
echo'</tr></table>';
$counter = '';
CloseTable();
echo '<br />';
}
OpenTable();
echo '<center><a href="'.$admin_file.'.php"><font class="title">'._MODULESADMIN.'</font></a>';
echo '<br /><br />';
echo'<table border="0" width="100%" cellspacing="1"><tr>';
$result = $db->sql_query('SELECT title, admins FROM '.$prefix.'_modules ORDER BY title ASC');
$row2 = $db->sql_fetchrow($db->sql_query('SELECT name FROM '.$prefix.'_authors WHERE aid=\''.$aid.'\''));
while ($row = $db->sql_fetchrow($result)) {
$admins = explode(',', $row['admins']);
$auth_user = 0;
for ($i=0; $i < sizeof($admins); $i++) {
if ($row2['name'] == $admins[$i]) {
$auth_user = 1;
}
}
if ($radminsuper == 1 OR $auth_user == 1) {
if (file_exists('modules/'.$row['title'].'/admin/index.php') AND file_exists('modules/'.$row['title'].'/admin/links.php') AND file_exists('modules/'.$row['title'].'/admin/case.php')) {
include_once('modules/'.$row['title'].'/admin/links.php');
}
}
}
adminmenu($admin_file.'.php?op=logout', _ADMINLOGOUT, 'logout.gif');
if ($counter==0) echo '<td></td>'; //Added by Raven 7/1/2007 to fix a warning in xhtml
echo'</tr></table></center>';
CloseTable();
echo '<br />';
}
/*********************************************************/
/* Administration Main Function */
/*********************************************************/
function adminMain() {
global $language, $admin, $aid, $prefix, $user_prefix, $file, $db, $sitename, $admin_file, $bgcolor1;
include_once('header.php');
/*
$dummy = 0;
$month = date('M');
$curDate2 = '%'.$month[0].$month[1].$month[2].'%'.date('d').'%'.date('Y').'%';
$ty = time() - 86400;
$preday = strftime('%d', $ty);
$premonth = strftime('%B', $ty);
$preyear = strftime('%Y', $ty);
$curDateP = '%'.$premonth[0].$premonth[1].$premonth[2].'%'.$preday.'%'.$preyear.'%';
*/
//Executing SQL For Today and Yesterday
$userCount = 0;
$userCount2 = 0;
$todayDST = date('I',time())*3600; // 2.2.0
$yesterdayDST = date('I',time()-86400)*3600; // 2.2.0
$Today = date('M d, Y',time()-$todayDST); // 2.2.0
$Yesterday = date('M d, Y',time()-86400-$yesterdayDST); // 2.2.0
$sql = 'SELECT user_regdate, COUNT(user_regdate) FROM '.$user_prefix.'_users where user_regdate IN(\''.$Today.'\', \''.$Yesterday.'\') GROUP BY user_regdate LIMIT 0,2';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
if ($row[0]==$Today) $userCount = $row[1];
elseif ($row[0]==$Yesterday) $userCount2 = $row[1];
}
GraphicAdmin();
$aid = substr("$aid", 0,25);
$row = $db->sql_fetchrow($db->sql_query('SELECT radminsuper, admlanguage FROM '.$prefix.'_authors WHERE aid=\''.$aid.'\''));
$radminsuper = intval($row['radminsuper']);
$admlanguage = addslashes($row['admlanguage']);
$result = $db->sql_query('SELECT admins FROM '.$prefix.'_modules WHERE title=\'News\'');
$result2 = $db->sql_query('SELECT name FROM '.$prefix.'_authors WHERE aid=\''.$aid.'\'');
list($aidname) = $db->sql_fetchrow($result2);
$radminarticle = 0;
while (list($admins) = $db->sql_fetchrow($result)) {
$admins = explode(',', $admins);
$auth_user = 0;
for ($i=0; $i < sizeof($admins); $i++) {
if ($aidname == $admins[$i]) {
$auth_user = 1;
}
}
if ($auth_user == 1) {
$radminarticle = 1;
}
}
if (!empty($admlanguage)) {
$queryalang = 'WHERE alanguage=\''.$admlanguage.'\'';
} else {
$queryalang = '';
}
list($main_module) = $db->sql_fetchrow($db->sql_query('SELECT main_module from '.$prefix.'_main'));
OpenTable();
echo '<center><b>'."$sitename".': '._DEFHOMEMODULE.'</b><br /><br />'
._MODULEINHOME.' <b>'."$main_module".'</b><br />[ <a href="'.$admin_file.'.php?op=modules">'._CHANGE.'</a> ]</center>';
CloseTable();
echo '<br />';
OpenTable();
$guest_online_num = intval($db->sql_numrows($db->sql_query('SELECT uname FROM '.$prefix.'_session WHERE guest=1')));
$member_online_num = intval($db->sql_numrows($db->sql_query('SELECT uname FROM '.$prefix.'_session WHERE guest=0')));
$who_online_num = $guest_online_num + $member_online_num;
$who_online = '<center><font class="option">'._WHOSONLINE.'</font><br /><br /><font class="content">'._CURRENTLY." $guest_online_num "._GUESTS." $member_online_num "._MEMBERS.'<br />';
// list($userCount) = $db->sql_fetchrow($db->sql_query('SELECT COUNT(user_id) AS userCount from '.$user_prefix.'_users WHERE user_regdate LIKE \''.$curDate2.'\''));
// list($userCount2) = $db->sql_fetchrow($db->sql_query('SELECT COUNT(user_id) AS userCount FROM '.$user_prefix.'_users WHERE user_regdate LIKE \''.$curDateP.'\''));
echo $who_online.'<br />'
._BTD.': <b>'.$userCount.'</b> - '._BYD.': <b>'.$userCount2.'</b></font></center>';
CloseTable();
if (is_active('News')) {
echo '<br />';
OpenTable();
echo '<center><b>'._AUTOMATEDARTICLES.'</b></center><br />';
$count = 0;
$result5 = $db->sql_query('SELECT anid, aid, title, time, alanguage FROM '.$prefix.'_autonews '.$queryalang.' ORDER BY time ASC');
while (list($anid, $aid, $listtitle, $time, $alanguage) = $db->sql_fetchrow($result5)) {
$anid = intval($anid);
$said = substr($aid, 0,25);
$title = $listtitle;
if (empty($alanguage)) {
$alanguage = _ALL;
}
if (!empty($anid)) {
if ($count == 0) {
echo '<table border="1" width="100%">';
$count = 1;
}
$time = str_replace(' ', '@', $time);
if (($radminarticle==1) OR ($radminsuper==1)) {
if (($radminarticle==1) AND ($aid == $said) OR ($radminsuper==1)) {
echo '<tr><td nowrap="nowrap"> (<a href="'.$admin_file.'.php?op=autoEdit&anid='.$anid.'">'._EDIT.'</a>-<a href="'.$admin_file.'.php?op=autoDelete&anid='.$anid.'">'._DELETE.'</a>) </td><td width="100%"> '.$title.' </td><td align="center"> '.$alanguage.' </td><td nowrap="nowrap"> '.$time.' </td></tr>'; /* Multilingual Code : added column to display language */
}else {
echo '<tr><td> ('._NOFUNCTIONS.') </td><td width="100%"> '.$title.' </td><td align="center"> '.$alanguage.' </td><td nowrap="nowrap"> '.$time.' </td></tr>'; /* Multilingual Code : added column to display language */
}
} else {
echo '<tr><td width="100%"> '.$title.' </td><td align="center"> '.$alanguage.' </td><td nowrap="nowrap"> '.$time.' </td></tr>'; /* Multilingual Code : added column to display language */
}
}
}
if ((empty($anid)) AND ($count == 0)) {
echo '<center><i>'._NOAUTOARTICLES.'</i></center>';
}
if ($count == 1) {
echo '</table>';
}
CloseTable();
echo '<br />';
OpenTable();
/*
if ($queryalang != '') {
$queryalang = ' AND alanguage= \'' . $admlanguage . '\'';
} */
echo '<center><b>'._LAST.' 20 '._ARTICLES.'</b></center><br />';
$result6 = $db->sql_query('SELECT sid, aid, title, time, topic, informant, alanguage, topicname FROM '.$prefix.'_stories left join ' .$prefix.'_topics ON topicid=topic '. $queryalang.' ORDER BY time DESC LIMIT 0,20');
echo '<center><table border="1" width="100%" bgcolor="'.$bgcolor1.'">';
while ($row = $db->sql_fetchrow($result6)) {
$sid = intval($row['sid']);
$said = substr($row['aid'], 0,25);
if ((empty($row['alanguage']))) {
$alanguage = _ALL;
}
else {
$alanguage = $row['alanguage'];
}
formatTimestamp($row['time']);
echo '<tr><td align="right"><b>'.$sid.'</b>'
.'</td><td align="left" width="100%"><a href="modules.php?name=News&file=article&sid='.$sid.'">'.$row['title'].'</a>'
.'</td><td align="center">'.$alanguage
.'</td><td align="right">'.$row['topicname'];
if ($radminarticle == 1 OR $radminsuper == 1) {
if (($radminarticle==1) AND ($aid == $said) OR ($radminsuper==1)) {
echo '</td><td align="right" nowrap="nowrap">(<a href="'.$admin_file.'.php?op=EditStory&sid='.$sid.'">'._EDIT.'</a>-<a href="'.$admin_file.'.php?op=RemoveStory&sid='.$sid.'">'._DELETE.'</a>)'
.'</td></tr>';
} else {
echo '</td><td align="right" nowrap="nowrap"><font class="content"><i>('._NOFUNCTIONS.')</i></font>'
.'</td></tr>';
}
} else {
echo '</td></tr>';
}
}
echo '</table></center>';
if (($radminarticle==1) OR ($radminsuper==1)) {
echo '<center>'
.'<form action="'.$admin_file.'.php" method="post">'
.'<table><tr><td>'
._STORYID.': <input type="text" name="sid" size="10" /></td>'
.'<td><select name="op">'
.'<option value="EditStory" selected="selected">'._EDIT.'</option>'
.'<option value="RemoveStory">'._DELETE.'</option>'
.'</select></td>'
.'<td><input type="submit" value="'._GO.'" /></td></tr></table>'
.'</form></center>';
}
CloseTable();
}
if (is_active('Surveys')) {
list($pollID, $pollTitle) = $db->sql_fetchrow($db->sql_query('SELECT pollID, pollTitle FROM '.$prefix.'_poll_desc WHERE artid=0 ORDER BY pollID DESC LIMIT 1'));
$pollID = intval($pollID);
echo '<br />';
OpenTable();
echo '<center><b>'._CURRENTPOLL.':</b> '.$pollTitle.' [ <a href="'.$admin_file.'.php?op=polledit&pollID='.$pollID.'">'._EDIT.'</a> | <a href="'.$admin_file.'.php?op=create">'._ADD.'</a> ]</center>';
CloseTable();
}
unset($title);
include_once('footer.php');
}
if($admintest) {
switch($op) {
case 'do_gfx':
/*****[BEGIN]******************************************
[ Base: GFX Code v1.0.0 ]
******************************************************/
gen_old_gfx();
/*****[END]********************************************
[ Base: GFX Code v1.0.0 ]
******************************************************/
break;
case 'deleteNotice':
deleteNotice($id);
break;
case 'GraphicAdmin':
GraphicAdmin();
break;
case 'adminMain':
adminMain();
break;
case 'logout':
setcookie('admin', false);
$admin = '';
include_once('header.php');
OpenTable();
echo '<center><font class="title"><b>'._YOUARELOGGEDOUT.'</b></font></center>';
CloseTable();
Header('Refresh: 3; url='.$admin_file.'.php');
include_once('footer.php');
break;
case 'login';
unset($op);
default:
if (!is_admin($admin)) {
login();
}
$casedir = dir('admin/case');
while($func=$casedir->read()) {
if(substr($func, 0, 5) == 'case.') {
include_once($casedir->path."/$func");
}
}
closedir($casedir->handle);
$result = $db->sql_query('SELECT title FROM '.$prefix.'_modules ORDER BY title ASC');
while (list($mod_title) = $db->sql_fetchrow($result)) {
if (file_exists('modules/'.$mod_title.'/admin/index.php') AND file_exists('modules/'.$mod_title.'/admin/links.php') AND file_exists('modules/'.$mod_title.'/admin/case.php')) {
include_once('modules/'.$mod_title.'/admin/case.php');
}
}
break;
}
}else {
switch($op) {
default:
login();
break;
}
}
?>
|
Edit admin.php instruction
Code:/************************************************************************/
/* This file is for instructional use. */
/* By: NukeScripts Network (webmaster@nukescripts.net) */
/* http://www.nukescripts.net */
/* Modifications Copyright © 2000-2008 by NukeScripts Network */
/************************************************************************/
/* Based on Patched 3.3 admin.php your admin.php may differ from the */
/* examples found here. */
/************************************************************************/
#
#-----[ OPEN ]------------------------------------------
#
admin.php
#
#-----[ FIND ]------------------------------------------
#
$checkurl = $_SERVER['REQUEST_URI'];
if((stripos_clone($_SERVER["QUERY_STRING"],'AddAuthor')) || (stripos_clone($_SERVER["QUERY_STRING"],'VXBkYXRlQXV0aG9y')) || (stripos_clone($_SERVER["QUERY_STRING"],'QWRkQXV0aG9y')) || (stripos_clone($_SERVER["QUERY_STRING"],'UpdateAuthor')) || (preg_match("/\?admin/", "$checkurl")) || (preg_match("/\&admin/", "$checkurl"))) {
die("Illegal Operation");
}
#
#-----[ COMMENT OUT ]------------------------------------------
#
//$checkurl = $_SERVER['REQUEST_URI'];
//if((stripos_clone($_SERVER["QUERY_STRING"],'AddAuthor')) || (stripos_clone($_SERVER["QUERY_STRING"],'VXBkYXRlQXV0aG9y')) || (stripos_clone($_SERVER["QUERY_STRING"],'QWRkQXV0aG9y')) || (stripos_clone($_SERVER["QUERY_STRING"],'UpdateAuthor')) || (preg_match("/\?admin/", "$checkurl")) || (preg_match("/\&admin/", "$checkurl"))) {
//die("Illegal Operation");
//}
|
My index.php (inside Your Account Module)
Code:<?php
/*********************************************************************************/
/* CNB Your Account: An Advanced User Management System for phpnuke */
/* ============================================ */
/* */
/* Copyright (c) 2004 by Comunidade PHP Nuke Brasil */
/* http://dev.phpnuke.org.br & http://www.phpnuke.org.br */
/* */
/* Contact author: escudero@phpnuke.org.br */
/* International Support Forum: http://ravenphpscripts.com/forum76.html */
/* */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License. */
/* */
/*********************************************************************************/
/* CNB Your Account it the official successor of NSN Your Account by Bob Marion */
/*********************************************************************************/
if (!eregi("modules.php", $_SERVER['SCRIPT_NAME'])) {
die ("You can't access this file directly...");
}
/**********************************/
/* Configuration */
/* */
/* You can change this: */
/* $index = 0; (right side off) */
/**********************************/
//$index = 1;
define('INDEX_FILE', true);
/**********************************/
$module_name = basename(dirname(__FILE__));
require_once("modules/Your_Account/includes/constants.php");
if (!defined('CNBYA')) { echo "CNBYA protection"; exit; }
require_once("mainfile.php");
include_once("modules/$module_name/includes/functions.php");
// menelaos: removed because it is already called in /modules/Your_Account/includes/mainfileend.php
$ya_config = ya_get_configs();
get_lang($module_name);
$userpage = 1;
//$index = 1;
include("modules/$module_name/navbar.php");
include("modules/$module_name/includes/cookiecheck.php");
cookiedecode($user);
switch($op) {
case "activate":
include("modules/$module_name/public/activate.php");
break;
case "avatarlist":
if (is_user($user)) {
include("modules/$module_name/public/avatarlist.php");
} else {
notuser();
}
break;
case "avatarsave":
if (is_user($user)) {
include("modules/$module_name/public/avatarsave.php");
} else {
notuser();
}
break;
case "avatarlinksave":
if (is_user($user)) {
include("modules/$module_name/public/avatarlinksave.php");
} else {
notuser();
}
break;
case "broadcast":
if ($broadcast_msg == 1) {
include("modules/$module_name/public/broadcast.php");
} else {
disabled();
}
break;
case "delete":
if ($ya_config['allowuserdelete'] == 1) {
include("modules/$module_name/public/delete.php");
} else {
disabled();
}
break;
case "deleteconfirm":
if ($ya_config['allowuserdelete'] == 1) {
include("modules/$module_name/public/deleteconfirm.php");
} else {
disabled();
}
break;
case "editcomm":
include("modules/$module_name/public/editcomm.php");
break;
case "edithome":
include("modules/$module_name/public/edithome.php");
break;
case "edittheme":
break;
case "changemail":
include("modules/$module_name/public/changemail.php");
changemail();
break;
case "chgtheme":
if ($ya_config['allowusertheme']==0) {
include("modules/$module_name/public/chngtheme.php");
} else {
disabled();
}
break;
case "edituser":
include("modules/$module_name/public/edituser.php");
break;
case "gfxadminimage":
// menelaos: dynamically insert the version number in the admin config panel image Copyright (c) 2004 :-)
$icon = "images/admin/users.png";
$image = ImageCreateFromPNG($icon);
$text_color = ImageColorAllocate($image, 0, 0, 0);
Header("Content-type: image/png");
ImageString ($image, 1, 7, 38, $cnbyaversion, $text_color);
ImagePNG($image, '', 75);
ImageDestroy($image);
break;
case "gfx":
// Begin Copyright (c) 2004 by NukeScripts Network
$datekey = date("F j");
$rcode = hexdec(md5($_SERVER[HTTP_USER_AGENT] . $sitekey . $random_num . $datekey));
$code = substr($rcode, 2, $ya_config['codesize']);
$ThemeSel = get_theme();
if (file_exists("themes/$ThemeSel/images/code_bg.png")) {
$codeimg = "themes/$ThemeSel/images/code_bg.png";
include("themes/$ThemeSel/theme.php");
$tcolor = str_replace("#", "", $textcolor1);
$tc_r = hexdec(substr($tcolor, 0, 2));
$tc_g = hexdec(substr($tcolor, 2, 2));
$tc_b = hexdec(substr($tcolor, 4, 2));
} else {
$codeimg = "images/code_bg.png";
$tc_r = $tc_g = $tc_b = 0;
}
$image = ImageCreateFromPNG($codeimg);
$text_color = ImageColorAllocate($image, $tc_r, $tc_g, $tc_b);
Header("Content-type: image/png");
ImageString ($image, 5, 5, 2, $code, $text_color);
ImagePNG($image, '', 75);
ImageDestroy($image);
die();
// End Copyright (c) 2004 by NukeScripts Network
break;
case "login":
$result = $db->sql_query("SELECT * FROM ".$user_prefix."_users WHERE username='$username'");
$setinfo = $db->sql_fetchrow($result);
// menelaos: check of the member agreed with the TOS and update the database field
if (($ya_config['tos'] == intval(1)) AND ($_POST['tos_yes'] == intval(1))) {
$db->sql_query("UPDATE ".$user_prefix."_users SET agreedtos='1' WHERE username='$username'");
}
$forward = ereg_replace("redirect=", "", "$redirect");
if (ereg("privmsg", $forward)) { $pm_login = "active"; }
if ($db->sql_numrows($result) == 0) {
include("header.php");
Show_CNBYA_menu();
OpenTable();
echo "<center><font class='title'>"._SORRYNOUSERINFO."</font></center>\n";
CloseTable();
include("footer.php");
} elseif ($db->sql_numrows($result) == 1 AND $setinfo['user_id'] != 1 AND $setinfo['user_password'] != "" AND $setinfo['user_active'] >0 AND $setinfo['user_level'] >0) {
$dbpass = $setinfo[user_password];
$non_crypt_pass = $user_password;
$old_crypt_pass = crypt($user_password,substr($dbpass,0,2));
$new_pass = md5($user_password);
if (($dbpass == $non_crypt_pass) OR ($dbpass == $old_crypt_pass)) {
$db->sql_query("UPDATE ".$user_prefix."_users SET user_password='$new_pass' WHERE username='$username'");
$result = $db->sql_query("SELECT user_password FROM ".$user_prefix."_users WHERE username='$username'");
list($dbpass) = $db->sql_fetchrow($result);
}
if ($dbpass != $new_pass) {
Header("Location: modules.php?name=$module_name&stop=1");
return;
}
$datekey = date("F j");
$rcode = hexdec(md5($_SERVER['HTTP_USER_AGENT'] . $sitekey . $random_num . $datekey));
$code = substr($rcode, 2, $ya_config['codesize']);
if (extension_loaded("gd") AND $code != $gfx_check AND ($ya_config['usegfxcheck'] == 2 OR $ya_config['usegfxcheck'] == 3)) {
Header("Location: modules.php?name=$module_name&stop=1");
die();
} else {
// menelaos: show a member the current TOS if he has not agreed yet
if (($ya_config['tos'] == intval(1)) AND ($ya_config['tosall'] == intval(1)) AND ($setinfo[agreedtos] != intval(1))) {
if($_POST['tos_yes'] != intval(1)) {
include("modules/$module_name/public/ya_tos.php");
exit;
}
}
// menelaos: show a member the current TOS if he has not agreed yet
yacookie($setinfo[user_id], $setinfo[username], $new_pass, $setinfo[storynum], $setinfo[umode], $setinfo[uorder], $setinfo[thold], $setinfo[noscore], $setinfo[ublockon], $setinfo[theme], $setinfo[commentmax]);
$uname = $_SERVER["REMOTE_ADDR"];
$db->sql_query("DELETE FROM ".$prefix."_session WHERE uname='$uname' AND guest='1'");
if ($Version_Num >= 7.4) $db->sql_query("UPDATE ".$prefix."_users SET last_ip='$uname' WHERE username='$username'");
}
// menelaos: the cookiecheck is run here
if ($ya_config['cookiecheck']==1) {
$cookiecheck = yacookiecheckresults();
}
if ($pm_login != "") {
Header("Location: modules.php?name=Private_Messages&file=index&folder=inbox");
} else if ($redirect == "" ) {
Header("Location: modules.php?name=Your_Account&op=userinfo&bypass=1&username=$username");
} else if ($mode == "") {
Header("Location: forums.html?file=$forward");
} else if ($t !="") {
Header("Location: forums.html?file=$forward&mode=$mode&t=$t");
} else {
Header("Location: forums.html?file=$forward&mode=$mode&f=$f");
}
} elseif ($db->sql_numrows($result) == 1 AND ($setinfo['user_level'] < 1 OR $setinfo['user_active'] < 1)) {
include("header.php");
Show_CNBYA_menu();
OpenTable();
if ($setinfo['user_level'] == 0) {
echo "<br><center><font class=\"title\"><b>"._ACCSUSPENDED."</b></font></center><br>\n";
} elseif ($setinfo['user_level'] == -1) {
echo "<br><center><font class=\"title\"><b>"._ACCDELETED."</b></font></center><br>\n";
} else {
echo "<br><center><font class=\"title\"><b>"._SORRYNOUSERINFO."</b></font></center><br>\n";
}
CloseTable();
include("footer.php");
} else {
Header("Location: modules.php?name=$module_name&stop=1");
}
break;
case "logout":
cookiedecode($user);
$r_uid = $cookie[0];
$r_username = $cookie[1];
setcookie("user");
if (trim($ya_config[cookiepath]) != '') setcookie("user","expired",time()-604800,"$ya_config[cookiepath]"); //correct the problem of path change
$db->sql_query("DELETE FROM ".$prefix."_session WHERE uname='$r_username'");
$db->sql_query("OPTIMIZE TABLE ".$prefix."_session");
//$db->sql_query("DELETE FROM ".$prefix."_bbsessions WHERE session_user_id='$r_uid'");
//$db->sql_query("OPTIMIZE TABLE ".$prefix."_bbsessions");
$user = "";
include("header.php");
if ($redirect != "") {
echo "<META HTTP-EQUIV=\"refresh\" content=\"2;URL=modules.php?name=$redirect\">";
} else {
echo "<META HTTP-EQUIV=\"refresh\" content=\"2;URL=index.php\">";
}
title(_YOUARELOGGEDOUT);
include("footer.php");
break;
case "mailpasswd":
include("modules/$module_name/public/mailpass.php");
break;
case "my_headlines":
include("modules/$module_name/public/headlines.php");
break;
case "new_user":
if (is_user($user)) {
mmain($user);
} else {
if ($ya_config['allowuserreg']==0) {
if ($ya_config['coppa'] == intval(1)) {
if($_POST['coppa_yes']!= intval(1)) {
include("modules/$module_name/public/ya_coppa.php");
exit;
}
}
if ($ya_config['tos'] == intval(1)) {
if($_POST['tos_yes'] != intval(1)) {
include("modules/$module_name/public/ya_tos.php");
exit;
}
}
if ($ya_config['coppa'] !== intval(1) OR $ya_config['coppa'] == intval(1) AND $_POST['coppa_yes'] = intval(1)){
if ($ya_config['tos'] !== intval(1) OR $ya_config['tos'] == intval(1) AND $_POST['tos_yes']=intval(1)){
if ($ya_config['requireadmin'] == 1) {
include("modules/$module_name/public/new_user1.php");
} elseif ($ya_config['requireadmin'] == 0 AND $ya_config['useactivate'] == 0) {
include("modules/$module_name/public/new_user2.php");
} elseif ($ya_config['requireadmin'] == 0 AND $ya_config['useactivate'] == 1) {
include("modules/$module_name/public/new_user3.php");
}
}
}
}else {
disabled();
}
}
break;
case "new_confirm":
if (is_user($user)) {
mmain($user);
} else {
if ($ya_config['allowuserreg']==0) {
if ($ya_config['requireadmin'] == 1) {
include("modules/$module_name/public/new_confirm1.php");
} elseif ($ya_config['requireadmin'] == 0 AND $ya_config['useactivate'] == 0) {
include("modules/$module_name/public/new_confirm2.php");
} elseif ($ya_config['requireadmin'] == 0 AND $ya_config['useactivate'] == 1) {
include("modules/$module_name/public/new_confirm3.php");
}
} else {
disabled();
}
}
break;
case "new_finish":
if (is_user($user)) {
mmain($user);
} else {
if ($ya_config['allowuserreg']==0) {
if ($ya_config['requireadmin'] == 1) {
include("modules/$module_name/public/new_finish1.php");
} elseif ($ya_config['requireadmin'] == 0 AND $ya_config['useactivate'] == 0) {
include("modules/$module_name/public/new_finish2.php");
} elseif ($ya_config['requireadmin'] == 0 AND $ya_config['useactivate'] == 1) {
include("modules/$module_name/public/new_finish3.php");
}
} else {
disabled();
}
}
break;
case "pass_lost":
include("modules/$module_name/public/passlost.php");
break;
case "saveactivate":
include("modules/$module_name/public/saveactivate.php");
break;
case "savecomm":
if (is_user($user)) {
include("modules/$module_name/public/savecomm.php");
} else {
notuser();
}
break;
case "savehome":
if (is_user($user)) {
include("modules/$module_name/public/savehome.php");
} else {
notuser();
}
break;
case "savetheme":
if (is_user($user)) {
if ($ya_config['allowusertheme']==0) {
include("modules/$module_name/public/savetheme.php");
} else {
disabled();
}
} else {
notuser();
}
break;
case "saveuser":
if (is_user($user)) {
include("modules/$module_name/public/saveuser.php");
} else {
notuser();
}
break;
case "userinfo":
include("modules/$module_name/public/userinfo.php");
break;
case "ShowCookiesRedirect":
ShowCookiesRedirect();
break;
case "ShowCookies":
ShowCookies();
break;
case "DeleteCookies":
DeleteCookies();
break;
default:
mmain($user);
break;
}
?>
|
Edit index.php instruction (index7.6)
Code:/************************************************************************/
/* This file is for instructional use. */
/* By: NukeScripts Network (webmaster@nukescripts.net) */
/* http://www.nukescripts.net */
/* Modifications Copyright © 2000-2008 by NukeScripts Network */
/************************************************************************/
/* Based on Patched 3.3 Your_Account/index.php your */
/* Your_Account/index.php may differ from the examples found here. */
/************************************************************************/
#
#-----[ OPEN ]------------------------------------------
#
index.php
in function mail_password($username, $code) {
#
#-----[ FIND ]------------------------------------------
#
global $sitename, $adminmail, $nukeurl, $user_prefix, $db, $module_name;
#
#-----[ ADD TO IT ]------------------------------------------
#
$nsnst_const,
Now it will look something like:
global $nsnst_const, $sitename, $adminmail, $nukeurl, $user_prefix, $db, $module_name;
#
#-----[ FIND ]------------------------------------------
# This appears twice in this function
$host_name = $_SERVER['REMOTE_ADDR'];
#
#-----[ REPLACE WITH ]------------------------------------------
#
if(!defined("NUKESENTINEL_IS_LOADED")) {
$host_name = $_SERVER['REMOTE_ADDR'];
} else {
$host_name = $nsnst_const['remote_ip'];
}
in function login($username, $user_password, $redirect, $mode, $f, $t, $random_num, $gfx_check) {
#
#-----[ FIND ]------------------------------------------
#
global $setinfo, $user_prefix, $db, $module_name, $pm_login, $prefix;
#
#-----[ ADD TO IT ]------------------------------------------
#
$nsnst_const,
Now it will look something like:
global $nsnst_const, $setinfo, $user_prefix, $db, $module_name, $pm_login, $prefix;
#
#-----[ FIND ]------------------------------------------
#
$uname = $_SERVER['REMOTE_ADDR'];
#
#-----[ REPLACE WITH ]------------------------------------------
#
if(!defined("NUKESENTINEL_IS_LOADED")) {
$uname = $_SERVER['REMOTE_ADDR'];
} else {
$uname = $nsnst_const['remote_ip'];
}
in function userinfo($username, $bypass=0, $hid=0, $url=0) {
# Submitted by technocrat
#-----[ FIND ]------------------------------------------
#
echo "[ <a href='".$admin_file.".php?op=ipban&ip=".$userinfo['last_ip']."'>"._BANTHIS."</a> | <a href=\"".$admin_file.".php?op=modifyUser&chng_uid=".$userinfo['username']."\">"._EDITUSER."</a> ]</center>";
#
#-----[ REPLACE WITH ]------------------------------------------
#
echo "[ <a href='".$admin_file.".php?op=ABBlockedIPAdd&tip=".$userinfo['last_ip']."'>"._BANTHIS."</a> | <a href=\"".$admin_file.".php?op=modifyUser&chng_uid=".$userinfo['username']."\">"._EDITUSER."</a> ]</center>";
|
|
|
|