PHP Business!


I’ve been thinking about this PHP style switcher business, as well as what I’m going to do with BellaBook3.1 to get it safe and secure, ready for release.

I have been trying to figure out the best way to have this PHP styleswitcher without disturbing browsing. I *think* because it’s a server-side language it is going to require a little bit of fuss, but not necessarily with the fart-arsing “if you’re sure this is the skin you want” pages. My theory is I can set what stylesheet the person chooses via $_SERVER['PHP_SELF']?style=bla which keep the user on the same page, and then have an if statement in my header above everything else with if (isset($_GET['style']) { ..etc which stores the cookie. Theoretically. Or am I going about this the wrong way and ignoring a more simple option?

Also.. with BellaBook3.1 my problem at the moment is trying to come up with a totally secure admin panel. I mean, I know nothing I do is really going to be totally 100% secure but I’d like to set off in the right direction. I was thinking of having the login page set up to restrict access and then just include the various admin files when a user is authenticated — with an if statement in the top of each admin page telling the script to exit if it’s accessed directly instead of via the main login thingymajig.

My brain doesn’t work at this time of the morning. *grumble*

ETA: fixed weird comment timestamp thing. I was right: for some reason I was using gmdate() for entries and date() for comments. Oops.

ABE: (that’s “another bloody edit”, btw) I didn’t get that job. Karl had to ring up to find out this, because for some reason we didn’t get the letter that was supposedly posted to me.

8 comments so far

  1. Amelie said:
    On December 6, 2005 at 9:00 am

    I use ye old classic skinning script (with a couple of modifications). What I did is just to make the link ?skinlinkhere=newskinblahblah. That way the query string attaches itself to the current page, whatever that might be. Though having said that, when I changed it to have the whole “choose a skin” page I just set it to go back to the homepage because… well, that’s the most interesting part of my site and people should stay there. :P I hate the “YAY YOU CHANGED SKIN!!!1 LIKE IT???” type page (normally called index2.php for some annoying reason) so definitely don’t do that or I shall … um … not change skins? Ha.

  2. Amelie said:
    On December 6, 2005 at 9:27 am

    Pssst, just thought I’d let you know – I logged onto your site from uni where I’ve never visited before (I don’t think anyway) using Safari (I’m on a Mac ^_____^ ) and your stylesheet thingy works fine, no whiteness/unstyled content for me. At home (using Firefox/Win) I did get that at first. Did you fix the stylesheet switcher problem? Or is Safari just way more awesome for some reason? Also, when are you gonna fix your blog timestamp – the way it looks now, it seems I commented before you even posted the entry XD Sorry for the double comment post -_- I should really remember what I was going to say when making my first comments…

  3. Skybly said:
    On December 6, 2005 at 10:25 am

    I’m using the PHP switcher from A List Apart (with some minor modifications) and that sends the user back to the referring page after setting the cookie. I don’t think it would be an improvement over your method though – it doesn’t work exactly as intended for people using certain firewalls (blank referrers get sent to my skin selection page), and the overhead saving seems minimal. But it’s an option :)

  4. Rosemarie said:
    On December 6, 2005 at 10:27 am

    lalala. It seems to me that some of the older theme switchers didn’t disturb browsing time. Y’know, before this newfangled idea came along about having people switch on a designated page or something. and I agree with Amelie’s method. yay!

  5. Stephanie said:
    On December 6, 2005 at 10:41 am

    Amelie – I Jem fixed it ’cause when I pulled the site up on my Mac last night, I received a page of unstyled content. And it can’t be because I have an old browser because I just got the computer like… three weeks ago?

  6. Jem said:
    On December 6, 2005 at 10:48 am

    I’ve not done anything to the styleswitcher so I’ve no idea. It seems completely bloody random! Oh, and thanks for mentioning the timestamp thing Amelie – I’d not even noticed, heh. Probably because the post entry thing uses gmdate() and the comments might still use date() ..perhaps. *goes looking*

  7. Sarah said:
    On December 6, 2005 at 5:55 pm

    Wow, that all sounds/looks quite confusing. I’m from near Ironbridge, though my boyfriend lives the other side of Cannock, so that’s why I am the weekends lol.

  8. Manon said:
    On December 7, 2005 at 2:54 am

    just wanted to say HEY! sorry about the job, and as far as the rest of your post… was that English?? j/k.