local whitelist whitelist password
sudo su - postgres
psql -c "create user whitelist password '1'" ( )
psql -c "create database whitelist owner whitelist"
psql -d whitelist -c "create table whitelist(email varchar, primary key(email))"
<? session_start(); ?> <html><head><title></title> </head> <body> <div align="center"> <table width="80%"><tr><td> <h1> </h1> , , . </td></tr> <tr><td align="center" class="formbg"> <form action="/whitelist_add.php" method="post"> <table><tr> <td> e-mail :</td> <td><input type="text" name="email" class="inp"/></td></tr> <tr><td> </td></tr> <tr> <td valign="bottom"> :</td> <td><img src="/kcaptcha/index.php?<?=session_name()?>=<?=session_id()?>"><br/><input type="text" name="keystring" class="inp"></td></tr> <tr><td> </td></tr> <tr><td colspan="2" align="center"><input type="submit" value=" "></td> </tr></table> </form> </td></tr> </table> </body> </html>
<? session_start(); ?> <html><head><title></title> </head> <body> <div align="center"> <table width="80%"><tr><td> <h1> </h1> , , . </td></tr> <tr><td align="center" class="formbg"> <form action="/whitelist_add.php" method="post"> <table><tr> <td> e-mail :</td> <td><input type="text" name="email" class="inp"/></td></tr> <tr><td> </td></tr> <tr> <td valign="bottom"> :</td> <td><img src="/kcaptcha/index.php?<?=session_name()?>=<?=session_id()?>"><br/><input type="text" name="keystring" class="inp"></td></tr> <tr><td> </td></tr> <tr><td colspan="2" align="center"><input type="submit" value=" "></td> </tr></table> </form> </td></tr> </table> </body> </html>
<? session_start(); $correct = false; if(count($_POST)>0){ if(isset($_SESSION['captcha_keystring']) && $_SESSION['captcha_keystring'] == $_POST['keystring']){ $correct = true; } } unset($_SESSION['captcha_keystring']); ?> <html><head><title> </title> </head> <body> <div align="center"> <table width="80%"><tr><td> <h1><? if($correct) { $dbconn = pg_connect("host=localhost dbname=whitelist user=whielist password=1") // , .1 or die('Could not connect: ' . pg_last_error()); // Performing SQL query $result = pg_prepare($dbconn, "check_query", 'select email from white_list where email = $1'); $result = pg_execute($dbconn, "check_query", array($_POST['email'])); if(pg_fetch_array($result)) { ?> <? } else { $result = pg_prepare($dbconn, "insert_query", 'insert into white_list(email) values($1)'); $result = pg_execute($dbconn, "insert_query", array($_POST['email'])); ?> !<? } if($result) { pg_free_result($result); } pg_close($dbconn); } else { ?> <? }?> </h1><? if($correct) { ?> <? } else { ?> <a href="whitelist.php"> </a> <? } ?> </td></tr> <tr><td><br/><br/><a href="/whitelist.php"> </a></td></tr> </table> </body> </html>
/.*/ REJECT \n\n******** your e-mail should be in our whitelist ******** \n Visit http://[ ]/whitelist.php \n\n *******************************************\n\n
hosts = localhost
user = whitelist
password = 1 # . 1
dbname = whitelist
query = select 'permit' from white_list where email = '%s'
smtpd_sender_restrictions = check_sender_access pgsql:/etc/postfix/pg_whitelist.cf, check_sender_access regexp:/etc/postfix/block
Source: https://habr.com/ru/post/57078/
All Articles