Jump to content
php.lv forumi

Shaize ar CONFIG.php laikam!Nerada reg lapu


deels

Recommended Posts

<?php

session_start();

$db_name = "xxx_xxx";

$host = "localhost";

$user = "xxxx";

$pass = "xxxx";

 

$link = mysql_connect($host,$user,$pass) or die(mysql_errno($link).mysql_error($link));

 

$db = mysql_select_db($db_name,$link) or die(mysql_errno($link).mysql_error($link));

mysql_query ("SET NAMES 'cp1251'");

?>

 

------------------------------------------------------------------------------------------------------------------------------------------

taatad sads izskatas Config fails !

vaina laikam vinaa jo iejot caur web register.php neraadaas nekaa.. a kad config.php sadi nokonnfigurets nekaa neradas tuksa lapa...

 

Seit arii register.php ja tas palidzes risinat problemu.

-------------------------------------------------------------------------------------------------------------------------------------

register.php

 

 

<?php

include("config.php");

?>

<table width="100%" align="center"><tr><td align="center">

<br>

<table width="300" border="0" cellspacing="0" cellpadding="0">

<tr>

<td colspan="3" height="28" background="image/menuup_long.gif">

<div align="center"><font color="#FFFFFF"><b>Register:</b></font></div></td>

</tr>

<tr>

<td width="12" height="76" background="image/menuleft.gif"> </td>

<td width="276" height="76" align="center">

<?php

if(isset($_POST['submit'])){

if(!empty($_POST['username']) && !empty($_POST['email']) && !empty($_POST['password']) && !empty($_POST['password_again'])){

$post_username = htmlspecialchars($_POST['username']);

$post_email = htmlspecialchars($_POST['email']);

$post_password = htmlspecialchars(md5(sha1($_POST['password'])));

$post_password_again = htmlspecialchars(md5(sha1($_POST['password_again'])));

////////////////////// Checkingin formation and creating user ////////////////////////

$query = mysql_query("SELECT * FROM `users` WHERE `username`='".$post_username."'");

if(mysql_num_rows($query) < 1){

if(strlen($post_username) < 20){

if($post_password == $post_password_again){

$reg_q = mysql_query("INSERT INTO `users` (`username`, `password`, `email`) VALUES ('".$post_username."', '".$post_password."', '".$post_email."')");

if($reg_q){

echo "<font color=green>You were successfuly registered.</font><br><a href='login.php'><font color=#006699>Please login.</font></a>";

}else{

echo "MySQL Error: ".mysql_error();

}

}else{

echo "<font color=red>Passwors do not match.</font>";

}

}else{

echo "<font color=red>Login must be less than 20 symbols.</font>";

}

}else{

echo "<font color=red>This login is already registered.</font>";

}

}else{

echo "<font color=red>All fields are necessary.</font>";

}

}

?>

<form action="register.php" method="post">

<table>

<tr><td><strong>Login: </strong></td><td><input type="text" name="username" maxlength="20"></td></tr>

<tr><td><strong>E-mail: </strong></td><td><input type="text" name="email" maxlength="30"></td></tr>

<tr><td><strong>Password: </strong></td><td><input type="password" name="password" maxlength="20"></td></tr>

<tr><td><strong>Password again: </strong></td><td valign="top"><input type="password" name="password_again" maxlength="20"></td>

</tr>

<tr align="center"><td colspan="2">

<input type="submit" value="Register" name="submit"></td>

</tr>

</table>

</form>

</td>

<td width="12" height="76" background="image/menuright.gif"> </td>

</tr>

<tr>

<td colspan="3" height="28" background="image/menudown_long.gif"> </td>

</tr>

</table>

<br>

</td>

</tr></table>

Link to comment
Share on other sites

×
×
  • Create New...