Bonjour,
J'essai d'installer un script php sur mon site, le seul hic c'est que j'ai supprimé par erreur le fichier de connection à la BDD, j'ai tenté de le reconstituer avec les bons paramètres de connexion mais j'obtiens toujours une erreur.
Les tables sont bien crées dans la Base de Donnée.
Voici le message:
Warning: mysql_query() [function.mysql-query]: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /homez.379/mafieuxd/www/Register2.php on line 47
Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /homez.379/mafieuxd/www/Register2.php on line 47
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /homez.379/mafieuxd/www/Register2.php on line 48
Warning: mysql_query() [function.mysql-query]: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /homez.379/mafieuxd/www/Register2.php on line 60
Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /homez.379/mafieuxd/www/Register2.php on line 60
Warning: mysql_query() [function.mysql-query]: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /homez.379/mafieuxd/www/Register2.php on line 61
Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /homez.379/mafieuxd/www/Register2.php on line 61
Warning: mysql_query() [function.mysql-query]: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /homez.379/mafieuxd/www/Register2.php on line 62
Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /homez.379/mafieuxd/www/Register2.php on line 62
You have successfully Registered!
Voici les 2 fichiers en cause :
Register2.php:
Code : Tout sélectionner
<html>
<head>
<title>Mafieuxdunet :: Register</title>
<meta name="author" CONTENT="okay">
<script language="JavaScript">
<!--
function SymError()
{
return true;
}
window.onerror = SymError;
//-->
</script>
<link REL="stylesheet" TYPE="text/css" HREF="main.css">
</head>
<body bgcolor="#000000" onLoad="grabit()">
<?PHP
include "includes/db_connect.php";
$datetime = gmdate('Y-m-d h:i:s');
if ($_POST['Submit'] && strip_tags($_POST['username']) && strip_tags($_POST['password']) && strip_tags($_POST['cpassword']) && strip_tags($_POST['email'])){
$ip=$_SERVER["REMOTE_ADDR"]; //draws IP address of visitor
$email = $_POST['email'];
$email = strip_tags($email);
$username = $_POST['username'];
$username = strip_tags($username);
$password = $_POST['password'];
$password = strip_tags($password);
$cpassword = $_POST['cpassword'];
$cpassword = strip_tags($cpassword);
$checkname = mysql_query("SELECT * FROM users WHERE username='$username' OR email='$email'");
$NameCount = mysql_num_rows($checkname);
if ($NameCount > 0)
{
echo "<font color=red>The username and/or email address is already in use<BR>Please <a href=\"Register2.php\">go back</a> and try again</font>";
}
else{
if (!(isset($email))){
echo 'You must insert an email address and/or username!';
}else{
mysql_query("INSERT INTO `users` ( `id` , `username` , `password` , `email` ,`ip` ) VALUES ('', '$username', '$password', '$email', '$ip')");
mysql_query("INSERT INTO `crimetimes` ( `id` , `username` , `crime1` , `crime1a` , `crime2` ,`crime2a` , `crime3` , `crime3a` , `crime4` ,`crime4a` , `crime5` , `crime5a` ) VALUES ('', '$username', '', '0', '', '0', '', '0', '', '0', '', '0')");
mysql_query("INSERT INTO `signups` ( `id` , `username` , `date` ) VALUES ('', '$username', '$datetime')");
// mail user their information
$yoursite = "www.mafieuxdunet.fr/";
$webmaster = "Oasis";
$youremail = "[email protected]";
$subject = "Registration Details";
$message = "Dear $username, you are now registered at mafieuxdunet.fr.
To login, simply go to $yoursite and enter in the following details in the login form:
Username: $username
Password: $password
Please print this information out and store it for future reference.
Thanks,
$webmaster";
mail($email, $subject, $message, "From: $yoursite <$youremail>\nX-Mailer:PHP/" . phpversion());
echo "<font color=red><b>You have successfully Registered!</b></font>
";
}}}
?> <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="keywords" content="mafia, role-play, role, play, game, rpg, game">
<meta name="description" content="A multi-player game where people compete to rise through the ranks of the mafia. Commit crimes, gamble at the casino and much more!">
<title>Mafieuxdunet</title>
<link href="includes/inc-style.css" type="text/css" rel="stylesheet" />
</head>
<body style="margin:0px; background-image: url(images/mainbg.png); background-repeat: no-repeat; background-position: top">
<br>
<br>
<br>
<br>
<table cellspacing="0" cellpadding="0" border="0" align="center" class="main" width="585">
<tr>
<td align="center"><img src="banner.jpg"></td>
</tr>
<tr>
<td align="center">
<div style="font-weight: bold; font-size: 10pt; width: 184px">Register</div>
<div style="font: 10px Verdana; color: #FF9900; text-align: center">
</div>
<br />
<form action="/Register2.php" method="post">
<table cellspacing="0" cellpadding="2" border="0" align="center" class="main">
<tr class="subhdr">
<td colspan="2" align="left">* - Required fields<br></td>
</tr>
<tr>
<td align="right" class="subhdr">Username: *</td>
<td style="width: 120px"><input type="text" name="username" maxlength="100"></td>
</tr>
<tr>
<td align="right" class="subhdr">Password: *</td>
<td><input type="password" name="password" maxlength="100"></td>
</tr>
<tr>
<td align="right" class="subhdr">Password confirm: *</td>
<td><input type="password" name="cpassword"></td>
</tr>
<tr>
<td align="right" class="subhdr">Email: *</td>
<td><input type="text" name="email"></td>
</tr>
<tr>
<td align="right" colspan="2"><input name="Submit" type="Submit" value="Submit"></td>
</tr>
</table>
</form>
</div>
<center><p><a href='index.php'><b>Index</b></a></p></center>
et db_connect.php que j'ai essayé de recrée mais ne fonctionnant visiblement pas:
Code : Tout sélectionner
<?
$DBTYPE = 'mysql';
$DBHOST = 'mon serveur';
$DBUSER = 'mon user';
$DBPASSWORD = 'mon pass';
$DBNAME = 'nom de la base';
?>
Voyez vous où celà peut clocher ?
Bonjour,
J'essai d'installer un script php sur mon site, le seul hic c'est que j'ai supprimé par erreur le fichier de connection à la BDD, j'ai tenté de le reconstituer avec les bons paramètres de connexion mais j'obtiens toujours une erreur.
Les tables sont bien crées dans la Base de Donnée.
Voici le message:
[sql]Warning: mysql_query() [function.mysql-query]: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /homez.379/mafieuxd/www/Register2.php on line 47
Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /homez.379/mafieuxd/www/Register2.php on line 47
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /homez.379/mafieuxd/www/Register2.php on line 48
Warning: mysql_query() [function.mysql-query]: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /homez.379/mafieuxd/www/Register2.php on line 60
Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /homez.379/mafieuxd/www/Register2.php on line 60
Warning: mysql_query() [function.mysql-query]: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /homez.379/mafieuxd/www/Register2.php on line 61
Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /homez.379/mafieuxd/www/Register2.php on line 61
Warning: mysql_query() [function.mysql-query]: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /homez.379/mafieuxd/www/Register2.php on line 62
Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /homez.379/mafieuxd/www/Register2.php on line 62
You have successfully Registered![/sql]
Voici les 2 fichiers en cause :
Register2.php:
[code]
<html>
<head>
<title>Mafieuxdunet :: Register</title>
<meta name="author" CONTENT="okay">
<script language="JavaScript">
<!--
function SymError()
{
return true;
}
window.onerror = SymError;
//-->
</script>
<link REL="stylesheet" TYPE="text/css" HREF="main.css">
</head>
<body bgcolor="#000000" onLoad="grabit()">
<?PHP
include "includes/db_connect.php";
$datetime = gmdate('Y-m-d h:i:s');
if ($_POST['Submit'] && strip_tags($_POST['username']) && strip_tags($_POST['password']) && strip_tags($_POST['cpassword']) && strip_tags($_POST['email'])){
$ip=$_SERVER["REMOTE_ADDR"]; //draws IP address of visitor
$email = $_POST['email'];
$email = strip_tags($email);
$username = $_POST['username'];
$username = strip_tags($username);
$password = $_POST['password'];
$password = strip_tags($password);
$cpassword = $_POST['cpassword'];
$cpassword = strip_tags($cpassword);
$checkname = mysql_query("SELECT * FROM users WHERE username='$username' OR email='$email'");
$NameCount = mysql_num_rows($checkname);
if ($NameCount > 0)
{
echo "<font color=red>The username and/or email address is already in use<BR>Please <a href=\"Register2.php\">go back</a> and try again</font>";
}
else{
if (!(isset($email))){
echo 'You must insert an email address and/or username!';
}else{
mysql_query("INSERT INTO `users` ( `id` , `username` , `password` , `email` ,`ip` ) VALUES ('', '$username', '$password', '$email', '$ip')");
mysql_query("INSERT INTO `crimetimes` ( `id` , `username` , `crime1` , `crime1a` , `crime2` ,`crime2a` , `crime3` , `crime3a` , `crime4` ,`crime4a` , `crime5` , `crime5a` ) VALUES ('', '$username', '', '0', '', '0', '', '0', '', '0', '', '0')");
mysql_query("INSERT INTO `signups` ( `id` , `username` , `date` ) VALUES ('', '$username', '$datetime')");
// mail user their information
$yoursite = "www.mafieuxdunet.fr/";
$webmaster = "Oasis";
$youremail = "
[email protected]";
$subject = "Registration Details";
$message = "Dear $username, you are now registered at mafieuxdunet.fr.
To login, simply go to $yoursite and enter in the following details in the login form:
Username: $username
Password: $password
Please print this information out and store it for future reference.
Thanks,
$webmaster";
mail($email, $subject, $message, "From: $yoursite <$youremail>\nX-Mailer:PHP/" . phpversion());
echo "<font color=red><b>You have successfully Registered!</b></font>
";
}}}
?> <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="keywords" content="mafia, role-play, role, play, game, rpg, game">
<meta name="description" content="A multi-player game where people compete to rise through the ranks of the mafia. Commit crimes, gamble at the casino and much more!">
<title>Mafieuxdunet</title>
<link href="includes/inc-style.css" type="text/css" rel="stylesheet" />
</head>
<body style="margin:0px; background-image: url(images/mainbg.png); background-repeat: no-repeat; background-position: top">
<br>
<br>
<br>
<br>
<table cellspacing="0" cellpadding="0" border="0" align="center" class="main" width="585">
<tr>
<td align="center"><img src="banner.jpg"></td>
</tr>
<tr>
<td align="center">
<div style="font-weight: bold; font-size: 10pt; width: 184px">Register</div>
<div style="font: 10px Verdana; color: #FF9900; text-align: center">
</div>
<br />
<form action="/Register2.php" method="post">
<table cellspacing="0" cellpadding="2" border="0" align="center" class="main">
<tr class="subhdr">
<td colspan="2" align="left">* - Required fields<br></td>
</tr>
<tr>
<td align="right" class="subhdr">Username: *</td>
<td style="width: 120px"><input type="text" name="username" maxlength="100"></td>
</tr>
<tr>
<td align="right" class="subhdr">Password: *</td>
<td><input type="password" name="password" maxlength="100"></td>
</tr>
<tr>
<td align="right" class="subhdr">Password confirm: *</td>
<td><input type="password" name="cpassword"></td>
</tr>
<tr>
<td align="right" class="subhdr">Email: *</td>
<td><input type="text" name="email"></td>
</tr>
<tr>
<td align="right" colspan="2"><input name="Submit" type="Submit" value="Submit"></td>
</tr>
</table>
</form>
</div>
<center><p><a href='index.php'><b>Index</b></a></p></center>[/code]
et db_connect.php que j'ai essayé de recrée mais ne fonctionnant visiblement pas:
[code]<?
$DBTYPE = 'mysql';
$DBHOST = 'mon serveur';
$DBUSER = 'mon user';
$DBPASSWORD = 'mon pass';
$DBNAME = 'nom de la base';
?>[/code]
Voyez vous où celà peut clocher ?