jQTouch和PHP登录表单

时间:2010-08-26 05:32:42

标签: php jqtouch

我正在使用jQTouch框架为iPhone开发Web应用程序。我找到了一个类似于我想要如何设置登录页面的例子:

http://www.golen.net/blog/2010/05/29/jqtouch-ajax-php-login-form/

并已下载示例php文件: http://www.golen.net/blog/wp-content/uploads/2010/05/jqtouch.zip

在此博客附带的视频3中,它显示除非您单击登录链接,否则不会显示登录表单。但是我已经下载了这些文件并将它们上传到我的两台服务器中,无论我是否登录,登录表格总是出现。据我所知,可下载的php文件与视频中的内容相同,但我无法阻止登录表单一直显示。

任何人都有任何想法。这是index.php页面,其中包含登录表单:

<?php

$ loggedIn =(isset($ _ COOKIE ['loggedin'])&amp;&amp; $ _COOKIE ['loggedin'] =='true')?true:false; ?&GT;              

    <title>jQTouch &beta;</title>
    <style type="text/css" media="screen">@import "jqtouch/jqtouch.css";</style>
    <style type="text/css" media="screen">@import "themes/jqt/theme.css";</style>
    <script src="jqtouch/jquery-1.4.2.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="jqtouch/jqtouch.js" type="application/x-javascript" charset="utf-8"></script>
    <script type="text/javascript" charset="utf-8">
        var jQT = new $.jQTouch({
            icon: 'jqtouch.png',
            addGlossToIcon: false,
            startupScreen: 'jqt_startup.png',
            statusBar: 'black',
            preloadImages: [
                'themes/jqt/img/back_button.png',
                'themes/jqt/img/back_button_clicked.png',
                'themes/jqt/img/button_clicked.png',
                'themes/jqt/img/grayButton.png',
                'themes/jqt/img/whiteButton.png',
                'themes/jqt/img/loading.gif'
                ]
        });
        // Some sample Javascript functions:
        $(function(){
        });
    </script>
</head>
<body>
    <div id="jqt">
        <div id="home">
            <div class="toolbar">
                <h1>Welcome</h1>
                <a class="back" href="#home">Home</a>
            </div>
            <?php if (!$loggedIn) {?>
            <ul class="rounded">
                <li class="forward"><a href="#login">Log In</a></li>
            </ul>
            <?php } else { ?>
            <ul class="rounded">
                <li class="forward"><a href="doLogoff.php" rel="external">Log off</a></li>
            </ul>
            <?php } ?>
        </div>
        <form id="login" action="doLogin.php" method="POST" class="form">
            <div class="toolbar">
                <h1>Login</h1>
                <a class="back" href="#">Back</a>
            </div>
            <ul class="rounded">
                <li><input type="text" name="username" value="" placeholder="Username" /></li>
                <li><input type="password" name="password" value="" placeholder="Password" /></li>
            </ul>
            <a style="margin:0 10px;color:rgba(0,0,0,.9)" href="#" class="submit whiteButton">Submit</a>
        </form>
    </div>
</body>

1 个答案:

答案 0 :(得分:1)

你只需稍微修改一下代码...删除jqt div,并输入一个div id&#39; ed&#34; login ...就像这样:

<body>

        <div id="home">
            <div class="toolbar">
                <h1>Welcome</h1>
                <a class="back" href="#home">Home</a>
            </div>
            <?php if (!$loggedIn) {?>
            <ul class="rounded">
                <li class="forward"><a href="#login">Log In</a></li>
            </ul>
            <?php } else { ?>
            <ul class="rounded">
                <li class="forward"><a href="doLogoff.php" rel="external">Log off</a></li>
            </ul>
            <?php } ?>
        </div>

     <div id="login">
        <form id="login" action="doLogin.php" method="POST" class="form">
            <div class="toolbar">
                <h1>Login</h1>
                <a class="back" href="#">Back</a>
            </div>
            <ul class="rounded">
                <li><input type="text" name="username" value="" placeholder="Username" /></li>
                <li><input type="password" name="password" value="" placeholder="Password" /></li>
            </ul>
            <a style="margin:0 10px;color:rgba(0,0,0,.9)" href="#" class="submit whiteButton">Submit</a>
        </form>
    </div>

</body>

希望能帮到你: - )