dongluzhi5208 2011-07-12 18:48
浏览 69
已采纳

php登录重定向并登录到https(如gmail等)

I was hoping to create a php script that allows me to provide a person a link and give them specific login credentials. When the user goes to the page and logins I would then like it to redirect them to an https site like gmail and have it auto login with my creditials. It's kind of a round about way to allow someone to access my email without them knowing my password. I know this is probably a very dumb way of doing this but I'm new with php and am not sure how exactly I would accomplish this task or if its even php for that matter, haha.

This is the code I have to log in:

HTML:

<h1>Login</h1> 

<form name="form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> 
    <p><label for="txtUsername">Username:</label> 
    <br /><input type="text" title="Enter your Username" name="txtUsername" /></p>

    <p><label for="txtpassword">Password:</label> 
    <br /><input type="password" title="Enter your password" name="txtPassword" /></p> 

    <p><input type="submit" name="Submit" value="Login" /></p> 

</form> 

PHP:

<?php 

// Define your username and password 
$username = "admin"; 
$password = "password"; 

if ($_POST['txtUsername'] != $username || $_POST['txtPassword'] != $password) { 

?> 


<?php 

} 
else { 

?> 

website html

<?php 

} 

?>

I apologize for the horrible style and butchering the code but this is literally the first thing i've written in php. Also I've seen a good amount of posts related to what i'm asking but doesn't fully answer it. thanks!

  • 写回答

1条回答 默认 最新

  • duandanai6470 2011-07-12 18:52
    关注

    Don't do this!

    you're adding insecurity to your account for no reason. Google already has this feature under settings > Accounts and Import > Grant access to your account

    If you were to set up a page for someone to go to to log in as you, anyone who stumbled across your page could then have full access to your account. Granting access instead would just allow another user limited privileges to your account, and you'd always be able to prevent them from accessing it in the future.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥170 如图所示配置eNSP
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改
  • ¥20 wireshark抓不到vlan
  • ¥20 关于#stm32#的问题:需要指导自动酸碱滴定仪的原理图程序代码及仿真
  • ¥20 设计一款异域新娘的视频相亲软件需要哪些技术支持
  • ¥15 stata安慰剂检验作图但是真实值不出现在图上
  • ¥15 c程序不知道为什么得不到结果
  • ¥15 键盘指令混乱情况下的启动盘系统重装