[ Поиск ] - [ Пользователи ] - [ Календарь ]
Полная Версия: система помощи
ozone
Добрый вечер, кто может дать мне сценарий кузниц, что вы меня не любите очень много в программировании Буду признателен Вам за bezkraino пожалуйста, помогите.
Вот вопрос:
Это сценарий входа, если вы можете перестроить его ко мне, чтобы изменить свой пароль: вместо того, чтобы делать регистрацию
Теперь поля:
имя учетной записи
пароль
Повторить пароль
адрес электронной почты.

Если вы можете переделать это как следует я очень благодарен.
стать:

имя учетной записи
Старый пароль
Новый пароль
повторите новый пароль
адрес электронной почты

то есть идея, чтобы изменить пароль спасибо заранее!

<?php
// ------------------------------------------------------------------------------------------ //
// //
// The Player vs Player Gaming Network //
// Web Account Creation Script //
// //
// Copyright © 2004 by U-238 //
// http://pvpgn-phputils.sourceforge.net //
// //
// ------------------------------------------------------------------------------------------ //
// //
// LICENSE //
// //
// This program is free software; you can redistribute it and/or modify it under the terms of //
// the GNU General Public License (GPL) as published by the Free Software Foundation; either //
// version 2 of the License, or (at your option) any later version. //
// //
// 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 General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License along with this program; //
// if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, //
// MA 02111-1307 USA //
// //
// This software is for non-commercial use only. //
// //
// ------------------------------------------------------------------------------------------ //
// //
// CHANGELOG //
// //
// v0.1 //
// - Initial Release //
// //
// ------------------------------------------------------------------------------------------ //
// //
// Please see config.php for configuration options. It's also a good idea to read ReadMe.txt //
// Do not edit this file unless you are experienced in PHP and you know what you're doing!!!! //
// //
// ------------------------------------------------------------------------------------------ //


include("config.php");
include("language.php");
include("pvpgn_hash.php");

define("__VERSION","v0.1");
define("__THEME",$theme);

function parse_theme($theme_file, $page_data) {
$filepath = "themes/" . __THEME . "/" . $theme_file;
if (!file_exists($filepath) || !is_file($filepath)) {
error(0,str_replace("[filename]",$filepath,__MISSINGFILE),"");
}
$fp = @fopen($filepath,"r") or error(0,str_replace("[filename]",$filepath,__FOPENERROR),"");
$size = filesize($filepath);
$content = fread($fp,$size);
fclose($fp);
foreach($page_data as $key => $val) {
// echo "Key: {$key}, Value: {$val}\n";
$content = str_replace("[[" . $key . "]]",$val,$content);
}
$content = str_replace("[[version]]",__VERSION,$content);
return $content;
}

function parse_error_theme($theme_file, $page_data) {
$filepath = "themes/" . __THEME . "/" . $theme_file;
if (!file_exists($filepath) || !is_file($filepath)) {
errorstandalone($page_data);
}
$fp = @fopen($filepath,"r") or errorstandalone($page_data);
$size = filesize($filepath);
$content = fread($fp,$size);
fclose($fp);
foreach($page_data as $key => $val) {
// echo "Key: {$key}, Value: {$val}\n";
$content = str_replace("[[" . $key . "]]",$val,$content);
}
$content = str_replace("[[version]]",__VERSION,$content);
return $content;
}

function error($mysql, $errormsg, $sqlerrormsg) {
if ($mysql) {
$page_data = array(
"errormsg" => $errormsg,
"sqlerrormsg" => $sqlerrormsg);
echo parse_error_theme("sql_error.htm", $page_data);
} else {
$page_data = array(
"errormsg" => $errormsg);
echo parse_error_theme("error.htm", $page_data);
}
die();
}

function errorstandalone($page_data) {
if ($page_data['sqlerrormsg']) {
echo "<HTML>\r\n";
echo "<HEAD>\r\n";
echo " <TITLE>PvPGN Web Account Creation Script :: MySQL Error</TITLE>\r\n";
echo "</HEAD>\r\n";
echo "<BODY>\r\n";
echo "<P>\r\n";
echo " <CENTER><H3>MySQL Error: " . $page_data['errormsg'] . "</H3></CENTER>\r\n";
echo "</P>\r\n";
echo "<P>\r\n";
echo " <CENTER>MySQL said: " . $page_data['sqlerrormsg'] . "</CENTER>\r\n";
echo "</P>\r\n";
echo "<P>\r\n";
echo " <CENTER>" . __SQLERRORMISSING . "</CENTER>\r\n";
echo "</P>\r\n";
echo "<P>\r\n";
echo " <CENTER>PvPGN Web Account Creation Script " . __VERSION . " by <A HREF=\"http://pvpgn-phputils.sourceforge.net/\">U-238</A></CENTER>\r\n";
echo "</P>\r\n";
echo "</BODY>\r\n";
echo "</HTML>\r\n";
} else {
echo "<HTML>\r\n";
echo "<HEAD>\r\n";
echo " <TITLE>PvPGN Web Account Creation Script :: Error</TITLE>\r\n";
echo "</HEAD>\r\n";
echo "<BODY>\r\n";
echo "<P>\r\n";
echo " <CENTER><H3>Error: " . $page_data['errormsg'] . "</H3></CENTER>\r\n";
echo "</P>\r\n";
echo "<P>\r\n";
echo " <CENTER>" . __ERRORHTMMISSING . "</CENTER>\r\n";
echo "</P>\r\n";
echo "<P>\r\n";
echo " <CENTER>PvPGN Web Account Creation Script " . __VERSION . " by <A HREF=\"http://pvpgn-phputils.sourceforge.net/\">U-238</A></CENTER>\r\n";
echo "</P>\r\n";
echo "</BODY>\r\n";
echo "</HTML>\r\n";
}
die();
}

function InsertData($data) {
unset($keys, $values);
foreach($data as $key => $val) {
// echo "Key: {$key}, Value: {$val}\n";
if (isset($keys)) {
$keys .= ",`" . $key . "`";
$values .= ",'" . $val . "'";
} else {
$keys = "`" . $key . "`";
$values = "'" . $val . "'";
}
}

if (@mysql_query("INSERT INTO `pvpgn_BNET`(" . $keys . ") VALUES(" . $values . ")")) {
return true;
} else {
error(1,__DBINSERTERROR,mysql_error());
}
}


function checkemail($email) {
$email = trim($email);
$pos1 = strpos($email, "@");
$pos2 = strpos($email, ".");
if (!$pos1 || !$pos2) {
return false;
} else {
return true;
}
}


if ($_POST) {
$account_allowed_chars = $account_allowed_symbols . "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
$acct_username = trim($_POST['acct_username']);
$length1 = strlen($acct_username);
$length2 = strlen($account_allowed_chars);
$account_allowed_chars = trim($account_allowed_chars);
for($count1 = 0; $count1 < $length1; $count1++) {
for($count2 = 0; $count2 < $length2; $count2++) {
if ($acct_username[$count1] == $account_allowed_chars[$count2]) {
$goodchar = true;
}
}

if (!$goodchar) {
error(0,str_replace("[allowed_chars]",$account_allowed_symbols,__INVALIDNAME),"");
}
$goodchar = false;
}

if (trim($_POST['password1']) == trim($_POST['password2'])) {
if (strlen(trim($_POST['password1'])) > 2) {
$passhash = pvpgn_hash(trim($_POST['password1']));
} else {
error(0,__SHORTPASS,"");
}
}
else {
error(0,__PASSMISMATCH,"");
}

$dbh = @mysql_connect($dbhost,$dbuser,$dbpass);
@mysql_select_db($dbname) or error(1,__DBCONNECTERROR,mysql_error());

$query1 = @mysql_query("SELECT MAX(`uid`) FROM `pvpgn_BNET`");
if ($row = @mysql_fetch_row($query1)) {
$query2 = "SELECT uid FROM `pvpgn_BNET` WHERE acct_username = \"" . trim($_POST['acct_username']) . "\";";
$response = @mysql_query($query2, $dbh);
if ($data = @mysql_fetch_array($response)) {
error(0,__USEREXISTS,"");
} else {
unset($data);
$data['uid'] = $row[0] + 1;
$data['acct_userid'] = $data['uid'];
$data['acct_username'] = trim($_POST['acct_username']);
$data['acct_passhash1'] = $passhash;
if ($_POST['acct_email'] && $_POST['acct_email'] <> "") {
if (checkemail($_POST['acct_email'])) {
$data['acct_email'] = trim($_POST['acct_email']);
} else {
error(0,__BADEMAIL,"");
}
}
}

InsertData($data);
$page_data = array(
"acct_username" => trim($_POST['acct_username']));
echo parse_theme("success.htm", $page_data);
} else {
error(1,__DBREADERROR,mysql_error());
}
}
else {
$page_data = array(
"self" => $PHP_SELF);
echo parse_theme("form.htm", $page_data);
}
?>


Вот ссылка для всей системы:http://sourceforge.net/projects/pvpgn-phputils/files/webregister/0.1/

http://sourceforge.net/projects/pvpgn-phpu...es/webregister/
Быстрый ответ:

 Графические смайлики |  Показывать подпись
Здесь расположена полная версия этой страницы.
Invision Power Board © 2001-2024 Invision Power Services, Inc.