简体   繁体   English

输入用户ID时如何将用户重定向到他的目录

[英]How can I redirect user to his directory when he enters his ID

Can anybody help me in making a input box where user enters his id and when he clicks on continue he will be redirected to his id folder on my website. 有人可以帮助我在用户输入ID的输入框中创建一个内容吗?当他单击继续时,他将被重定向到我网站上的ID文件夹中。 Like this: user opens website example.com and enters his id and click on continue then he will be redirected to exaple.com/(user id). 这样:用户打开网站example.com并输入其ID,然后单击“继续”,那么他将被重定向到exaple.com/(用户ID)。

Html Code : HTML代码:

<input type="text" name="userName" id="userName">
<button name="contiueButton" id="contiueButton"> Continue </button>

Jquery: jQuery:

$( document ).ready(function() {
    $("#contiueButton").on("click",function(){      
       var userName = $("#userName").val();
       //validate username like check empty, check exist in db 
       var url ="exaple.com/"+userName;
       window.location.href = url; 
    });
});

Try this: 尝试这个:

$userid = $_GET['id'];
mkdir($userid, 0700); // to create new directory
header("location=example.com/".$userid."/"); // to redirect

Happy Coding... 快乐编码...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在用户登录 php 后,我如何成功地将用户重定向到他所在的位置(他的当前页面)? - how can i successfully redirect user to where he was(his current page) after he logged in in php? 如何通过用户ID检查WordPress是否在线? - How can I check if a user is online in WordPress by his id? 我如何使用PHP和cron通知用户还剩15天的付款时间? - Using PHP & cron how can i inform a user that he has got 15 days more left to pay his amount? 标头用户登录时进入其个人资料页面 - Header user to his profile page when he logs in Tymon JWT:我如何通过他的 id 从经过身份验证的用户向另一个用户进行身份验证? - Tymon JWT: how can I authenticate from authenticated user with another user via his id? 用户单击电子邮件中的某些链接时如何登录我的Web应用程序 - How to log in user to my web application when he click on some link in his email 当用户进入主页(index.php)时,如何显示用户随机子网页? - How can I show the user random subwebpage when he enters my main page (index.php)? 如何知道用户是否使用其会话ID登录 - How to know if user is logged with his session id 如何将每个用户连接到他自己的数据库? - How Can I Connect Each User To His Own Database? htaccess将用户重定向到他的个人资料 - htaccess redirect user to his profile
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM