Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 11 of 11

Thread: Blog help.

  1. #1
    kin
    kin is offline
    New Coder
    Join Date
    Jul 2011
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Blog help.

    Well, I made this kind of update blog for a gameserver me and a bud run. The problem is, the way i created it. I just made a php system with a javascript edit button(visible to everyone) that prompts for a password. I did not want this type of system in the first place though. The system i originally tried to create was a normal blog type thing. Where it would have newpost at the top then edit post in all the individual posts, for an example: http://corruptionx.com, now do not tell me its by vbadvanced etc. Its an example of what i wish it to look like, so if you guys can help me develop the first couple of lines, and give me a few functions from mysql or php or w/e is required. I can build off of that, thanks for your help in advance.

  • #2
    Senior Coder
    Join Date
    Jul 2011
    Posts
    1,226
    Thanks
    3
    Thanked 171 Times in 171 Posts
    I'm not really sure exactly what you mean.

    Wordpress would give you all you require, would just need to either buy a template, get a free one or make your own following the many tutorials on the website.

    If you're wanting your own, you'll have to make the user system (if that is what you want) and then basically make a simple CMS. There's a few posts around the PHP board on that subject, and definitely lots on the internet about that as well.

    Hope I helped and pointed you in the right direction

  • #3
    kin
    kin is offline
    New Coder
    Join Date
    Jul 2011
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by BluePanther View Post
    I'm not really sure exactly what you mean.

    Wordpress would give you all you require, would just need to either buy a template, get a free one or make your own following the many tutorials on the website.

    If you're wanting your own, you'll have to make the user system (if that is what you want) and then basically make a simple CMS. There's a few posts around the PHP board on that subject, and definitely lots on the internet about that as well.

    Hope I helped and pointed you in the right direction
    Thanks, but problem is... i have already created a working user system. And no i want to create something similar to that blog. In the middle of the page. Not a replica but something different.

  • #4
    Senior Coder
    Join Date
    Jul 2011
    Posts
    1,226
    Thanks
    3
    Thanked 171 Times in 171 Posts
    In that case, just give the users an numerical access level. Users with an access level >= the level required to edit, can see the edit button. You'll also have to verify the user level at the actual edit page and processing page, for security reasons (to stop people just navigating to the edit page without having a decent access level). Author of news will be the id of the user in the database to uniquely identify them and dynamically get their user details. Everything else will work similarly, the rest is just styling.

    Hopefully I have steered you in the right direction

  • #5
    kin
    kin is offline
    New Coder
    Join Date
    Jul 2011
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by BluePanther View Post
    In that case, just give the users an numerical access level. Users with an access level >= the level required to edit, can see the edit button. You'll also have to verify the user level at the actual edit page and processing page, for security reasons (to stop people just navigating to the edit page without having a decent access level). Author of news will be the id of the user in the database to uniquely identify them and dynamically get their user details. Everything else will work similarly, the rest is just styling.

    Hopefully I have steered you in the right direction
    you did, but i am having troubles fetching the numerical value of rights from mysql. Think you can help me out? Also, how would i make posts stack, instead of just making an edit button :S?

  • #6
    Senior Coder
    Join Date
    Jul 2011
    Posts
    1,226
    Thanks
    3
    Thanked 171 Times in 171 Posts
    Don't really get what you mean by stack, but for access levels just have an extra field in the user table called "access_level" then define a simple bunch of levels. Something like, Guest = 0, registered user = 1, news writer = 2, admin = 3. Then, assign users whatever level you want.

  • #7
    kin
    kin is offline
    New Coder
    Join Date
    Jul 2011
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes, but how do i check it in php? I have had troubles with that, and what i mean by stack is. You do not edit the same post over and over again. It creates a new one once an admin clicks new post.

    EDIT: Fixed the login issue

    now how do i check the rights section in php, im using

    Code:
    if(mysql_query("SELECT rights FROM Users WHERE rights='3'"))
    Last edited by kin; 07-23-2011 at 11:33 PM.

  • #8
    kin
    kin is offline
    New Coder
    Join Date
    Jul 2011
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Please help?

  • #9
    Senior Coder
    Join Date
    Jul 2011
    Posts
    1,226
    Thanks
    3
    Thanked 171 Times in 171 Posts
    Well, you'd be wanting to check if a particular user has the correct rights, and you're almost there with your query.
    PHP Code:
    $query "SELECT rights FROM users WHERE id=$id;";

    $result mysql_query($query) or die(mysql_error());
    $info mysql_fetch_array($result);

    // Check for access
    if($info['rights'] >= *minimum level user has to be to do task/see information*){


  • #10
    Super Moderator guelphdad's Avatar
    Join Date
    Mar 2006
    Location
    St. Catharines, Ontario Canada
    Posts
    2,633
    Thanks
    4
    Thanked 148 Times in 139 Posts
    kin, please don't bump your own thread after an hour. if you haven't got a response on a thread in 12-24 hours then you can consider it reasonable to ask again for help.

  • #11
    Senior Coder
    Join Date
    Jul 2011
    Posts
    1,226
    Thanks
    3
    Thanked 171 Times in 171 Posts
    How about this. On login, save the users rights into a session variable. Then just check that to see if that variable is equal or higher than the access level required.


  •  

    Posting Permissions

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