editaccount.php 下载,edit_user.php

/**

* Silurus Classifieds Builder

*

*

* @authorSnowHall - http://snowhall.com

* @websitehttp://snowhall.com/silurus

* @emailsupport@snowhall.com

*

* @version2.0

* @dateMarch 7, 2013

*

* Silurus is a professionally developed PHP Classifieds script that was built for you.

* Whether you are running classifieds for autos, motorcycles, bicycles, rv's, guns,

* horses, or general merchandise, our product is the right package for you.

* It has template system and no limit to usage with free for any changes.

*

* Copyright (c) 2009-2013

*/

include("./include_php/init.php");

if($_SESSION['memberID'] == 0) header("location: index.php");

if($_SERVER['REQUEST_METHOD'] == 'POST')

{

$err = array();

$add_on = '';

if($_POST['Email'] != $_POST['Email2'])

$err['Email2'] = 1;

/*if(trim($_POST['fname']) == '')

$err['fname'] = 1;

if(trim($_POST['lname']) == '')

$err['lname'] = 1;

if(trim($_POST['city']) == '')

$err['city'] = 1;*/

if(trim($_POST['Email']) == '')

$err['Email'] = 1;

/*if(trim($_POST['zip']) == '')

$err['Zip'] = 1;*/

if($_POST['Password1'] != '' && $_POST['Password1'] != $_POST['Password2'])

$err['Password2'] = 1;

$us = mysql_numrows(mysql_query("select * from Profiles where ID<>".$_SESSION['memberID']." and Email='".mysql_escape_string($_POST['Email'])."'"));

if($us > 0 && $_POST['Email']!='')

{

$add_on = "Error: This E-mail already use
";

$err['Email'] = 1;

}

if(empty($err))

{

$collge = mysql_fetch_assoc(mysql_query("select * from City where Title = '".mysql_escape_string(trim($_POST['city']))."'"));

if(intval($collge['ID']) > 0)

$collgeid = intval($collge['ID']);

else

{

mysql_query("insert into City set Title='".mysql_escape_string(trim($_POST['city']))."'");

$collgeid = mysql_insert_id();

}

$Photo = '';

if( !$_FILES['Photo'] or empty( $_FILES['Photo'] ) )

$add_on .= report_err('File not uploaded');

else

{

if( $_FILES['Photo']['error'] != 0 )

$sActionText = 'File upload error
';

else

{

$aFileInfo = getimagesize( $_FILES['Photo']['tmp_name'] );

if( !$aFileInfo )

$sActionText = 'You uploaded not image file
';

else

{

$ext = false;

switch( $aFileInfo['mime'] )

{

case 'image/jpeg': $ext = 'jpg'; break;

case 'image/gif': $ext = 'gif'; break;

case 'image/png': $ext = 'png'; break;

}

if( !$ext )

$sActionText = 'You uploaded not JPEG, GIF or PNG file
';

else

{

$dir = "media/images/profile/".$_SESSION['memberID']."/";

if(!is_dir($dir)) mkdir($dir, 0755, true);

if(trim($_SESSION['memberINFO']['PrimPhoto'])!='' && trim($_SESSION['memberINFO']['PrimPhoto'])!='0')

$newFileName = $_SESSION['memberINFO']['PrimPhoto'];

else

$newFileName = time().'.'.$ext;

if( !move_uploaded_file( $_FILES['Photo']['tmp_name'], $dir.'photo_'.$newFileName ) )

$sActionText = 'Couldn\'t download file.';

else

{

imageResize( $dir.'photo_'.$newFileName, $dir.'thumb_'.$newFileName,200);

$Photo = "PrimPhoto='$newFileName',";

}

}

}

}

}

mysql_query("update `Profiles` SET

fname='".mysql_escape_string($_POST['fname'])."',

lname='".mysql_escape_string($_POST['lname'])."',

Email='".mysql_escape_string($_POST['Email'])."',

".($_POST['Password1'] != ''?"Password='".mysql_escape_string($_POST['Password1'])."',":"")."

zip='".mysql_escape_string($_POST['zip'])."',

city=".$collgeid.",

$Photo

LastModified=".time().",

intro='".mysql_escape_string($_POST['intro'])."',

note='".mysql_escape_string($_POST['note'])."',

altemail='".mysql_escape_string($_POST['altemail'])."',

phone='".mysql_escape_string($_POST['phone'])."',

cell='".mysql_escape_string($_POST['cell'])."',

aim='".mysql_escape_string($_POST['aim'])."',

skype='".mysql_escape_string($_POST['skype'])."',

phone_none='".intval($_POST['phone_none'])."',

cell_none='".intval($_POST['cell_none'])."',

aim_none='".intval($_POST['aim_none'])."',

altemail_none='".intval($_POST['altemail_none'])."',

skype_none='".intval($_POST['skype_none'])."'

where ID=".$_SESSION['memberID']);

$_SESSION['memberINFO'] = mysql_fetch_assoc(mysql_query("select * from Profiles where ID=".$_SESSION['memberID']));

header("location: profile.php"); die();

}

$smarty->assign("error", $err);

$smarty->assign("t_error", $add_on);

}

else

{

$_REQUEST = $_SESSION['memberINFO'];

$_REQUEST['Email2'] = $_REQUEST['Email'];

$city = mysql_fetch_assoc(mysql_query("select * from City where ID=".intval($_REQUEST['city'])));

$_REQUEST['city'] = $city['Title'];

}

addNavigation('profile.php','My Profile');

addNavigation('','Edit My Account Information');

$smarty->assign("site_title", 'Edit My Account Information'." :: ".$gConfig['site_title']);

$smarty->assign("HEADERTEXT", 'Edit My Account Information');

show_smarty_template('edit_user');

?>

一键复制

编辑

Web IDE

原始数据

按行查看

历史

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
资源包主要包含以下内容: ASP项目源码:每个资源包中都包含完整的ASP项目源码,这些源码采用了经典的ASP技术开发,结构清晰、注释详细,帮助用户轻松理解整个项目的逻辑和实现方式。通过这些源码,用户可以学习到ASP的基本语法、服务器端脚本编写方法、数据库操作、用户权限管理等关键技术。 数据库设计文件:为了方便用户更好地理解系统的后台逻辑,每个项目中都附带了完整的数据库设计文件。这些文件通常包括数据库结构图、数据表设计文档,以及示例数据SQL脚本。用户可以通过这些文件快速搭建项目所需的数据库环境,并了解各个数据表之间的关系和作用。 详细的开发文档:每个资源包都附有详细的开发文档,文档内容包括项目背景介绍、功能模块说明、系统流程图、用户界面设计以及关键代码解析等。这些文档为用户提供了深入的学习材料,使得即便是从零开始的开发者也能逐步掌握项目开发的全过程。 项目演示与使用指南:为帮助用户更好地理解和使用这些ASP项目,每个资源包中都包含项目的演示文件和使用指南。演示文件通常以视频或图文形式展示项目的主要功能和操作流程,使用指南则详细说明了如何配置开发环境、部署项目以及常见问题的解决方法。 毕业设计参考:对于正在准备毕业设计的学生来说,这些资源包是绝佳的参考材料。每个项目不仅功能完善、结构清晰,还符合常见的毕业设计要求和标准。通过这些项目,学生可以学习到如何从零开始构建一个完整的Web系统,并积累丰富的项目经验。
资源包主要包含以下内容: ASP项目源码:每个资源包中都包含完整的ASP项目源码,这些源码采用了经典的ASP技术开发,结构清晰、注释详细,帮助用户轻松理解整个项目的逻辑和实现方式。通过这些源码,用户可以学习到ASP的基本语法、服务器端脚本编写方法、数据库操作、用户权限管理等关键技术。 数据库设计文件:为了方便用户更好地理解系统的后台逻辑,每个项目中都附带了完整的数据库设计文件。这些文件通常包括数据库结构图、数据表设计文档,以及示例数据SQL脚本。用户可以通过这些文件快速搭建项目所需的数据库环境,并了解各个数据表之间的关系和作用。 详细的开发文档:每个资源包都附有详细的开发文档,文档内容包括项目背景介绍、功能模块说明、系统流程图、用户界面设计以及关键代码解析等。这些文档为用户提供了深入的学习材料,使得即便是从零开始的开发者也能逐步掌握项目开发的全过程。 项目演示与使用指南:为帮助用户更好地理解和使用这些ASP项目,每个资源包中都包含项目的演示文件和使用指南。演示文件通常以视频或图文形式展示项目的主要功能和操作流程,使用指南则详细说明了如何配置开发环境、部署项目以及常见问题的解决方法。 毕业设计参考:对于正在准备毕业设计的学生来说,这些资源包是绝佳的参考材料。每个项目不仅功能完善、结构清晰,还符合常见的毕业设计要求和标准。通过这些项目,学生可以学习到如何从零开始构建一个完整的Web系统,并积累丰富的项目经验。
好的,我会为您提供一个基于对话框的银行账户管理程序的示例代码。这个程序不使用数据库,而是使用文件来保存账户信息。 首先,我们需要创建一个 MFC 对话框应用程序,并添加以下控件:2 个按钮(登录和创建账号)、4 个编辑框(账号、姓名、余额、身份证号码)、1 个组合框(操作类型)、2 个按钮(确定和取消)。 下面是程序的具体步骤: 1. 定义账户信息结构体 我们需要定义一个结构体来存储账户信息,包括账号、姓名、余额和身份证号码。在本程序中,我们使用一个文件来保存账户信息,每个账户信息占用一行,每个字段之间用逗号分隔。 ```c++ struct AccountInfo { CString account; CString name; double balance; CString idNumber; }; ``` 2. 实现登录和创建账号功能 点击登录按钮时,程序会检查输入的账号是否存在于账户文件中,并且密码是否正确。如果账号不存在,则提示用户创建新账号。点击创建账号按钮时,程序会生成一个新的唯一的账号,并且将账号信息保存到文件中。 ```c++ void CAccountManagerDlg::OnBnClickedBtnLogin() { // 获取输入的账号和密码 CString account, password; m_editAccount.GetWindowText(account); m_editPassword.GetWindowText(password); // 检查账号是否存在 if (!IsAccountExist(account)) { if (AfxMessageBox(_T("账号不存在,是否创建新账号?"), MB_YESNO) == IDYES) { // 创建新账号 CString newAccount = GenerateNewAccount(); AccountInfo newInfo; newInfo.account = newAccount; newInfo.name = _T(""); newInfo.balance = 0; newInfo.idNumber = _T(""); SaveAccountInfo(newInfo); m_editAccount.SetWindowText(newAccount); } else { return; } } // 检查密码是否正确 AccountInfo info; if (GetAccountInfo(account, info) && info.password == password) { // 登录成功,显示操作界面 m_editAccount.EnableWindow(FALSE); m_editPassword.EnableWindow(FALSE); m_btnLogin.EnableWindow(FALSE); m_btnCreate.EnableWindow(FALSE); m_comboOperation.EnableWindow(TRUE); m_editAmount.EnableWindow(TRUE); m_btnOk.EnableWindow(TRUE); m_btnCancel.EnableWindow(TRUE); } else { // 密码错误 AfxMessageBox(_T("密码错误")); } } CString CAccountManagerDlg::GenerateNewAccount() { // 生成一个唯一的账号,规则为 A0001、A0002、A0003... CString newAccount; int maxAccount = 0; for (auto& account : m_accounts) { int num = _ttoi(account.account.Mid(1)); if (num > maxAccount) { maxAccount = num; } } newAccount.Format(_T("A%04d"), maxAccount + 1); return newAccount; } ``` 3. 实现存款、取款和查询功能 当用户选择操作类型时,程序会根据选中的操作类型设置相应的控件状态(例如,当选择存款时,金额编辑框应该是可用的)。当用户点击确定按钮时,程序会根据选中的操作类型执行相应的操作。 ```c++ void CAccountManagerDlg::OnCbnSelchangeComboOperation() { // 根据操作类型设置控件状态 int index = m_comboOperation.GetCurSel(); switch (index) { case 0: // 存款 m_editAmount.EnableWindow(TRUE); m_editAmount.SetWindowText(_T("")); break; case 1: // 取款 m_editAmount.EnableWindow(TRUE); m_editAmount.SetWindowText(_T("")); break; case 2: // 查询 m_editAmount.EnableWindow(FALSE); break; } } void CAccountManagerDlg::OnBnClickedBtnOk() { // 获取当前选中的操作类型 int index = m_comboOperation.GetCurSel(); switch (index) { case 0: // 存款 Deposit(); break; case 1: // 取款 Withdraw(); break; case 2: // 查询 Query(); break; } } void CAccountManagerDlg::Deposit() { // 获取存款金额 double amount = GetAmount(); if (amount <= 0) { AfxMessageBox(_T("请输入正确的金额")); return; } // 更新账户余额 CString account; m_editAccount.GetWindowText(account); AccountInfo info; if (!GetAccountInfo(account, info)) { AfxMessageBox(_T("账号不存在")); return; } info.balance += amount; SaveAccountInfo(info); AfxMessageBox(_T("存款成功")); } void CAccountManagerDlg::Withdraw() { // 获取取款金额 double amount = GetAmount(); if (amount <= 0) { AfxMessageBox(_T("请输入正确的金额")); return; } // 更新账户余额 CString account; m_editAccount.GetWindowText(account); AccountInfo info; if (!GetAccountInfo(account, info)) { AfxMessageBox(_T("账号不存在")); return; } if (info.balance < amount) { AfxMessageBox(_T("余额不足")); return; } info.balance -= amount; SaveAccountInfo(info); AfxMessageBox(_T("取款成功")); } void CAccountManagerDlg::Query() { // 显示账户信息 CString account; m_editAccount.GetWindowText(account); AccountInfo info; if (!GetAccountInfo(account, info)) { AfxMessageBox(_T("账号不存在")); return; } CString message; message.Format(_T("账号:%s\n姓名:%s\n余额:%.2f\n身份证号码:%s"), info.account, info.name, info.balance, info.idNumber); AfxMessageBox(message); } double CAccountManagerDlg::GetAmount() { // 获取金额输入框中的值 CString amountStr; m_editAmount.GetWindowText(amountStr); return _ttof(amountStr); } ``` 4. 实现文件读写功能 我们需要实现两个函数来读取和保存账户信息。这些函数使用逗号分隔的文本格式来保存账户信息。 ```c++ bool CAccountManagerDlg::GetAccountInfo(LPCTSTR account, AccountInfo& info) { // 从文件中读取账户信息 std::ifstream ifs(m_filePath); if (!ifs) { return false; } std::string line; while (std::getline(ifs, line)) { std::istringstream iss(line); std::string acc, name, balance, idNumber, password; std::getline(iss, acc, ','); std::getline(iss, name, ','); std::getline(iss, balance, ','); std::getline(iss, idNumber, ','); std::getline(iss, password, ','); if (CString(acc.c_str()) == account) { info.account = acc.c_str(); info.name = name.c_str(); info.balance = _ttof(CString(balance.c_str())); info.idNumber = idNumber.c_str(); info.password = password.c_str(); return true; } } return false; } bool CAccountManagerDlg::SaveAccountInfo(const AccountInfo& info) { // 将账户信息保存到文件中 std::ofstream ofs(m_filePath, std::ios::app); if (!ofs) { return false; } ofs << CT2A(info.account) << "," << CT2A(info.name) << "," << info.balance << "," << CT2A(info.idNumber) << "," << CT2A(info.password) << std::endl; return true; } ``` 完整的代码如下:
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值