User Authentication with CrudAdminGenerator - php

I'm using https://github.com/jonseg/crud-admin-generator to generate a simple back-end for database operations. However, I want to make it so that only an admin user can use the page.
I can't seem to find a good tutorial that is compatible with this framework. I've looked at Symfony and Silex tutorials, but neither one seem to be 'compatible'. This framework doesn't seem to have those files..... Is there a tutorial / something that can help me get started with this? Is there an easy/safe way to lock down some pages in PHP that is compatible with this framework?

there is a property in the firewall, named "security.access_rules"
that add the path and the role and that'll make it so you can lock down certain routes.

Related

Laravel API Generator

I have a project and I'm only responsible for the Back-End development.
In the Back-End I have to create an API that generally have CRUD operations, and the problem is that they are a lot, so to explain exactly here is an example:
Demand => Create a CRUD for Article(Id:number, Title:string, Thumbnail:picture, Content:text, Tags:text)
Explanation => I have to create everything needed so the Front-end can send requests to Create, Read, List, Update or Delete an Article (Return data as JSON)
Problem => I'm searching for a package or a tool that generates that automatically, knowing that a request could contain files or pictures not only text data.
Please Don't Forget
I'm not seeking for a view generator [I'm not working for the Front-End] I'm only responsible for the Back-End
Everything I need do exist in other frameworks, but I want to work with Laravel
I wish you give me tools or packages that you have used not from Google searches because I'm searching for the 4th day
I found this http://labs.infyom.com/laravelgenerator/ but it seems that it have a little bit complicated documentation (Maybe the problem in me)
I'm using Laravel 5
There are several great options for automatic generation of api in laravel you can checkout Dreamfactory, infyom or apiato, I recommend infyom if you have a small project and you need simple api.
It's not totally clear to me what you're looking for. Regarding routes and controllers, Laravel's built-in functionality for Resource Controllers is quite useful in providing general REST scaffolding. If you're interested in all the details of implementing CRUD-like functionality, that's a more involved topic and I'd advise spending some time reading through Laravel's fairly comprehensive documentation.
Try Laravel API/Scaffold/CRUD Generator

Website with login

I want to create do the following things:
1. Create a new E-Commerce website
2. Update a already made website(superbrainacademy.com)
So the second thing, I have to include a log in provision so that some people which I authorize can get to see certain extra pages than others.
In e-commerce website I want everything like they can sign up themselves, I do not want to add each person manually, they log in with their email id and password and do shopping like something like flipkart.com. Well, payment gateway is out of scope for this question. What I need to know is how to start? In what language to make all this? Any guide on this?
What I know and i have created: I know programming in html and a little bit css. I make websites from downloading some good templates or just putting nice images at back and all. See my websites to have an idea(superbrainacademy.com or octindia.com)
I thought that maybe I could achieve this through joomla/drupal/wordpress. So I downloaded xampp and installed wordpress, drupal and joomla on it. The websites that open up look basic blogs to me (sorry but i am new to it) So I have no idea whether or not what I want can be accomplished by use of any of them. I also downloaded many many wordpress templates but they looked disgusting.
So what I need: A way to create a website with login id and password (signing in and signing up) but one has to be authorized by me as the users < 20 or so and the other needs to be done automatic as users > 100 or idk maybe greater. So how should i start.
Note: I do not prefer using automatic website making like weebly and all...
I would recommend using a CMS. If your willing to put some time into it you can learn to build your own template. I haven't used wordpress but I have built templates for Joomla, it takes some time to learn probably just as much time it would take to do what you want to do from scratch. Check out their guide to building a basic Joomla template.
http://docs.joomla.org/Creating_a_basic_Joomla!_template
So it seems that, you just need an e-commerce cms, and its likes of .
My suggestion for you is to deploy a Magento installation with a prebuilt template and demo just so you know where to start, and it gets easier for you to do stuff yourself, once you get a hang of it.
There are various of Magento/osCommerce template service providers out there some of them free maybe, some of them premium. Though I strongly bias my recommendation towards Magento than osCommerce, after myself having worked on both.
Note:- I am taking about opensource here, and mostly all of these cms installations tend to be quite similar.
Update:-
About integrating a login system inside your current website, you can use a script from HERE as per your requirement and complexity.
Joomla has inbuilt ACL:
http://docs.joomla.org/J3.2:Access_Control_List_Tutorial
so that would enable you to set specific access for specific user groups eg branches
It would allow you to either:
a) let people register individually
b) you approve each registration
c) you set up each user individually
You could also combine Joomla with an eCommerce component.
I find mixing Joomla with Mijoshop (OpenCart for Joomla) a good solution.
You can install Joomla with VirtualMart. If you don't need all functionalities of joomla just disable those from back-end. If you need a pure e-commerce site you can use OpenCart (lightweight solution) or Magento which is a much more complex e-commerce solution.
Update:
The second thing couldn't be accomplished by using HTML only. wardha-Web's answer below (php login) seems to be a good choice since it's quite simple. Another sophisticated way would be to modify your existing site and put it behind to a php framework where you can define access role based authentication, but for this you need to have some php and object oriented programming skills

Making joomla Extension in my own way

I've tried to understand the structure of joomla. I've read many kinds of documents and tutorial regarding about how to make extensions in joomla. I can't able to understand it fully. I still had some doubts on it. I've made a simple component in joomla by using MVC concept and using some joomla core files. I won't say that it is like same as what professional are making it. I've used 30% of joomla like using MVC concept, extending the core files of joomla and connected with the database using joomla syntax and some other ways also. Rest of the percent, i've used my own codes by using oops concept. So do you think that is it good enough to make an extension like this or i have to make an extension like that or i really have to learn and understand the official joomla way of making it's extension. I want to know it please.
First of all the joomla is given a brief details for developing its extensions.
You can check the following url for understanding the components structure of joomla.
http://docs.joomla.org/Developing_a_Model-View-Controller_Component/1.5/Introduction
In this doc at the end you can find a download link download the component and go through the code you will get full idea about joomla MVC concept.Its pretty simple.
I think no one can explain your requirement with what you are expecting.
Just keep this in mind while developing joomla's extensions.
1)Do not edit core file for your component task achievement.
2)Try to use jRequest class for getting submitted values.
3)For new task use your controller overrided functions.
4)Make all your sql queries inside model only.
5)And make an extension that compact able for later version too.
These are the tips i can give you.
Just walk through the code of some good extensions and try to follow that .
Hope this may help you..
For ease of maintenance and for future development I would definitely recommend that you develop your component the right way. If you are going to release the component I would say that it is a requirement.
The who MVC structure can be confusing at first but once you get your head around it is really nice.
I would suggest making the MVC skeleton by using the Joomla Component Creator
http://www.notwebdesign.com/joomla-component-creator/ and then add the custom code yourself.

Looking for a easy integration PHP forum

I'm building a website with codeigniter (PHP) and I'm looking for a forum easy to integrate with my current database so users don't have to register twice. Moreover, I need to use the same html head and styles that in my website, placing the forum inside a div of <body>
Could anyone recommend me any simple forum application for my situation? Thanks.
I'm not aware of CI-specific solutions, but I've used a couple times MyBB and I can say it's really easy to integrate anywhere, as (at least in the 1.6 release, I haven't use it for some time) it's structure is easily moddable. I integrated it in a Joomla! website and in a custom one, and in both ways it's just a matter of reading the mybb_users table for access; it's quite a detailed table, so you can find almost anything you need for a registration table, like salt,password,timestamp of registration,email, and so on, so you just need to query that table and you're set.
As for the integration with CI I think the best way would be to place the whole forum folder and access it there; for the header, footer and other website parts you just change the relative forum template (layout are divided into subsets of templates, so you can change it easily and in details) and the user would not notice they are different applications.
You can also try and build a CI library for communicatin with the forum; they don't have an official API, but in functions.php and a couple other files I don't remember now (yes, 1.6 was mostly procedural, hope they have changed it now) you'll find all the relevant MyBB core, so building an API is straightforward; I once built own for Joomla! and was really easy. Moreover, there's This guy who wrote an integration for MyBB which is, in fact, a nice API; I don't know how updated it is, just check, but It's not difficult to port those files to a Codeigniter custom library, in case.
For database integration you're not going to find a forum that uses the same DB architecture as CodeIgnitor. What you can do, however, is alter your PHP registration scripts (for both CodeIgnitor and your forum) to add an entry in both member records.
Depending on your database you can also use Database Triggers to automatically update the other table when one is updated.
As for your layout, anything can be modified. Open source options will be the simplest, so I'd recommend phpBB for simplicity sake.
For more information on Database Triggers in MySQL, see here: http://dev.mysql.com/doc/refman/5.0/en/triggers.html
I would suggest using PHPBB forum or Wordpress with the BuddyPress plug-in.
I'm not quite sure how the integration with your codeigniter would be, but seeing as PHP is open-source, it shouldn't be too hard to crack open and find out.

User authentication with CodeIgniter

I am writing a web application using PHP. I want to use the MVC pattern for this, and decided to go with CodeIgniter. My application will have some pages which will require authentication, and some pages won't. I want to design this in a very generic way, so that there should be no code duplication. Can any one point to some good "design/class structure" for this?
Write a custom library that you can autoload in your code igniter app on every page view. It should have functions that:
Authenticate the user ie. check if a user is logged in or not
Log you in ie. set a session variable or something
Log you out
Then in your controller classes you can do a call to the authentication function in the constructor then depending on the outcome continue as normal or redirect them to a login screen with an access denied message.
Do a search on the code igniter wiki for 'authentication' and there are a number of results that may help: http://codeigniter.com/wiki/
"Ion Auth" is lean, well-programmed, somewhat widely used and is actively maintained.
http://github.com/benedmunds/CodeIgniter-Ion-Auth
If by "some pages" you mean some controllers (the gateway to your views), then you may want to investigate controller inheritance. Extend the default CodeIgniter controller with your own and put an authentication check in the constructor (check the session for a logged in flag or something and if not logged in then redirect to login page). Then, all controllers that require authentication will need to extend your new parent controller. That's it.
Head on over to the CodeIgniter forums and search for some different ways to extend the controller. Here is one http://codeigniter.com/forums/viewthread/89768/#452890
May be you can use CL_AUTH library for CI. I've used it and it works good. You can find it here http://www.jasonashdown.co.uk/cl_auth_doc/
I was looking into the same thing recently, and I found a CodeIgniter fork called Kohana that includes a nice authentication module. If you are set on CI, maybe adapting Kohana's auth module backwards to CI would save you some time? If you have just started out on your project and PHP5 is OK to use, consider switching over; they are very similar frameworks.
Visit GitHub and search for Codeigniter Auth or Authentication, or check the CodeIgniter Wiki, you'll find many libraries with different features.. explore them and choose the one you need! But be careful, many are for CI 2, and you have to ucfirst the classes to use with CI 3, otherwise they don't work at all.
Use flexi auth a modified version of the popular Ion Auth library. It's more advanced and do all the job out-of-the-box.
flexi auth is a free open source user authentication/login library for use with the CodeIgniter 2.0+ framework.
I know it's too late but I hope someone else will find it helpful. Cheers!

Categories