If you install PlainCart and access the administration page, you are given a default username, which is “admin”, and a default password behind the asterisks. Hitting the login button should bring you directly to the PlainCart Administration page. But what if you encounter this error: “Wrong username or password”?

Was it a flaw in PlainCart? The answer is NOPE! It has something to do with your webhost.

You see, PlainCart uses the PASSWORD function to encrypt sensitive data in your MySQL database, especially passwords. But some webhosts were configured in such a way that they no longer recognizes the PASSWORD function of encryption. A work-around will be to change the encryption method from PASSWORD to MD5. Quite simple. Here’s what you need to do?

1. Open the file “admin/library/functions.php” and locate between lines 39-43 the word PASSWORD(‘$password’). Change the word PASSWORD (not the variable name) to md5.

2. Edit the file “admin/user/changePass.php” and between lines 14-31, locate all of the instances of the word PASSWORD and change them all to md5. Be careful not to touch the $password variables.

3. Edit the file “admin/user/processUser.php” and locate between lines 50-58 the word PASSWORD and change them all to md5. On the same file, between lines 64-76, change all the instances of the word PASSWORD to md5.

4. You’re almost done. The next thing you have to do is to change the encrypted password in your database. Open the table tbl_user inside your PlainCart database (you may want to use PHPMyAdmin to do this task easier), click on the BROWSE tab, and edit the values for the record containing the username “admin”. In the user_password field, key-in your desired password for the “admin” username. Under the Function column, choose MD5 and save the data.

5. Head on to your PlainCart Administration page (yourdomain.com/plaincart/admin), key-in “admin” as the username and change the default password with the one you had just saved in the database table. It should make you access the Administration page of PlainCart.

If you got lost with my instructions above, please do not hesitate to email me via robert{dot}reyes{at}gmail{dot}com.


If you are helped by this tip, I will appreciate you sending me a US$2














ABOUT THE AUTHOR

Robert “Bob” Reyes is a technologist, an ICT Consultant and Tech Speaker, a certified Google IT Support Specialist, and an Open Source advocate representing the global non-profit Mozilla (makers of Firefox) in the Philippines. Bob is a Technology Columnist for the Manila Bulletin Publishing Corporation and an aviation subject matter expert contributor for Spot.PH.

Follow The Filipino Tech Explainer on Facebook and X/Twitter.

If you liked my articles or any of the contents or if The Filipino Tech Explainer has helped you in any way, you can buy me a coffee and share your thoughts. Help me continue producing awesome articles by supporting my website. Maraming salamat po! Thank you very much!

What’s your Reaction?
+1
0
+1
0
+1
0
+1
0
+1
0
+1
0
+1
0
51 thoughts on “Problem Logging-in as Admin in PlainCart?”
  1. Thanks a million man … you saved me !!!
    great problem solving article…
    THANKS AGAIN

  2. hey thanks for this help section.. it got me through!! really a genius!! though now i have another problem with Plaincart… everytime i try to upload an image to my “category” i get this message..

    Warning: imagejpeg() [function.imagejpeg]: Unable to open ‘/home/mic/public_html/plaincart/images/category/723c06ee8cb6ec282444e12b1eb0ce04.jpg’ for writing in /home/mic/public_html/plaincart/admin/library/functions.php on line 254

    Warning: Cannot modify header information – headers already sent by (output started at /home/mic/public_html/plaincart/admin/library/functions.php:254) in /home/mic/public_html/plaincart/admin/category/processCategory.php on line 50

    any ideas on what could be wrong with this?

  3. Hello Mic! Thanks for visiting my website.

    A solution to your problem (uploading pictures) is to set the folder permissions to either 755 or 777 (/plaincart; /plaincart/images; /plaincart/images/category; and /plaincart/images/products). You should be able to upload images for your categories & products once the correct folder permissions are set.

  4. actually, ngayon ko lang nakita itong post mo… lahat ng students ko, ni CHMOD ko to read-write-execute 3x yung folders nila. on my own. kaloka! may instructions pala dito puwede pala nila gawin on their own. XD

  5. shet. i can’t get over the fact na ni-777 ko on my own halos lahat ng hosts ng students ko… TATLONG SECTIONS YUN!!!

  6. Hi,
    First of all thank you very much for this article it really helped me a lot.

    But unfortunetly I have a new problem and I was wondering if you could help me or direct me to right place.

    the plain cart is working without any problem in my localhost, however when I upload it to my web host the admin section does not wotk properley, I am able to login to admin section but but when I log-in first thing that I notice is the web page is not styled with admin.css so everything is displayed without using the styles, secondly the links on the left hand side doesnot work, when I click on them they been added extra bits onthem, for example instead of going http://www.mydomain.co.uk/admin/category, it goes like that http://www.mydomain.co.uk/content/StartupHostPlus/s/e/mydomain.co.uk/web/admin/category/ , as result I get server error saying that page not found.

    I believe the problem lies with the config.php wher eit says

    $thisFile = str_replace(‘\\’, ‘/’, __FILE__);
    $docRoot = $_SERVER[‘DOCUMENT_ROOT’];

    $webRoot = str_replace(array($docRoot, ‘library/config.php’), ”, $thisFile);
    $srvRoot = str_replace(‘library/config.php’, ”, $thisFile);

    define(‘WEB_ROOT’, $webRoot);
    define(‘SRV_ROOT’, $srvRoot);

    But I dont rally know how to solve this.

    If you could help me on this matter I will realky appreciate.

    thanks murat

  7. Hello Macy! It depends on how do you manage your website. If you have cPanel, you can use the File Manager to change the folder/file permissions. If you have access to your site’s FTP using FileZilla, SmartFTP, or any other FTP clients, a simple right-click will do to change the permissions of your folders/files.

  8. Hey bob great stuff, i’m having problems with pictures “Fatal error: Call to undefined function imagecreatetruecolor() in Z:\wamp\www\plaincart\admin\library\functions.php on line 223”

    On the plain cart site says that i must open my php.ini file and change a line, but that doesnt work either, in fact there is nothing to change there… it has something to do with GD not being enabled??

  9. Solved, for thos who use wamp(like me) you must not only remove the “;” from the php.ini file but also enable it in the wamp menu. Cool! Now if only somebody would do a search engine for this cart would be mega awsome

  10. Hello! this plaincart is pure evil, once u resolve a problem, u get another one :(.
    I use wamp, i have gd active.I have a problem at upload… didn’t upload my picture in category or product folders, but insert the name of picture in database. Please help 🙁

  11. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ”cronixz” at line 3

    This is what i get after i have done all of the switches of passwords with md5s. I am using localhost for the meanwhile until i decide to post it up.
    Thank you,
    Benjamin

  12. @Benjamin: The problem there is with the encryption method used in the original source code of PlainCart, which is PASSWORD. Change it to MD5 and it should work well.

  13. I got to the next level but the admin page has no template, and it wont let me click on any buttons. It gives me a 404 error

  14. i will give you a good donation, for your help through alll these steps. I am creating a website right now, and undertook a job that is a bit hard to handle, relative to my expertise.

  15. About using PASSWORD. I had the same problem, but then I found that the length of the encryptet password is now 41 bytes. Therefore, once i changed the field length from 32 to 41 in the MySQL database, voila – it worked 🙂

  16. i’m stuck on this step

    “Under the Function column, choose MD5 and save the data.”

    there is no function column, and there is no option to set anything to md5 ANYWHERE that i’m seeing in dbtools or phpmyadmin

    HELP

  17. after doing these instructions Problem Logging-in as Admin in PlainCart? It still won’t let me login can you help me
    Thank you

  18. Thanks very much! I was on the right track with the PASSWORD() function and database needing changed but didn’t realize the function was in more than one file and that the user couldn’t be changed until after logging in as admin, why is that, user stored in a file somewhere? Now I have a problem with not being able to select category in add product.

  19. I have the SQL problem :

    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘Set, pd_name = ‘Dining Table’, pd_description = ‘Dining Table’, pd_image = pd_im’ at line 2

    Once I modify the product item , anyone can help ?

  20. hi,
    i am very new to php. and i am using plaincart first time.
    i have installed php 5.2 manually on xp.
    my problem is that when i login to admin panel .the page does not redirect to index.php ,it show same login page.while username and password is correct.

  21. Hi…
    I am sarith really don’t know the syntax of web_roo if you know pls help
    Best regards,

  22. Hello,
    I can not be able to add categories and products in my plaincart.there are no errors and when I click to add, nothing happens apart from the browser that generates this error : Webpage error details

    User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)
    Timestamp: Thu, 12 Aug 2010 13:52:30 UTC

    Message: Object expected
    Line: 5
    Char: 3
    Code: 0
    URI: http://pixierallyteam.com/admin/library/category.js

    help!

  23. You da MAN that solve my problem now stuck with the
    $thisFile = str_replace(‘\\’, ‘/’, __FILE__);
    make link wrong.

  24. how do i set it up in my localhost…

    i tried changin the config.php … but not working …

    the webroot and srvroot seems to be not assigned properly…

    ne advice on how to fix it ?

  25. still I have problems in webroot because after i login no css take effect and links are not working well

  26. Dear all,
    Its works perfectly my localhost. but is not working properly on my server when i login admin page is not show correctly. help me please…

  27. Hi,
    i can enter admin ok but when doLogout and reenter the user and password fields are always with the last user and pass data.
    How can i clear the fields so that when i reenter have to insert user and pass?

    Help pls…
    Many thanks

  28. thanks so much for the help (i asked so many people for help, who despite working in web companies couldnt help me)

  29. Just wanted to say thank you very very much for the help you provide here. Definitely has helped me with the md5 part of it. 🙂

  30. Hi There,

    You are a genius! I would really get you a coffee if you are in UK. Many thanks for updating this. Highly appreciated!

    Thanks Dude! All the best for your future works..

  31. hello sir,
    Im having a problem regarding on updating the quantity of item in the cart it has no syntax error or anything that will pop up when their is one,. but when i try to change the quantity of the item and click the update cart button nothings change plus it automatically return to the previews link. pls help what could be the problem??

    btw im using xamp 1.7.7 version
    php: 5.3.8

  32. Thanks m8, i wish you good luck and a good health, i realy mean that, thanks again !

Leave a Reply