Jump to content

phpinfo comparison


student101

Recommended Posts

I need some idea of why my code works on 2 servers except the one that it needs to work on.

Below is the code including the sites where the phpinfo is loaded.

 

Please help me figure this one out, it's probably simple but I don't see it.

 

phpinfo of the one not working as expected

phpinfo of the one that works as expected

 

The problem is here I think?

$insertGoTo = SITE_URL."?pg=registered&addr=".$myid;

header('Location:'.$insertGoTo);

 

The code is too long to be posted... in reply...

Link to comment
Share on other sites

<?php 
if (!session_id()) session_start();

// require_once('restrict.php'); 
// restrict.php start
if (!isset($_SESSION)){session_start();}
define("SITE_URL", "http://" . $_SERVER['HTTP_HOST'] . "/");

if (isset($_GET['pg']) && $_GET['pg'] != "") {
$page = basename($_SERVER['SCRIPT_NAME']); 
$page = trim(stripslashes($page));
$page = explode(".", $page);
$page = strtolower($page[0]);
$page = strtolower($_GET['pg']);
}else{
header('location:'.SITE_URL.'?pg=home');
}
// restrict.php end
?>
<?php require_once('Connections/cnfwd.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($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']);
}

// *** Mail form ***
if (isset($_POST["FX_sendForm"]) && $_POST["FX_sendForm"] == "regform") {

foreach ($_POST as $key => $value) { 
$_POST[$key] = trim(mysql_real_escape_string($value)); 
}

$checkemail = "/^[a-z0-9]+([_\\.-][a-z0-9]+)*@([a-z0-9]+([\.-][a-z0-9]+)*)+\\.[a-z]{2,}$/i";

$colname1_rscheck = "-1";
if (isset($_POST['email2'])) {
  $colname1_rscheck = $_POST['email2'];
}
$colname2_rscheck = "-1";
if (isset($_POST['uname'])) {
  $colname2_rscheck = $_POST['uname'];
}
$colname3_rscheck = "-1";
if (isset($_POST['rplate'])) {
  $colname3_rscheck = $_POST['rplate'];
}
mysql_select_db($database_cnfwd, $cnfwd);
$query_rscheck = sprintf("SELECT * FROM freewayusers WHERE emailaddress = %s OR uname = %s OR rplate = %s", GetSQLValueString($colname1_rscheck, "text"),GetSQLValueString($colname2_rscheck, "text"),GetSQLValueString($colname3_rscheck, "text"));
$rscheck = mysql_query($query_rscheck, $cnfwd) or die(mysql_error());
$row_rscheck = mysql_fetch_assoc($rscheck);
$totalRows_rscheck = mysql_num_rows($rscheck);

if ($totalRows_rscheck >= 1){
$mess = "<p>Sorry but that <b>Registration Plate</b>, <b>Username</b> or <b>Email</b> already exists!</p>";

}else if( strlen($_POST['rplate']) < 6 || strlen($_POST['rplate']) > 15 ){
  $mess .= "<p>Your Registration Plate should be between 6 and 15 characters.</p>";
}else if(preg_match('/[^0-9A-Za-z]/',$_POST['rplate'])){
  $mess .= "<p>Invalid characters in Registration Plate!</p>";

}else if( strlen($_POST['uname']) < 6 || strlen($_POST['uname']) > 15 ){
  $mess .= "<p>Your username should be between 6 and 15 characters.</p>";
}else if(preg_match('/[^0-9A-Za-z]/',$_POST['uname'])){
  $mess .= "<p>Invalid characters in username!</p>";
  
}else if( strlen($_POST['pwd2']) < 6 || strlen($_POST['pwd2']) > 15 ){
  $mess .= "<p>Your password should be between 6 and 15 characters</p>";
}else if(preg_match("/^.*(?=.{8,})(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z]).*$/", $_POST["pwd2"]) === 0) {
$mess .= "<p>Your password should be between 6 and 15 characters & contain at least one uppercase, lowercase & digit</p>"; 
}else if(!ereg("^([a-zA-Z0-9]{6,15})$", $_POST['pwd2']) || !ereg ("[a-zA-Z]", $_POST['pwd2']) || !ereg ("[0-9]", $_POST['pwd2'])) {
  $mess .= "<p>Your password should contain characters & digits</p>";
}else if(preg_match('/[^0-9A-Za-z]/',$_POST['pwd2'])){
  $mess .= "<p>Invalid characters in password!</p>";
}else if($_POST['pwd2'] != $_POST['con_pwd2']){
  $mess = "<p>Your passwords don't match!</p>";

}else if( strlen($_POST['fulllname']) < 6 || strlen($_POST['fulllname']) > 15 ){
  $mess .= "<p>Your fulllname should be between 6 and 15 characters.</p>";

}else if(!preg_match($checkemail, $_POST['email2'])){
  $mess = "<p>Please provide your valid email address</p>";
}else if(!preg_match($checkemail, $_POST['con_email2'])){
  $mess = "<p>Please confirm your valid email address</p>";
}else if($_POST['email2'] != $_POST['con_email2']){
  $mess = "<p>Your Email Addresses  don't match!</p>";

}else if($_POST['txtgender'] == "") {$mess .= "<p>Please provide your preferred Gender</p>"; 
}else if($_POST['txtlookgender'] == "") {$mess .= "<p>Please provide the preferred Gender you are loooking for</p>"; 
}else if($_POST['txtlookagestart'] == "") {$mess .= "<p>Please provide your Preferred starting age range</p>";
}else if($_POST['txtlookageend'] == "") {$mess .= "<p>Please provide your Preferred ending age range</p>";
}else if($_POST['country'] == "") { $mess .= "<p>Please provide your Province</p>";
}else if($_POST['city'] == "") {$mess .= "<p>Please provide your City</p>"; 

}else if(
mysql_num_rows(mysql_query("SELECT emailaddress, uname, rplate FROM freewayusers WHERE emailaddress = '".$_POST['email2']."' OR uname = '".$_POST['uname']."' OR rplate = '".$_POST['rplate']."'")) == 1){
$mess = "<p>Sorry but that <b>Registration Plate</b>, <b>Username</b> or <b>Email</b> already exists!</p>";

}else if($_POST['code'] != $_SESSION['code'] || $_POST['code']=='') {
$mess .= "<p>Please match the code below.</p>";

}else{

require_once("class.phpmailer.php");
function smtpmailer($to, $from, $from_name, $subject, $body) { 
global $error;
$mail = new PHPMailer(); // defaults to using php "mail()"
$mail->Sender=$from;
$mail->AddReplyTo($from, $from_name);
$mail->AddAddress($to);
$mail->SetFrom($from, $from_name);
$mail->Subject = $subject;
$mail->Body = $body;
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
if(!$mail->Send()) {
  $error = 'Mail error: '.$mail->ErrorInfo; 
  return false;
} else {
  return true;
}
}

$time = strtotime("+6 hours");
$time = date('l jS \of F Y h:i:s A', $time);

$ffrom = "noreply@example.com";
$fname = "Freeway Dating";
$email2 = $_POST['email2'];
$fulllname = $_POST['fulllname'];
$uname = $_POST['email2'];
$upass = $_POST['pwd2'];
$ucode = $_POST['code'];
$htmSubject = "Member Registration: ".$email2;
$htmlBody = $time." text for email goes here";
if (smtpmailer($email2, $ffrom, $fname, $htmSubject, $htmlBody)) {
smtpmailer($ffrom, $email2, $fulllname, $htmSubject, $htmlBody);
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
$alphanum = "23456789ABCDEFGHJKMNPQRSTUVWXYZ23456789abcdefghkmnpqrstuvwxyz23456789";
$rand1 = substr(str_shuffle($alphanum), 0, 5);
$_POST['pwd2'] = $_POST['pwd2'].'_'.$rand1;
$insertmSQL = sprintf("INSERT INTO freewayemail (rplate, uname, pwd2, fullname, emailaddress, fmsg, code) VALUES (%s, %s, %s, %s, %s, %s, %s)",
                       GetSQLValueString($_POST['rplate'], "text"),
                       GetSQLValueString($_POST['uname'], "text"),
                       GetSQLValueString($_POST['pwd2'], "text"),
                       GetSQLValueString($_POST['fulllname'], "text"),
                       GetSQLValueString($_POST['email2'], "text"),
                       GetSQLValueString($htmlBody, "text"),
                       GetSQLValueString($_POST['code'], "text"));
  mysql_select_db($database_cnfwd, $cnfwd);
  $ResultSQL = mysql_query($insertmSQL, $cnfwd) or die(mysql_error());

$_POST['pwd2'] = md5($_POST['pwd2']);
  $insertSQL = sprintf("INSERT INTO freewayusers (intaccessid, rplate, uname, pwd2, fullname, emailaddress, txtlookagestart, txtlookageend, txtgender, txtlookgender, country, city, code) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
                       GetSQLValueString($_POST['intaccessid'], "int"),
                       GetSQLValueString($_POST['rplate'], "text"),
                       GetSQLValueString($_POST['uname'], "text"),
                       GetSQLValueString($_POST['pwd2'], "text"),
                       GetSQLValueString($_POST['fulllname'], "text"),
                       GetSQLValueString($_POST['email2'], "text"),
                       GetSQLValueString($_POST['txtlookagestart'], "text"),
                       GetSQLValueString($_POST['txtlookageend'], "text"),
                       GetSQLValueString($_POST['txtgender'], "text"),
                       GetSQLValueString($_POST['txtlookgender'], "text"),
                       GetSQLValueString($_POST['country'], "text"),
                       GetSQLValueString($_POST['city'], "text"),
                       GetSQLValueString($_POST['code'], "text"));

  mysql_select_db($database_cnfwd, $cnfwd);
  $Result1 = mysql_query($insertSQL, $cnfwd) or die(mysql_error());
  $myid = mysql_insert_id();
  $insertGoTo = SITE_URL."?pg=registered&addr=".$myid;
header('Location:'.$insertGoTo);
}
}

mysql_select_db($database_cnfwd, $cnfwd);
$query_rsprovince = "SELECT prid, province, id, city FROM cty, provinces WHERE pid = prid";
$rsprovince = mysql_query($query_rsprovince, $cnfwd) or die(mysql_error());
$row_rsprovince = mysql_fetch_assoc($rsprovince);
$totalRows_rsprovince = mysql_num_rows($rsprovince);
?>

<form action="<?php SITE_URL;?>?pg=register" method="post" name="regform" id="regform" autocomplete="off">
<table width="100%" border="0" cellpadding="0" cellspacing="2" style="border:1px solid #E47522;">
<tr>
<td colspan="3" class="formhead"><h2>Account Registration Form</h2></td>
</tr>
<tr>
  <td colspan="3"><?php if(isset($mess)) { ?>
<h3 style="color:#900;">Form errors</h3>
<div class="messagebox" style="border:1px solid #F00;"><?php echo $mess; ?></div>
<?php }?></td>
</tr>
<tr>
  <td colspan="3"><h3>Login Details</h3></td>
  </tr>
<tr class="lightblue">
<td>Registration Plate:</td>
<td><input class="ornge" name="rplate" type="text" id="rplate" size="20" value="<?php echo((isset($_POST["rplate"]))?trim(stripslashes($_POST["rplate"])):"") ?>" /></td>
<td> </td>
</tr>
<tr class="colnull">
<td width="36%">Username:</td>
<td width="18%">
<input class="ornge" name="uname" type="text" id="uname" size="20" maxlength="20" value="<?php echo((isset($_POST["uname"]))?trim(stripslashes($_POST["uname"])):"") ?>" />
</td>
<td width="46%" rowspan="2"><img src="img/back.png" align="absmiddle" /> Please choose a unique username by which other members will communicate with you. Please choose one with at least 6 and at most 15 characters. </td>
</tr>
<tr class="colnull">
  <td width="36%"> </td>
  <td><div style="margin-top:6px" class="posthidden">
  <p class="signup"><img src="img/pp.png" align="left" border="0" /><a href="javascript:void(0);" onclick="checkUname();">Username Exists?</a></p>
  </div></td>
</tr>
<tr class="lightblue">
  <td>Password:</td>
<td><input name="pwd2" type="password" class="ornge" id="pwd2" value="<?php echo((isset($_POST["pwd2"]))?trim(stripslashes($_POST["pwd2"])):"") ?>" size="17" maxlength="15" /></td>
  <td rowspan="2"><img src="img/back.png" alt="" align="absmiddle" /> Please choose a password that you will remember, this will be used when logging in to your account. Your password should be between 6 and 15 characters long. </td>
</tr>
<tr class="lightblue">
  <td>Repeat Password: </td>
  <td><input name="con_pwd2" type="password" class="ornge" id="con_pwd2" value="<?php echo((isset($_POST["con_pwd2"]))?trim(stripslashes($_POST["con_pwd2"])):"") ?>" size="17" maxlength="15" /></td>
</tr>
<tr class="colnull" style="display:none;" id="unamecheck_body">
  <td colspan="3" id="unamecheck" style="border-top: 1px solid #e0e7ef; border-bottom: 1px solid #e0e7ef;"> </td>
</tr>
<tr>
  <td colspan="3"><h3>Profile</h3></td>
  </tr>
<tr class="lightblue">
  <td>Full Name:</td>
  <td><input class="ornge" name="fulllname" type="text" id="fulllname" size="20" value="<?php echo((isset($_POST["fulllname"]))?trim(stripslashes($_POST["fulllname"])):"") ?>" /></td>
  <td><img src="img/back.png" align="absmiddle" /> Required for communication directly between Freeway Dating and yourself. </td>
</tr>
<tr class="colnull">
  <td>Email Address: </td>
  <td><input class="ornge" name="email2" type="text" id="email2" size="30" value="<?php echo((isset($_POST["email2"]))?trim(stripslashes($_POST["email2"])):"") ?>" /></td>
  <td rowspan="2"><img src="img/back.png" alt="" align="absmiddle" /> Please make sure that the email address you enter is valid and belongs to you, you will not be able to validate your account if you can not read the confirmation email that will be sent to this address. </td>
</tr>
<tr class="colnull">
  <td>Confirm Email Address: </td>
  <td><input name="con_email2" type="text" class="ornge" id="con_email2" value="<?php echo((isset($_POST["con_email2"]))?trim(stripslashes($_POST["con_email2"])):"") ?>" size="30" /></td>
</tr>
<tr>
  <td>I am a:<!-- / We area a:--></td>
  <td colspan="2"><select class="ornge" style="width: 80px" name="txtgender" onchange="updateTimes();">
<option value="" <?php if (!(strcmp("", $_POST['txtgender']))) {echo "selected=\"selected\"";} ?>>Gender</option>
<option label="Man" value="Man" <?php if (!(strcmp("Man", $_POST['txtgender']))) {echo "selected=\"selected\"";} ?>>Man</option>
<option label="Woman" value="Woman" <?php if (!(strcmp("Woman", $_POST['txtgender']))) {echo "selected=\"selected\"";} ?>>Woman</option>
</select> looking for a <select class="ornge" style="width: 100px" name="txtlookgender" onchange="updateTimes();">
<option value="" <?php if (!(strcmp("", $_POST['txtlookgender']))) {echo "selected=\"selected\"";} ?>>Gender</option>
<option label="Man" value="Man" <?php if (!(strcmp("Man", $_POST['txtlookgender']))) {echo "selected=\"selected\"";} ?>>Man</option>
<option value="Woman" <?php if (!(strcmp("Woman", $_POST['txtlookgender']))) {echo "selected=\"selected\"";} ?>>Woman</option>
</select></td>
  </tr>
<tr>
  <td>Preferred age range:</td>
  <td colspan="2"> <select class="ornge" style="width: 100px" name=txtlookagestart>
<option value="" <?php if (!(strcmp("", $_POST['txtlookagestart']))) {echo "selected=\"selected\"";} ?>>Age Start</option>
<option label="18" value="18" <?php if (!(strcmp(18, $_POST['txtlookagestart']))) {echo "selected=\"selected\"";} ?>>18</option>
... to 
<option label="99" value="99" <?php if (!(strcmp(99, $_POST['txtlookagestart']))) {echo "selected=\"selected\"";} ?>>99</option>
</select> to             <select class="ornge" style="width: 100px" name=txtlookageend>
<option value="" <?php if (!(strcmp("", $_POST['txtlookageend']))) {echo "selected=\"selected\"";} ?>>Age End</option>
<option label="18" value="18" <?php if (!(strcmp(18, $_POST['txtlookageend']))) {echo "selected=\"selected\"";} ?>>18</option>
... to
<option label="99" value="99" <?php if (!(strcmp(99, $_POST['txtlookageend']))) {echo "selected=\"selected\"";} ?>>99</option>
</select> years old. </td>
</tr>
<tr class="colnull">
  <td colspan="3"><h3>Location</h3></td>
  </tr>
<tr class="colnull">
<td>Province:</td>
<td>
<select name="country" id="country" onchange="TCN_reload(this)">
  <option selected="selected" value="" <?php if (!(strcmp("", $_POST['country']))) {echo "selected=\"selected\"";} ?>>Select Province</option>
</select></td>
<td rowspan="2"><img src="img/back.png" alt="" align="absmiddle" /> Part of the Public Gallery search provides that members
    (including yourself) can search for matches through provinces and suburbs. You can also hide your profile
    from being displayed in the gallery. </td>
</tr>
<tr class="lightblue">
<td>Suburb:</td>
<td>
<select name="city" id="city" onchange="TCN_reload(this)">
<option selected="selected" value="" <?php if (!(strcmp("", $_POST['city']))) {echo "selected=\"selected\"";} ?>>Select City</option>
</select>
<script language="JavaScript" type="text/javascript">
//script to process the the dynamic drop down
</script>
</td>
</tr>
<tr>
  <td> </td>
  <td> </td>
  <td> </td>
</tr>
<tr>
  <td> </td>
  <td> </td>
  <td> </td>
</tr>
<tr>
  <td> </td>
  <td> </td>
  <td> </td>
</tr>
<tr>
  <td> </td>
  <td> </td>
  <td> </td>
</tr>
<tr>
  <td><strong style="float:left; margin-top:10px;">Code:</strong></td>
  <td colspan="2"><img src="captcha.php" alt="code" name="image" border="0" style="vertical-align: middle; margin:2px;" id="image" /><a href="#" onclick="javascript: document.getElementById('image').src = 'captcha.php?' + Math.random();"><img src="img/refresh.gif" alt="Refresh code" title="Refresh code" width="16" height="16" border="0" style="vertical-align:middle; margin:2px;"/></a><input name="code" type="text" id="code" size="5" maxlength="8" style="width:60px;" class="ornge" /></td>
  </tr>
<tr class="loginfoot">
<td> </td>
<td> </td>
<td><input name="Submit" type="submit" value="Next Step ›" />
<input name="intaccessid" type="hidden" id="intaccessid" value="98" />
<input type="text" name="dummy" style="display:none" />
<input type="hidden" name="MMinsert" value="form1" />
</td>
</tr>
</table>
<input type="hidden" name="FX_sendForm" value="regform" />
</form>
<p> </p>
<?php
mysql_free_result($rsprovince);
mysql_free_result($rscheck);
?>

Link to comment
Share on other sites

Nobody is going to wade through that much code hunting for some problem when you don't even tell us what the problem is.  Are you getting an error message?  If so what is it, exactly?  Do you just get a blank page?  You need to tell us what exactly is not working right, what it is doing, and what you expect it to be doing.

 

You should also attempt to narrow down the problem area and just post the 10 or so lines around that area, not just dump the entire file.

 

 

 

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.