Jump to content

Recommended Posts

I have a form which submits and if there is an error it sends to this page...

if (isset($_SESSION['error']) && $_SESSION['error'] == true){
   header("location:./?page=register&error=true");
}

 

When it sends it just takes it to the homepage.

if ($_GET['error'] == true && $_SESSION['error'] == true){
$fname = $_SESSION['fname'];
$lname = $_SESSION['lname'];
$email = $_SESSION['email'];
$secq = $_SESSION['secq'];
$seca = $_SESSION['seca'];
$bname = $_SESSION['bname'];
$budget = $_SESSION['budget'];
$deadline = $_SESSION['deadline'];
$other = $_SESSION['other'];
if (isset($_SESSION['error_firstname'])){
	$fname_color = "#CC0000";
}
else{
	$fname_color = "#ffffff";	
}


if (isset($_SESSION['error_lastname'])){
	$lname_color = "#CC0000";
}
else{
	$lname_color = "#ffffff";	
}
if (isset($_SESSION['error_email'])){
	$email_color = "#CC0000";
}
else{
	$email_color = "#ffffff";	
}
if (isset($_SESSION['error_secretq'])){
	$sq_color = "#CC0000";
}
else{
	$sq_color = "#ffffff";	
}
if (isset($_SESSION['error_secreta'])){
	$sa_color = "#CC0000";
}
else{
	$sa_color = "#ffffff";	
}
if (isset($_SESSION['error_work'])){
	$work_color = "#CC0000";
}
else{
	$work_color = "#ffffff";	
}
if (isset($_SESSION['other'])){
$other_color = "#CC0000";
}
else{
$other_color = "#ffffff";
}
if (isset($_SESSION['error_username']) || isset($_SESSION['error_password']) || isset($_SESSION['error_tos']) || isset($_SESSION['error_email'])){
	print "<p>Errors found. Please review the form.</p> <p>Errors are in red</p>";
}
echo<<<END
<form name="client" method="post" action="p_developer.php">
<table width="400" border="0" align="center">
  <tr>
    <td>* First Name:</td>
    <td><input type="text" name="fname" id="fname" size="8" value="$fname" style="background:$fname_color"/></td>
  </tr>
  <tr>
    <td>* Last Name:</td>
    <td><input type="text" name="lname" id="lname" size="8" value="$lname" style="background:$lname_color"/></td>
  </tr>
  <tr>
    <td>* Email:</td>
    <td><input type="text" name="email" id="email" size="8" value="$email" style="background:$email_color"/></td>
  </tr>
  <tr>
    <td>* Confirm Email:</td>
    <td><input type="text" name="confirmemail" id="confirmemail" size="8" value="$email" style="background:$email_color"/></td>
  </tr>
      <tr>
    <td>* Security Question:</td>
    <td><input type="text" name="security" id="security" size="8" value="$secq" style="background:$sq_color"/></td>
  </tr>
    <tr>
    <td>* Security Answer:</td>
    <td><input type="text" name="securityanswer" id="answer" size="8" value="$seca" style="background:$sa_color"/></td>
  </tr>
  <tr>
    <td>Business Name:</td>
    <td><input type="text" name="bname" size="8"/></td>
  </tr>
  <tr>
    <td>Budget:</td>
    <td><input type="text" name="budget" id="budget" size="8" value="$budget" /></td>
  </tr>

  <tr>
    <td>Deadline:</td>
    <td><input type="text" name="deadline" rows="5" id="deadline" size="8" value="$deadline" /></td>
  </tr>
  <tr>
    <td>* All other details:</td>
    <td><textarea name="other" rows="5" id="other"  value="$other" size="8" style="background:$other_color"></textarea></td>
  </tr>
  <tr>
    <td><input type="submit" name="submit" value="Submit" /></td>
    <td> </td>
  </tr>
</table>
END;
}

 

Any suggestions?

 

Thanks,

Steve

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/130163-get-not-working/
Share on other sites

Here is how it is defined...

if (!strstr($email, "@") || !strstr($email, ".") || $email == "" || $email != $email2){
   $_SESSION['error_email'] = true;
   $_SESSION['error'] = true;
}
if (!(isset($fname)) || $fname == ""){
   $_SESSION['error_firstname'] = true;
   $_SESSION['error'] = true;
}
if (!(isset($lname)) || $lname == ""){
   $_SESSION['error_lastname'] = true;
   $_SESSION['error'] = true;
}
if (!(isset($sq)) || $sq == ""){
   $_SESSION['error_secretq'] = true;
   $_SESSION['error'] = true;
}
if (!(isset($sa)) || $sa == ""){
   $_SESSION['error_secreta'] = true;
   $_SESSION['error'] = true;
}

if (isset($_SESSION['error']) && $_SESSION['error'] == true){
   header("location:./?page=register&error=true");
}

 

 

Link to comment
https://forums.phpfreaks.com/topic/130163-get-not-working/#findComment-675026
Share on other sites

http://www.developersmatch.com/developersmatch/client/index%20copy.php you can see what happens there...

 

here is the code...

<?php
if ($_GET['error'] == true && $_SESSION['error'] == true){
$fname = $_SESSION['fname'];
$lname = $_SESSION['lname'];
$email = $_SESSION['email'];
$secq = $_SESSION['secq'];
$seca = $_SESSION['seca'];
$bname = $_SESSION['bname'];
$budget = $_SESSION['budget'];
$deadline = $_SESSION['deadline'];
$other = $_SESSION['other'];
if (isset($_SESSION['error_firstname'])){
	$fname_color = "#CC0000";
}
else{
	$fname_color = "#ffffff";	
}


if (isset($_SESSION['error_lastname'])){
	$lname_color = "#CC0000";
}
else{
	$lname_color = "#ffffff";	
}
if (isset($_SESSION['error_email'])){
	$email_color = "#CC0000";
}
else{
	$email_color = "#ffffff";	
}
if (isset($_SESSION['error_secretq'])){
	$sq_color = "#CC0000";
}
else{
	$sq_color = "#ffffff";	
}
if (isset($_SESSION['error_secreta'])){
	$sa_color = "#CC0000";
}
else{
	$sa_color = "#ffffff";	
}
if (isset($_SESSION['error_work'])){
	$work_color = "#CC0000";
}
else{
	$work_color = "#ffffff";	
}
if (isset($_SESSION['other'])){
$other_color = "#CC0000";
}
else{
$other_color = "#ffffff";
}
if (isset($_SESSION['error_username']) || isset($_SESSION['error_password']) || isset($_SESSION['error_tos']) || isset($_SESSION['error_email'])){
	print "<p>Errors found. Please review the form.</p> <p>Errors are in red</p>";
}
echo<<<END
<form name="client" method="post" action="p_developer.php">
<table width="400" border="0" align="center">
  <tr>
    <td>* First Name:</td>
    <td><input type="text" name="fname" id="fname" size="8" value="$fname" style="background:$fname_color"/></td>
  </tr>
  <tr>
    <td>* Last Name:</td>
    <td><input type="text" name="lname" id="lname" size="8" value="$lname" style="background:$lname_color"/></td>
  </tr>
  <tr>
    <td>* Email:</td>
    <td><input type="text" name="email" id="email" size="8" value="$email" style="background:$email_color"/></td>
  </tr>
  <tr>
    <td>* Confirm Email:</td>
    <td><input type="text" name="confirmemail" id="confirmemail" size="8" value="$email" style="background:$email_color"/></td>
  </tr>
      <tr>
    <td>* Security Question:</td>
    <td><input type="text" name="security" id="security" size="8" value="$secq" style="background:$sq_color"/></td>
  </tr>
    <tr>
    <td>* Security Answer:</td>
    <td><input type="text" name="securityanswer" id="answer" size="8" value="$seca" style="background:$sa_color"/></td>
  </tr>
  <tr>
    <td>Business Name:</td>
    <td><input type="text" name="bname" size="8"/></td>
  </tr>
  <tr>
    <td>Budget:</td>
    <td><input type="text" name="budget" id="budget" size="8" value="$budget" /></td>
  </tr>

  <tr>
    <td>Deadline:</td>
    <td><input type="text" name="deadline" rows="5" id="deadline" size="8" value="$deadline" /></td>
  </tr>
  <tr>
    <td>* All other details:</td>
    <td><textarea name="other" rows="5" id="other"  value="$other" size="8" style="background:$other_color"></textarea></td>
  </tr>
  <tr>
    <td><input type="submit" name="submit" value="Submit" /></td>
    <td> </td>
  </tr>
</table>
END;
}
elseif(isset($_GET['register']) && $_GET['register'] == success){
print "<p>Account created Successfully!</p>\n<p>Please check your inbox to verify your email address<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />";
}
else{
?>
<form name="client" method="post" action="p_developer.php">
<table width="400" border="0" align="center">
  <tr>
    <td>* First Name:</td>
    <td><input type="text" name="fname" id="fname" size="8" /></td>
  </tr>
  <tr>
    <td>* Last Name:</td>
    <td><input type="text" name="lname" id="lname" size="8" /></td>
  </tr>
  <tr>
    <td>* Email:</td>
    <td><input type="text" name="email" id="email" size="8" /></td>
  </tr>
  <tr>
    <td>* Confirm Email:</td>
    <td><input type="text" name="confirmemail" id="confirmemail" size="8"/></td>
  </tr>
      <tr>
    <td>* Security Question:</td>
    <td><input type="text" name="security" id="security" size="8" /></td>
  </tr>
    <tr>
    <td>* Security Answer:</td>
    <td><input type="text" name="securityanswer" id="answer" size="8"/></td>
  </tr>
  <tr>
    <td>Business Name:</td>
    <td><input type="text" name="bname" size="8"/></td>
  </tr>
  <tr>
    <td>Budget:</td>
    <td><input type="text" name="budget" id="budget" size="8" /></td>
  </tr>

  <tr>
    <td>Deadline:</td>
    <td><input type="text" name="deadline" rows="5" id="deadline" size="8" /></td>
  </tr>
  <tr>
    <td>All other details:</td>
    <td><textarea name="other" rows="5" id="other" size="8"></textarea></td>
  </tr>
  <tr>
    <td><input type="submit" name="submit" value="Submit" /></td>
    <td> </td>
  </tr>
</table>
</form>

 

 

Link to comment
https://forums.phpfreaks.com/topic/130163-get-not-working/#findComment-675038
Share on other sites

Here is the whole of

p_developer.php

<?php
include("../config.inc.php");

session_start();
session_destroy();
include("../functions.inc.php");
session_start();
$fname = clean_data($_POST['fname']);
$lname = clean_data($_POST['lname']);
$email = clean_data($_POST['email']);
$email2 = clean_data($_POST['confirmemail']);
$sq = clean_data($_POST['security']);
$sa = clean_data($_POST['securityanswer']);
$bname = clean_data($_POST['bname']);
$budget = clean_data($_POST['budget']);
$deadline = clean_data($_POST['deadline']);
$otherinfo = clean_data($_POST['other']);



$_SESSION['fname'] = $fname;
$_SESSION['lname'] = $lname;
$_SESSION['email'] = $email;
$_SESSION['secq'] = $sq;
$_SESSION['seca'] = $sa;
$_SESSION['bname'] = $bname;
$_SESSION['budget'] = $budget;
$_SESSION['deadline'] = $deadline;
$_SESSION['other'] = $otherinfo;
$skill_count = 0;
if (!strstr($email, "@") || !strstr($email, ".") || $email == "" || $email != $email2){
   $_SESSION['error_email'] = true;
   $_SESSION['error'] = true;
}
if (!(isset($fname)) || $fname == ""){
   $_SESSION['error_firstname'] = true;
   $_SESSION['error'] = true;
}
if (!(isset($lname)) || $lname == ""){
   $_SESSION['error_lastname'] = true;
   $_SESSION['error'] = true;
}
if (!(isset($sq)) || $sq == ""){
   $_SESSION['error_secretq'] = true;
   $_SESSION['error'] = true;
}
if (!(isset($sa)) || $sa == ""){
   $_SESSION['error_secreta'] = true;
   $_SESSION['error'] = true;
}

if (isset($_SESSION['error']) && $_SESSION['error'] == true){
   header("location:./?page=register&error=true");
}
else{
   $sql = "INSERT INTO `clients` (first_name, last_name, email, security_question, security_answer, business_name, budget, deadline, other_details) VALUES('$fname', '$lname', '$email', '$sq', '$sa', '$bname', '$budget', '$deadline', '$otherinfo');";
   mysql_query($sql);
   	$to = $_POST['email'];
$from = "'Developers Match'<contact@developersmatch.com>";
$subject = "Welcome";
$message = "Thank you for signing up you will be contacted shortly with any developers we find. For any support please read our FAQ online and you can email us on\n\r
\n\r
Email - contact@developersmatch.com\n\r

\n\r
Best Regards, \n\r
DevelopersMatch.com";

$headers = "From: $from\r\n";
mail($to, $subject, $message, $headers) or die("ERROR!");

$to = 'contact@developersmatch.com';
$from = "'Developers Match'<contact@developersmatch.com>";
$subject = "New Client";
$message = "$fname $lname has signed up as a client to our service. Please make him feel comftable in our service with friendly and personal contact. All details can be found on the database.

His/Her email is $email";

$headers = "From: $from\r\n";
mail($to, $subject, $message, $headers) or die("ERROR!");




   header("location:./?page=register&register=success");
}

?>

Link to comment
https://forums.phpfreaks.com/topic/130163-get-not-working/#findComment-675074
Share on other sites

I don't have the time to debug the whole thing, but this should fix it

<?php
include("../config.inc.php");
session_start();
session_unset();
include("../functions.inc.php");

$fname = clean_data($_POST['fname']);
$lname = clean_data($_POST['lname']);
$email = clean_data($_POST['email']);
$email2 = clean_data($_POST['confirmemail']);
$sq = clean_data($_POST['security']);
$sa = clean_data($_POST['securityanswer']);
$bname = clean_data($_POST['bname']);
$budget = clean_data($_POST['budget']);
$deadline = clean_data($_POST['deadline']);
$otherinfo = clean_data($_POST['other']);
$_SESSION['fname'] = $fname;
$_SESSION['lname'] = $lname;
$_SESSION['email'] = $email;
$_SESSION['secq'] = $sq;
$_SESSION['seca'] = $sa;
$_SESSION['bname'] = $bname;
$_SESSION['budget'] = $budget;
$_SESSION['deadline'] = $deadline;
$_SESSION['other'] = $otherinfo;
$skill_count = 0;
if (!strstr($email, "@") || !strstr($email, ".") || $email == "" || $email != $email2){
$_SESSION['error_email'] = true;
$_SESSION['error'] = true;
}
if (!(isset($fname)) || $fname == ""){
$_SESSION['error_firstname'] = true;
$_SESSION['error'] = true;
}
if (!(isset($lname)) || $lname == ""){
$_SESSION['error_lastname'] = true;
$_SESSION['error'] = true;
}
if (!(isset($sq)) || $sq == ""){
$_SESSION['error_secretq'] = true;
$_SESSION['error'] = true;
}
if (!(isset($sa)) || $sa == ""){
$_SESSION['error_secreta'] = true;
$_SESSION['error'] = true;
}

if (isset($_SESSION['error']) && $_SESSION['error'] == true){
header("location:./?page=register&error=true");
}
else{
$sql = "INSERT INTO `clients` (first_name, last_name, email, security_question, security_answer, business_name, budget, deadline, other_details) VALUES('$fname', '$lname', '$email', '$sq', '$sa', '$bname', '$budget', '$deadline', '$otherinfo');";
mysql_query($sql);
$to = $_POST['email'];
$from = "'Developers Match'<contact@developersmatch.com>";
$subject = "Welcome";
$message = "Thank you for signing up you will be contacted shortly with any developers we find. For any support please read our FAQ online and you can email us on\n\r
\n\r
Email - contact@developersmatch.com\n\r

\n\r
Best Regards, \n\r
DevelopersMatch.com";

$headers = "From: $from\r\n";
mail($to, $subject, $message, $headers) or die("ERROR!");
$to = 'contact@developersmatch.com';
$from = "'Developers Match'<contact@developersmatch.com>";
$subject = "New Client";
$message = "$fname $lname has signed up as a client to our service.\r\n
    Please make him feel comftable in our service with friendly and personal\r\n
    contact. All details can be found on the database.\r\n
    His/Her email is $email";
$headers = "From: $from\r\n";
mail($to, $subject, $message, $headers) or die("ERROR!");
header("location:./?page=register&register=success");
}
?>

Link to comment
https://forums.phpfreaks.com/topic/130163-get-not-working/#findComment-675360
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.