PHP
18 Dec 2009
 
 
 
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
function registr($user,$password,$stats){
if(empty($user) || empty($password)){
$errors['empty_form'] = true;
}
else{
$errors['empty_form'] = false;
}
return $errors['empty_form'];
}
function registr($user,$password,$stats){
if($fresult==0){
$sql="INSERT INTO members VALUES('','".$user."','".$password."','".$stats."')";
$result=mysql_query($sql);
mysql_close();
}
require_once("config.php");
// Connect to server and select database.
mysql_connect("$dblocation", "$dbuser", "$dbpasswd")or die("cannot connect");
mysql_select_db("$dbname")or die("cannot select DB");
$user=$_POST['cname'];
$password=$_POST['password'];
$stats="user";
$fresult=registr($user,$password,$stats);
if($fresult==0){
$e=registr($user,$password,$stats);}
else{}
?>