小编Dan*_*ves的帖子

自动移动网站重定向

我刚刚创建了我的第一个jQuery移动网站.

我想让那些用手机查看我的"完整网站"的人自动转移到"移动网站".但也可以单击链接以查看完整站点(如果需要).

我不知道从哪里开始.我可以使用一些JavaScript吗?

如果您想查看网站的外观,请访问以下网站:http://www.solera-restaurant.com,移动网站仍在我的测试服务器上:http://graves-incorporated.com/test_sites/solera_mobile /

html javascript css css3 jquery-mobile

13
推荐指数
3
解决办法
6万
查看次数

如何防止php/mysql中重复的用户名

(这是我第一次尝试使用php)

我有一个非常基本的注册页面. http://graves-incorporated.com/test_sites/member_test/register/register.php

*我只记得PHP代码没有出现在源代码中,所以这里是:

enter code here
<?php
include('connection.php');

if(isset($_POST['form'])){
    if(empty($_POST['username']) || empty($_POST['password']) || empty($_POST['conf_pass']) || empty($_POST['email'])){
        echo '<b>Please fill out all fields.</b>';

    }elseif($_POST['password'] != $_POST['conf_pass']){
        echo '<b>Your Passwords do not match.</b>';
    }else{
        $url = 'http://graves-incorporated.com/test_sites/plantation_park_2012/';
        echo '<META HTTP-EQUIV=Refresh CONTENT="2; URL='.$url.'">';
        echo '<b>Congrats, You are now Registered.</b>';
        mysql_query("INSERT INTO users VALUES(NULL, '$_POST[username]', '$_POST[password]', '$_POST[email]')");     
    }
}
?>
Run Code Online (Sandbox Code Playgroud)

我想确保我没有在数据库中获得重复的用户和/或电子邮件地址.我在MySQL中为用户名和电子邮件设置了一个唯一密钥,这可以防止它,但是实际表单上的用户不知道,它仍然告诉他们"恭喜,你已经注册"或者其他什么......哈哈

那么我可以添加到php代码(以及代码中的哪个位置)来阻止这种情况呢?

感谢帮助这个主要的菜鸟,丹格雷夫斯

php mysql registration duplicates

0
推荐指数
1
解决办法
1万
查看次数

标签 统计

css ×1

css3 ×1

duplicates ×1

html ×1

javascript ×1

jquery-mobile ×1

mysql ×1

php ×1

registration ×1