Jump to content

need help with my code relate to confirm code...


Alidad

Recommended Posts

yes i can wait to read your article that would help me to understand. at the mean time maybe you can help me with one line code that got into error.

 

please code

 

<?php require_once('../Connections/emailtest.php'); ?>
<?php
$confirm_code=md5(uniqid(rand())); 
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"] == "form1")) {
  $insertSQL = sprintf("INSERT INTO temp_members_db (confirm_code, name, email, password, country) VALUES (%s, %s, %s, %s, %s)",
                       
          GetSQLValueString($_POST['confirm_code'], "text"),
                       GetSQLValueString($_POST['name'], "text"),
                       GetSQLValueString($_POST['email'], "text"),
                       GetSQLValueString($_POST['password'], "text"),
                       GetSQLValueString($_POST['country'], "text"));

  mysql_select_db($database_emailtest, $emailtest);
  $Result1 = mysql_query($insertSQL, $emailtest) or die(mysql_error());

  $insertGoTo = "../IsNotWorking.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $insertGoTo));
}
?>

I'm having trouble to insert confirm_code into the databse, as you can see on the top of code where it said    $confirm_code=md5(uniqid(rand())) that suppose to be insert the code number but i could not figure out why is not working!

 

Any idea that you can help me!

 

AM

Link to comment
Share on other sites

thank you for your help i have fixed that by puting

GetSQLValueString('$confirm_code', "text"),

instead of

GetSQLValueString($_POST['confirm_code'], "text"),

 

but when i tested that and i checked in mysql database is showing word "$confirm_code" instead of confirm code number.

 

What did i missed!

 

AM

Link to comment
Share on other sites

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.