• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

php + mssql help :)

miro

Emulation Addict
hey guys... iam gettin undiffine connection sql...can you help please...
php:
PHP:
<?php
    
   
        if(isset($_POST["submit"])){

             if($_POST['regpassword'] == $_POST['regcpassword']){
                if(!empty($_POST['regusername']) && !empty($_POST['regpassword'])) {
	                $user=$_POST['regusername'];
	                $pass=$_POST['regpassword'];
                    $email=$_POST['regemail'];


	            $con=mysql_connect('AMIR-PC\SQLEXPRESS','sa','FD9D60B133f498b') or die(mysql_error());
	            mysql_select_db('dnmembership') or die("cannot select DB");

	            $query=mysql_query("SELECT * FROM Accounts WHERE AccountName='".$user."'");
	            $numrows=mysql_num_rows($query);
	            if($numrows==0){
                    $sql="INSERT INTO Accounts(AccountName,NxLoginPwd,AccountEmail) VALUES('$user','$pass','$email')";

	            $result=mysql_query($sql);


	            if($result){
	                echo "Account Successfully Created";
                } else {
	            echo "Failure!";
	            }

	            } else {
	                echo "That username already exists! Please try again with another.";
	            }

        } else {
	        echo "All fields are required!";
        }
        }else{
            echo "passwords are not match";
        }
        }

?>
register form:
HTML:
<form action="" method="post" id="register-form" novalidate>
<div class="register-body">
Username<br/>
<input name="regusername" type="text" class="type4"/>
<br/>Password<br/>
<input name="regpassword" id="regpassword" type="password" class="type4"/>
<br/>Confirm Password<br/>
<input name="regcpassword" type="password" class="type4"/>
<br/>E-Mail Address<br/>
<input name="regemail" type="text" class="type4"/>
<br/>Security Image<br/>
<input name="regcaptcha" type="text" class="type4" maxlength="5"/>
<table width="338" border="0" cellspacing="0" cellpadding="0" style="margin-top:10px;">
<tr>
<td><img src="includes/captcha502b.png?_CAPTCHA&t=0.43569700+1428219637" alt="CAPTCHA"/></td>
<td valign="top" align="center">
<div class="input type2 type4" style="display: inline-block">
<input name="submit" type="submit" value="SUBMIT" class="button" id="submit"/>
<div class="hover"></div>
</div>
<div class="input type2 type3 type4" style="display: inline-block">
<input name="reset" type="reset" value="RESET ALL" class="button" id="reset"/>
<div class="hover"></div>
</div>
</td>
</tr>
</table>
</div>
</form>

btw...its not for world of warcraft server
 
Last edited:

Hyperion

Founder
use Mysqli, mysql is depreciated.

mysqli_connect(host, user, pass, db);

and 'AMIR-PC\SQLEXPRESS' isn't a hostname. if it is local then just use localhost or 127.0.0.1
 

Tok124

Respected Member
He cannot use mysqli. He use mssql. Not mysql. That's different. I tried to help him myself but i could not help since he use mssql
 

Syphex

Exalted Member
So he is running a sql server?

AS mssql stands for Microsoft Structured Query Language
And that is from Microsoft SQL Server

He's into some pretty advanced stuff here, Nothing i can really do as that is a bit more advanced for my current skills. but i thought i would share it.
 
Top