Jump to content

Recommended Posts

Hello all. I've recently started to experiment with PHP/MySQL so I'm still fairly new at this. I have been using the same commenting script for a while and I have tweaked it to my liking (visually). Unfortunately, the website I got the script off has been hacked and no longer online. However, if you need any snippets of code to further understand then I can post them as I still have the script saved on my computer. The commenting script contains two php pages only.

 

Now.. on to my question. I would like to include a feature that only allows registered users to comment. I have a login script I have been messing around with for a while to try and understand it better which can be found here. The script had some features I did not need such as the admin panel and user panel so I took those off. I'm hoping that the two scripts can somehow be combined to work together. Say for example, when a registered user comments his username will be placed as the person who commented.

 

Notice the login script is fairly simple as well. I'm not looking for anything fancy that comes with admin pages, user pages, and so on. I'm just hoping on having a simple script that allows only registered members to comment on the website's content. Non-registered users will still be able to see the comments but no form will be available for them to fill out to comment.

 

Thanks in advance!

Link to comment
https://forums.phpfreaks.com/topic/203722-php-commenting-script/
Share on other sites

Both scripts work just fine by seperately. The problem is editing the comment script to check the MySQL database to see if the user is registered or not. Say, if he's/she's not registered then the form will replaced with a text saying something like, must be registered to comment. Register Here. I'd like to get the two scripts to work together with each other. I'm still fairly new to PHP so I'm not sure where to even begin. My only guess at approaching this would be that you'd only have to edit the comment script to achieve this. Could there be a way that the form can be hidden from non-registered users and instead display the text telling them to register? Perhaps an if-statement checking if they are authenticated or not?

 

I have included the comment script in a zipped file. This is the version I have tweaked but the only things I added was more styles and the placement of the comments such as "Posted by:" and so on.

 

[attachment deleted by admin]

Sorry for the double post but I have thought of a better way to view this problem.

 

What I am trying to achieve is to somehow get the comment script to view the client's cookies(or whatever lets other sites know you are logged in) and verify, using another database as reference, if that client is registered or not. If not, a text will appear telling that client to register. If the client is registered then a form will be available for them to comment. One problem that may arise with tackling this problem is that my site has one database for the comments and another holding the registered users. Is there a way this can be done.. connect to another database to verify if the client is registered or not?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.