[Solved]Global_Ann_db_Update.php File...

Makes it posible to post Global announcements, viewble in all forums

Moderator: Moderators

Forum rules
The content in this forum is dated Dec. 21 2005 and can be used as Archive only. This Forum is LOCKED and READ ONLY !

[Solved]Global_Ann_db_Update.php File...

Postby Grimster on Wed 29. Dec, 2004 13:30

Season Greeting , Wish All A Happy Safe Holidays

And First Of All I like to thank Niels For This Mod

Yet Guy's I Have A Question Here About the DB Update File

#########################################################
## SQL commands to phpBB2
## Author: Niels Chr. Rّd
## Nickname: Niels Chr. Denmark
## Email: ncr@db9.dk
##
## Ver 1.0.7
##
## phpBB2 database update script for mods
## this file is intended to use with phpBB2, when installing mods
## after so you may delete this file, but only admin can use so it really doesen't matter
## The script will look what prefix you are using, and use the existing DB defined by congig.php
## The execution of this script's included SQL is harmless, so you can run it as meny times you like
## note, though that the users last visit, will be set back to his/her last login,
## but that is a minor cosmetic isue, that will correct it self next time the use logs in
##
## the following example are from my mods, and you can add some self, for other mods if you like
## you will after execution get a list over those commands that are run with succes and those with warnings !
## delete the sample lines if you are using it only for other mods
##
#########################################################

define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'includes/functions_selects.'.$phpEx);
define('SITE_HISTORY_TABLE', $table_prefix.'site_history');

###################################################################################################
##
## put the SQL commands below here, the SQL commands listed below are only exampels, substitude them with the one you need ##
##
###################################################################################################
$sql=array(
'ALTER TABLE '.FORUMS_TABLE.' ADD auth_globalannounce TINYINT (2) DEFAULT "3" NOT NULL AFTER auth_announce',
'ALTER TABLE '.AUTH_ACCESS_TABLE.' ADD auth_globalannounce TINYINT (1) not null AFTER auth_announce',
);

$mods = array (
'Global Announcement Mod','Global Announcement Mod'
);

############################################### Do not change anything below this line #######################################

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

if ($userdata['user_level']!=ADMIN)
message_die(GENERAL_ERROR, "You are not Authorised to do this");
$n=0;
$message="<b>This list is a result of the SQL queries needed for the additional mods in the pre-moded pack</b><br/><br/>";
while($sql[$n])
{
$message .= ($mods[$n-1] != $mods[$n]) ? '<p><b><font size=3>'.$mods[$n].'</font></b><br/>' : '';
if(!$result = $db->sql_query($sql[$n]))
$message .= '<b><font color=#FF0000>[Already added]</font></b> line: '.($n+1).' , '.$sql[$n].'<br />';
else $message .='<b><font color=#0000fF>[Added/Updated]</font></b> line: '.($n+1).' , '.$sql[$n].'<br />';
$n++;
}
message_die(GENERAL_MESSAGE, $message);
?>


And It Goes Like This Can Any One Please Explain To Me What Does The Red Highlighted Text means , I Kinda Got Lost There
And Didn't Quit Get What Niels Meant :( , I Mean What Lines Or Changes Need I Add To Add or Do To Niles SQL Code For Updating The DB for it to work on my MYSQL Version 4.0.22 , I'm Running A PHPBB 2.0.11

Please Advice ...

As You All Can See I'm Still A Newbie With PHP :oops: , So Please Bare With Me

Many Thanks In Advance

Grim


P.S: Is It Me Or The Site Browsing Is Really Slow !!
Last edited by Grimster on Sun 02. Jan, 2005 08:23, edited 1 time in total.
Grimster
Poster
Poster
 
Posts: 3
Joined: Wed 29. Dec, 2004 13:11

Postby Niels on Wed 29. Dec, 2004 14:15

I can understand your question...
the db_update.php file, is made as a general file, witch can be used to easyly execute any SQL command.

therefore I did include some text to explain where to modify, and where NOT to modify, if any one would like to make there own SQL (not only for my mods).
The file included into my mods, does not need to be changed (at least not if your db is mysql) - so simply pretent like the text is not there, and "execute" the file from your browser.
the sql are as ligitime as any other sql run by phpBB2 forum software, so don't be scared - its just minor changes it wil do.

in the case of global announcement mod, the file include 2 SQL commands witch will be executed, the commands will make it posible to control global post permission.

about the speed on this forum - you are right, its slow - this is due to the fact that I'm runing on a "mobile celron 300" witch only 192 Mb ram - this setup is not only used to run this forum, by does also a lot of other services - inlcuding my answering machine :lol: so bear with the speed, it may from time to time be a litle slow
(if a how-to is EM ready, it will mostly be bullet prof, since a machine is more picky than a human. :D)
User avatar
Niels
Poster
Poster
 
Posts: 4390
Joined: Sat 27. Jul, 2002 15:46

Postby Grimster on Wed 29. Dec, 2004 14:53

Aha Thanks Niels For The Fast Reply :D , And For The Info And Tips


But When I Tried To Run The DB Update From My Browser I Keep Getting
Error You Are Not Authurised , So I Did Change The DB_Update.php To
DB_Update.php.Txt And Tried To Run SQL query From The DB_Update.php.txt

I Get This Error

Code: Select all
There seems to be an error in your SQL query. The MySQL server error output below, if there is any, may also help you in diagnosing the problem

ERROR: Unknown Punctuation String @ 1
STR: <?
SQL: <?php
#########################################################
## SQL commands to phpBB2
## Author: Niels Chr. Rød
## Nickname: Niels Chr. Denmark
## Email: ncr@db9.dk
##
## Ver 1.0.7
##
## phpBB2 database update script for mods
## this file is intended to use with phpBB2, when installing mods
## after so you may delete this file, but only admin can use so it really doesen't matter
## The script will look what prefix you are using, and use the existing DB defined by congig.php
## The execution of this script's included SQL is harmless, so you can run it as meny times you like
## note, though that the users last visit, will be set back to his/her last login,
## but that is a minor cosmetic isue, that will correct it self next time the use  logs in
##
## the following example are from my mods, and you can add some self, for other mods if you like
## you will after execution get a list over those commands that are run with succes and those with warnings !
## delete the sample lines if you are using it only for other mods
##
#########################################################

define('IN_PHPBB', true)

SQL-query:

MySQL said: 

#1064 - You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near '<?php
########################################################


So What Seems To Be The Problem Please ...



And About The Server Woahaaaa 8O , No Wonder It's So Slow , I Thought That It's At My End , But Now I Know , Then Again Atleast Its Doing What It Supose To Do The Site Is Running :wink:


Thanks

Grim
Grimster
Poster
Poster
 
Posts: 3
Joined: Wed 29. Dec, 2004 13:11

Postby Niels on Wed 29. Dec, 2004 23:40

first of all, you can't just change the name of a php file, and expect it to be readeble by phpmyadmin. - you need to change it back.

the "not autorised" is showing becourse you need to be logged into your forum as administrator before the script will accept you as autorised to run the file - this is a security precausion, preventing other users from runing the file - if you should forget to delete it after you have run it.

so go to your forum, and login using a account with admin privileges - then execute the file from your browser.
the result will show 2 SQL commands, witch have been executed
(if a how-to is EM ready, it will mostly be bullet prof, since a machine is more picky than a human. :D)
User avatar
Niels
Poster
Poster
 
Posts: 4390
Joined: Sat 27. Jul, 2002 15:46

Postby Grimster on Sun 02. Jan, 2005 08:21

<<< Slaping Him Self Silly


Niels , Thank You So Much , It Works Just Great Now :D


P.S: You Can Delete This Post If You Like
Grimster
Poster
Poster
 
Posts: 3
Joined: Wed 29. Dec, 2004 13:11

Postby Niels on Sun 02. Jan, 2005 16:55

thanks for the feedback, you may delete the db_update.php file, as there is no use for it anymore.
btw. I never deltes topic, witch might help other users :wink: - this isenøt the first time this type of mistake was made :D
(if a how-to is EM ready, it will mostly be bullet prof, since a machine is more picky than a human. :D)
User avatar
Niels
Poster
Poster
 
Posts: 4390
Joined: Sat 27. Jul, 2002 15:46


Return to Global announcement [2.0.6/EM]

Who is online

Users browsing this forum: No registered users and 1 guest

cron