html - PHP mail Form redirect URL doesn't work. Webpage is here. (Tried other "SOF" answers) -


first of all, have this.i used "wix" website since doesn't have function [img] tag percentage width.so have started making own website, , that's 1month ago, when knew how [img src], without other html knowledge. forced myself make myself can make website want, , seems done uploaded on hosting server.

the problem is, in 'order page', after filling out form, , press 'submit button', doesn't show page attended show. turns out first part of order page.

the code tried

if(isset($_post['submitted'])) { if($formproc->processform()) {     $formproc->redirecttourl("http://ljhbunkercom.ipage.com/index/thank-you.php"); } 

when filled form gets submitted submit button, sends every information mailbox, thank-you.php doesn't show up.

i tried

 if(isset($_post['submitted']))     {     if($formproc->processform())     {         $formproc->header("location: http://ljhbunkercom.ipage.com/index/thank-you.php");    } 

( change , redirect url -> header location.)

and also, not showing thank-you page.

i modified free open email form source own order page, combining open source.

-->http://www.sanwebe.com/2014/04/ajax-contact-form-attachment-jquery-php

this source used, works fine. when filled out input text box , pressed submit button, shows thank-you.php.

i think did wrong, when modified it.

i remember changed this, htmlentities-> htmlspecialchars don't think effect.

please .

my web orderpage . http://ljhbunkercom.ipage.com/index/order.php

(! please not hack webpage. )

****what problem, , how can make show thank-you.php page when required information have been submitted??****

============== form class==========

    class fg_captchahandler {     function validate() { return false;}     function geterror(){ return '';} } /* fgcontactform general purpose contact form class supports captcha, html emails, sending emails conditionally, file atachments , more. */ class fgcontactform {     var $receipients;     var $errors;     var $error_message;     var $name;     var $email;     var $message;     var $from_address;     var $form_random_key;     var $conditional_field;     var $arr_conditional_receipients;     var $fileupload_fields;     var $captcha_handler;      var $mailer;      function fgcontactform()     {         $this->receipients = array();         $this->errors = array();         $this->form_random_key = 'xxxxxxx';         $this->conditional_field='';         $this->arr_conditional_receipients=array();         $this->fileupload_fields=array();          $this->mailer = new phpmailer();         $this->mailer->charset = 'utf-8';     }      function enablecaptcha($captcha_handler)     {         $this->captcha_handler = $captcha_handler;         session_start();     }      function addrecipient($email,$name="")     {         $this->mailer->addaddress($email,$name);     }      function setfromaddress($from)     {         $this->from_address = $from;     }     function setformrandomkey($key)     {         $this->form_random_key = $key;     }     function getspamtrapinputname()     {         return 'sp'.md5('xxxxxxxxx'.$this->getkey());     }     function safedisplay($value_name)     {         if(empty($_post[$value_name]))         {             return'';         }         return htmlspecialchars($_post[$value_name]);     }     function getformidinputname()     {         $rand = md5('xxxxxxx'.$this->getkey());          $rand = substr($rand,0,20);         return 'id'.$rand;     }       function getformidinputvalue()     {         return md5('xxxxxxx'.$this->getkey());     }      function setconditionalfield($field)     {         $this->conditional_field = $field;     }     function addconditionalreceipent($value,$email)     {         $this->arr_conditional_receipients[$value] =  $email;     }      function addfileuploadfield($file_field_name,$accepted_types,$max_size)     {          $this->fileupload_fields[] =             array("name"=>$file_field_name,             "file_types"=>$accepted_types,             "maxsize"=>$max_size);     }      function processform()     {         if(!isset($_post['submitted']))         {            return false;         }         if(!$this->validate())         {             $this->error_message = implode('<br/>',$this->errors);             return false;         }         $this->collectdata();          $ret = $this->sendformsubmission();          return $ret;     }      function redirecttourl($url)     {         header("location: $url");         exit;     }      function geterrormessage()     {         return $this->error_message;     }     function getselfscript()     {         return htmlspecialchars($_server['php_self']);     }      function getname()     {         return $this->name;     }     function getemail()     {         return $this->email;     }     function getmessage()     {         return htmlspecialchars($this->message,ent_quotes,"utf-8");     }  /*--------  private (internal) functions -------- */       function sendformsubmission()     {         $this->collectconditionalreceipients();          $this->mailer->charset = 'utf-8';          $this->mailer->subject = "contact form submission $this->name";          $this->mailer->from = $this->getfromaddress();          $this->mailer->fromname = $this->name;          $this->mailer->addreplyto($this->email);          $message = $this->composeformtoemail();          $textmsg = trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/s','',$message)));         $this->mailer->altbody = @html_entity_decode($textmsg,ent_quotes,"utf-8");         $this->mailer->msghtml($message);          $this->attachfiles();          if(!$this->mailer->send())         {             $this->add_error("알수없는 이유로 메일보내기가 실패하였습니다. ljhbunker@ljhbunker.com 으로 연락주시길 바랍니다!");             return false;         }          return true;     }      function collectconditionalreceipients()     {         if(count($this->arr_conditional_receipients)>0 &&           !empty($this->conditional_field) &&           !empty($_post[$this->conditional_field]))         {             foreach($this->arr_conditional_receipients $condn => $rec)             {                 if(strcasecmp($condn,$_post[$this->conditional_field])==0 &&                 !empty($rec))                 {                     $this->addrecipient($rec);                 }             }         }     }      /*     internal variables, donot want appear in email     add variables in array.     */     function isinternalvariable($varname)     {         $arr_interanl_vars = array('scaptcha',                             'submitted',                             $this->getspamtrapinputname(),                             $this->getformidinputname()                             );         if(in_array($varname,$arr_interanl_vars))         {             return true;         }         return false;     }      function formsubmissiontomail()     {         $ret_str='';         foreach($_post $key=>$value)         {             if(!$this->isinternalvariable($key))             {                 $value = htmlspecialchars($value,ent_quotes,"utf-8");                 $value = nl2br($value);                 $key = ucfirst($key);                 $ret_str .= "<div class='label'>$key :</div><div class='value'>$value </div>\n";             }         }         foreach($this->fileupload_fields $upload_field)         {             $field_name = $upload_field["name"];             if(!$this->isfileuploaded($field_name))             {                 continue;             }                      $filename = basename($_files[$field_name]['name']);              $ret_str .= "<div class='label'>file upload '$field_name' :</div><div class='value'>$filename </div>\n";         }         return $ret_str;     }      function extrainfotomail()     {         $ret_str='';          $ip = $_server['remote_addr'];         $ret_str = "<div class='label'>ip address of submitter:</div><div class='value'>$ip</div>\n";          return $ret_str;     }      function getmailstyle()     {         $retstr = "\n<style>".         "body,.label,.value { font-family:arial,verdana; } ".         ".label {font-weight:bold; margin-top:5px; font-size:1em; color:#333;} ".         ".value {margin-bottom:15px;font-size:0.8em;padding-left:5px;} ".         "</style>\n";          return $retstr;     }     function gethtmlheaderpart()     {          $retstr = '<!doctype html public "-//w3c//dtd html 4.0 transitional//en">'."\n".                    '<html><head><title></title>'.                    '<meta http-equiv=content-type content="text/html; charset=utf-8">';          $retstr .= $this->getmailstyle();          $retstr .= '</head><body>';          return $retstr;     }     function gethtmlfooterpart()     {         $retstr ='</body></html>';         return $retstr ;     }     function composeformtoemail()     {         $header = $this->gethtmlheaderpart();         $formsubmission = $this->formsubmissiontomail();         $extra_info = $this->extrainfotomail();         $footer = $this->gethtmlfooterpart();          $message = $header."submission 'contact us' form:<p>$formsubmission</p><hr/>$extra_info".$footer;          return $message;     }      function attachfiles()     {         foreach($this->fileupload_fields $upld_field)         {             $field_name = $upld_field["name"];             if(!$this->isfileuploaded($field_name))             {                 continue;             }              $filename =basename($_files[$field_name]['name']);              $this->mailer->addattachment($_files[$field_name]["tmp_name"],$filename);         }     }      function getfromaddress()     {         if(!empty($this->from_address))         {             return $this->from_address;         }          $host = $_server['server_name'];          $from ="nobody@$host";         return $from;     }      function validate()     {         $ret = true;         //security validations         if(empty($_post[$this->getformidinputname()]) ||           $_post[$this->getformidinputname()] != $this->getformidinputvalue() )         {             //the proper error not given intentionally             $this->add_error("automated submission prevention: case 1 failed");             $ret = false;         }          //this hidden input field. humans won't fill field.         if(!empty($_post[$this->getspamtrapinputname()]) )         {             //the proper error not given intentionally             $this->add_error("automated submission prevention: case 2 failed");             $ret = false;         }          //name validations         if(empty($_post['name']))         {             $this->add_error("&nbsp;&nbsp;이름을 기재하여주세요!&nbsp;&nbsp;");             $ret = false;         }         else         if(strlen($_post['name'])>50)         {             $this->add_error("&nbsp;&nbsp;이름을 정확히 기재하여 주세요!&nbsp;&nbsp;");             $ret = false;         }          //email validations         if(empty($_post['email']))         {             $this->add_error("&nbsp;&nbsp;e-mail 주소가 입력되지 않았습니다!&nbsp;&nbsp;");             $ret = false;         }         else         if(strlen($_post['email'])>50)         {             $this->add_error("&nbsp;&nbsp;올바른 e-mail 주소를 &ldquo;정확히&rdquo; 입력하여주세요!&nbsp;&nbsp;");             $ret = false;         }         else         if(!$this->validate_email($_post['email']))         {             $this->add_error("&nbsp;&nbsp;올바른 e-mail 주소를 &ldquo;정확히&rdquo; 입력하여주세요!&nbsp;&nbsp;");             $ret = false;         }          //check validations         if(empty($_post['message0']))         {             $this->add_error("&nbsp;&nbsp;용도를 기입하여 주세요!&nbsp;&nbsp;");             $ret = false;         }          //message validaions         if(strlen($_post['message2'])>2048)         {             $this->add_error("&nbsp;&nbsp;추가 코멘트가 너무 깁니다! 500자 이내의 분량만 수용이 가능합니다.&nbsp;&nbsp;");             $ret = false;         }          //file validations         if($_files['photo']['size'] == 0 )         {             $this->add_error("&nbsp;&nbsp;스케치가 첨부되지 않았습니다!&nbsp;&nbsp;");             $ret = false;         }          //check validations          if(empty($_post['check']))         {             $this->add_error("&nbsp;&nbsp;커스텀 일러스트 type을 선택하여주세요!&nbsp;&nbsp;");             $ret = false;         }           //captcha validaions         if(isset($this->captcha_handler))         {             if(!$this->captcha_handler->validate())             {                 $this->add_error($this->captcha_handler->geterror());                 $ret = false;             }         }         //file upload validations         if(!empty($this->fileupload_fields))         {          if(!$this->validatefileuploads())          {             $ret = false;          }         }         return $ret;     }      function validatefiletype($field_name,$valid_filetypes)     {         $ret=true;         $info = pathinfo($_files[$field_name]['name']);         $extn = $info['extension'];         $extn = strtolower($extn);          $arr_valid_filetypes= explode(',',$valid_filetypes);         if(!in_array($extn,$arr_valid_filetypes))         {             $this->add_error("valid file types are: $valid_filetypes");             $ret=false;         }         return $ret;     }      function validatefilesize($field_name,$max_size)     {         $size_of_uploaded_file =                 $_files[$field_name]["size"]/4096;//size in kbs         if($size_of_uploaded_file > $max_size)         {             $this->add_error("스케치파일의 용량이 너무 큽니다! (4메가 초과) ");             return false;         }         return true;     }      function isfileuploaded($field_name)     {         if(empty($_files[$field_name]['name']))         {             return false;         }         if(!is_uploaded_file($_files[$field_name]['tmp_name']))         {             return false;         }         return true;     }     function validatefileuploads()     {         $ret=true;         foreach($this->fileupload_fields $upld_field)         {             $field_name = $upld_field["name"];              $valid_filetypes = $upld_field["file_types"];              if(!$this->isfileuploaded($field_name))             {                 continue;             }              if($_files[$field_name]["error"] != 0)             {                 $this->add_error("error in file upload; error code:".$_files[$field_name]["error"]);                 $ret=false;             }              if(!empty($valid_filetypes) &&              !$this->validatefiletype($field_name,$valid_filetypes))             {                 $ret=false;             }              if(!empty($upld_field["maxsize"]) &&             $upld_field["maxsize"]>0)             {                 if(!$this->validatefilesize($field_name,$upld_field["maxsize"]))                 {                     $ret=false;                 }             }          }         return $ret;     }      function stripslashes($str)     {         if(get_magic_quotes_gpc())         {             $str = stripslashes($str);         }         return $str;     }     /*     sanitize() function removes potential threat     data submitted. prevents email injections or other hacker attempts.     if $remove_nl true, newline chracters removed input.     */     function sanitize($str,$remove_nl=true)     {         $str = $this->stripslashes($str);          if($remove_nl)         {             $injections = array('/(\n+)/i',                 '/(\r+)/i',                 '/(\t+)/i',                 '/(%0a+)/i',                 '/(%0d+)/i',                 '/(%08+)/i',                 '/(%09+)/i'                 );             $str = preg_replace($injections,'',$str);         }          return $str;     }      /*collects clean data $_post array , keeps in internal variables.*/     function collectdata()     {         $this->name = $this->sanitize($_post['name']);         $this->email = $this->sanitize($_post['email']);         $this->check = $this->sanitize($_post['check']);          /*newline ok in message.*/         $this->message0 = $this->stripslashes($_post['message0']);         $this->message2 = $this->stripslashes($_post['message2']);     }      function add_error($error)     {         array_push($this->errors,$error);     }     function validate_email($email)     {         return eregi("^[_\.0-9a-za-z-]+@([0-9a-za-z][0-9a-za-z-]+\.)+[a-za-z]{2,6}$", $email);     }      function getkey()     {         return $this->form_random_key.$_server['server_name'].$_server['remote_addr'];     }  } 

(please please let me know if wrote should kept unshown on public..)


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -