Laravel 5 Application For More Than 1 Site - php

I'm not sure how to phrase my title so I had done the best I could.
I am putting together a Laravel 5 application to which multiple sites can pay to use for their company. This is an application that stores site related content in my database. So all data will be attached to a specific company (site).
Lets say there are 3 sites that want to use my application.
www.site1.com
www.site2.com
www.site3.com
When a user goes to either of those sites and wants to access lets say the name of my project lets say:
www.site1.com/projectname
www.site2.com/projectname
www.site3.com/projectname
It would then be sent to my site where they would log into my system and it would be able to grab the url and match it verify that it is a company that uses my system and then it would be able to keep separate the users and data separated from the other companies who use it.
Is this something that could be worked and if so any thoughts or ideas upon this.
I watched a series on this type of thing from net.tutsplus.com https://code.tutsplus.com/courses/building-multitenant-apps-in-laravel and have the basic idea however the video doesn't cover the situation like mine would with the other sites url coming into play.

Related

How can I merge register/logon from 3 scripts (databases) into one form -for one userdashboard?

I am pretty new at building sites have tried to build my 3 scripts so my users only need to register with one registry form and login with one logon form, in order to get access to use all 3 "features" scripts with a logon.
The plan is that I will make a member / user dashboard where the three websites can be used from.
Right now the three websites made as http://e-meditecs.com/art, /adz and /class. Each of the websites have their own register and login forms, thus also each have their own SQL database.
I have a "front page e-mediatecs . com where I think the Register and Logon shape to be placed.
I is completely solid and have made many google searches, now seemed just that I only become more confused.
Hope that the issue is understandable.

Creating Multiple portals from a site and serving the portals

I need to build a strategy or plan for implementation of a site
the situation is the following:
i have a site for people which belong to a community say xyz.
now i need to provide an account for the individuals of such communities on my site
when they logs into my site, there will be a feature to build a portal for themselves with some functionalities
like wise when n no of people logs in they might create n no of portal for themselves with some functionalities
the people will also create or use a n no of domain name respectively for the portal.
my problem or questions is:
How can i plan to create such a website?
Do i have to create separate code base files for each individual portal? or my current website portal code base can serve for each individual created portals?
How can i setup the site at domain automatically?
Update 1
I think the main website will already have a domain name for it
The other portals created through the main website will also have domain name for themselves as they are for some users
but the question is i have my main website domain name already using the code base which is serving the main website, now can i create domain names through my main website for the users and also ask the newly created domain names to use the same code base of my main website?
Actually i am planning to create domains through my application(please guide how can i create domain from my application) than after creating the domain can i ask the newly created domain to use the code base of my website which created the domain.
than there in the code base i do a domain name check as suggested in few other forums i guess, and load the content for the portal in the newly created domin
is this possible? if yes also can you guide me how can i:
create domains from my application? and than
during domain creation process through my application, how can i configure the new domain being created to my application code base?
is this the right way of implementing it?
1) How can i plan to create such a website?
Think about what exactly it is that the user requires. They have made an account, and want a portal to their own personal domain on the server. A domain on a server is just a file, so when they create that new portal, you might want to simply add a new HTML file under a logical directory, and populate it with some standard HTML.
2)Do I have to create separate code base files for each individual portal? or my current website portal code base can serve for each individual created portals?
I guess you can make the difference specified by a query string in the URL. For example, add database values for each user, and do something like this:
www.mywebsite.com/portal.php?id=40395
Your page will then use that id value, and take values from the database to populate the page with. That way you only have one file, portal.php, but it serves for any number of people.
3)How can i setup the site at domain automatically?
Like I said, the domain is just a file on the server. For example:
www.mywebsite.com/files/directory/hello.php
is just referring to the structure of files on the server. Namely:
www.mywebsite.com
files
directory
hello.php
If you place a file, goodbye.php in the same place, you can access it in a similar way.
www.mywebsite.com/files/directory/goodbye.php
PLEASE NOTE : You have provided no code, so I don't feel obliged to provide any in return. If you haven't took a swing at the problem of implementing the solution, then I guess I won't either.

Login from a site A to a site B?

There's one news-portal and its huge (site A). During production backwards, it has been even powered with some sort of a social networking stuff - not yet started, but about to start (soon site B).
Packed together looks great, but in some future there might be a lot of problems with maintaining the database, servers and stuff so I've been asked to separate it as I did. Site A goes on its own domain, site B also - databases are separated.
Now, I need to do the following: when user logs into site B (social site) and arrives to site A (portal) they should be instantly logged in there too (on a site A).
Any ideas how to do this - without duplicating entries to user tables?
EDIT:
Any other ideas instead of auth services? OpenId will just give us one user with 10 accounts, fakes and so on. How about cookie stuff or multi-database queries?
EDIT 2:
Well this is something hot.. unless its not April 1st joke and worth a try:
http://www.shawnhogan.com/2005/12/cross-database-join-with-mysql.html
You can use OpenID.
OpenID is an open standard that describes how users can be authenticated in a decentralized manner, eliminating the need for services to provide their own ad hoc systems and allowing users to consolidate their digital identities.
If you want to share some profile information (e.g. posts or photos) without giving access to your login and password you can use OAuth.
See if my answer here is of any use.
It's pretty simple, and only requires user information to be kept on one side. Where you need some information on the non-database side, you can just pass that information there using values in a query string, alongside the encrypted string.
Can you believe this?
$DB->query("SELECT * FROM table..."); // works of course...
$DB->query("SELECT * FROM another_database.table..."); // WORKS ALSO!
This guy is a miracle:
http://www.shawnhogan.com/2005/12/cross-database-join-with-mysql.html
I don't believe it, so simple at the end!

How to create restricted and non restricted area same time in Symfony2

what i have to build is page that have some pages that are restricted and some are not on similar links. I`ll try to explain it on example:
Let's say that i have users in my system (based on FOSUserBundle), and each of them have own account that contains a Blog and Gallery (different controllers). Some of User want to give access to thier Blog and Gallery only for certain group of people (that are not stored in system), so they generate token (only one token, so whoever know token will be able to access area) and sends to Users. What i don`t want to do is to check it in each method of controllers.
So let`s say we have 2 users, steven and stan and first of them want to make his blog and gallery free to see, but second one want to be restricted based on token.
Link would be like this:
/steven/blog
/steven/gallery
/stan/blog
/stan/gallery
Could anybody recommend some solution or any idea how can i try to build it in Symfony2?
Why don't you want to check it into the controllers ? I don't see any others ways to do that, according you want it to be dynamic and possibly changing.

Remote alternative to local storage for low-security user data?

Suppose you're developing an independent, small sub-page for a big and well frequented web portal.
The sub-page shows entries from a public event calendar, and allows users to highlight those especially interesting to them. The highlighted events shall be highlighted (and maybe shown on a separate list) on each future visit of that user.
However, building a classical user registration system, or any other way of storing the user-highlighted event picks on the server, is not an option: The sub-module needs to be as self-contained and need as little maintenance as possible. It's one of the conditions of the project.
The only way to do this without building a login system of some sort (as far as I can see) is using cookies or some other local storage (Flash / HTML 5....) which has the obvious and big downside that it's tied to the computer, not the user.
Is there a way of storing a few kilobytes data on a per-person basis, but without having to utilize a login or openID, that I am overlooking? A reliable web service perhaps?
A "key/value" storage service, to which I pass a unique key (one that the user specified) and get the savedvalue in return, would be sufficient. There is no need for real security - the data in question is by no means confidential.
OpenID is not an option: It is not well known enough among the audience of the site.
Facebook would be an option, but I don't think they provide "storage" options like this.
As a workaround, I am contemplating offering the user their event picks as a text file download, that also can be uploaded and turned into cookies on another machine. But that is pretty complicated for the user, and thus not perfect.
We have a similar system on our site, where users can bookmark pages to a planner/wishlist function. The saved items are sent via a webservice and stored on our server, and there is a corresponding get webservice.
We have a 'lazy register' system. The first time a user saves an item, they are asked for their email (but no password, as nothing is confidential). This is hashed and saved locally using a cookie, then used to set/get the saved items. When the user uses a different computer they are again asked for their email.
The key is that a register and a login are the same operation, so there is no need for any password reminders or any reset functionality.
The Google Docs API provides programmatic access to Google Docs, where you can create and store documents and spreadsheets. Your application could have its own Google login, which it uses to create one or more documents per user. These documents could be used to store the user settings.
Provided you can get a unique ID from each user (an email address, or something more secure, perhaps), this should be fairly simple. You can even organize the files into folders—one per user.
Alternatively, you could combine Google Docs with the Google Spreadsheets API, where I have just noticed this rather handy feature:
Tables & Records
Interact with spreadsheets as if they're a database
using Tables and Records.

Categories