dcblogdev / dcblogcomments

2 stars 0 forks source link

creating-a-blog-from-scratch-with-php-part-8-tags-sidebar #7

Open utterances-bot opened 4 years ago

utterances-bot commented 4 years ago

Creating a blog from scratch with PHP - Part 8 Tags Sidebar - DC Blog | Development Tutorials

In the last tutorial we created the ability for having tags for each post, this part will co...

https://dcblog.dev/creating-a-blog-from-scratch-with-php-part-8-tags-sidebar

jpgateaux commented 4 years ago

Noticed on Parts 7 and 8 references to table blog_posts. Shouldn't they be blog_posts_seo?

jpgateaux commented 4 years ago

also part 9 references blog_posts rather than blog_posts_seo

Powered by Cricket Wireless

-------- Original message -------- From: utterances bot notifications@github.com Date: 4/27/20 05:54 (GMT-08:00) To: dcblogdev/dcblogcomments dcblogcomments@noreply.github.com Cc: jpgateaux celeiner@outlook.com, Comment comment@noreply.github.com Subject: [dcblogdev/dcblogcomments] creating-a-blog-from-scratch-with-php-part-8-tags-sidebar (#7)

Creating a blog from scratch with PHP - Part 8 Tags Sidebar - DC Blog | Development Tutorials

In the last tutorial we created the ability for having tags for each post, this part will co...

https://dcblog.dev/creating-a-blog-from-scratch-with-php-part-8-tags-sidebar

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/dcblogdev/dcblogcomments/issues/7, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGEGHHWS5BDKFF7LYETITJDROV56XANCNFSM4MR4WGEQ.

surfkahuna commented 4 years ago

Great resource, thank you.

I'm having a slight problem with my .htaccess file. It seems the RewriteRule ^(.*)$ viewpost.php?id=$1 [QSA,L] rule ads a URL querystring to the end of any php files I have in a subdirectory.

for example, php files in http://mywebsite/about/company.php gets converted to: http://mywebsite/about/company.php?id=company

Would you know how to remove the unwanted querystring?

dcblogdev commented 4 years ago

also part 9 references blog_posts rather than blog_posts_seo Powered by Cricket Wireless -------- Original message -------- From: utterances bot notifications@github.com Date: 4/27/20 05:54 (GMT-08:00) To: dcblogdev/dcblogcomments dcblogcomments@noreply.github.com Cc: jpgateaux celeiner@outlook.com, Comment comment@noreply.github.com Subject: [dcblogdev/dcblogcomments] creating-a-blog-from-scratch-with-php-part-8-tags-sidebar (#7) Creating a blog from scratch with PHP - Part 8 Tags Sidebar - DC Blog | Development Tutorials In the last tutorial we created the ability for having tags for each post, this part will co... https://dcblog.dev/creating-a-blog-from-scratch-with-php-part-8-tags-sidebar — You are receiving this because you commented. Reply to this email directly, view it on GitHub<#7>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGEGHHWS5BDKFF7LYETITJDROV56XANCNFSM4MR4WGEQ.

yes, you're correct thanks I've updated the posts now.

surfkahuna commented 4 years ago

I found a workaround to my issue if anyone is interested: I ended up placing a new .htaccess file in each subdirectory where i'm hosting additional .php content.

Using the example above, http://mywebsite/about/company.php, place a new .htaccess file in the /about/ directory with the following contents.

remove querystring

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^?]*)\? RewriteRule .php$ /%1? [R=301,L]

display page w/out extension

RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^(.*)$ $1.php [NC,L]

It may be crude but it worked for me.

simenas commented 4 years ago

This is exactly what i was looking for, a simple CMS where i could have one admin to edit all the posts. However everything seems to word except for the admin login screen. I have filled out:

//database credentials define('DBHOST','localhost'); define('DBUSER','root'); define('DBPASS','ThePasswordIUse'); define('DBNAME','feed');

$db = new PDO("mysql:host=".DBHOST.";port=3306;dbname=".DBNAME, DBUSER, DBPASS); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

However i can't seem to log in. It just displays the error message: "Wrong username or password". I tried with the root user in the database credentials, and the users i created in phpmyadmin in the blog_members table. Also tried demo but it still wont log in to the admin panel.

What am i doing wrong? How do i add the first (and only, as i only need one) administrator for the cms?

Any help much appriciated! I'll definately donate if i can get it to work :D

tjbruce17594 commented 4 years ago

How does one create the first admin account to access the admin backend for the blog?

vizaganand commented 4 years ago

the admin user id is demo and password is demo. The following sql will create first admin. After logging into admin, you can add users.

Dump of table blog_members

------------------------------------------------------------

DROP TABLE IF EXISTS blog_members;

CREATE TABLE blog_members ( memberID int(11) unsigned NOT NULL AUTO_INCREMENT, username varchar(255) DEFAULT NULL, password varchar(255) DEFAULT NULL, email varchar(255) DEFAULT NULL, PRIMARY KEY (memberID) ) ENGINE=InnoDB DEFAULT CHARSET=latin1;

LOCK TABLES blog_members WRITE; /!40000 ALTER TABLE blog_members DISABLE KEYS /;

INSERT INTO blog_members (memberID, username, password, email) VALUES (1,'Demo','$2a$12$TF8u1maUr5kADc42g1FB0ONJDEtt24ue.UTIuP13gij5AHsg5f5s2','demo@demo.com');

/!40000 ALTER TABLE blog_members ENABLE KEYS /; UNLOCK TABLES;

cmsnyder1980 commented 4 years ago

I must say that I really like what you're offering and can't wait to extend it further but am having a major issue.. when creating a new account (right now need one for me and one for a co-poster) it keeps saving NULL to the DB. I added the demo user SQL and can log in and out of that one. I created an account for myself, including a password. But I cannot log into it. Then looking at PHP My Admin all of the data is there for a new user except for NULL in the password field.

When I copy and paste the encrypted password from the demo SQL file and save that in PHP MyAdmin I can log into my account using the password "demo" but I don't want both of us having the same password and do not want either of us having "demo" as the password hah I am using the files supplied in the zip file and am having this issue without having modified anything. Reading through the class I cannot figure out why it is saving the encrypted version of the provided password.

Any help would be greatly appreciated!

TraLeeee commented 4 years ago

How does one create the first admin account to access the admin backend for the blog?

There's no function help you create a first account (or you can say it admin account). But the first account have been quote in blog post (demo:demo).

grgoboy commented 3 years ago

How to downlaod update with Tags Before We have download link

luiztux commented 3 years ago

It is highly recommended not to use the __autoload() function any more. Now the spl_autoload_register() function is what you should consider.

puputicedd commented 2 years ago

thankyouuu its work! hope you can share another tutorial!

https://ftmm.unair.ac.id/ftmm-ajak-mahasiswa-belajar-internet-of-things-dan-pemrograman-android/

issatillie commented 2 years ago

Everytime I keep adding/editing a user, the password field changes into null. This is my form (I removed the confirm password feature):

              <form class="forms-sample" action="" method="post">
              <input type='hidden' name='memberID' value='<?php echo $row['memberID'];?>'>
                <div class="form-group">
                  <label for="username">Username</label>
                  <input type="text" name="username" class="form-control" placeholder="Username" value='<?php echo $row['username'];?>'>
                </div>
                <div class="form-group">
                  <label for="password">Password (only to change)</label>
                  <input type="password" name="password" class="form-control" placeholder="Password" value=''>
                </div>
                <div class="form-group">
                  <label for="email">Email</label>
                  <input type="text" name="email" class="form-control" placeholder="Email" value='<?php echo $row['email'];?>'>
                </div>

                <button type="submit" name="submit" value="Add user" class="btn btn-primary mr-2">Add user</button>
                <a href="../dashboard.php"><button class="btn btn-light">Cancel</button></a>
              </form>