Page 1 of 4 1234 LastLast
Results 1 to 16 of 63

Thread: A very simple CMS for a website

  1. #1
    Senior Member Kezzer's Avatar
    Join Date
    Sep 2003
    Posts
    4,863
    Thanks
    12
    Thanked
    5 times in 5 posts

    A very simple CMS for a website

    Basically i'm doing a band website and as many of you know I seem to have the inability to program competently in PHP with MySQL. All this CMS will do is have the ability to add / edit / delete news posts and gig dates. I want to expand it in the future so all pages are editable throughout the whole site.

    Now, there will be 4 band members using it only to update, instead of faffing around with a table in a database to retrieve the usernames and passwords is it ok to simply store the usernames and passwords in a file on the webserver and just compare values that way?

    This thread will get lengthy as i'll be asking questions over the next few days

    Cheers all

  2. #2
    HEXUS.net Webmaster
    Join Date
    Jul 2003
    Location
    UK
    Posts
    3,108
    Thanks
    1
    Thanked
    0 times in 0 posts
    No, as soon as someone guesses the URL of the text file you're screwed, even if you encrypt it they'll get hold of it sooner or later, especially since you've just announced your intention

  3. #3
    HEXUS.social member Agent's Avatar
    Join Date
    Jul 2003
    Location
    Internet
    Posts
    19,185
    Thanks
    739
    Thanked
    1,614 times in 1,050 posts
    You could do it that way, but its just more work than doing it from the DB itself.
    If your going to be using a DB, use it fully.

    Adding / editing / ect. users to the CMS would not be very different from inserting an article. You have the basic fields, which you just pull out when somone log's in and compare the values.
    Remember to use hashing too, MD5 will be the one you want.
    Quote Originally Posted by Saracen View Post
    And by trying to force me to like small pants, they've alienated me.

  4. #4
    Gaarrrrr! Dav0s's Avatar
    Join Date
    Aug 2005
    Location
    Bristol
    Posts
    1,442
    Thanks
    1
    Thanked
    3 times in 3 posts
    storing them in a table really wont be that much more effort, since your website has a databse neway.

    tbh i find working with files horrible in php, i wd much rather use mysql

  5. #5
    HEXUS.social member Agent's Avatar
    Join Date
    Jul 2003
    Location
    Internet
    Posts
    19,185
    Thanks
    739
    Thanked
    1,614 times in 1,050 posts
    Quote Originally Posted by Iain
    No, as soon as someone guesses the URL of the text file you're screwed, even if you encrypt it they'll get hold of it sooner or later, especially since you've just announced your intention
    He could set up the permissions to disallow web access, but as you say, its just not a good way to do it.
    Quote Originally Posted by Saracen View Post
    And by trying to force me to like small pants, they've alienated me.

  6. #6
    Moderator DavidM's Avatar
    Join Date
    Jan 2005
    Posts
    8,779
    Thanks
    802
    Thanked
    252 times in 234 posts
    If you use a proper CMS - just set up a login area, which need not even be visible - just a url ... then you'll have no issues.

    Also then you have the possibility of expanding it later to add a forum or whatever if required.

  7. #7
    Senior Member Kezzer's Avatar
    Join Date
    Sep 2003
    Posts
    4,863
    Thanks
    12
    Thanked
    5 times in 5 posts
    Yeh i'll be adding a forum etc. Yeh I know it's not hard to do it with a table, in fact my current admin pages use a table.

    I'll be doing some more coding tomorrow, the website design is finished though (funnily enough I haven't checked it to see if it meets standards *hides in shame*)

    Gah, it's going to take so long to make sure it's protected against SQL injection and that other one cross something something

  8. #8
    Moderator DavidM's Avatar
    Join Date
    Jan 2005
    Posts
    8,779
    Thanks
    802
    Thanked
    252 times in 234 posts
    Thats why using a standard cms is sometimes safer -as the problems are spotted quite quickly and patched

  9. #9
    Senior Member Kezzer's Avatar
    Join Date
    Sep 2003
    Posts
    4,863
    Thanks
    12
    Thanked
    5 times in 5 posts
    I'd like to incorporate a simple CMS but WP is too advanced for the kind of thing i'm doing, I just need a simple news posting CMS henceforth i'm just doing it myself

  10. #10
    Member
    Join Date
    Sep 2003
    Location
    Aberdoom
    Posts
    172
    Thanks
    0
    Thanked
    0 times in 0 posts
    Write yourself a simple user authentication class. Mine is ~200 lines long, which covers logging in, logging out, creating cookies, hashing values, creating/validating digests, getting permissioins etc. All fairly basic stuff... but self contained. Benefit of this is that I can use it all over the place, and never need to worry about having to code user authentication stuff again. Makes for very easy maintenance.

    For SQL Injections... escape everything, and put everything inside quotes. Control the input as much as you can, check values, again and again to make sure they're of the length you expect, type you expect, and within the ranges expected (database value ranges, or plain mix max values). Covering this should stop any rubbish being added to your database to keep everything nice and tight*.

    * made up term, but it sounds nice.

  11. #11
    DR
    DR is offline
    on ye old ship HEXUS DR's Avatar
    Join Date
    Jul 2003
    Location
    HEXUS HQ, Elstree
    Posts
    13,412
    Thanks
    1,060
    Thanked
    841 times in 373 posts
    why not look at Mambo?

  12. #12
    Moderator DavidM's Avatar
    Join Date
    Jan 2005
    Posts
    8,779
    Thanks
    802
    Thanked
    252 times in 234 posts
    Not the easiest to use by far. (And it's Jamoola now btw - as they've recently had a split with Miro ... who wanted to turn the system from open source to commercial)

    In my spare time I deal with a couple of CMS coding teams - so have experience of a few cms systems... PM me and i'll speak about this further.

  13. #13
    Senior Member Kezzer's Avatar
    Join Date
    Sep 2003
    Posts
    4,863
    Thanks
    12
    Thanked
    5 times in 5 posts
    I had considered writing an authentication class as it would be easier to use for future reference, for now i'll just do it procedurally and see what I can come up with

  14. #14
    Senior Member Kezzer's Avatar
    Join Date
    Sep 2003
    Posts
    4,863
    Thanks
    12
    Thanked
    5 times in 5 posts
    Code:
    <?php
        session_start();
    ?>
    
    <html>
    <head>
    </head>
    
    <body>
    
    <?php
    
    if(!isset($username) || !isset($password)) {
         include('includes/login.php');
         exit();
    }
       
    session_register("username");
    session_register("password");
    
    $conn = mysql_connect('localhost', 'xxx, 'xxx');
    if(!$conn) {
        session_unset();
        session_destroy();
    	
        echo 'Unable to connect to db';
        include('includes/login.php');
        exit();
    }
    
    mysql_select_db('xxx');
    
    $sql = mysql_query('SELECT user_table WHERE username =="' . strip_tags(mysql_real_escape_string('$username')).'"') or die('Couldnt find table');
    $fetch = mysql_fetch_array($sql);
    $numrows = mysql_num_rows($sql);
    
    if($numrows != "0" && ($password == $fetch["password"])) {
       $valid_user = 1;
    }
    else
    {
       $valid_user = 0;
    }
    
    if(!($valid_user)) {
       session_unset();
       session_destroy();
    
       include('includes/login.php');
       exit();
    }
    else {
       include('includes/content.php');
    }
    ?>
    
    </body>
    </html>
    That's the index.php for admin stuff, it's not working yet as it's saying it can't connect to the database, just checking through it now. Thoughts?

  15. #15
    TonyBurn
    Guest
    click here

    Nice little tutorial to assist you making a php cms.

  16. #16
    Senior Member Kezzer's Avatar
    Join Date
    Sep 2003
    Posts
    4,863
    Thanks
    12
    Thanked
    5 times in 5 posts
    Oooh nifty, Cheers Tony

Page 1 of 4 1234 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Automating Website Backup?
    By Aaron in forum Software
    Replies: 12
    Last Post: 31-08-2005, 01:55 PM
  2. Replies: 13
    Last Post: 30-07-2005, 06:15 PM
  3. Website / Name Purchasing and Hosting (Help)
    By muddyfox470 in forum Software
    Replies: 8
    Last Post: 08-07-2005, 03:27 PM
  4. BBC culls Cult website
    By Steve in forum HEXUS News
    Replies: 0
    Last Post: 01-07-2005, 01:47 PM
  5. recommend some website design software
    By petrefax in forum Software
    Replies: 24
    Last Post: 23-09-2004, 09:00 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •