Skip to content

Commit

Permalink
9.0 Stable
Browse files Browse the repository at this point in the history
  • Loading branch information
secret715 committed Mar 30, 2016
1 parent 097cf4b commit 7092adc
Show file tree
Hide file tree
Showing 91 changed files with 4,032 additions and 5,629 deletions.
33 changes: 32 additions & 1 deletion Connections/SQL-sample.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,36 @@
<?php
/*
<Secret Center, open source member management system>
Copyright (C) 2012-2016 Secret Center開發團隊 <http://center.gdsecret.net/#team>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, version 3.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<http://www.gnu.org/licenses/>.
*/

if(!@$includepath){
set_include_path('include/');
}
Expand All @@ -13,4 +45,3 @@
global $SQL;
$SQL = new Database($hostname_SQL,$username_SQL,$password_SQL,$database_SQL);
$SQL->query("SET NAMES 'utf8'");
?>
35 changes: 33 additions & 2 deletions Connections/SQL.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,47 @@
<?php
/*
<Secret Center, open source member management system>
Copyright (C) 2012-2016 Secret Center開發團隊 <http://center.gdsecret.net/#team>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, version 3.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<http://www.gnu.org/licenses/>.
*/

if(!@$includepath){
set_include_path('include/');
}
error_reporting(E_ALL);
require_once('database.php');

$database_SQL = "sc8.0";//資料庫名稱
$database_SQL = "center";//資料庫名稱
$username_SQL = "root";//連線帳號
$password_SQL = "usbw";//連線密碼
$hostname_SQL = "127.0.0.1";//MySQL伺服器

global $SQL;
$SQL = new Database($hostname_SQL,$username_SQL,$password_SQL,$database_SQL);
$SQL->query("SET NAMES 'utf8'");
?>
172 changes: 100 additions & 72 deletions account.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,36 @@
<?php
/*
<Secret Center, open source member management system>
Copyright (C) 2012-2016 Secret Center開發團隊 <http://center.gdsecret.net/#team>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, version 3.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<http://www.gnu.org/licenses/>.
*/

require_once('Connections/SQL.php');
require_once('config.php');
require_once('include/view.php');
Expand All @@ -8,112 +40,108 @@
exit;
}

$view = new View('view/new_theme.html','include/nav.php',$center['site_name'],'我的帳號');
$view->addScript("https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js");
$view->addScript("include/js/channel.js");
$view->addScript("include/js/notice.js");
$view->addScript("include/js/jquery.validate.js");

$member = sc_get_member_data($_SESSION['Center_Username']);

$_member = sc_get_result("SELECT * FROM `member` WHERE `id` = '%d'",array($_SESSION['Center_Id']));

if(isset($_POST['email'])&& filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)){
if($_POST['web_site']!='' && !filter_var($_POST['web_site'], FILTER_VALIDATE_URL)){
$_web_site=$member['row']['web_site'];
$_web_site=$_member['row']['web_site'];
}else{
$_web_site=$_POST['web_site'];
}
if($_POST['password'] == ''){
$pass = $member['row']['password'];
}
else {
$pass = sc_password($_POST['password'], $member['row']['name']);
$_password = $_member['row']['password'];
}else {
$_password = sc_password($_POST['password'], $_member['row']['username']);
}

$SQL->query("UPDATE member SET password = '%s', email = '%s', web_site = '%s' WHERE name = '%s'",array(
$pass,
$_POST['email'],
$_web_site,
$_SESSION['Center_Username']
));
$SQL->query("UPDATE `member` SET `password` = '%s', `email` = '%s', `web_site` = '%s' WHERE `id` = '%d'",array($_password,$_POST['email'],$_web_site,$_SESSION['Center_Id']));
header("Location: account.php?ok");
}


$view = new View('include/theme/default.html','include/nav.php',NULL,$center['site_name'],'我的帳號');
$view->addScript("include/js/notice.js");
?>
<script type="text/javascript">
<script>
$(function(){
$("#form1").validate({
rules:{
authpassword:{equalTo: "#password"},
email:{required:true,email:true},
web_site:{url:true},
},
messages:{
authpassword:{equalTo: "密碼不一致"},
$('input[name="authpassword"]').on('keyup', function(){
var $_error_msg=$(this).parent().siblings('.help-block');
if($(this).val()!=$('input[name="password"]').val()){
$_error_msg.html('<span class="text-danger">密碼不一致</span>');
$('input[type="submit"]').attr('disabled','disabled');
}else{
$_error_msg.html('');
$('input[type="submit"]').attr('disabled',false);
}
});
}).parent().parent().append('<div class="col-sm-3 help-block"></div>');
});
</script>
<div class="main">
<?php if(isset($_GET['ok'])){?>
<div class="alert alert-success">修改成功!</div>
<?php } ?>
<h2 class="subtitle">我的帳號</h2>
<div class="row-fluid">
<div class="span3 text-center">
<img src="include/avatar.php?id=<?php echo $member['row']['name']; ?>" class="avatar">
<p><a href="avatar.php">修改頭像</a></p>
<h2 class="page-header">我的帳號</h2>
<div class="row">
<div class="col-sm-3 text-center">
<img src="<?php echo sc_avatar_url($_member['row']['id']); ?>" class="avatar">
<p><a href="avatar.php">修改頭貼</a></p>
</div>
<div class="span9">
<form id="form1" name="form1" action="account.php" method="POST" class="form-horizontal">
<div class="control-group">
<label class="control-label">帳號:</label>
<div class="controls"><?php echo htmlspecialchars($member['row']['name']); ?></div>
<div class="col-sm-9">
<form class="form-horizontal form-sm" action="account.php" method="POST">
<div class="form-group">
<label class="col-sm-3 control-label">帳號:</label>
<div class="col-sm-6">
<p class="form-control-static"><?php echo $_member['row']['username']; ?></p>
</div>
</div>
<div class="control-group">
<label class="control-label" for="password">密碼:</label>
<div class="controls">
<input name="password" type="password" class="input-large" id="password" maxlength="30">
<div class="form-group">
<label class="col-sm-3 control-label" for="username">密碼:</label>
<div class="col-sm-6">
<input class="form-control" name="password" type="password" maxlength="30">
</div>
</div>
<div class="control-group">
<label class="control-label" for="authpassword">確認密碼:</label>
<div class="controls">
<input name="authpassword" type="password" id="authpassword" class="input-large" maxlength="30" />
<div class="form-group">
<label class="col-sm-3 control-label" for="authpassword">確認密碼:</label>
<div class="col-sm-6">
<input class="form-control" name="authpassword" type="password">
</div>
</div>
<div class="control-group">
<label class="control-label" for="email">* 電子信箱:</label>
<div class="controls">
<input name="email" type="text" id="email" class="input-large" maxlength="255" value="<?php echo $member['row']['email']; ?>" />
<div class="form-group">
<label class="col-sm-3 control-label" for="email">* 電子信箱:</label>
<div class="col-sm-6">
<input class="form-control" name="email" type="email" maxlength="255" required="required" value="<?php echo $_member['row']['email']; ?>">
</div>
</div>
<div class="control-group">
<label class="control-label" for="web_site">個人網站:</label>
<div class="controls">
<input name="web_site" type="text" id="web_site" class="input-large" maxlength="255" value="<?php echo $member['row']['web_site']; ?>" />
<div class="form-group">
<label class="col-sm-3 control-label" for="web_site">個人網站:</label>
<div class="col-sm-6">
<input class="form-control" name="web_site" type="text" maxlength="255" value="<?php echo $_member['row']['web_site']; ?>">
</div>
</div>
<div class="control-group">
<label class="control-label">權限:</label>
<div class="controls"><?php echo sc_member_level($member['row']['level']); ?></div>
<div class="form-group">
<label class="col-sm-3 control-label">權限:</label>
<div class="col-sm-6">
<p class="form-control-static"><?php echo sc_member_level($_member['row']['level']); ?></p>
</div>
</div>
<div class="control-group">
<label class="control-label">註冊日期:</label>
<div class="controls"><?php echo $member['row']['joined']; ?></div>
<div class="form-group">
<label class="col-sm-3 control-label">註冊日期:</label>
<div class="col-sm-6">
<p class="form-control-static"><?php echo $_member['row']['joined']; ?></p>
</div>
</div>
<div class="control-group">
<label class="control-label">最後登入:</label>
<div class="controls"><?php echo $member['row']['last_login']; ?></div>
<div class="form-group">
<label class="col-sm-3 control-label">最後登入:</label>
<div class="col-sm-6">
<p class="form-control-static"><?php echo $_member['row']['last_login']; ?></p>
</div>
</div>
<div class="control-group">
<div class="controls">
<input name="button" type="submit" id="botton" class="btn btn-success btn-large" value="確認修改" />
<div class="form-group">
<div class="col-sm-offset-3 col-sm-6">
<input class="btn btn-success btn-lg" type="submit" value="確認修改">
</div>
</div>
</div>
<div class="clearfix"></div>
</form>
</div>
</form>
</div>
</div>
<?php
$view->render();
Expand Down
Loading

0 comments on commit 7092adc

Please sign in to comment.