I have one login page on site. I have 4 different tye of users and i want that when they login they go to different page based on their role assigned.
Is there any way?
I have one login page on site. I have 4 different tye of users and i want that when they login they go to different page based on their role assigned.
Is there any way?
You need to give the array_shift()
the parameter! Look this example:
$stack = array("orange", "banana", "apple", "raspberry");
$fruit = array_shift($stack); // Here you give the parameter
print_r($fruit);
You give the null parameter on array_shift()
and you need to change it!
Update:
array_shift()
shifts the first value of the array off and returns it, shortening the array by one element and moving everything down. All numerical array keys will be modified to start counting from zero while literal keys won't be touched. Read here for more
file_put_contents
creates the file if it doesn't exist, but it fails if you try to put the file in a directory that doesn't exist. So you should try the following:
images
directory exists$target_dir = '/home/ragiththomas/Sites/asco-forum/images/';
@Danial check this code
DatabaseReference rootRef = FirebaseDatabase.getInstance().getReference("users");
rootRef.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
for (DataSnapshot dataSnapshot:snapshot.getChildren()){
String mail=dataSnapshot.child("type").getValue().toString();
if (userType.equals("Buyer")) {
startActivity(new Intent(MainActivity.this,BuyerHomepage.class));
}
if(userType.equals("Seller")) {
startActivity(new Intent(MainActivity.this,SellerHomepage.class));
}
}
}
@Override
public void onCancelled(@NonNull DatabaseError error) {
}
});
Apache's mod_proxy could, in fact, do exactly what you want.
Its session-stickiness reads from cookie values; if all of the application servers know which server a user needs to go to (I'm not really clear on how the user distribution is decided, but we'll assume that it's stored or calculable), then it's simple.
Any server could give the user their server cookie on the first request. Say apache throws them to internal1
, but they should be on internal2
; the cookie can be something like SERVERID
set to server.internal2
. On the second request, with the below config, apache will see the cookie and send the user to the BalancerMember
backend that is attached to the route defined in the cookie.
<Proxy balancer://domain>
BalancerMember http://internal1.domain.com route=internal1
BalancerMember http://internal2.domain.com route=internal2
</Proxy>
ProxyPass / balancer://domain/ stickysession=SERVERID
ProxyPassReverse / balancer://domain/
One way to solve this is to use an event listener on the
security.interactive_login
event. In this case I simply attach another listener in that event listener so it will fire on the response. This lets the authentication still happen but still perform a redirect once complete.And the class...