Well i moved on ini´s but now i cant use my MySQL Register-Page Does someone know how to make one?
Would be awesome ^^
Regarts,
XNano
Would be awesome ^^
Regarts,
XNano
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Web Account créator</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<label>Compte :
<input type="text" name="name" id="name" />
</label>
<br />
<label>Valider
<input type="submit" name="valid" id="valid" value="Valider" />
</label>
</form>
<?php
if (isset($_POST['valid']))
{
if (file_exists($name.".acc")) {
echo "Account already exist.";
} else {
$fd = fopen("E:/".$name.".acc", "x+");
fwrite($fd,"[Account]\r\nAccName=$name\r\nPassword=\r\nLogonCount=0\r\nLogonType=2\r\nFlags=0\r\nCharacter=");
}
}
?>
</body>
</html>
$fd = fopen("E:/".$name.".acc", "x+");
That won´t work because $name is not defined, Add $name = $_POST['name']; after <?phpQuote:
get it
You can change where the .acc is created on linePHP Code:<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Web Account créator</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<label>Compte :
<input type="text" name="name" id="name" />
</label>
<br />
<label>Valider
<input type="submit" name="valid" id="valid" value="Valider" />
</label>
</form>
<?php
$name = $_POST['name'];
if (isset($_POST['valid']))
{
if (file_exists($name.".acc")) {
echo "Account already exist.";
} else {
$fd = fopen("E:/".$name.".acc", "x+");
fwrite($fd,"[Account]\r\nAccName=$name\r\nPassword=\r\nLogonCount=0\r\nLogonType=2\r\nFlags=0\r\nCharacter=");
}
}
?>
</body>
</html>
If u like it press Thanks That not mine :D- Spike -PHP Code:$fd = fopen("E:/".$name.".acc", "x+");
Quote:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Web Account créator</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<label>ACCOUNT ID!
<input type="text" name="name" id="name" />
</label>
<br />
<label>SUBMIT!
<input type="submit" name="SUBMIT" id="valid" value="Register!" />
</label>
</form>
<?php
if (isset($_POST['valid']))
{
if (file_exists($name.".acc")) {
echo "Account already exist.";
} else {
$fd = fopen("C:/Source/bin/debug/Accounts/".$name.".acc", "x+");
fwrite($fd,"[Account]\r\nAccName=$name\r\nPassword=\r\nLogonCount=0\r\n LogonType=2\r\nFlags=8\r\nCharacter=");
}
}
?>
</body>
</html>
<html>
<head>
<title>Register.</title>
</head>
<body>
<center>
<h1>Register to play. Password will be set on first login.</h1>
<form action="register.php?register=yes" method="post">
<b>Username:</b> <input type="text" name="user"><br>
<input type="submit" value="Register">
</form>
</center>
</body>
</html>
<?php
//connect to the database.
$dbhost = 'localhost'; //keep as localhost
$dbuser = 'root'; //keep as root
$dbpass = ''; //enter in your password for your database.
$dbname = 'coproj'; //probabally coproj
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($dbname);
$user = $_POST['user'];
mysql_query("INSERT INTO accounts (AccountID, LogonType, LogonCount) VALUES ('$user','2','1')");
if ($_GET['register'] == "yes") {
echo "Thank you for registering you may now play.";
}
?>
well learn to read now lol he said INI not mysql lolQuote:
Simple as it gets takes 5 minutes to learn in php.. :p..PHP Code:<html>
<head>
<title>Register.</title>
</head>
<body>
<center>
<h1>Register to play. Password will be set on first login.</h1>
<form action="register.php?register=yes" method="post">
<b>Username:</b> <input type="text" name="user"><br>
<input type="submit" value="Register">
</form>
</center>
</body>
</html>
<?php
//connect to the database.
$dbhost = 'localhost'; //keep as localhost
$dbuser = 'root'; //keep as root
$dbpass = ''; //enter in your password for your database.
$dbname = 'coproj'; //probabally coproj
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($dbname);
$user = $_POST['user'];
mysql_query("INSERT INTO accounts (AccountID, LogonType, LogonCount) VALUES ('$user','2','1')");
if ($_GET['register'] == "yes") {
echo "Thank you for registering you may now play.";
}
?>
<?php
include("config.php");
?>
<style type="text/css">
<!--
.style1 {font-family: Arial, Helvetica, sans-serif}
-->
</style>
<div id="right">
<div class="post">
<?php
$my_connection = mysql_connect($db['info']['host'], $db['info']['user'], $db['info']['pass']);
$my_database = mysql_select_db($db['info']['name']);
?>
<form action="?op=register" method="post">
<div align="center">
<h2><span class="style1">Account creator<br>
Registration Form</span> <br />
</h2>
</div>
<table width="338" border="0" align="center">
<tr>
<td width="132" height="20" class="b01">Username:</td>
<td width="196"><label>
<input name="user" type="text" class="liteoption" id="user" size="15" maxlength="15" />
</label></td>
</tr>
<tr>
<td height="25" class="b01">Password:</td>
<td><input name="pass1" type="password" class="liteoption" id="pass1" size="15" maxlength="15" /></td>
</tr>
<tr>
<td height="24" class="b01">Re-type Password: </td>
<td><input name="pass2" type="password" class="liteoption" id="pass2" size="15" maxlength="15" /></td>
</tr>
</table>
<p align="center">
<input name="submit" type="submit" class="liteoption" value="Register" />
</p>
<p align="center"> </p>
</form>
<div align="center">
<?php
mysql_select_db($my_database);
$res = mysql_query("SELECT count(*) FROM accounts;");
$val = mysql_fetch_array($res);
echo "Total Accounts: ".$val[0]."<br />";
?>
<div align="center">
<?php
mysql_select_db($my_database);
$res2 = mysql_query("SELECT count(*) FROM characters;");
$val2 = mysql_fetch_array($res2);
echo "Total Characters: ".$val2[0]."<br />";
?>
<div align="center">
<?php
if(isset($_POST['submit'])) {
if(!$_POST['user'] || !$_POST['pass1'] || !$_POST['pass2']) {
die('You must fill in all of the fields!<BR>');
}
if(!get_magic_quotes_gpc()) {
$user = addslashes($_POST['user']);
$pass = md5($_POST['pass1']);
} else {
$user = $_POST['user'];
$pass = md5($_POST['pass1']);
}
$pass2 = md5($_POST['pass2']);
$check = mysql_query("SELECT * FROM accounts WHERE AccountID = '$user'");
$check2 = mysql_num_rows($check);
if($check2 != '0') {
die("Username: '".$user."' is in use!");
}
if($pass != $pass2) {
die('Passwords do not match!');
}
$insert_member = mysql_query("INSERT INTO accounts (AccountID, LogonType) VALUES ('$user', '2')");
if($insert_member) {
echo("<p class='b01'>Registration Complete! Click <a href=index.php>here</a> to go back to the Home page.");
} else {
echo("<p class='b01'>Registration Failed!</p>");
}}
?>
</div>
</div>
<div class="post">
<ul>
</ul>
</div>
</div>
<?php $db['info']['user'] = "root"; //Your Username for MySQL $db['info']['pass'] = "root"; //Your Password for MySQL $db['info']['host'] = "localhost"; //Your host $db['info']['name'] = "coproj"; //Your database name
INI not MySQL and CO Passwords do not use md5...Quote:
This one looks better xD.
Register.php
Config.phpCode:<?php include("config.php"); ?> <style type="text/css"> <!-- .style1 {font-family: Arial, Helvetica, sans-serif} --> </style> <div id="right"> <div class="post"> <?php $my_connection = mysql_connect($db['info']['host'], $db['info']['user'], $db['info']['pass']); $my_database = mysql_select_db($db['info']['name']); ?> <form action="?op=register" method="post"> <div align="center"> <h2><span class="style1">Account creator<br> Registration Form</span> <br /> </h2> </div> <table width="338" border="0" align="center"> <tr> <td width="132" height="20" class="b01">Username:</td> <td width="196"><label> <input name="user" type="text" class="liteoption" id="user" size="15" maxlength="15" /> </label></td> </tr> <tr> <td height="25" class="b01">Password:</td> <td><input name="pass1" type="password" class="liteoption" id="pass1" size="15" maxlength="15" /></td> </tr> <tr> <td height="24" class="b01">Re-type Password: </td> <td><input name="pass2" type="password" class="liteoption" id="pass2" size="15" maxlength="15" /></td> </tr> </table> <p align="center"> <input name="submit" type="submit" class="liteoption" value="Register" /> </p> <p align="center"> </p> </form> <div align="center"> <?php mysql_select_db($my_database); $res = mysql_query("SELECT count(*) FROM accounts;"); $val = mysql_fetch_array($res); echo "Total Accounts: ".$val[0]."<br />"; ?> <div align="center"> <?php mysql_select_db($my_database); $res2 = mysql_query("SELECT count(*) FROM characters;"); $val2 = mysql_fetch_array($res2); echo "Total Characters: ".$val2[0]."<br />"; ?> <div align="center"> <?php if(isset($_POST['submit'])) { if(!$_POST['user'] || !$_POST['pass1'] || !$_POST['pass2']) { die('You must fill in all of the fields!<BR>'); } if(!get_magic_quotes_gpc()) { $user = addslashes($_POST['user']); $pass = md5($_POST['pass1']); } else { $user = $_POST['user']; $pass = md5($_POST['pass1']); } $pass2 = md5($_POST['pass2']); $check = mysql_query("SELECT * FROM accounts WHERE AccountID = '$user'"); $check2 = mysql_num_rows($check); if($check2 != '0') { die("Username: '".$user."' is in use!"); } if($pass != $pass2) { die('Passwords do not match!'); } $insert_member = mysql_query("INSERT INTO accounts (AccountID, LogonType) VALUES ('$user', '2')"); if($insert_member) { echo("<p class='b01'>Registration Complete! Click <a href=index.php>here</a> to go back to the Home page."); } else { echo("<p class='b01'>Registration Failed!</p>"); }} ?> </div> </div> <div class="post"> <ul> </ul> </div> </div>
Code:<?php $db['info']['user'] = "root"; //Your Username for MySQL $db['info']['pass'] = "root"; //Your Password for MySQL $db['info']['host'] = "localhost"; //Your host $db['info']['name'] = "coproj"; //Your database name