User Website Mod - Request!!

All web design discussion, including Ultimate Quiz MOD support.

Moderator: CricketMX Forum Moderators

Post Reply
User avatar
moomoo
Greenhorn
Greenhorn
Posts: 3
Joined: Tue Sep 27, 2005 8:29 pm

(as posted on phpbb.com)

on the topic of mod_rewrite:

thought about allowing urls such as:

website.php?id=username

so a user such as 'admin' would have the url:

website.php?id=admin

i allready use mod_rewrite to change profile urls and blog urls to something nicer, i sadly am a novice to php or i would of coded it myself.

for those of you interested in the .htaccess codes for the blog mod and profiles:

blog:
Quote:

RewriteRule (.+) weblog.php?u=$1 [L]


profile:
Quote:

RewriteRule (.+) profile.php?mode=viewprofile&u=$1 [L]

(i have used this inside 2 seperate .htaccess files -create a file called htaccess.txt upload them to your linux server, i have place example 1 (blog) into a folder called 'weblogs' (outside of phpbb) and example 2 (profile) into a folder called 'users' (outside of phpbb) then once uploaded copy your profile.php to /users and your weblog.php to /weblogs, rename both htaccess.txt files to .htaccess, and make sure the phpbb root path points to your forum i.e : "../phpbb")

the reason why this would be cool is i have both my profile.php and weblog.php outside my forum root.

this means to see a users profile you would go to:
http://mysite.com/users/username

and to see a users blog you would go to:
http://mysite.com/weblogs/username

only leaves websites and then i think my site would be complete!!

-i really could do with this modification as the user website component is what i am after for my website (website for up and coming artists and musicians) the ability to use mod_rewrite on alot of phpbb mods has made my site more personalised for potential users - hope you can help or give pointers - and thankyou for your great mod idea!!!
User avatar
battye
Site Admin
Site Admin
Posts: 14391
Joined: Sun Jan 11, 2004 8:26 am
Location: Australia
Contact:

Hi, welcome to the forum, and thanks for posting the info.

I don't know anything about mod_rewrite, so I'm afraid I won't be able to help you with this one :(

A forum that should be able to give you the answers, in my mind is Sitepoint.

If you do find the answer, please post back here, as I am very interested in the answer too.

Thanks :)
CricketMX.com in 2022: Still the home of bat's, rat's and other farmyard animals!

"OK, life [as you chose to define it] repeats until there are no more lessons to be learned." - nrnoble (June 12, 2005)
"the new forum looks awesome, it's getting bigger & better" - p2p-sharing-rules (11 Jan, 2008)
"Looks like CMX is not only getting bigger...but, also getting better!!" - moongirl (14 Dec, 2007)
User avatar
moomoo
Greenhorn
Greenhorn
Posts: 3
Joined: Tue Sep 27, 2005 8:29 pm

im due to do some courses in php, and this looks to be something that could proove quite useful to others as well as my needs...

im really starting from the bottom up here so looking at the code in question id like some pointers on removing several possible problem areas...

$id

this seems to be the definition used in calling pages, as it is used alot, perhaps it would be a good idea to remove the hits counter from the code, could you give me some help on this?

this means i only have to deal with it for necessary bits of code, the hits counter in my oppinion might hinder my work.

functions_website.php

im looking at this code and as im very new to php, im pretty certain it isnt used in regards to calling pages from the database more for determining factors, displaying links, determining group permissions, displaying template info etc...

if you could give me some rundown on it i can (slowly) work out my plan of action.

i have seen a fix for the guestbook mod for profiles that may be useful, this too didnt originally handle urls the way i wanted them (although the mod doesnt work with my version), im deturmined to get this done so i will post code and results here.

hope you can give me some pointers, did you work with others on this mod?
User avatar
moomoo
Greenhorn
Greenhorn
Posts: 3
Joined: Tue Sep 27, 2005 8:29 pm

ignore the bit about hits, did it in all of 30 secs, i can be quite fearful of code at times..

if anyone doesnt want hits either, heres the code for it, ill edit this again to describe what table to drop (sorry batye im just working with the code as streamlined as possible so i dont go too far wrong)

new 'website.php'
<?php
/***************************************************************************
* website.php
* -------------------
* begin : Thursday, Jun 09, 2005
* copyright : (C) 2005 Battye @ CricketMX.com
* email : cricketmx@hotmail.com
*
* $Id: website.php, v1.000.0.00 2005/09/06 21:18:36 battye Exp $
*
*
***************************************************************************/

/***************************************************************************
*
* 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, or
* (at your option) any later version.
*
***************************************************************************/

define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . '../45666$$$Rrwew/*****$3.'.$phpEx);
include($phpbb_root_path . '/includes/constants.'.$phpEx);
include($phpbb_root_path . '/includes/functions_website.'.$phpEx);
include($phpbb_root_path . 'includes/bbcode.'.$phpEx);

//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//

/* // For testing purposes
$lang['No_website'] = 'No website has been configured at this address!';
$lang['No_website_chosen'] = 'No website has been entered';
$lang['MOD_provided_website'] = 'User Website MOD &copy; <a href=http://www.cricketmx.com>battye</a> 2005';
$lang['Admin_website'] = 'Administer Website';
$lang['Admin_sitename'] = 'Select an appropriate name for your website:';
$lang['Admin_sitetext'] = 'Enter the HTML for your site here:<br /><span class="genmed">Or use site %stemplates%s!';
$lang['Admin_website_updated'] = 'Website updated successfully!<br />Click %shere%s to view your site!';
$lang['Admin_website_colour'] = 'Choose a background colour for your site:';
$lang['Admin_website_nav'] = 'Administer Website';
$lang['Admin_website_back'] = 'Click <a href="javascript: history.go(-1)">here</a> to go back and make changes, or Submit!';
$lang['Admin_website_view_template'] = 'View Templates';
$lang['Admin_wesbite_theme_name'] = 'Template Name';
$lang['Admin_wesbite_theme_desc'] = 'Template Description';
$lang['Admin_wesbite_theme_auth'] = 'Template Author';
$lang['Admin_wesbite_use_temp'] = 'Use Template';
$lang['Admin_wesbite_preview_theme'] = 'Preview Template';
$lang['Admin_css'] = 'Enter the CSS for your site here:';
$lang['Admin_user_banned'] = 'You have been banned from creating a website!<br />Please contact an administrator for further details!';
$lang['Admin_group_banned'] = 'This usergroup has been banned from creating a website!<br />Please contact an administrator for further details!';
$lang['Admin_user_low_post'] = 'You need to have at least %s posts to create a website!<br />Please contact an administrator for further details!';
$lang['Admin_mod_off'] = 'This feature has been disabled by an administrator.';
$lang['Admin_user_not_enabled'] = 'Users are not allowed to have websites!';

$lang['Admin_group_not_enabled'] = 'Usergroups are not allowed to have websites!'; */
// Gotta remember to put this in constants.php
/* // User Website MOD
define('WEB_YES', '1');
define('WEB_NO', '0');
*/
/*
$uwm_lang = array();
$uwm_lang['TABLE_HEADING'] = 'Table Heading';
$uwm_lang['SITE_DESCRIPTION'] = 'Enter a description of your site here';
$uwm_lang['LINK_DESCRIPTION'] = 'Enter a description of your link here';
$uwm_lang['CONTENT'] = 'Enter content here';
$uwm_lang['FONT_FACE'] = 'Verdana';
$uwm_lang['FONT_SIZE'] = '2'; */


// Ok let's begin outputting the site.. not just yet though.. haha tricked you :-)
if(isset($HTTP_GET_VARS['id']) || intval($HTTP_GET_VARS['group_id']) && $HTTP_GET_VARS['mode'] != "owner")
{
uwm_enabled();
user_or_group_enabled($HTTP_GET_VARS['group_id']);

if(intval($HTTP_GET_VARS['id']) || intval($HTTP_GET_VARS['group_id']))
{
$id = (intval($HTTP_GET_VARS['id'])) ? $HTTP_GET_VARS['id'] : $HTTP_GET_VARS['group_id'];

if(intval($HTTP_GET_VARS['id']))
{

$sql = "SELECT * FROM " . USERS_TABLE . " WHERE user_id = '" . $id . "'";
}

if(intval($HTTP_GET_VARS['group_id']))
{
// Are they a member?
if(user_group_member($userdata['user_id'], $HTTP_GET_VARS['group_id']) == 2)
{
message_die(CRITICAL_ERROR, 'Only group members can create and edit group websites');
}

$sql = "SELECT * FROM " . GROUPS_TABLE . " WHERE group_id = '" . $id . "'";
}


if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not grab information');
}

while($user_website = $db->sql_fetchrow($result))
{
if (!$user_website['user_website_html'])
{
message_die(GENERAL_ERROR, $lang['No_website']);
}

$user_website['user_website_title'] = str_replace($chars, $tags, $user_website['user_website_title']);
$user_css = (isset($user_website['user_website_css'])) ? "<style type=\"text/css\"><br /><!--<br />" . $user_website['user_website_css'] . "<br />--><br /></style>" : ""; // Originally by Excursus

$bad = array("<script", "<form", "<iframe", "<?php", "?>", "<html>", "<body>", "</html>", "</body>");
$good = array("<script", "<form", "<iframe", "<?php", "?>", "<html>", "<body>", "</html>", "</body");
// Changed to htmlspecialchars() and back again, damn error, how was *I* to know it wanted parameter 1 to be a string :rolls eyes:


$title_website = (str_replace("''", "'", $user_website['user_website_title'])) ? str_replace("''", "'", $user_website['user_website_title']) : "";
$user_html = str_replace("''", "'", str_replace($bad, $good, $user_website['user_website_html']));
$user_html = bbencode_second_pass($user_html, '');
$colour = $user_website['user_website_colour'];

$db->sql_close();
}

// Ok, do it...
echo '<html><body bgcolor="' . $colour . '">';
echo $user_css; // Originally by Excursus
echo "<title>$title_website</title>";
echo $user_html;
echo '</body></html>';
echo '<br />';
echo '<font face="Arial"><table width="100%"><tr><td align="center">';
echo $lang['MOD_provided_website'];
echo '<br />';
echo $board_config['website_footer'];
echo '<br />';
echo '</td></tr></table></font>';
}

else
{
message_die(GENERAL_ERROR, $lang['No_website_chosen']);
}
}


if($HTTP_GET_VARS['mode'] == "owner" && $userdata['session_logged_in'])
{
uwm_enabled();
user_or_group_enabled($HTTP_GET_VARS['group_id']);

if(intval($HTTP_GET_VARS['group_id']))
{
// Are they a member?
if(user_group_member($userdata['user_id'], $HTTP_GET_VARS['group_id']) == 2)
{
message_die(CRITICAL_ERROR, 'Only group members can create and edit group websites');
}

$sql = "SELECT * FROM " . GROUPS_TABLE . " WHERE group_id = " . intval($HTTP_GET_VARS['group_id']);
}

else
{
$sql = "SELECT * FROM " . USERS_TABLE . " WHERE user_id = " . $userdata['user_id'];
}

if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not grab information');
}

$gu_data = $db->sql_fetchrow($result);

if($HTTP_GET_VARS['view'] == "templates")
{
// From php.net: readdir
if(!(isset($HTTP_GET_VARS['filename'])))
{
if ($handle = opendir('./html_templates'))
{
include($phpbb_root_path . "includes/page_header.$phpEx");
$page_title = $lang['Admin_website_view_template'];
$template->set_filenames(array("admin_t" => "admin_view_site_template_body.tpl"));

/* This is the correct way to loop over the directory. */
while (false !== ($file = readdir($handle)))
{
if(get_site_template_html("description", $file) != '')
{
$file_link = "<a href='./website.$phpEx?mode=owner&view=templates&filename=$file'>$file</a>"; // Filename

$template->assign_block_vars('temp', array(
"U_LINK" => $file_link,
"U_DESC" => str_replace("Description: ", "", get_site_template_html("description", $file)),
"U_AUTHOR" => str_replace("Author: ", "", get_site_template_html("author", $file))));
}
}

$template->assign_vars(array(
"L_LINK_NAME" => $lang['Admin_wesbite_theme_name'],
"L_DESCRIPTION" => $lang['Admin_wesbite_theme_desc'],
"L_AUTHOR_NAME" => $lang['Admin_wesbite_theme_auth']));
$template->pparse("admin_t");
include($phpbb_root_path . "includes/page_tail.$phpEx");
}
}

if(isset($HTTP_GET_VARS['filename']))
{
include($phpbb_root_path . "includes/page_header.$phpEx");
$page_title = $lang['Admin_website_view_template'];
$template->set_filenames(array("admin_vt" => "admin_consider_template_body.tpl"));

$template->assign_vars(array(
"U_NAME" => $HTTP_GET_VARS['filename'],
"U_FULL_DESC" => str_replace("Description: ", "", get_site_template_html("description", $HTTP_GET_VARS['filename'])),
"U_AUTH_NAME" => str_replace("Author: ", "", get_site_template_html("author", $HTTP_GET_VARS['filename'])),
"U_CSS" => nl2br(htmlspecialchars("<style type=\"text/css\">" . get_site_template_html('css', $HTTP_GET_VARS['filename']) . "\n</style>")),
"U_HTML" => nl2br(htmlspecialchars(get_site_template_html("html", $HTTP_GET_VARS['filename']))),
"U_FORM" => append_sid("website.$phpEx?mode=owner"),
"U_FORM_P" => append_sid("website.$phpEx?mode=preview"),
"U_HIDDEN" => str_replace("<", "<", get_site_template_html("html", $HTTP_GET_VARS['filename'])),

"L_PRE_TEMP" => $lang['Admin_wesbite_preview_theme'],
"L_DESC" => $lang['Admin_wesbite_theme_desc'],
"L_USE_TEMP" => $lang['Admin_wesbite_use_temp'],
"L_AUTHOR" => $lang['Admin_wesbite_theme_auth']));

$template->pparse("admin_vt");
include($phpbb_root_path . "includes/page_tail.$phpEx");
}
}

else
{
if(isset($HTTP_POST_VARS['pre_temp']))
{
echo "<style type=\"text/css\"><br /><!--<br />" . get_site_template_html("css", $HTTP_POST_VARS['html']) . "<br />--><br /></style>";
echo get_site_template_html("html", $HTTP_POST_VARS['html']);
die();
}

if(isset($HTTP_POST_VARS['use_temp']))
{
$userdata_revised_text = get_site_template_html("html", $HTTP_POST_VARS['html']);
$userdata_revised_css = get_site_template_html("css", $HTTP_POST_VARS['html']);
}

else
{
$userdata_revised_text = stripslashes(str_replace("''", "'", $gu_data['user_website_html']));
$userdata_revised_css = stripslashes(str_replace("''", "'", $gu_data['user_website_css']));
}

check_web_ban("user", "");

if(isset($HTTP_GET_VARS['group_id']))
{
check_web_ban("group", $HTTP_GET_VARS['group_id']);
}

include($phpbb_root_path . "includes/page_header.$phpEx");
$page_title = $lang['Admin_website'];
$template->set_filenames(array("admin" => "admin_website_body.tpl"));
$template->assign_vars(array(
"L_ADMIN_WEBSITE" => $lang['Admin_website_nav'],
"L_SITENAME" => $lang['Admin_sitename'],
"L_SITETEXT" => sprintf($lang['Admin_sitetext'], "<a href='./website.$phpEx?mode=owner&view=templates'>", "</a>"),
"L_SITECOLOUR" => $lang['Admin_website_colour'],
"L_CSS" => $lang['Admin_css'],
"L_SUBMIT" => $lang['Submit'],
"L_PREVIEW" => $lang['Preview'],

"U_SITECOLOUR" => $gu_data['user_website_colour'],
"U_CSS" => $userdata_revised_css,
"U_SITENAME" => $gu_data['user_website_title'],
"U_SITETEXT" => $userdata_revised_text,

"GROUP" => (intval($HTTP_GET_VARS['group_id'])) ? $HTTP_GET_VARS['group_id'] : '',
"FORM" => append_sid("website.$phpEx?mode=sql")));

$template->pparse("admin");
include($phpbb_root_path . "includes/page_tail.$phpEx");
}
}

if($HTTP_GET_VARS['mode'] == "sql" && $userdata['session_logged_in'])
{
uwm_enabled();
user_or_group_enabled($HTTP_POST_VARS['group']);

if(!$HTTP_POST_VARS)
{
message_die(CRITICAL_ERROR, 'No $HTTP_POST_VARS found!');
}

if(isset($HTTP_POST_VARS['preview']))
{
$site_text = bbencode_first_pass(str_replace("\'", "''", $HTTP_POST_VARS['Sitetext']), '');
$site_text = str_replace($chars, $tags, $site_text);
$site_title = str_replace("\'", "''", $HTTP_POST_VARS['Sitename']);

$user_css = (isset($HTTP_POST_VARS['Sitecss'])) ? "<style type=\"text/css\"><br /><!--<br />" . $HTTP_POST_VARS['Sitecss'] . "<br />--><br /></style>" : ""; // Originally by Excursus

$bad = array("<script", "<form", "<iframe", "<?php", "?>", "<html>", "<body>", "</html>", "</body>");
$good = array("<script", "<form", "<iframe", "<?php", "?>", "<html>", "<body>", "</html>", "</body");

$title_website = (str_replace("''", "'", $site_title)) ? str_replace("''", "'", $site_title) : "";
$user_html = stripslashes(str_replace("''", "'", str_replace($bad, $good, $site_text)));
$user_html = bbencode_second_pass($user_html, '');
$colour = str_replace("'", "''", $HTTP_POST_VARS['Sitecolour']);
$db->sql_close();


echo '<html><body bgcolor="' . $colour . '">';
echo $user_css;
echo "<title>$title_website</title>";
echo $user_html;
echo '</body></html>';


echo '<br />';
echo '<font face="Arial"><table width="100%"><tr><td align="center">';
echo $lang['Admin_website_back'];
echo '</td></tr></table></font>';
}

if(isset($HTTP_POST_VARS['submit']))
{
$site_text = bbencode_first_pass(str_replace("\'", "''", $HTTP_POST_VARS['Sitetext']), '');
$site_title = str_replace("\'", "''", $HTTP_POST_VARS['Sitename']);
$site_css = str_replace("\'", "''", $HTTP_POST_VARS['Sitecss']);

if(intval($HTTP_POST_VARS['group']))
{
$sql = "UPDATE " . GROUPS_TABLE . " SET user_website_title = '$site_title', user_website_colour = '" . str_replace("'", "''", $HTTP_POST_VARS['Sitecolour']) . "', user_website_css = '$site_css', user_website_html = '$site_text' WHERE group_id = " . $HTTP_POST_VARS['group'];
}

else
{
$sql = "UPDATE " . USERS_TABLE . " SET user_website_title = '$site_title', user_website_colour = '" . str_replace("'", "''", $HTTP_POST_VARS['Sitecolour']) . "', user_website_css = '$site_css', user_website_html = '$site_text' WHERE user_id = " . $userdata['user_id'];
}

if(!$db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not update user website information');
}

else
{
if(intval($HTTP_POST_VARS['group']))
{
message_die(GENERAL_MESSAGE, sprintf($lang['Admin_website_updated'], "<a href='./website.$phpEx?group_id=" . intval($HTTP_POST_VARS['group']) . "'>", "</a>"));
}

else
{
message_die(GENERAL_MESSAGE, sprintf($lang['Admin_website_updated'], "<a href='./website.$phpEx?id=" . $userdata['user_id'] . "'>", "</a>"));
}
}
}
}
?>
admin_website.php
<?php
/***************************************************************************
* admin_website.php
* -------------------
* begin : Saturday, 25 June, 2005
* copyright : (C) 2005 Battye @ CricketMX.com
* email : cricketmx@hotmail.com
*
* $Id: admin_website.php, v1.000.0.00 2005/06/25 20:31:00 battye Exp $
*
*
***************************************************************************/

/***************************************************************************
*
* 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, or
* (at your option) any later version.
*
***************************************************************************/

define('IN_PHPBB', 1);

if( !empty($setmodules) )
{
$filename = basename(__FILE__);
$module['General']['Websites'] = $filename;
return;
}

//
// Load default header
//
$phpbb_root_path = "./../";
require($phpbb_root_path . 'extension.inc');
require('./pagestart.' . $phpEx);

/* $lang['Website_footer'] = 'Set A Footer';
$lang['Website_footer_explain'] = '<b>A short message that will be displayed at the bottom of all users websites</b>';
*/

if(!$HTTP_GET_VARS['mode'])
{

// Enabled or not?
$web_enabled_yes = ( $board_config['website_enabled'] == WEB_YES ) ? "checked=\"checked\"" : "";
$web_enabled_no = ( $board_config['website_enabled'] == WEB_NO ) ? "checked=\"checked\"" : "";

// Groups enabled or not?
$groups_enabled_yes = ( $board_config['website_group_enabled'] == WEB_YES ) ? "checked=\"checked\"" : "";
$groups_enabled_no = ( $board_config['website_group_enabled'] == WEB_NO ) ? "checked=\"checked\"" : "";

// Groups enabled or not?
$users_enabled_yes = ( $board_config['website_users_enabled'] == WEB_YES ) ? "checked=\"checked\"" : "";
$users_enabled_no = ( $board_config['website_users_enabled'] == WEB_NO ) ? "checked=\"checked\"" : "";

$template->set_filenames(array('website_admin' => 'admin/website_configuration_body.tpl'));
$template->assign_vars(array(
'U_MINIMUM_POSTS' => $board_config['website_minimum_posts'], // Groups of course have no post limit
'U_BANNED_USERS' => $board_config['website_banned_users'], // List of users that are banned, can be added to
'U_BANNED_GROUPS' => $board_config['website_banned_groups'], // Ditto, except for groups
'U_FOOTER' => $board_config['website_footer'],
'U_ENABLED_NO' => $web_enabled_no,
'U_ENABLED_YES' => $web_enabled_yes,
'U_ENABLED_NO' => $web_enabled_no,
'U_GROUPS_YES' => $groups_enabled_yes,
'U_GROUPS_NO' => $groups_enabled_no,
'U_USERS_YES' => $users_enabled_yes,
'U_USERS_NO' => $users_enabled_no,

'L_ENABLE' => $lang['Website_enable'],
'L_DISABLE' => $lang['Website_disable'],
'L_DESCRIPTION' => $lang['Website_description'],
'L_SETTING' => $lang['Website_setting'],

'L_MINIMUM_POSTS' => $lang['Website_min_posts'],
'L_MINIMUM_POSTS_EX' => $lang['Website_min_posts_explain'],
'L_BANNED_USERS' => $lang['Website_banned_users'],
'L_BANNED_USERS_EX' => $lang['Website_banned_users_explain'],
'L_BANNED_GROUPS' => $lang['Website_banned_groups'],
'L_BANNED_GROUPS_EX' => $lang['Website_banned_groups_explain'],
'L_FOOTER' => $lang['Website_footer'],
'L_FOOTER_EX' => $lang['Website_footer_explain'],
'L_MOD_ENABLED' => $lang['Website_mod_enabled'],
'L_MOD_ENABLED_EX' => $lang['Website_mod_enabled_explain'],
'L_GROUPS' => $lang['Website_groups_enabled'],
'L_GROUPS_EX' => $lang['Website_groups_enabled_explain'],
'L_USERS' => $lang['Website_users_enabled'],
'L_USERS_EX' => $lang['Website_users_enabled_explain'],

'F_ENABLE' => WEB_YES,
'F_DISABLE' => WEB_NO,
'F_SUBMIT' => $lang['Website_submit'],
'F_FORM' => append_sid("admin_website." . $phpEx . "?mode=sql")));

$template->pparse('website_admin');
}

else
{
$website_hit_enabled = $HTTP_POST_VARS['hit_enable'];
$website_mod_enabled = $HTTP_POST_VARS['mod_enable'];
$website_user_enabled = $HTTP_POST_VARS['user_enable'];
$website_group_enabled = $HTTP_POST_VARS['group_enable'];
$website_min_posts = str_replace("\'", "''", $HTTP_POST_VARS['minimum_posts']);
$website_banned_users = str_replace("\'", "''", $HTTP_POST_VARS['banned_users']);
$website_banned_groups = str_replace("\'", "''", $HTTP_POST_VARS['banned_groups']);
$website_footer = str_replace("\'", "''", $HTTP_POST_VARS['footer']);

$sql = array();
$sql[] = "UPDATE " . CONFIG_TABLE . " SET `config_value` = ' $website_group_enabled' WHERE `config_name` = 'website_group_enabled'";
$sql[] = "UPDATE " . CONFIG_TABLE . " SET `config_value` = '$website_mod_enabled' WHERE `config_name` = 'website_enabled'";
$sql[] = "UPDATE " . CONFIG_TABLE . " SET `config_value` = '$website_user_enabled' WHERE `config_name` = 'website_users_enabled'";
$sql[] = "UPDATE " . CONFIG_TABLE . " SET `config_value` = '$website_banned_groups' WHERE `config_name` = 'website_banned_groups'";
$sql[] = "UPDATE " . CONFIG_TABLE . " SET `config_value` = '$website_banned_users' WHERE `config_name` = 'website_banned_users'";
$sql[] = "UPDATE " . CONFIG_TABLE . " SET `config_value` = '$website_min_posts' WHERE `config_name` = 'website_minimum_posts'";
$sql[] = "UPDATE " . CONFIG_TABLE . " SET `config_value` = '$website_footer' WHERE `config_name` = 'website_footer'";


for( $i = 0; $i < count($sql); $i++ )
{
if( !$result = $db->sql_query ($sql[$i]) )
{
message_die(GENERAL_ERROR, 'Could not update Configuration', '', __LINE__, __FILE__, $sql);
}
}
message_die(GENERAL_MESSAGE, $lang['Website_config_updated']);
}

//
// Generate the page
//
// Lang = done. Really

include('page_footer_admin.php');
?>

website_configuration_body.tpl
<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
<form action="{F_FORM}" method="post">
<tr>
<th colspan="1" width="100%" class="thTop" nowrap="nowrap">&nbsp;{L_DESCRIPTION}&nbsp;</th>
<th colspan="1" width="100%" class="thTop" nowrap="nowrap">&nbsp;{L_SETTING}&nbsp;</th>
</tr>

<tr>
<td class="row1" align="left" valign="middle" height="30"><span class="genmed">{L_GROUPS}</span><br /><span class="gensmall">{L_GROUPS_EX}</span></td>
<td class="row2" align="center" valign="middle" height="30"><span class="gensmall">
<input type="radio" name="group_enable" {U_GROUPS_YES} value="{F_ENABLE}"> {L_ENABLE}<br />
<input type="radio" name="group_enable" {U_GROUPS_NO} value="{F_DISABLE}"> {L_DISABLE}</span></td>
</tr>

<tr>
<td class="row1" align="left" valign="middle" height="30"><span class="genmed">{L_USERS}</span><br /><span class="gensmall">{L_USERS_EX}</span></td>
<td class="row2" align="center" valign="middle" height="30"><span class="gensmall">
<input type="radio" name="user_enable" {U_USERS_YES} value="{F_ENABLE}"> {L_ENABLE}<br />
<input type="radio" name="user_enable" {U_USERS_NO} value="{F_DISABLE}"> {L_DISABLE}</span></td>
</tr>

<tr>
<td class="row1" align="left" valign="middle" height="30"><span class="genmed">{L_MOD_ENABLED}</span><br /><span class="gensmall">{L_MOD_ENABLED_EX}</span></td>
<td class="row2" align="center" valign="middle" height="30"><span class="gensmall">
<input type="radio" name="mod_enable" {U_ENABLED_YES} value="{F_ENABLE}"> {L_ENABLE}<br />
<input type="radio" name="mod_enable" {U_ENABLED_NO} value="{F_DISABLE}"> {L_DISABLE}</span></td>
</tr>

<tr>
<td class="row1" align="left" valign="middle" height="30"><span class="genmed">{L_MINIMUM_POSTS}</span><br /><span class="gensmall">{L_MINIMUM_POSTS_EX}</span></td>
<td class="row2" align="center" valign="middle" height="30"><span class="gensmall"><input type="text" class="post" name="minimum_posts" size="4" maxlength="10" value="{U_MINIMUM_POSTS}" /></span></td>
</tr>

<tr>
<td class="row1" align="left" valign="middle" height="30"><span class="genmed">{L_FOOTER}</span><br /><span class="gensmall">{L_FOOTER_EX}</span></td>
<td class="row2" align="center" valign="middle" height="30"><span class="gensmall"><input type="text" class="post" name="footer" size="25" maxlength="1000" value="{U_FOOTER}" /></span></td>
</tr>


<tr>
<td class="row1" align="left" valign="middle" height="30"><span class="genmed">{L_BANNED_USERS}</span><br /><span class="gensmall">{L_BANNED_USERS_EX}</span></td>
<td class="row2" align="center" valign="middle" height="30"><span class="gensmall"><input type="text" class="post" name="banned_users" size="20" maxlength="1000" value="{U_BANNED_USERS}" /></span></td>
</tr>

<tr>
<td class="row1" align="left" valign="middle" height="30"><span class="genmed">{L_BANNED_GROUPS}</span><br /><span class="gensmall">{L_BANNED_GROUPS_EX}</span></td>
<td class="row2" align="center" valign="middle" height="30"><span class="gensmall"><input type="text" class="post" name="banned_groups" size="20" maxlength="1000" value="{U_BANNED_GROUPS}" /></span></td>
<tr>
<th class="catBottom" colspan="2" align="center" height="28"><input class="liteoption" type="submit" value="{F_SUBMIT}" /></form></th>
</tr>
</tr>
</form>
</table>
<br />
User avatar
battye
Site Admin
Site Admin
Posts: 14391
Joined: Sun Jan 11, 2004 8:26 am
Location: Australia
Contact:

Been a while since I've worked on this MOD, but I'm sure I put an option in the ACP for turning off hits, so you don't need to take out the code to disable it :wink:
CricketMX.com in 2022: Still the home of bat's, rat's and other farmyard animals!

"OK, life [as you chose to define it] repeats until there are no more lessons to be learned." - nrnoble (June 12, 2005)
"the new forum looks awesome, it's getting bigger & better" - p2p-sharing-rules (11 Jan, 2008)
"Looks like CMX is not only getting bigger...but, also getting better!!" - moongirl (14 Dec, 2007)
Post Reply