I have a page which have different version, one is member, one is admin, and one is guest.
You may know what is the different, if the user, they have:
login button
register button
if the user is a member, they have:
logout button
edit button in they content
and the admin, will have:
logout button
banned button for all content
So, my question is, they are similar content, show I make 3 separate page? or one page to do all this stuff? Thank you.
I suggest you use one page and use ACL to define what every user can do. I heard ZEND_Acl is a good start.
Definition of ACL:
http://en.wikipedia.org/wiki/Access_control_list
CodeIgniter + Zend ACL:
http://www.lucdebrouwer.nl/adding-zend-acl-to-codeigniter/
http://www.revolves.net/2008/12/18/using-zend-acl-with-codeigniter/
Related
I have a home page url http://localhost:3443/home1
In the index action of home1 I am having a session["Home"]=Home1.
I am having another home page url http://localhost:3443/home2
There i have a session session["Home"]=Home2.
Now the context is for some user the landing page is home1. So if they click on home button on the menu or or do any such activity they should land into home1.
For another set of users they should land into home 2 for whatever activity they do which leads to the home page.
Now the menu.it is a ascx control
Here we are checking the session value is home1 or home2.
Based on that we are redirecting the user to the desired landing page.
Now the problem that I am facing is when we copy
http://localhost:3443/home1 to another tab e.g. tab2 and from there we change it into home2 and then do some activity. And then come back to tab1, what happens the value gets overridden it taken the home2 session. Which leads to the wrong landing page on click of home link in the menu. Do you have any solutions for this problem?
I hope i have correctly explained the problem if not please let me know,I will explain further.
Session is for the connection which will include both tabs (for example why you can login to stackoverflow on one tab and then if you open a second tab you are still logged in)
As #Skuld mentioned, the session is for user connection to the site so if the user goes to another page he or she is allowed to go they can open this in a new tab keeping the original tab open, if these are form pages you might want to look at 14 AntiForgeryToken. also i noticed you said this happens in IE does this also happen in Chrome? if so you might want to look to see if IE is excepting cookies. you can add roles to the session and then authorize those roles to home1 or home 2 from your controller, you should be authorizing users and roles to pages in your code not within your session. its hard to help any more without any code to look at.
Hope this gets you on the right track.
Into an Universal windows app I want to check user's authentication during page load, or after that an user as navigated to. This permits me to offer a navigation filtered by authorizations with a single page granularity.
For example, if an user didn't login and a page requires authentication, user has to be redirected to a login page.
The problem comes when I try navigate to an other page from the OnNavigatedTo event, when previous navigation is not completed and the new fails. I've searched for other events like an OnNavigationCompleted, but I don't find anything. If I use an asynchronous method without waiting it works, as if I use a timer dispatcher, but both solutions doesn't sound like so clean.
Exists a method to handle an event raised after navigation completed or I have to pre-check authorization during navigation call? I hope to avoid this solution because a wrong call could show an unauthorized page.
If you really want a separate page according to this answer https://stackoverflow.com/a/19527979/4788286 you could probably use the loaded event. But I'd test it before just to make sure.
Sidenote: also, your question implies that you're doing business logic in the view codebehinds - this is bad practice, I suggest looking into the MVVM pattern. (If you need a framework I suggest MVVMLight or PRISM)
I think the precheck would be the best method. Check if they are authorized to view the page before they can navigate to the page. If they are not authorized ask if they want to log in or purchase rights to the page
I have a registration form completed and would like to add a profile picture upload. Once the user clicks the browse, he can select the photo. Then he clicks ok/apply/ok and then the photo is reflected in the thumbnail area without page refreshing.
Once the user is happy with all fields input he can submit the form and with it the photo of course.
Anything that does this exists out there already? If not, please provide guidance on how to establish this feature.
Thanks,
I'm not aware of a ready made solution for this but there probably is something :-)
However, with Laravel this is beautifully simple. You've tagged your question ajax but I'll answer this assuming you're going to use an old fashioned server round trip (i.e a form submit).
1) In your template, add a file element to the form. http://laravel.com/docs/html#file-input
2) Add some javascript to the page that detects when a file is selected and shows the preview. Extensive tutorial here: http://www.html5rocks.com/en/tutorials/file/dndfiles/
3) In your controller, handle the file using the Input facade. http://laravel.com/docs/requests#files
Can anyone help. I have created a small WP7 and its working the way i want it to.
It always asks the user for username and password to enter the application, I also have a button called "Remember Settings", if this is checked the next time the application is loaded i would like it to login autoamtically hence the user will not see the login screen and it will bypass this view and load another.
I need some way to load 1 xaml is the user credentials don't exist or are not valid and another the main app xaml if credential exists and are valid.
It appears that the loading of the page is hardcoded in the manifast. As you can see i am loading my LoginPage.
<Tasks>
<DefaultTask Name ="_default" NavigationPage="LoginPage.xaml"/>
</Tasks>
SO what would my best way of accomplishing this, I thought of changing creating xaml (entance file) where i could check in the constructor of my VIEWMODEL if the credentials exists etc and then do a navigateTo another page. But this feels like code smell..
Can anyone help with advise or examples of the best way of accomplishing this.
I am actually using MVVM Light but things should be pretty much the same?
Thanks in advance
You can do by storing user credentials in ISOLATED STORAGE of windows phone 7. Once User checks remember settings or credentials checkbox then you save these settings in isolated storage. And Next Time As Your Application Launches And Suppose Your Default Page is "MainPage.XAML". Then On This Page OnPageNavigated Event Check For User Settings. If Settings There Then Redirect To User on Other View (Logged View). Otherwise User Will Be On MainPage.xaml. And Logout Button You Can Clear These Settings..
Here is Good Example Here For ISOLATED Storage.
http://msdn.microsoft.com/en-us/library/ff769510%28v=vs.92%29.aspx
http://go.microsoft.com/fwlink/?LinkID=229120 (Example Code)
http://www.windowsphonegeek.com/tips/all-about-wp7-isolated-storage--intro-to-isolated-storage
Hope this will help you. :)
Try storing the username, password, authtokens or any other value which you need to check for authentication in settings.
On opening of login page, check the value of your token from settings in the OnNavigatedTo method. If its not null, it means user is already logged in, then you can redirect him to you Home screen else show the login page and ask him to enter the credentials.
Also don't forget to save the settings on app exit. Check this link below for further help
http://msdn.microsoft.com/en-us/library/ff769510(v=VS.92).aspx
On Logout, clear the tokens in the settings page
I would like to have a button that depending on where the user was on the site, it calls the appropriate controller and action.
I have a page with a back button.
People can arrive on that page trough:
a) link on the homepage.
OR
b) trough a link on another page (inside the same site).
If the user comes from the homepage, the back button should point to that controller and action.
If, however, the user comes from that other page, the back button should point to another controller and action.
How can we accomplish something like this?
Thanks a lot,
MEM
ps - History Back is of no use, because we cannot allow that button to link to an external site.
Well, if you can't use javascript to go back in the history, then you have an undefined case when some external site leads directly to the page. Let's assume that if the user arrived at the page via an external site, the back button should simply not appear.
Consider checking the $_SERVER['HTTP_REFERER'] and constructing the back button link based on that. Inspect the referer (parse_url() may be of particular service here), if it's not your domain, don't display the button, otherwise, pick someplace to send the user "back" to (probably just the whole referer URL).