} else { $PdoMySQL->delete($table, 'id=' . $lastInsertId); echo '注册失败,请重新注册'; echo '3秒钟后跳转到注册页面'; echo '<meta http-equiv="refresh" content="3;url=index.php#toregister"/>'; } } catch (Swift_ConnectionException $e) { echo '邮件发送错误' . $e->getMessage(); } } else { echo '用户注册失败,3秒钟后跳转到注册页面'; echo '<meta http-equiv="refresh" content="3;url=index.php#toregister"/>'; } } elseif ($act === 'login') { //完成登陆的功能 $row = $PdoMySQL->find($table, "username='******' AND password='******'", 'status'); if ($row['status'] == 0) { echo '请先激活在登陆'; echo '<meta http-equiv="refresh" content="3;url=index.php#tologin"/>'; } else { echo '登陆成功,3秒钟后跳转到首页'; echo '<meta http-equiv="refresh" content="3;url=http://www.imooc.com"/>'; } } elseif ($act === 'active') { $token = addslashes($_GET['token']); $row = $PdoMySQL->find($table, "token='{$token}' AND status=0", array('id', 'token_exptime')); $now = time(); if ($now > $row['token_exptime']) { echo '激活时间过期,请重新登陆激活'; } else { $res = $PdoMySQL->update(array('status' => 1), $table, 'id=' . $row['id']);