Ver Mensaje Individual
  #5 (permalink)  
Antiguo 05/09/2013, 10:38
Avatar de jonni09lo
jonni09lo
Colaborador
 
Fecha de Ingreso: septiembre-2011
Ubicación: Estigia
Mensajes: 1.471
Antigüedad: 13 años, 2 meses
Puntos: 397
Respuesta: Actualizar Version de archivo

Código PHP:
Ver original
  1. <?php
  2.  
  3. /*
  4. ################################################## ########################################
  5. ## FILE: nvform.php ##
  6. ## ##
  7. ## Novice Form Version 1.1 ##
  8. ## © Copyright 2000-2003 Seth Michael Knorr [email protected] ##
  9. ## ##
  10. ## http://www.noviceform.com/ ##
  11. ## Please contact me with any bugs found, or any bug fixes. ##
  12. ## ##
  13. ## ##
  14. ################################################## ########################################
  15. ## ##
  16. ## There is no email support provided for this script, the only support can be ##
  17. ## found at our web site: http://www.noviceform.com/ ##
  18. ## ##
  19. ## ##
  20. ## ANY PERSON(S) MAY USE AND MODIFY THESE SCRIPT(S) FREE OF CHARGE FOR EITHER BUSINESS ##
  21. ## OR PERSONAL, HOWEVER AT ALL TIMES HEADERS AND COPYRIGHT MUST ALWAYS REMAIN IN TACT. ##
  22. ## ##
  23. ## REDISTRIBUTION FOR PROFIT IS PROHIBITED WITH OUT THE CONSENT OF SETH KNORR. ##
  24. ## ##
  25. ## By using this code you agree to indemnify Seth M. Knorr from any liability that ##
  26. ## might arise from its use. ##
  27. ## ##
  28. ## ##
  29. ################################################## ########################################
  30. */
  31.  
  32.  
  33. /* $sendto is the email where form results are sent to */
  34. $sendto = "[email protected]";
  35.  
  36. /* $ccto is the email where form results can be carbon copied to */
  37. $ccto = "";
  38.  
  39. /*
  40. O P T I O N A L V A R I A B L E S
  41. */
  42.  
  43.  
  44. /*
  45. TO POST PHP ERRORS TO PAGE FOR DEBUGING SET:
  46. $report_errors = "ALL";
  47.  
  48.  
  49. TO REMOVE PHP ERRORS FROM POSTING TO THE PAGE FOR USE SET:
  50. $report_errors = "NONE";
  51.  
  52. */
  53. $report_errors = "NONE";
  54.  
  55. $setokurl = "2";
  56.  
  57. $okurls = "http://yourdomain.com,http://www.yourdomain.com,192.103.45.67";
  58.  
  59. /*
  60. N O N E E D T O E D I T A N Y V A R I A B L E S B E L O W
  61. */
  62.  
  63. $footer = "<br><br><br><br><br><center><font face=\"Arial\"><a href=\"http://www.noviceform.com/\" target=\"_blank\"><font color=\"#ff0000\">Form processing script provided by Novice Form</font></a> </center></font>";
  64. $backbutton = "<br><br><b>Hit your browsers back button and resubmit the form.</b>";
  65.  
  66.  
  67. if ($report_errors == "NONE") {
  68.     error_reporting(0);
  69. }else{
  70.     error_reporting(E_ALL);
  71. }
  72.  
  73. /* --- I F S E T O K U R L = 1 ----- */
  74.  
  75. if ($setokurl == "1"){
  76.  
  77.     $found_url = "0";
  78.     $referer =$_SERVER["HTTP_REFERER"];
  79.     $referer = str_replace("://", "[CS]", $referer);
  80.     $referer_sp = explode("/", $referer);
  81.     $referer = "$referer_sp[0]";
  82.     $referer .= "/";
  83.     $referer = str_replace("[CS]", "://", $referer);
  84.     $referer = strtolower($referer);
  85.    
  86.     $okurls = split(",", $okurls);
  87.    
  88.     foreach ($okurls as $myokurls) {
  89.    
  90.         $myokurls = strtolower($myokurls);
  91.    
  92.         if ($referer == strtolower($myokurls)) {
  93.             $found_url = "1";
  94.         }
  95.  
  96.     }
  97.  
  98.     if ($found_url == "0") {
  99.         $ERROR_action = "bad_okurl";
  100.         include("$PATH_error$PAGE_error");
  101.     }
  102.  
  103. }
  104. /* --- E N D I F S E T O K U R L = 1 --- */
  105.  
  106. /* check to see if posted */
  107. if ($HTTP_GET_VARS || ! $HTTP_POST_VARS || $_GET || ! $_POST) {
  108.     include("nverror.php");
  109.     no_pst();
  110. }else{
  111.  
  112.     /* IF OLDER VERSION OF PHP CONVERT TO NEWER VARIABLES */
  113.     if (! $_POST) {
  114.         $_POST = "$HTTP_POST_VARS";
  115.     }
  116.  
  117.     if (! $_SERVER) {
  118.         $_SERVER = "$HTTP_SERVER_VARS";
  119.     }
  120.  
  121.  
  122.     $year = date("Y");
  123.     $month = date("m");
  124.     $day = date("d");
  125.     $hour = date("h");
  126.     $min = date("i");
  127.     $tod = date("a");
  128.  
  129.  
  130.     $ip=$_SERVER["REMOTE_ADDR"];
  131.  
  132.     $SEND_prnt = "The form below was submited by " . $_POST{"email"} . " from Ip address: $ip on $monthnameactual $month/$day/$year at $hour:$min $tod \n";
  133.     $SEND_prnt .= "-------------------------------------------------------------------------\n\n";
  134.  
  135.  
  136.     /* CHECK TO SEE IF $_POST{"required"} IS SET */
  137.     if ($_POST{"required"}){
  138.  
  139.         $post_required = $_POST{"required"};
  140.         $required = split(",", $post_required);
  141.         $reqnum = count($required);
  142.  
  143.         for ($req=0; $req < $reqnum; $req++) {
  144.  
  145.             $REQ_name = $required[$req];
  146.             $REQ_value = $POST{"$REQ_name"};
  147.  
  148.             if ($REQ_name == "email") {
  149.                 $goodem = ereg("^[^@ ]+@[^@ ]+\.[^@ \.]+$", $_POST{"email"}, $trashed);
  150.  
  151.             if (! $goodem) {
  152.                 include("nverror.php");
  153.                 msng_email();
  154.             } /* end ! $goodem */
  155.        
  156.         } elseif (! $_POST{"$REQ_name"}) {
  157.                 $isreqe = "1";
  158.                 $REQ_error .= "<li> $REQ_name ";
  159.             } /* end ! req val */
  160.  
  161.         } /* end REQ for loop */
  162.  
  163.  
  164.         /* IF THERE ARE ANY REQUIRED FIELDS NOT FILLED IN */
  165.  
  166.         if ($isreqe == "1") {
  167.             include("nverror.php");
  168.             msng_required();
  169.         }
  170.     } /* END CHECK TO SEE IF $_POST{"required"} IS SET */
  171.  
  172.     /* END IF THERE ARE ANY REQUIRED FIELDS NOT FILLED IN */
  173.  
  174.  
  175.     /* GET POSTED VARIABLES */
  176.     foreach ($_POST as $NVPOST_name => $NVPOST_value) {
  177.  
  178.         $NVPOST_value = str_replace("\n", "", $NVPOST_value);
  179.         $NVPOST_value = str_replace("\r", "", $NVPOST_value);
  180.  
  181.         $NVPOST_value = preg_replace("'\cc:'si", "Cc ", $NVPOST_value);
  182.         $NVPOST_value = preg_replace("'\bcc:'si", "bcc ", $NVPOST_value);
  183.         $NVPOST_value = preg_replace("'\to:'si", "to ", $NVPOST_value);
  184.         $NVPOST_value = preg_replace("'\bc:'si", "bc ", $NVPOST_value);
  185.  
  186.         if (strtolower($NVPOST_name) == "subject") {
  187.             $NVPOST_value = str_replace(":", ";", $NVPOST_value);
  188.         }
  189.  
  190.         /* G E T E M A I L */
  191.  
  192.         if (strtolower($NVPOST_name) == "email") {
  193.             $SEND_email = "$NVPOST_value";
  194.             $SEND_email = str_replace(":", "", $SEND_email);
  195.             $SEND_email = str_replace(" ", "", $SEND_email);
  196.         }
  197.        
  198.         /* END GET LEADS EMAIL */
  199.  
  200.         if (! $_POST{"sort"}) {
  201.             /* CHECK TO SEE IF CONFIG FIELD */
  202.             if ($NVPOST_name == "subject" || $NVPOST_name == "sort" || $NVPOST_name == "required" || $NVPOST_name == "success_page"){}else{
  203.                 $SEND_prnt .= "$NVPOST_name; $NVPOST_value \n";
  204.             }
  205.         } /* end ! sort */
  206.  
  207.     } /* end foreach */
  208.  
  209.     /* END GET POSTED VARIABLES */
  210.  
  211.     if ($_POST{"sort"}) {
  212.    
  213.         /* SORT VARIABLES */
  214.  
  215.         $sortvars = split(",", $_POST{"sort"});
  216.         $sortnum = count($sortvars);
  217.         for ($num=0; $num < $sortnum; $num++) {
  218.             $SEND_prnt .= "$sortvars[$num]: " . $_POST{"$sortvars[$num]"} . " \n";
  219.         }
  220.     } /* END SORT VARIABLES */
  221.  
  222.     /* send mail */
  223.     if (! $ccto) {
  224.         $header = "From: $SEND_email\r\nReply-to: $SEND_email";
  225.     }else{
  226.         $header = "From: $SEND_email\r\nReply-to: $SEND_email\r\nCc: $ccto";
  227.     }
  228.    
  229.     mail($sendto, $_POST{"subject"}, $SEND_prnt, $header);
  230.    
  231.     /* END sendmail */
  232.    
  233.     /* CHECK TO SEE IF FORM SPECIFYS A SUCCESS PAGE */
  234.     if (! $_POST{"success_page"}) {
  235.         include("nverror.php");
  236.         default_success();
  237.     }else{
  238.         $successpage=$_POST{"success_page"};
  239.         header("Location: $successpage"); /* redirect */
  240.         exit;
  241.     }
  242. } /* END IF POSTED */
  243. ?>
  244. </h1>

Hola asi debes de mostrar el código; cuando creas el post te aparece un select que dice Highlight

Mirado tu código debo de decirte lo siguiente

1. ereg esta obsoleto debes usar preg_match.
2. Nunca he visto esta sintaxis en los arrays en PHP 5 $array{'indice'} siempre he visto $array['indice'].
3. Tienes etiquetas html que están sueltas <li> no lo cierras o </h1> no lo abres estos son ejemplos de esto.

Saludos
__________________
Haz preguntas inteligentes-Como ser Hacker
No hacer preguntas por mensaje privado. No sólo no es inteligente sino que es egoísta.