Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Redirect by username

Featured Replies

Hi there,

 

Firstly apologies if this is in the wrong section.

 

Here is what I would like to achieve, I want to have a login screen where you can enter a username/password and depending on the username/password entered it will direct you to a folder for that user

 

eg; user1 would log in and be directed to domain.com/user1

user2 would log in and be directed to domain.com/user2

 

also obviously, user2 shouldn't be able to change the address to domain.com/user1 and be allowed access to that folder and so on.

 

Please can anyone point me in the right direction for how to achieve this? I have been following a tutorial to create a login page but that directs to the same page for all users

 

EDIT: maybe this should be in the PHP section

 

here is part of the php code being used, i see where it directs to folder/index.php

is it possible here to add something like;

 

if user = user1 goto user1/index.php

if user = user2 goto user2/index.php

 

function validate_user($un, $pwd) {
	$mysql = New Mysql();
	$ensure_credentials = $mysql->verify_Username_and_Pass($un, md5($pwd));

	if($ensure_credentials) {
		$_SESSION['status'] = 'authorized';
		header("location: folder/index.php");
	} else return "Please enter a correct username and password";

} 

 

Sorry my php really isnt that great, also maybe should add the usernames / passwords are stored in a mysql db

 

Thanks

Edited by Jager616

  • 1 month later...

Why don't you use username as folder names to redirect?

 

your code will look like

 

function validate_user($un, $pwd) {
               $mysql = New Mysql();
               $ensure_credentials = $mysql->verify_Username_and_Pass($un, md5($pwd));

               if($ensure_credentials) {
                       $_SESSION['status'] = 'authorized';
                       header("location: $un/");
               } else return "Please enter a correct username and password";

       }

 

To create folder upon confirmed registration use mkdir.

mkdir("user_folders/$un",0777);

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.