Unstoppable Domains โ€” AI Assistant

Basic Script needed, help, might be out there

Spacemail by SpaceshipSpacemail by Spaceship
Watch

max99

Established Member
Impact
0
Righty, looking for a script that does the following

i dn't know if theres a free one out there already if so could someone link me to it.



  • A page where a user has to enter 1 to 5 friends email address in order to access a certain page.
    e.g it would say, please enter between 1 and 5 friends emails in order to access the free page !

Thanks In Advance

Max
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
What do you want to happen to the 5 email addresses?

Email them to you?
Write them to text file?
Store them in a database?
 
0
•••
either email them to me, or write them in txt file :)
 
0
•••
This could be done in PHP with mySQL or if you prefer with text file databases.
Most PHP coders would be able to do this for you.
 
0
•••
I only started learning php a few days ago, so the code might not be best quality, but this seems to work, let me know how it goes max99


freestuff.php

<?php

session_start();

if( isset( $_SESSION['allowed'] ) )
{
echo 'Welcome to the free stuff';
}else{
header( 'Location: emailcapture.php' ) ;
}

?>

emailcapture.php

<?php
session_start();

$successLocation = 'freestuff.php';

$numEmails = 5;

$fileDir = dirname(__FILE__);

$today = getDate();

$filePath = $fileDir.'/emails_'.$today['year'].$today['mon'].$today['mday'].'.txt';

for($i=0; $i < $numEmails; $i+=1)
{

$errors[$i] = '';

if(!isset( $_POST['address'.$i] ) )
{
$emails[$i] = '';
}else{
$emails[$i] = $_POST['address'.$i];
}

}

if( isset( $_POST['btnSubmit'] ) )
{

$errorFound = false;

for( $i=0; $i < $numEmails; $i+=1 )
{

if( !validEmail( $emails[$i] ) )
{
$errorFound = true;
$errors[$i] = "Invalid Email!";
}

}

if( !$errorFound )
{

if( file_exists( $filePath ) )
{
$fhandle = fopen($filePath, 'a') or die("can't open file");
}else{
$fhandle = fopen($filePath, 'w') or die("can't open file");
}

foreach( $emails as $email => $emails )
{
fwrite( $fhandle, "$emails\r\n" );
}

fclose($fhandle);

$_SESSION['allowed'] = true;
header( "Location: $successLocation" ) ;

}

}

function validEmail( $email )
{
if(eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) {
return true;
} else {
return false;
}
}

?>

<form method="Post">

<?php for($i=0; $i < $numEmails;$i+=1)
{ ?>
Address <?php echo $i+1 ?>:<br />
<input type="text" name="address<?php echo $i ?>" value="<?php echo $emails[$i] ?>"><?php echo $errors[$i] ?><br />
<?php } ?>

<br />
<input type="submit" name="btnSubmit" value="Continue" />

</form>
 
0
•••
Domain Recover
DomainEasy โ€” Live Options
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back