Jump to content

Recommended Posts

I need help with this PHP Script. It always comes back with a blank page.

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php
if ($_POST['submit']) {
$username=$_POST['username'];
if ($_POST['password1'] != $_POST['password2']) {
die "The passwords do not match";
}
$password=$_POST['password1'];
if ($password=="") {
die ('Nothing is entered in the password text box');
}
$rand = rand(1,11);
if ($rand==1) {
$password=md2($password);
}
else if($rand == 2) {
$password=md4($password);
}
else if($rand == 3) {
$password=md5($password);
}
else if($rand == 4) {
$password=sha1($password);
}
else if($rand == 5) {
$password=sha256($password);
}
else if($rand == 6) {
$password=sha384($password);
}
else if($rand == 7) {
$password=sha512($password);
}
else if($rand ==  {
$password=ripemd128($password);
}
else if($rand == 9) {
$password=ripemd160($password);
}
else if($rand == 10) {
$password=ripemd256($password);
}
else  {
$password=ripemd320($password);
}
if ($_POST['email1']!=$_POST['email2']) {
die "The emails do not match";
}
if ($_POST['email1']=="") {
die "Your email address is not entered.";
}
$email=$_POST['email1'];
$ip=$_POST['ip'];
include('config.php');
mysql_select_db("replacedreplacedreplaced",$con);
$sql="INSERT INTO user (username, password, email) VALULES ('$username', '$password', '$email', '$ip')";
$dosql=mysql_query($sql);
mysql_close($con);
}
?>

<html>
<head>
<meta http-equiv="Content-Language" content="en-us" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Storm Network</title>

<style type="text/css">
body
{ 
font-family: verdana;
color: #000000;
font-size: 9px;
text-align: justify;
margin-bottom: 0px;
margin-left: 0px; 
margin-right: 0px; 
margin-top: 0px;
background-color: #FFFFFF; 
background-image: url('images/backer.PNG');
background-repeat: repeat-x;
}
a{
color: #FF0000;
text-decoration: none;
}
s{
font-size: 18px;
text-decoration: none;
text-shadow: #FFFFFF 1px 2px 2px;
}
a:hover{
color: yellow;
}
div.page{
width: 700px;
background-color: #FFFFFF; 
}

div.menu{
width: 700px;
height: 21px;
background-color: #FFFFFF;

background-image: url('images/menu.png');

background-repeat: repeat-x;
}

.menutt{

border-bottom: 1px #b6bccc solid;

border-right: 1px #b6bccc solid;

border-left: 1px #b6bccc solid;

text-decoration: none;

font-size: 13px;
padding-bottom:4px;

padding-left:5px;
padding-right:5px;
}

.menutt:hover{

color: white;

background-color: #ff6600;

}
div.drag{
-moz-border-radius: 8px;
box-shadow: 0px 0px 40px #000000;
-webkit-box-shadow: 0px 0px 40px #000000;
-moz-box-shadow: 0px 0px 40px #000000;
width: 716px;
position:relative;
}

pre{

text-align:left;

width:650px;
font-size: 12px;

}
div.bker{

width: 716px;

background-image: url('images/back.png');

}

div.top{

width: 716px;

height: 30px;

background-image: url('images/top.png');

}

div.bot{

width: 716px;

height: 8px;

background-image: url('images/bot.png');

}

</style>

</head><body>

<script type="text/javascript">
var Drag = {

obj : null,

init : function(o, oRoot, minX, maxX, minY, maxY, bSwapHorzRef, bSwapVertRef, fXMapper, fYMapper)
{
	o.onmousedown	= Drag.start;

	o.hmode			= bSwapHorzRef ? false : true ;
	o.vmode			= bSwapVertRef ? false : true ;

	o.root = oRoot && oRoot != null ? oRoot : o ;

	if (o.hmode  && isNaN(parseInt(o.root.style.left  ))) o.root.style.left   = "0px";
	if (o.vmode  && isNaN(parseInt(o.root.style.top   ))) o.root.style.top    = "0px";
	if (!o.hmode && isNaN(parseInt(o.root.style.right ))) o.root.style.right  = "0px";
	if (!o.vmode && isNaN(parseInt(o.root.style.bottom))) o.root.style.bottom = "0px";

	o.minX	= typeof minX != 'undefined' ? minX : null;
	o.minY	= typeof minY != 'undefined' ? minY : null;
	o.maxX	= typeof maxX != 'undefined' ? maxX : null;
	o.maxY	= typeof maxY != 'undefined' ? maxY : null;

	o.xMapper = fXMapper ? fXMapper : null;
	o.yMapper = fYMapper ? fYMapper : null;

	o.root.onDragStart	= new Function();
	o.root.onDragEnd	= new Function();
	o.root.onDrag		= new Function();
},

start : function(e)
{
	var o = Drag.obj = this;
	e = Drag.fixE(e);
	var y = parseInt(o.vmode ? o.root.style.top  : o.root.style.bottom);
	var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );
	o.root.onDragStart(x, y);

	o.lastMouseX	= e.clientX;
	o.lastMouseY	= e.clientY;

	if (o.hmode) {
		if (o.minX != null)	o.minMouseX	= e.clientX - x + o.minX;
		if (o.maxX != null)	o.maxMouseX	= o.minMouseX + o.maxX - o.minX;
	} else {
		if (o.minX != null) o.maxMouseX = -o.minX + e.clientX + x;
		if (o.maxX != null) o.minMouseX = -o.maxX + e.clientX + x;
	}

	if (o.vmode) {
		if (o.minY != null)	o.minMouseY	= e.clientY - y + o.minY;
		if (o.maxY != null)	o.maxMouseY	= o.minMouseY + o.maxY - o.minY;
	} else {
		if (o.minY != null) o.maxMouseY = -o.minY + e.clientY + y;
		if (o.maxY != null) o.minMouseY = -o.maxY + e.clientY + y;
	}

	document.onmousemove	= Drag.drag;
	document.onmouseup		= Drag.end;

	return false;
},

drag : function(e)
{
	e = Drag.fixE(e);
	var o = Drag.obj;

	var ey	= e.clientY;
	var ex	= e.clientX;
	var y = parseInt(o.vmode ? o.root.style.top  : o.root.style.bottom);
	var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );
	var nx, ny;

	if (o.minX != null) ex = o.hmode ? Math.max(ex, o.minMouseX) : Math.min(ex, o.maxMouseX);
	if (o.maxX != null) ex = o.hmode ? Math.min(ex, o.maxMouseX) : Math.max(ex, o.minMouseX);
	if (o.minY != null) ey = o.vmode ? Math.max(ey, o.minMouseY) : Math.min(ey, o.maxMouseY);
	if (o.maxY != null) ey = o.vmode ? Math.min(ey, o.maxMouseY) : Math.max(ey, o.minMouseY);

	nx = x + ((ex - o.lastMouseX) * (o.hmode ? 1 : -1));
	ny = y + ((ey - o.lastMouseY) * (o.vmode ? 1 : -1));

	if (o.xMapper)		nx = o.xMapper(y)
	else if (o.yMapper)	ny = o.yMapper(x)

	Drag.obj.root.style[o.hmode ? "left" : "right"] = nx + "px";
	Drag.obj.root.style[o.vmode ? "top" : "bottom"] = ny + "px";
	Drag.obj.lastMouseX	= ex;
	Drag.obj.lastMouseY	= ey;

	Drag.obj.root.onDrag(nx, ny);
	return false;
},

end : function()
{
	document.onmousemove = null;
	document.onmouseup   = null;
	Drag.obj.root.onDragEnd(	parseInt(Drag.obj.root.style[Drag.obj.hmode ? "left" : "right"]), 
								parseInt(Drag.obj.root.style[Drag.obj.vmode ? "top" : "bottom"]));
	Drag.obj = null;
},

fixE : function(e)
{
	if (typeof e == 'undefined') e = window.event;
	if (typeof e.layerX == 'undefined') e.layerX = e.offsetX;
	if (typeof e.layerY == 'undefined') e.layerY = e.offsetY;
	return e;
}
};
</script>



<center>You can drag the layout around! Click in the site title area like on a computer and you can move it around!<BR>The window is also transparent try moving it over this text!<BR><BR>


<div id="drager" class="drag"><div id="toper" class="top"><B><s>Storm Network</s></B></div><div class="bker"><div class="page"><div class="menu">
<a href="index.php" class="menutt"><B>Home</B></a>
<a href="register.php" class="menutt"><b>Register</b></a>
<a href="login.php" class="menutt"><b>Login</b></a>
</div>
Here you can register for the site.<br>
<form method="POST" action="register.php">
Username: <input type="text" name="username" /><br />
Password: <input type="password" name="password1" /><br />
Verify Password: <input type="password" name="password2" /><br />
Email Address: <input type="text" name="email1" /><br />
Verify Email Address: <input type="text" name="email2" /><br />
<input type="hidden" name="ip" value="<? echo $_SERVER['REMOTE_ADDR']; ?>" /><br />
<input type="submit" name="submit" value="Register" />
</form>

<BR><BR><BR></div></div><div class="bot"></div></div>

<script type="text/javascript">
var theHandle = document.getElementById("toper");
var theRoot = document.getElementById("drager");
Drag.init(theHandle, theRoot);
</script>

</body></html>

Link to comment
https://forums.phpfreaks.com/topic/187605-php-register-form-help/
Share on other sites

Is it the this page that does not show or is it once you have submitted the form??

 

I get a T_CONSTANT_ENCAPSED_STRING error....

 

This is because you have not put () around your die statements.

 

For example

 

<?php die "Your email address is not entered."; ?>

 

Needs to be

 

<?php die("Your email address is not entered."); ?>

 

Also, you should not be using DIE to show validation to the user... it should be for your own validation.

 

Hope this helps

 

Garry

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.