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.

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

报告相同问题?

悬赏问题

  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭