Jump to content

Recommended Posts

I have an installation of the database-less blog service Text Rider that I wish to take public, but I want to polish it off, make it prettier, and dumber for the average user before doing so. 

 

I want it to be a system where anyone can register and post to the home page, but users can only modify their own posts, whereas administrators can, of course, modify anything.

 

I realize how incredibly stupid this idea is, but I want to go through with it anyways, to learn programming techniques and user habits.

 

One problem is, by default, any user logged in is presented with "edit this post" buttons for every post, regardless of poster.  Luckily, if it is not their post, they will not be able to actually edit it.  I have attempted to make the if statement only display the button if the user is the author of the post, which works to an extent, but still not enough to actually accept.  It is too hard to describe here, for anyone willing to help me, the index.php file that contains this if statement is attached, and the if statement is as follows:

if($_COOKIE['username'] == $author){
$edit = "|<a href=?page=edit&x=$ffrow>Edit this post</a>";
}else{
echo ""; }

 

Next is, when a user comments on an article, I want the only logged in users to be able to comment, and I want the username of the commenter to show up, as opposed to the commenter entering the display name in a form.  Here is the code for the form, which also is in the attached default.tpl.

Name:
      </td>
      <td width="289" height="1"><input type="text" name="name" onblur="this.value=TrimValue(this.value);">
  <input type="hidden" name="com_id" value={uniq_id}>
  <input type="hidden" name="ip" value={client_ip}>
  </td>
  

    </tr>
    <tr>
      <td width="49" height="1">

 

Lastly, there is a page in the user control panel called "Modify Posts," which lists all of the posts on the site, each with an edit and delete link on them.  I want users to only be able to see their own posts when clicking that link.  This bit is too much to include in a quote, so just look in the attached index.php.

 

If anyone could help me at all, I would be forever greatful.  Thanks anyways!

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/43566-text-rider-database-less-blog-php-help/
Share on other sites

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.