2013-05-17 161 views
-3

我不知道你们是否熟悉Pancake App(Self Hosted Invoicing)我正在尝试制作一个脚本,允许我的客户从我的登录屏幕登录他们的帐户网页。 (我想我只需要一个全新的脚本,修复补丁只是提供了越来越多的错误后:(PHP登录脚本并重定向

我有这样的脚本,我拼凑起来的,但它返回的错误:

<?php 
$con=mysqli_connect("example.com","exampleuser","examplepass","db_name"); 
// Check connection 
if (mysqli_connect_errno()) 
    { 
    echo "Failed to connect to MySQL: " . mysqli_connect_error(); 
    } 

$result = mysqli_query($con,"SELECT * FROM mypanda_clients 
WHERE unique_id='$_POST[username]'"); 

while($row = mysqli_fetch_array($result)) 
    { 
    if ($_POST[password] == $ROW[password]) 
    { 
    header('Location: http://www.green-panda.com/my_panda/Clients/$_POST[username]); 
    } 
    else 
    { 
    echo "The username and or password was incorrect. Please try again." 
    } 
    } 
?> 

错误被返回是:

Parse error: syntax error, unexpected '}', expecting ',' or ';' in /home/content/38/10473938/html/website/panda/login.php on line 21 

我需要这个脚本

  1. 匹配的用户名与在该UNIQUE_ID数据库
  2. 验证密码UNIQUE_ID
  3. 转发用户匹配:http://www.green-panda.com/my_panda/Clients/ “UNIQUE_ID”

任何帮助将不胜感激!

+0

你刚刚更新的问题,以消除标识的错误下面的答案?如果是这样,请不要这样做。它使所有的答案无效,并使这个问题对将来的网站访问者无用。 –

+0

有没有办法解除编辑?我不是故意用我复制和粘贴的解决方案来更新答案,但没有意识到我有过。 – user2371301

回答

2

两个错别字:

header('Location: http://www.green-panda.com/my_panda/Clients/'.$_POST[username]); // concatenate the string 

echo "The username and or password was incorrect. Please try again."; // missing semi colon 
0

你缺少'在这里,我想......

header('Location: http://www.green-panda.com/my_panda/Clients/$_POST[username]);