Need help to make it validateable

Discussion in 'PHP' started by khan11, Nov 27, 2007.

  1. #1
    Hello guys,

    I've generated form from phpform generator.

    Here is my process file:

    
    <?php
    include("global.inc.php");
    $errors=0;
    $error="The following errors occured while processing your form input.<ul>";
    pt_register('POST','name');
    pt_register('POST','email');
    pt_register('POST','title');
    pt_register('POST','keywords');
    pt_register('POST','description');
    $description=preg_replace("/(\015\012)|(\015)|(\012)/","&nbsp;<br />", $description);pt_register('POST','reciprocal');
    
    
    
    if($name=="" || $email=="" || $title=="" || $keywords=="" || $description=="" || $reciprocal==""){
    $errors=1;
    $error.="<li>You did not enter one or more of the required fields. Please go back and try again.";
    }
    
    if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$email)){
    $error.="<li>Invalid email address entered";
    $errors=1;
    }
    if($errors==1) echo $error;
    else{
    $where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"));
    $message="name: ".$name."
    email: ".$email."
    title: ".$title."
    keywords: ".$keywords."
    description: ".$description."
    reciprocal: ".$reciprocal."
    ";
    $message = stripslashes($message);
    mail("rak2006@gmail.com","New directory submitted",$message,"From: myRank");
    
    ?>
    
    
    <table width="70%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#006600">
      <tr>
        <td bgcolor="#eeffee"><h2 align="center">Thank you <?php echo $name; ?>!</h2>
        <p align="center">We've received your directory submission... <br />
        Please be patient, we might contact you within 24-72 hours of submission.<br />
          <br />
          <br />
        </p>
        <div align="left"><br />
        </div>
        &nbsp;<a href="http://<?=$_SERVER['HTTP_HOST'];?>/"><font color="#006600">&laquo; Back to homepage </font></a></td>
      </tr>
    </table>
    <?php 
    }
    ?>
    
    
    PHP:
    Here is a reciprocal link checker:

    
    	$siteurl = "http://fonebuzz.net/"; // this is the webpage the backlink should be found on
    	
    	if (backlinkCheck($siteurl, $reciprocal)) {
    		$abcc="";
    	} else {
    		$corr="Reciprocal is wrong";
    	}
    	
    	function backlinkCheck($siteurl, $reciprocal) {
    	$arrText = file($siteurl);
    	for ($i=0; $i<count($arrText); $i++) {
    		$text = $text . $arrText[$i];
    	}
    	if (eregi($reciprocal, $text)) {
    		return true; // set true if there is a backlink
    	} else {
    		echo $abcc; // set false if backlink is missing
    	}
    }
    
    PHP:
    i want to connect that reciprocal variable with above form, so it could pass the url first before sending the form at my email.


    any help?
     
    khan11, Nov 27, 2007 IP