2 Replies - 5364 Views - Last Post: 17 September 2008 - 01:41 PM Rate Topic: -----

#1 komi200  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 28-August 08

php, password length, passowrd confirmation

Post icon  Posted 17 September 2008 - 11:10 AM

 
<?php require_once('Connections/mtob.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "custInfor")) {
$insertSQL = sprintf("INSERT INTO cust_infor (clogin, cname, cpass, cRePass, cpasshint, chomeadd, cOffAdd, cpost, cCity, cstate, cgen, csalu, cemail, cphonum, DOB) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['clogin'], "text"),
GetSQLValueString($_POST['cname'], "text"),
GetSQLValueString($_POST['cpass'], "text"),
GetSQLValueString($_POST['cRePass'], "text"),
GetSQLValueString($_POST['cpasshint'], "text"),
GetSQLValueString($_POST['chomeadd'], "text"),
GetSQLValueString($_POST['cOffAdd'], "text"),
GetSQLValueString($_POST['cpost'], "text"),
GetSQLValueString($_POST['cCity'], "text"),
GetSQLValueString($_POST['cstate'], "text"),
GetSQLValueString($_POST['cgen'], "text"),
GetSQLValueString($_POST['csalu'], "text"),
GetSQLValueString($_POST['cemail'], "text"),
GetSQLValueString($_POST['cphonum'], "int"),
GetSQLValueString($_POST['DOB'], "date"));

mysql_select_db($database_mtob, $mtob);
$Result1 = mysql_query($insertSQL, $mtob) or die(mysql_error());

$insertGoTo = "/newuser.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
function trimdata($formdata)
{
foreach ($formdata as $key=> $value)
{
$new_array[$key] = trim($value);
}
return $new_array;
}
function check_password_length($formdata,$password,$minlen)
{
if (strlen ($formdata[$password]) <$minlen)
return false;
else
return true;
}

function confirm_password($formdata,$cpass,$cRePass)
{
if ($formdata[$cpass] === $formdata[$cRePass])
return true;
else false;
}
header(sprintf("Location: %s", $insertGoTo));
}

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">


i edit password length coding and password confirm coding but its never show me any action. when i try to do it, the password confirm still not working. plz help me to solve it.. kindly tell me whr to fix the both coding. i'm using dreamweaver, php, mysql. thanks alot guys...

Is This A Good Question/Topic? 0
  • +

Replies To: php, password length, passowrd confirmation

#2 Moshambi  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 8
  • View blog
  • Posts: 280
  • Joined: 20-November 07

Re: php, password length, passowrd confirmation

Posted 17 September 2008 - 11:15 AM

if ($formdata[$cpass] === $formdata[$cRePass])
return true;
else false;
}



I would try changing this piece of code right here to this:

if ($formdata[$cpass] === $formdata[$cRePass])
return true;
else 
return false;
}



I don't know if that will fix your problem but sometimes little errors like that will mess up the whole script.
Was This Post Helpful? 0
  • +
  • -

#3 ghqwerty  Icon User is offline

  • if($spareTime > 0){ $this->writeCode(); }
  • member icon

Reputation: 43
  • View blog
  • Posts: 903
  • Joined: 08-August 08

Re: php, password length, passowrd confirmation

Posted 17 September 2008 - 01:41 PM

View PostMoshambi, on 17 Sep, 2008 - 11:15 AM, said:

if ($formdata[$cpass] === $formdata[$cRePass])
return true;
else false;
}



I would try changing this piece of code right here to this:

if ($formdata[$cpass] === $formdata[$cRePass])
return true;
else 
return false;
}



I don't know if that will fix your problem but sometimes little errors like that will mess up the whole script.


also remember {}
you have 1 too many =
so

if ($formdata[$cpass] == $formdata[$cRePass]){
return true;
}else{ 
return false;
}



Was This Post Helpful? 0
  • +
  • -

Page 1 of 1