begin process at 2012 05 28 21:48:03
  Trouver un code source :
 
dans
 
Accueil > Forum > 

PHP

 > 

Base de données

 > 

MySQL

 > 

Formulaire D'inscription


Derniers messages déposésPoser une question dans le forum ou lancer une discussion

Formulaire D'inscription

mardi 22 septembre 2009 à 11:05:54 | Formulaire D'inscription

musiman

Voila mon probleme jai un serveur wow jveux faire une page dinscription mais ses que il me dise tjrs creation imposible jsuis vrmt bloquer aider moi quelqun jai pris se code dune source je les editer un peu quit a men donner un autre qui va marcher
Connexion --> Wamp Serveur
IP = 192.168.0.101 (exemple)
Username = "QUIQUI"
PAssword = "chouchou"
Database = "Realmd"
Table = "Account"
Je doi enregistre les champ suivant
Username = $Letextbox username
Sha_pass_hash = $Le champ password mais generer du genre "128ad534218f3beb87b38f196e744b8e1a5c7536" si quelqun peu mexplique la genereration comment ses fais merci bcp
Expansion = Tjrs "1" sans champ
Last_ip = $Le IP Du nouveau menbre
Ps.Jsuis une vrai couille mole en php =/

<?php


$lang="en"; // Language ("en" - english, "ru" - russian) // NAME of Mangos database
$hostr="192.168.0.101"; // HOST for Realm database
$userr="admin" ; // USER for Realm database
$passwordr="maxime"; // PASS for Realm database
$dbr="realmd"; // NAME of Realm database
$database_encoding = 'CP1251'; // Set encoding
$img_base = "img/"; // Image dir
$server = "Shadowowserver.no-ip.org"; // Server adress (for realm status)
$port = "8085"; // Server port (for realm status) 8085 or 3724
$lock_acc=0; // Lock created account to IP adress (1 - on, 0 - off)
$lock_reg=0; // Registration only one (or more) account from one IP adress
// 0 - not limit, 1 - one acc, 2 - two acc, etc...
// 0 - not limit, 1 - one acc, 2 - two acc, etc...



Switch ($lang)
{
case "en":
$button="create_en.gif";
$text = Array(
'acc' => 'Creation de compte',
'create' => 'termin&eacute; !',
'failed' => 'impossible !',
'not_all' => 'Il manque des donn&eacute;es',
'playerson' => 'joueurs connect&eacute;s',
'off' => 'est déconnect&eacute;',
'name' => 'Nom de compte',
'password' => 'Mot de Passe',
'ip_limit' => Array('Depuis votre ip ',' comptes déjà cr&eacute;&eacute;s')
);
break;
}




class DBLayer
{
var $link_id;
var $query_result;
var $saved_queries = array();
var $num_queries = 0;

function DBLayer($db_host, $db_username, $db_password, $db_name)
{
$this->link_id = @mysql_connect($db_host, $db_username, $db_password, true);

if ($this->link_id)
{
if (@mysql_select_db($db_name, $this->link_id))
return $this->link_id;
else
error('Unable to select database. MySQL reported: '.mysql_error(), __FILE__, __LINE__);
}
else
error('Unable to connect to MySQL server. MySQL reported: '.mysql_error(), __FILE__, __LINE__);
}

function query($sql)
{
$this->query_result = @mysql_query($sql, $this->link_id);

if ($this->query_result)
{
++$this->num_queries;
return $this->query_result;
}
else
{
return false;
}
}


function result($query_id = 0, $row = 0)
{
return ($query_id) ? @mysql_result($query_id, $row) : false;
}


function fetch_assoc($query_id = 0)
{
return ($query_id) ? @mysql_fetch_assoc($query_id) : false;
}


function fetch_row($query_id = 0)
{
return ($query_id) ? @mysql_fetch_row($query_id) : false;
}


function num_rows($query_id = 0)
{
return ($query_id) ? @mysql_num_rows($query_id) : false;
}


function affected_rows()
{
return ($this->link_id) ? @mysql_affected_rows($this->link_id) : false;
}


function insert_id()
{
return ($this->link_id) ? @mysql_insert_id($this->link_id) : false;
}


function get_num_queries()
{
return $this->num_queries;
}


function get_saved_queries()
{
return $this->saved_queries;
}


function free_result($query_id = false)
{
return ($query_id) ? @mysql_free_result($query_id) : false;
}


function escape($str)
{
if (function_exists('mysql_real_escape_string'))
return mysql_real_escape_string($str, $this->link_id);
else
return mysql_escape_string($str);
}


function error()
{
$result['error_sql'] = @current(@end($this->saved_queries));
$result['error_no'] = @mysql_errno($this->link_id);
$result['error_msg'] = @mysql_error($this->link_id);

return $result;
}


function close()
{
if ($this->link_id)
{
if ($this->query_result)
@mysql_free_result($this->query_result);

return @mysql_close($this->link_id);
}
else
return false;
}
}

function error($message, $file, $line, $db_error = false)
{
global $siteerrors;
$s = "\t\t".'Error: <strong>'.$message.'.</strong>'."\n";
echo $s;
}


function test_realm(){
global $server, $port;
$s = @fsockopen("$server", $port, $ERROR_NO, $ERROR_STR,(float)0.5);
if($s){@fclose($s);return true;} else return false;
}

function get_realm_name(){
global $hostr, $userr, $passwordr, $dbr, $database_encoding;
$realm_db = new DBLayer($hostr, $userr, $passwordr, $dbr);
$realm_db->query("SET NAMES $database_encoding");
$query = $realm_db->query("SELECT * FROM `realmlist`");
$result = $realm_db->fetch_assoc($query);
$realm_db->close();
unset($realm_db);
return($result['name']);
}



if (empty($_POST['username']) and empty($_POST['passw']) and empty($_POST['email']))
{
$cont=' <TR>
<TD rowSpan=6><IMG height=110
src="'.$img_base.'pixel.gif" width=15></TD>
<TD vAlign=center align=left width=190><B
style="FONT-SIZE: 8pt; COLOR: white; LETTER-SPACING: 3px; FONT-VARIANT: small-caps"><LABEL
for=username>'.$text["name"].':</LABEL>&nbsp;</B><BR><INPUT
id=username style="WIDTH: 175px" tabIndex=1 maxLength=16
size=18 name=username></TD>
<TD rowSpan=6><IMG height=1 src="'.$img_base.'pixel.gif" width=15></TD></TR>
<TR><TD width=190 height=1></TD></TR>
<TR><TD width=190 height=1></TD></TR>
<TR>
<TD vAlign=center align=left width=190><B
style="FONT-SIZE: 8pt; COLOR: white; LETTER-SPACING: 3px; FONT-VARIANT: small-caps"><LABEL
for=passw>'.$text["password"].':</LABEL>&nbsp;</B><BR><INPUT id=passw
style="WIDTH: 175px" tabIndex=2 type=password maxLength=16
size=18 name=passw></TD></TR>
<TR>
<TD vAlign=center align=left width=190><B
style="FONT-SIZE: 8pt; COLOR: white; LETTER-SPACING: 3px; FONT-VARIANT: small-caps"><LABEL
for=email>E-mail:</LABEL>&nbsp;</B><BR><INPUT id=email
style="WIDTH: 175px" tabIndex=2 maxLength=50
size=18 name=email></TD></TR>
<TR>
<TD align=left>
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TBODY>
<TR>
<TD><IMG height=3
src="'.$img_base.'pixel.gif" width=1></TD>
<TD></TD>
<TD></TD></TR></TBODY></TABLE></TD></TR>
<TR>
<TD align=left colSpan=3>
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TBODY>
<TR>
<TD><IMG height=39
src="'.$img_base.'pixel.gif" width=19></TD>
<TD><INPUT class=button
style="WIDTH: 168px; HEIGHT: 39px" tabIndex=3 type=image
alt=Create src="'.$img_base.$button.'"
value=Create border=0></TD>
</TR></TBODY></TABLE></TD></TR>';
}
elseif (empty($_POST['username']) or empty($_POST['passw']) or empty($_POST['email']))
{

$cont='<TR><TD rowSpan=6><IMG height=152 width=1 src="'.$img_base.'pixel.gif"><TD align=Center><SMALL class=error>
'.$text["not_all"].'
<br><br><a href="" onClick="history.go(-1)">Back</a></SMALL></TD></TD></TR>';

}
else
{
$username = htmlspecialchars(trim("$_POST[username]"));
$passw = trim($_POST['passw']);
$email = htmlspecialchars(trim($_POST['email']));
$ip = getenv('REMOTE_ADDR');
// ñäåëàòü ïðîâåðêó íà íåïîëó÷åíèå èïà

$realm_db = new DBLayer($hostr, $userr, $passwordr, $dbr);
$realm_db->query("SET NAMES $database_encoding");

$ip_cr=0;
if ($lock_reg!=0){
$query = $realm_db->query("SELECT `last_ip` FROM `account` WHERE `last_ip`='$ip'");
while($result = $realm_db->fetch_assoc($query)) $ip_cr++;
}

if (($ip_cr>=$lock_reg) && ($lock_reg!=0))
{
$cont='<TR><TD rowSpan=6><IMG height=152 width=1 src="'.$img_base.'pixel.gif"><TD align=Center><SMALL class=error>
'.$text["ip_limit"][0].$ip.'<br>'.$ip_cr.$text["ip_limit"][1].'
<br><br><a href="" onClick="history.go(-1)">Back</a></SMALL></TD></TD></TR>';
} else
{
if($realm_db->query("INSERT INTO `account` (`username`,`Sha_pass_hash`,`email`,`last_ip`,`locked`,`expansion`) VALUES ('$username','$passw','
$email','$ip','$lock_acc',`1`)"))
{
$realm_db->query("UPDATE `account` SET `I`=SHA1(CONCAT(UPPER(`username`),':',UPPER(`I`))) WHERE (`username`='$username');");
$cont='<TR><TD rowSpan=6><IMG height=152 width=1 src="'.$img_base.'pixel.gif"><TD align=Center><SMALL>
'.$text["acc"].'<br><strong>'.$username.'</strong><br>'.$text["create"].'
</SMALL></TD></TD></TR>';
}
else
{
$cont='<TR><TD rowSpan=6><IMG height=152 width=1 src="'.$img_base.'pixel.gif"><TD align=Center><SMALL class=error>
'.$text["acc"].'<br><strong>'.$username.'</strong><br>'.$text["failed"].'
<br><br><a href="" onClick="history.go(-1)">Back</a></SMALL></TD></TD></TR>';
}
}



$realm_db->close();
unset($realm_db);
}



function make_players_array(){
global $host, $user, $password, $db, $database_encoding, $pl_array;
$i=0;
$mangos_db = new DBLayer($host, $user, $password, $db);
$mangos_db->query("SET NAMES $database_encoding");
$query = $mangos_db->query("SELECT * FROM `character` WHERE `online`='1' ORDER BY `name`");
while($result = $mangos_db->fetch_assoc($query))
{
$char_data = explode(' ',$result['data']);
$char_gender = dechex($char_data[36]);
$char_gender = str_pad($char_gender,8, 0, STR_PAD_LEFT);
$char_gender = $char_gender{3};
$res_pos=get_zone_name($result['map'], $result['position_x'], $result['position_y']);

$pl_array[$i] = Array($result['name'], $result['race'], $result['class'], $char_data[34], $res_pos, $char_gender);
$i++;
}
$mangos_db->close();
unset($mangos_db);
return $i;
}

$onlineplayers=make_players_array();

if (!$sort = &$_GET['s']) $sort=0;
if (!$flag = &$_GET['f']) $flag=0;
if ($flag==0) { $flag=1; $sort_type='<'; }
else { $flag=0; $sort_type='>'; }
$link=$_SERVER['PHP_SELF']."?f=".$flag."&s=";

if (!empty($pl_array))
{
usort($pl_array, create_function('$a, $b', 'if ( $a['.$sort.'] == $b['.$sort.'] ) return 0; if ( $a['.$sort.'] '.$sort_type.' $b['.$sort.'] ) return

-1; return 1;'));
}

$list="";
$i=0;
while ($i < $onlineplayers)
{
$name=$pl_array[$i][0];
$race=$pl_array[$i][1];
$class=$pl_array[$i][2];
$res_race = $def['character_race'][$race];
$res_class = $def['character_class'][$class];
$lvl=$pl_array[$i][3];
$loc=$pl_array[$i][4];
$gender=$pl_array[$i][5];
$list.= "
<tr class=txt>
<td></td>
<td>$name</td>
<td align='center'><img alt=$res_race src='".$img_base.$race."-$gender.gif' height='18' width='18'></td>
<td align='center'><img alt=$res_class src='".$img_base."$class.gif' height='18' width='18'></td>
<td align='center'>$lvl</td>
<td >$loc</td>
</tr>";
$i++;
}

$title=get_realm_name();
if (test_realm())
{
$title.=(' ('.$onlineplayers.' '.$text["playerson"].')');
} else
{
$title.=(' '.$text["off"]);
}


// Main part !!!
?>
<HTML><HEAD><META HTTP-EQUIV="Pragma" CONTENT="no-cache"><TITLE><?php print $title ?></TITLE>
<META http-equiv=Content-Type content="text/html; charset=ISO-8859-1"><LINK
id=bnetstyle href="<?php print $img_base ?>style.css" type=text/css
rel=stylesheet>
<SCRIPT language=javascript>
<!--
var styleSheet;
var agt = navigator.userAgent.toLowerCase();
var appVer = navigator.appVersion.toLowerCase();
var verInt = parseInt(appVer);
var ie = (appVer.indexOf('msie') != -1);
var opera = (agt.indexOf('opera') != -1);
var mozilla = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('opera')==-1)
&& (agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1)
&& (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
var ns4 = (mozilla && (verInt == 4));

if (ie && !opera) {
document.styleSheets["bnetstyle"].addRule ("input", "background-color: #040D1A");
document.styleSheets["bnetstyle"].addRule ("input", "border-style: solid");
document.styleSheets["bnetstyle"].addRule ("input", "border-width: 1px");
document.styleSheets["bnetstyle"].addRule ("input", "border-color: #7F7F7F");
document.styleSheets["bnetstyle"].addRule ("input", "color: #FFAC04");

document.styleSheets["bnetstyle"].addRule ("textarea", "background-color: #040D1A");
document.styleSheets["bnetstyle"].addRule ("textarea", "border-style: solid");
document.styleSheets["bnetstyle"].addRule ("textarea", "border-width: 1px");
document.styleSheets["bnetstyle"].addRule ("textarea", "border-color: #7F7F7F");
document.styleSheets["bnetstyle"].addRule ("textarea", "color: #FFAC04");

document.styleSheets["bnetstyle"].addRule ("textarea", "scrollbar-Base-Color: #012158");
document.styleSheets["bnetstyle"].addRule ("textarea", "scrollbar-Arrow-Color: #7F7F7F");
document.styleSheets["bnetstyle"].addRule ("textarea", "scrollbar-3dLight-Color: #7F7F7F");
document.styleSheets["bnetstyle"].addRule ("textarea", "scrollbar-DarkShadow-Color: black");
document.styleSheets["bnetstyle"].addRule ("textarea", "scrollbar-Highlight-Color: black");
document.styleSheets["bnetstyle"].addRule ("textarea", "scrollbar-Shadow-Color: #00B3FF");

document.styleSheets["bnetstyle"].addRule ("select", "background-color: #040D1A");
document.styleSheets["bnetstyle"].addRule ("select", "color: #FFAC04");

document.styleSheets["bnetstyle"].addRule ("select.gray", "background-color: #040D1A");
document.styleSheets["bnetstyle"].addRule ("select.gray", "color: #FFAC04");

document.styleSheets["bnetstyle"].addRule ("ul.thread", "margin-left: 22px;");
}
//-->
</SCRIPT>
<style type="text/css">
<!--
.style4 {color: #d79f14}
.style6 {color: #365221; font-weight: bold; }
-->
</style>
</HEAD>
<?php
$today = getdate();
$hours = $today['hours'];
$minutes = $today['minutes'];
$seconds = $today['seconds'];
$month = $today['month'];
$day = $today['mday'];
$year = $today['year'];
if($hours > 19 or $hours < 6)
{print "<BODY text=#d79f14 vLink=#aaaaaa link=#ffffbb bgColor=#000000 background='img/32.jpg' bgproperties='fixed' leftMargin=0 topMargin=0

marginheight='0' marginwidth='0'>";
}
else
{print "<BODY text=#d79f14 vLink=#aaaaaa link=#ffffbb bgColor=#000000 background='img/back_Create.jpg' bgproperties='fixed' leftMargin=0 topMargin=0

marginheight='0' marginwidth='0'>";
}
?>
<FORM name=login_form method=post>
<div align="center">
<p>
<TABLE height="100%" cellSpacing=0 cellPadding=0 width="100%" border=0>
</p>
</div>
<TBODY>
<TR>
<TD align=middle>

<TABLE cellSpacing=0 cellPadding=0 background="<?php print $img_base ?>pixeltje.gif" border=0 style="background-repeat: repeat;">
<TBODY>
<TR>
<TD vAlign=top>
<DIV style="POSITION: relative">
<DIV
style="LEFT: 130px; WIDTH: 400px; POSITION: absolute; TOP: 0px"></DIV></DIV></TD>
<TD><IMG height=169 src="<?php print $img_base ?>pixel.gif"
width=1></TD>
<TD></TD></TR>
<TR>
<TD><IMG height=1 src="<?php print $img_base ?>pixel.gif"
width=203></TD>
<TD>
<TABLE cellSpacing=0 cellPadding=0 width=220 border=0>
<TBODY>
<?php print $cont ?></TBODY></TABLE></TD>
<TD><IMG height=1 src="<?php print $img_base ?>pixel.gif"
width=217></TD></TR>
<TR>
<TD colSpan=3>
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TBODY>
<TR>
<TD colSpan=3><IMG height=17
src="<?php print $img_base ?>pixel.gif" width=1></TD></TR>
<TR>
<TD width=106><IMG height=1
src="<?php print $img_base ?>pixel.gif" width=106></TD>
<TD width=410><SMALL>



<table cellpadding='3' cellspacing='0' align<br><strong class=title><center><?php print $title ?></center></strong>
<p align="center"><?php
print "<b>Local servertime:<br>$hours:$minutes:$seconds&nbsp;&nbsp;$day-$month-$year</b>";
?>
<tbody>
<tr class=title>
<td align='left' nowrap='nowrap' width=50></td>
<td align='left' nowrap='nowrap' width=60><a href="<?php print $link.'0">'.$text['char'][0] ?></a></td>
<td align='center' nowrap='nowrap' width=40><a href="<?php print $link.'1">'.$text['char'][1] ?></a></td>
<td align='center' nowrap='nowrap' width=40><a href="<?php print $link.'2">'.$text['char'][2] ?></a></td>
<td align='center' nowrap='nowrap' width=40><a href="<?php print $link.'3">'.$text['char'][3] ?></a></td>
<td align='left' nowrap='nowrap' width=100><a href="<?php print $link.'4">'.$text['char'][4] ?></a></td>
</tr>
<tr><td class='txt' align='center' colspan='6' nowrap='nowrap'><IMG height=1 src='<?php print $img_base ?>pixel.gif' width=400></td></tr>

<?php print $list ?>
</tbody>
</table>

</SMALL></TD>
<TD width=124><IMG height=1
src="<?php print $img_base ?>pixel.gif" width=124></TD></TR>
<TR>
<TD colSpan=3><IMG height=100
src="<?php print $img_base ?>pixel.gif"
width=1></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
</FORM></BODY></HTML>



Cette discussion est classée dans : db, id, query, return, result


Répondre à ce message

Sujets en rapport avec ce message

problème avec doublon dans ma classe de base de donnée [ par Dyr3e ] bonjour, j'ai un problème de Doublon avec la classe pour les base de donnée que j'utilise. Je n'arrive pas a trouver d'ou cela viens mais j'obtiens su exection 2 fois du code? [ par vieaiepie ] Bonjour, J'ai fais un fichier php qui permet d'importer des données à partir d'un fichier texte (fichier de 400 lignes de code que je ne vais pas d&# Modification d'un code en PHP4 pour le rendre compatible PHP4 [ par tom10000 ] Voici mon code ( en tout cas la partie qui pose problème sous PHP5  : include(dirname(__FILE__) . "/inc/header.php");$server = 'localhost';    problème session [ par habibcode ] bonjour à tousj'ai un probléme avec les sessionj'ai stocker les les session dans une base de donnée mais les erreurs qui s'affichent "Undefined index: arboresecence subordoné [ par aazperfection ] je veux creer une arborecence -----------------------------------------+nom1-nom2  +nom21  -nom22     +nom221     +nom222  +nom33  +nom3-------------- requete mysql [ par gribouille2 ] Bonjour Je suis débutant et je bute sur l'erreur suivante. Ca doit être tout bête mais je n'y arrive pas.Merci pour la réponse  :Parse error: syntax e Affichage de plusieurs images [ par Euskalor ] Bonjour !J'ai plusieurs images dans ma base de donnée ( avec le champ LONGBLOB ) et je souhaiterai afficher toutes les images.Pour l'instant j'utilise la partie encadrée par les étoiles ne fonctionn pas, je veux avoir une solution [ par chourouk86 ] //Données d'un client//$mail=$_POST['mail'];$mp=$_POST['mp'];//Données d'une reservation//if(isset($_GET['id_vehicule'])){$id_vehicule=$_G Bonjour, petit soucis de passage de variable vers flash [ par chlipou ] Bonjour à tous,Voilà je suis en train de réaliser un petit exo perso pour la réalisation d'un diagramme qui comptabilise les personnes connectées et l Listing 1 seul enregistrement [ par christuckers ] Amis CSistes, bien le bonjour.....J'ai posé une question hier après midi, par rapport à la fonction INNER JOIN, qui n'est apparament pas disponible su


Nos sponsors


Sondage...

Comparez les prix

CalendriCode

Mai 2012
LMMJVSD
 123456
78910111213
14151617181920
21222324252627
28293031   

Consulter la suite du CalendriCode

A découvrir



 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 0,374 sec (3)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales