Topic: MYSQL Read-Only possible??

Subject says it all really lol

Is it possible?

Re: MYSQL Read-Only possible??

Sure, make a user account that doesn't have INSERT, UPDATE or DELETE privileges.

Re: MYSQL Read-Only possible??

Ahh.... I didnt think of that. So I could just do account for insert and update...

then going on to my other subject. Would this mean admin could not delete anything. smile

Re: MYSQL Read-Only possible??

StevenBullen wrote:

then going on to my other subject. Would this mean admin could not delete anything. smile

Yes, including users and search indexes =P I'm not sure if PunBB works on a MySQL account without delete. It might.

5 (edited by StevenBullen 2006-08-28 14:00)

Re: MYSQL Read-Only possible??

Rickard could you possibly confirm this?

EDIT: I will be testing it this evening anyway, so no rush to answer.

6 (edited by Smartys 2006-08-28 14:04)

Re: MYSQL Read-Only possible??

PunBB can't work without update/delete.

Re: MYSQL Read-Only possible??

Smartys wrote:

PunBB can't work without update/delete.

Argh... Why wont it work without delete?

Re: MYSQL Read-Only possible??

DELETE is needed. First error popped up here:

An error was encountered
Error: Unable to delete from online list.

Re: MYSQL Read-Only possible??

I would of thought that was the only one. So I could easily remove the online offline process (I think I could anyway).

Re: MYSQL Read-Only possible??

Myeah, well, I'm not going to try removing all deletes now tongue
Have fun with it ^^

Re: MYSQL Read-Only possible??

Will report back on results. big_smile

12 (edited by Smartys 2006-08-28 14:19)

Re: MYSQL Read-Only possible??

You won't have online status (at least not accurate online status), delete.php won't work, etc
Not being able to delete != read only.
You want a read only PunBB? That's possible (but it would kind of involve ripping out a lot of features and having it just as an archive)

Re: MYSQL Read-Only possible??

The reason I need this... is because I have created something simliar to (opensourcecms) but instead of forums and stuff its punbb mods.

It basically shows you live demos of all the mods currently about that can run on 1.2.12.
also...
If the mod is to basic for a live demo then you have a before and after image.

Now all was fine until I started thinking... quite a few mods have plugins so admin access will have to be essential to get understanding of both sides of the mod.
Which brings me to here and now.... and finding a cure to protect my stuff.

DB is reset every single hour on the hour so in theory I could just leave everything as it is..... spammers wont get anywhere because the DB will just keep resetting.

Re: MYSQL Read-Only possible??

I'd say have it reset every hour and leave it at that. Because otherwise some mods (ones that need delete access) won't work.

Re: MYSQL Read-Only possible??

Smartys wrote:

I'd say have it reset every hour and leave it at that. Because otherwise some mods (ones that need delete access) won't work.

Yeah, that's the best option.


I wonder how you're going to have it all fit in tho, as many mods modify the same query etc.

Re: MYSQL Read-Only possible??

elbekko wrote:

I wonder how you're going to have it all fit in tho, as many mods modify the same query etc.

Its not on one installation its covered over a few.

Smartys wrote:

I'd say have it reset every hour and leave it at that. Because otherwise some mods (ones that need delete access) won't work.

Yeah I am going to go with this one.
But also I am going to put a reset button that resets the database instantly, incase any problems with people deleteing stuff. Will put a time limit on DB reset so cant be done every second as such.

17

Re: MYSQL Read-Only possible??

I explored this a while back when I was helping out as an admin on OSCMS, I thought of doing the same thing so that the demos wouldn't have to be refreshed every couple of hours.

I never found a solution but it would indeed open up some great possibilities for the demoing of web apps.

18

Re: MYSQL Read-Only possible??

Erm.. is ist not possible to change the db functions?

What you want is that if this function is called

$db->query('UPDATE....

then nothing should happen, right?

So, if you change your dblayer file (may be mysql.php or mysqli.php) you could do somethng similar to

       if(preg_match("/(UPDATE|DELETE|INSERT)/i",$sql) and preg_match("/admin/",$_SERVER['REQUEST_URI']))  return 1;

so that it looks like

    function query($sql, $unbuffered = false)
    {
      // CHANGED HERE.
       if(preg_match("/(UPDATE|DELETE|INSERT)/i",$sql) and preg_match("/admin/",$_SERVER['REQUEST_URI']))  return 1;
        if (defined('PUN_SHOW_QUERIES'))
            $q_start = get_microtime();

        $this->query_result = @mysqli_query($this->link_id, $sql);

You would then have a positive return value without anything happening to the database. but only if th URL contains "admin"
Or so I think, haven't tested. Maybe it's worth a try?

The German PunBB Site:
PunBB-forum.de

19 (edited by Smartys 2006-08-29 12:52)

Re: MYSQL Read-Only possible??

But then a lot of mods won't actually work
The trick (I think) is to "break" some functionality (change password, change username, registering, changing group, etc) in such a way that the user can't mess with it.
The only important thing is not to demo things like the DB plugin (or at least to not allow restores and to stop anything that isn't a select from being executed in the query box)

20

Re: MYSQL Read-Only possible??

I thought that was the idea of it:
Show the admin interface but disable actual changes.

The German PunBB Site:
PunBB-forum.de

Re: MYSQL Read-Only possible??

He said live demos, I assumed that meant showing the functionality, not just how it looks tongue

Re: MYSQL Read-Only possible??

Smartys wrote:

He said live demos, I assumed that meant showing the functionality, not just how it looks tongue

This is correct... All demos have live functionality.
I thought it would be a good idea as PunBB has many mods but its sometimes hard to understand the end result. A live demo was my answer.

I will cheat and just use the DB reset idea. smile