Register Script v14 offi

01/16/2010 18:04 Richii#1
Suche einen funktionirenden Register Script für offi v14
danke schon mal im vorraus :)
01/17/2010 13:43 Richii#2
bump
01/17/2010 20:42 Lucyy#3
register.php
HTML Code:
<?php
include "functions.php";

if(isset($_POST['submit']))
{
	$server = "ALPHA876\SQLEXPRESS,49264";
	$user = "sa";
	$pass= "trimErFgCxSaE603704";
	
	$username = strtolower(trim(htmlspecialchars(addslashes($_POST['username']))));
	$password = md5("0900sas9!00".$_POST['password']);
	$password2 = md5("0900sas9!00".$_POST['password2']);
	$ip = trim(htmlspecialchars($_POST['ip']));

#############################################################
	
	if(strlen($username) < 4 ||
	   strlen($username) > 16)
	{
		die("Dein Benutzername ist zu kurz/lang .<br>Er muss zwischen <b><u>4 und 16</u></b> Zeichen lang sein .");
	}
	
	if(strlen($_POST['password']) < 4 ||
	   strlen($_POST['password']) > 16)
	{
		die("Dein Passwort ist zu kurz/lang .<br>Es muss zwischen <b><u>4 und 16</u></b> Zeichen lang sein .");
	}
	
	if($password != $password2)
	{
		die("Die Passwˆrter stimmen nich ¸berein.");
	}
	
#############################################################

	$conn = mssql_connect($server,$user,$pass);

	if(!$conn)
	{
		die("Connection failed!<br>");
	}

	$select = mssql_select_db("ACCOUNT_DBF",$conn);

	if(!$select)
	{
		die("Can't select Database!<br>");
	}
	
#############################################################
	
	if(exist($username) != '0')
	{
		die ("Der Benutzername ".$username." wird schon benutzt .");
	}
	
	if(existip($ip) >= '2')
	{
		die("Du hast schon genug Accounts erstellt.");
	}
	
#############################################################

	$bind = mssql_init("createaccount",$conn);

	if(!$bind)
	{
		die("Couldn't Bind Variables.<br>");
	}

	$acc = $username;
	$pass = $password;
	$ipadress = $ip;

	mssql_bind($bind, '@account' , $acc , SQLVARCHAR);
	mssql_bind($bind, '@password', $pass, SQLVARCHAR);
	mssql_bind($bind, '@ipadress', $ip  , SQLVARCHAR);

	$execute = mssql_execute($bind);

	if($execute)
	{
		echo 'Account wurde <font color="green">erfolgreich</font> erstellt !';
	}
	else
	{
		echo 'Account erstellung<font color="red">fehlgeschlagen</font> !';
	}

	mssql_close($conn);
}
else
{

?>
<center>
  <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
	<table>
		<tr>
			<td colspan="2" align ="center">
				<h3>Account erstellen</h3>
			</td>
		</tr>
		<tr>
			<td align ="right">
				Account :
			</td>
			<td>
				<input type="text" size="20" name="username" maxlength="15" />
			</td>
            <td>&nbsp;</td>
	    </tr>
		<tr>
			<td align ="right">
				Passwort :
			</td>
			<td>
				<input type="password" size="20" name="password" maxlength="32" />
			</td>
		</tr>
		<tr>
			<td align ="right">
				Passwort widerh. :
			</td>
			<td>
				<input type="password" size="20" name="password2" maxlength="32" />
			</td>
		</tr>
		<tr>
			<td>
				<input type="hidden" size="20" name="ip" maxlength="32" value="<?php echo $_SERVER['REMOTE_ADDR']; ?>"/>
			</td>
        </tr>
      	<tr>
			<td colspan="2" align="center">
				<input type="submit" name="submit" value="Account erstellen" />
			</td>
		</tr>
	</table>
</form>
</center>
<?php
}
?>
functions.php
HTML Code:
<?php

function exist($account){
	$sql = "SELECT * FROM ACCOUNT_TBL WHERE account='".$account."'";
	$result = mssql_query($sql);
	if(!$result) {
		die("MSSQL Error");
	}
	$check = mssql_num_rows($result);
	return $check;
}

function existip($ip){
	$sql = "SELECT * FROM ACCOUNT_TBL_DETAIL WHERE ip='".$ip."'";
	$result = mssql_query($sql);
	if(!$result) {
		die("MSSQL Error");
	}
	$check = mssql_num_rows($result);
	return $check;
}

?>
01/31/2010 22:09 Gamerhh#4
hei danke für die scripts, aber wenn ich mich anmelden will kommt:

Fatal error: Call to undefined function mssql_connect() in C:\xampp\htdocs\flyff\register.php on line 36

was heißt das? :S
hab den servernamen auch geändert...

warte auf antwort :D
01/31/2010 22:45 Lucyy#5
Quote:
Originally Posted by Gamerhh View Post
hei danke für die scripts, aber wenn ich mich anmelden will kommt:

Fatal error: Call to undefined function mssql_connect() in C:\xampp\htdocs\flyff\register.php on line 36

was heißt das? :S
hab den servernamen auch geändert...
Du musst in der php.ini die MSSQL Erweiterung aktivieren und danach Apache neu starten. Dazu entfernst du einfach das Semikolon am Anfang der Zeile.

Vorher
Code:
;extension=php_mssql.dll
Nachher
Code:
extension=php_mssql.dll
02/01/2010 15:21 Gamerhh#6
hmm ..
das ok, aber nun hab ich anscheinen etwas geamcht oder so..
nun kommt bei mir:

Quote:
16) { die("Dein Benutzername ist zu kurz/lang .
Er muss zwischen 4 und 16 Zeichen lang sein ."); } if(strlen($_POST['password']) < 4 || strlen($_POST['password']) > 16) { die("Dein Passwort ist zu kurz/lang .
Es muss zwischen 4 und 16 Zeichen lang sein ."); } if($password != $password2) { die("Die Passwˆrter stimmen nich ¸berein."); } ################################################## ########### $conn = mssql_connect($server,$user,$pass); if(!$conn) { die("Connection failed!
"); } $select = mssql_select_db("ACCOUNT_DBF",$conn); if(!$select) { die("Can't select Database!
"); } ################################################## ########### if(exist($username) != '0') { die ("Der Benutzername ".$username." wird schon benutzt ."); } if(existip($ip) >= '2') { die("Du hast schon genug Accounts erstellt."); } ################################################## ########### $bind = mssql_init("createaccount",$conn); if(!$bind) { die("Couldn't Bind Variables.
"); } $acc = $username; $pass = $password; $ipadress = $ip; mssql_bind($bind, '@account' , $acc , SQLVARCHAR); mssql_bind($bind, '@password', $pass, SQLVARCHAR); mssql_bind($bind, '@ipadress', $ip , SQLVARCHAR); $execute = mssql_execute($bind); if($execute) { echo 'Account wurde erfolgreich erstellt !'; } else { echo 'Account erstellungfehlgeschlagen !'; } mssql_close($conn); } else { ?>



und hier sind die 3 registrierungsfelder..
hab folgendes in der register.php
HTML Code:
<?php
include "functions.php";

if(isset($_POST['submit']))
{
	$server = "AMPH\SQLEXPRESS";
	$user = "sa";
	$pass= "";
	
	$username = strtolower(trim(htmlspecialchars(addslashes($_POST['username']))));
	$password = md5("0900sas9!00".$_POST['password']);
	$password2 = md5("0900sas9!00".$_POST['password2']);
	$ip = trim(htmlspecialchars($_POST['ip']));

#############################################################

	if(strlen($username) < 4 ||
	   strlen($username) > 16)
	{
		die("Dein Benutzername ist zu kurz/lang .<br>Er muss zwischen <b><u>4 und 16</u></b> Zeichen lang sein .");
	}

	if(strlen($_POST['password']) < 4 ||
	   strlen($_POST['password']) > 16)
	{
		die("Dein Passwort ist zu kurz/lang .<br>Es muss zwischen <b><u>4 und 16</u></b> Zeichen lang sein .");
	}
	
	if($password != $password2)
	{
		die("Die Passwˆrter stimmen nich ¸berein.");
	}
	
#############################################################

	$conn = mssql_connect($server,$user,$pass);

	if(!$conn)
	{
		die("Connection failed!<br>");
	}

	$select = mssql_select_db("ACCOUNT_DBF",$conn);

	if(!$select)
	{
		die("Can't select Database!<br>");
	}
	
#############################################################
	
	if(exist($username) != '0')
	{
		die ("Der Benutzername ".$username." wird schon benutzt .");
	}
	
	if(existip($ip) >= '2')
	{
		die("Du hast schon genug Accounts erstellt.");
	}
	
#############################################################

	$bind = mssql_init("createaccount",$conn);

	if(!$bind)
	{
		die("Couldn't Bind Variables.<br>");
	}

	$acc = $username;
	$pass = $password;
	$ipadress = $ip;

	mssql_bind($bind, '@account' , $acc , SQLVARCHAR);
	mssql_bind($bind, '@password', $pass, SQLVARCHAR);
	mssql_bind($bind, '@ipadress', $ip  , SQLVARCHAR);

	$execute = mssql_execute($bind);

	if($execute)
	{
		echo 'Account wurde <font color="green">erfolgreich</font> erstellt !';
	}
	else
	{
		echo 'Account erstellung<font color="red">fehlgeschlagen</font> !';
	}

	mssql_close($conn);
}
else
{

?>
<center>
  <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
	<table>
		<tr>
			<td colspan="2" align ="center">
				<h3>Account erstellen</h3>
			</td>
		</tr>
		<tr>
			<td align ="right">
				Account :
			</td>
			<td>
				<input type="text" size="20" name="username" maxlength="15" />
			</td>
            <td>&nbsp;</td>
	    </tr>
		<tr>
			<td align ="right">
				Passwort :
			</td>
			<td>
				<input type="password" size="20" name="password" maxlength="32" />
			</td>
		</tr>
		<tr>
			<td align ="right">
				Passwort widerh. :
			</td>
			<td>
				<input type="password" size="20" name="password2" maxlength="32" />
			</td>
		</tr>
		<tr>
			<td>
				<input type="hidden" size="20" name="ip" maxlength="32" value="<?php echo $_SERVER['REMOTE_ADDR']; ?>"/>
			</td>
        </tr>
      	<tr>
			<td colspan="2" align="center">
				<input type="submit" name="submit" value="Account erstellen" />
			</td>
		</tr>
	</table>
</form>
</center>
<?php
}
?>
was nun :(
02/01/2010 15:39 janny1783mmm#7
also bei mir kommt leider das hier :(
Warning: include(functions.php) [function.include]: failed to open stream: No such file or directory in C:\xampplite\htdocs\flyff_2\index1.php on line 2

Warning: include() [function.include]: Failed opening 'functions.php' for inclusion (include_path='.;\xampplite\php\PEAR') in C:\xampplite\htdocs\flyff_2\index1.php on line 2

Hab das schon mit dem ; geändert aber irgendwie wil les net :(
02/01/2010 16:03 Lucyy#8
Quote:
Originally Posted by janny1783mmm View Post
also bei mir kommt leider das hier :(
Warning: include(functions.php) [function.include]: failed to open stream: No such file or directory in C:\xampplite\htdocs\flyff_2\index1.php on line 2

Warning: include() [function.include]: Failed opening 'functions.php' for inclusion (include_path='.;\xampplite\php\PEAR') in C:\xampplite\htdocs\flyff_2\index1.php on line 2

Hab das schon mit dem ; geändert aber irgendwie wil les net :(
Bei dir fehlt die functions.php oder du hast sie umbenannt. Bitte behalte die alten Namen (cp.php und functions.php).

@Gamerhh: Auf die schnelle fällt mir dazu nichts ein. Ich werds mir heute noch etwas genauer anschauen.
02/01/2010 16:20 janny1783mmm#9
ja cool hat in der tat geholfen...aber nun zum nächsten fehler >_<

Quote:
Warning: mssql_connect() [function.mssql-connect]: message: Fehler bei der Anmeldung für den Benutzer 'sa'. Der Benutzer ist keiner vertrauenswürdigen SQL Server-Verbindung zugeordnet. (severity 14) in C:\xampplite\htdocs\flyff_2\register.php on line 36

Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: JJJ-PC\SQLEXPRESS in C:\xampplite\htdocs\flyff_2\register.php on line 36
Connection failed!
was hab ich da wieder verbockt?
02/01/2010 16:23 Lucyy#10
Quote:
Originally Posted by janny1783mmm View Post
ja cool hat in der tat geholfen...aber nun zum nächsten fehler >_<



was hab ich da wieder verbockt?
Sieht so aus, als hättest du bei der Installation die Instanz für die Windows Authentifizierung konfiguriert oder einen anderen Anmeldenamen als 'sa' benutzt.

Wie man die Remote Anmeldung freischält oder den Benutzernamen ändert weiß ich leider nicht, ich arbeite noch nicht allzu lange mit MSSQL.
02/01/2010 16:29 janny1783mmm#11
ohhh man :( dann werd ich mich mal duch das große google land schalgen
02/02/2010 10:37 janny1783mmm#12
so habe nun alles neu gemacht und dachte ich wäre auf den richtigen weg ><
nun kommt diese meldung:
Quote:
Warning: mssql_execute() [function.mssql-execute]: message: Für die Prozedur oder Funktion createaccount wurden zu viele Argumente angegeben. (severity 16) in C:\xampplite\htdocs\flyff_2\register.php on line 79

Warning: mssql_execute() [function.mssql-execute]: stored procedure execution failed in C:\xampplite\htdocs\flyff_2\register.php on line 79
Account erstellungfehlgeschlagen !
edit:
sorry für doppelpost >_<
02/03/2010 12:22 Rosiel2#13
hab den gleichen fehler mti execute ...
02/17/2010 10:33 Flo999999#14
@Lucyy: ich hab dasselbe problem wie janny

Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: VPS37159\SQLEXPRESS in C:\inetpub\vhosts\legendsoflevithan.de\httpdocs\ac count.php on line 41
Connection failed!

und ich hab sa als benutzername. ;D
02/17/2010 21:13 kongo1337#15
ich hab auch das problem

Warning: mssql_execute() [function.mssql-execute]: message: Für die Prozedur oder Funktion createaccount wurden zu viele Argumente angegeben. (severity 16) in C:\xampp\htdocs\flyff2\register.php on line 79

Warning: mssql_execute() [function.mssql-execute]: stored procedure execution failed in C:\xampp\htdocs\flyff2\register.php on line 79
Account erstellungfehlgeschlagen !