89 lines
8.8 KiB
PHP
Executable File
89 lines
8.8 KiB
PHP
Executable File
<?php
|
|
$pdo=new PDO("pgsql:host=localhost;dbname=adx_system","admin","admin123");
|
|
$isps=['Gmail'=>['filter'=>'Content filtering','tips'=>'Engagement is key, avoid spam words'],'Yahoo'=>['filter'=>'Engagement-based','tips'=>'Warm up slowly, maintain good reputation'],'Outlook'=>['filter'=>'SmartScreen + Junk','tips'=>'Authenticate SPF/DKIM/DMARC'],'AOL'=>['filter'=>'Reputation-based','tips'=>'Monitor bounce rates carefully'],'iCloud'=>['filter'=>'Content + IP reputation','tips'=>'Keep content clean and simple'],'Comcast'=>['filter'=>'Cloudmark','tips'=>'Avoid URL shorteners'],'Orange'=>['filter'=>'Vade Secure','tips'=>'French ISP - respect GDPR'],'Free.fr'=>['filter'=>'Internal','tips'=>'Low volume recommended'],'SFR'=>['filter'=>'Internal + Vade','tips'=>'Authenticate properly'],'GMX'=>['filter'=>'Content-based','tips'=>'German ISP - strict rules'],'ProtonMail'=>['filter'=>'Aggressive','tips'=>'Privacy-focused users'],'Zoho'=>['filter'=>'SpamAssassin','tips'=>'Business users mainly']];
|
|
$spamwords=['free','winner','congratulations','urgent','act now','limited time','click here','buy now','order now','special offer','exclusive deal','risk free','no obligation','guarantee','promise','credit','cash','money','earn','income','profit','discount','save','cheap','bonus','prize','million','billion','investment','opportunity','action required','verify','confirm','account','suspended','password','security','alert','warning','bank','paypal','amazon','apple','microsoft','irs','lottery','inheritance'];
|
|
$score=0;$issues=[];$subject=$_POST['subject']??'';$content=$_POST['content']??'';
|
|
if($_POST){
|
|
$text=strtolower($subject.' '.$content);
|
|
foreach($spamwords as $w){if(strpos($text,$w)!==false){$issues[]="Spam word: '$w'";$score+=10;}}
|
|
if(strlen($subject)>60){$issues[]='Subject too long (>60 chars)';$score+=5;}
|
|
if(preg_match('/[A-Z]{5,}/',$subject)){$issues[]='Too many CAPS in subject';$score+=15;}
|
|
if(substr_count($subject,'!')>1){$issues[]='Multiple exclamation marks';$score+=10;}
|
|
if(substr_count($subject,'?')>1){$issues[]='Multiple question marks';$score+=5;}
|
|
if(preg_match('/\$\d/',$text)){$issues[]='Dollar amounts detected';$score+=10;}
|
|
if(preg_match('/%\s*off/i',$text)){$issues[]='Percentage discount detected';$score+=5;}
|
|
if(strpos($text,'http://')!==false){$issues[]='Non-secure HTTP links';$score+=10;}
|
|
if(preg_match('/bit\.ly|tinyurl|goo\.gl/i',$text)){$issues[]='URL shorteners detected';$score+=15;}
|
|
if(!$subject){$issues[]='Empty subject line';$score+=20;}
|
|
$score=min(100,$score);
|
|
}
|
|
$rating=$score<20?'Excellent':($score<40?'Good':($score<60?'Warning':'Poor'));
|
|
$color=$score<20?'#10b981':($score<40?'#06b6d4':($score<60?'#f59e0b':'#ef4444'));
|
|
?><!DOCTYPE html><html><head><meta charset="UTF-8"><title>Deliverability Playground</title>
|
|
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
|
|
<style>*{margin:0;padding:0;box-sizing:border-box}body{font-family:system-ui;background:#f0f4f8;min-height:100vh}.header{background:linear-gradient(135deg,#059669,#10b981);padding:20px;color:#fff}.container{max-width:1400px;margin:0 auto;padding:20px}.grid{display:grid;grid-template-columns:1fr 1fr;gap:20px}.card{background:#fff;border-radius:12px;padding:20px;box-shadow:0 2px 10px rgba(0,0,0,.08);margin-bottom:20px}.card h3{margin-bottom:15px;display:flex;align-items:center;gap:10px}.form-group{margin-bottom:15px}.form-group label{display:block;font-size:13px;font-weight:600;margin-bottom:6px;color:#475569}.form-group input,.form-group textarea{width:100%;padding:12px;border:2px solid #e2e8f0;border-radius:8px;font-family:inherit}.form-group textarea{min-height:150px}.btn{padding:12px 24px;border:none;border-radius:8px;cursor:pointer;font-weight:600;background:#10b981;color:#fff}.isp-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:12px}.isp{background:#f8fafc;border:1px solid #e2e8f0;border-radius:10px;padding:15px}.isp strong{color:#1e293b;display:block;margin-bottom:5px}.isp small{color:#64748b;font-size:11px;display:block}.isp span{font-size:11px;color:#10b981;display:block;margin-top:8px}.score-box{text-align:center;padding:30px;border-radius:12px;margin-bottom:20px}.score-val{font-size:64px;font-weight:700}.score-lbl{font-size:18px;margin-top:10px}.issues{background:#fef2f2;border:1px solid #fecaca;border-radius:10px;padding:15px;margin-bottom:20px}.issues h4{color:#dc2626;margin-bottom:10px}.issues li{color:#7f1d1d;margin:8px 0;font-size:13px}.tips{background:#f0fdf4;border:1px solid #86efac;border-radius:10px;padding:15px}.tips h4{color:#166534;margin-bottom:10px}.tips li{color:#14532d;margin:8px 0;font-size:13px}.spam-words{display:flex;flex-wrap:wrap;gap:6px;margin-top:15px}.spam-word{background:#fee2e2;color:#dc2626;padding:4px 10px;border-radius:15px;font-size:11px}.good{background:#d1fae5;color:#065f46}.tabs{display:flex;gap:8px;margin-bottom:20px}.tab{padding:10px 20px;background:#fff;border:none;border-radius:8px;cursor:pointer;font-weight:500}.tab.active{background:#10b981;color:#fff}.panel{display:none}.panel.active{display:block}</style>
|
|
</head>
|
|
<body><div class="header"><h1><i class="fas fa-inbox"></i> Deliverability Playground</h1><p style="opacity:.8;margin-top:5px">Test and optimize your email deliverability</p></div>
|
|
<div class="container">
|
|
<div class="tabs"><button class="tab active" onclick="showTab(0)"><i class="fas fa-search"></i> Analyzer</button><button class="tab" onclick="showTab(1)"><i class="fas fa-server"></i> ISP Filters</button><button class="tab" onclick="showTab(2)"><i class="fas fa-ban"></i> Spam Words</button></div>
|
|
|
|
<div class="panel active" id="p0">
|
|
<div class="grid">
|
|
<div class="card"><h3><i class="fas fa-edit" style="color:#10b981"></i> Test Your Email</h3>
|
|
<form method="POST">
|
|
<div class="form-group"><label>Subject Line</label><input name="subject" placeholder="Enter your email subject..." value="<?=htmlspecialchars($subject)?>"></div>
|
|
<div class="form-group"><label>Email Content (optional)</label><textarea name="content" placeholder="Paste your email content here..."><?=htmlspecialchars($content)?></textarea></div>
|
|
<button class="btn"><i class="fas fa-search"></i> Analyze</button>
|
|
</form></div>
|
|
<div>
|
|
<?php if($_POST):?>
|
|
<div class="score-box" style="background:<?=$color?>20;border:2px solid <?=$color?>">
|
|
<div class="score-val" style="color:<?=$color?>"><?=100-$score?>/100</div>
|
|
<div class="score-lbl" style="color:<?=$color?>"><?=$rating?></div>
|
|
</div>
|
|
<?php if($issues):?><div class="issues"><h4><i class="fas fa-exclamation-triangle"></i> Issues Found (<?=count($issues)?>)</h4><ul><?php foreach($issues as $i):?><li><?=$i?></li><?php endforeach;?></ul></div><?php endif;?>
|
|
<?php if(!$issues):?><div class="tips"><h4><i class="fas fa-check-circle"></i> Looking Good!</h4><p>No major issues detected. Your email should have good deliverability.</p></div><?php endif;?>
|
|
<?php endif;?>
|
|
<div class="tips"><h4><i class="fas fa-lightbulb"></i> Best Practices</h4><ul>
|
|
<li>Keep subject under 50 characters</li>
|
|
<li>Avoid ALL CAPS and excessive punctuation</li>
|
|
<li>Personalize with recipient name</li>
|
|
<li>Use clear sender name and reply-to</li>
|
|
<li>Include unsubscribe link</li>
|
|
<li>Balance text and images (60/40)</li>
|
|
<li>Authenticate with SPF, DKIM, DMARC</li>
|
|
<li>Warm up new domains gradually</li>
|
|
</ul></div></div>
|
|
</div></div>
|
|
|
|
<div class="panel" id="p1">
|
|
<div class="card"><h3><i class="fas fa-server" style="color:#10b981"></i> ISP Spam Filters</h3>
|
|
<div class="isp-grid"><?php foreach($isps as $name=>$info):?><div class="isp"><strong><?=$name?></strong><small><?=$info['filter']?></small><span><i class="fas fa-lightbulb"></i> <?=$info['tips']?></span></div><?php endforeach;?></div>
|
|
</div></div>
|
|
|
|
<div class="panel" id="p2">
|
|
<div class="card"><h3><i class="fas fa-ban" style="color:#ef4444"></i> Common Spam Trigger Words</h3>
|
|
<p style="color:#64748b;margin-bottom:15px">Avoid these words to improve deliverability:</p>
|
|
<div class="spam-words"><?php foreach($spamwords as $w):?><span class="spam-word"><?=$w?></span><?php endforeach;?></div>
|
|
</div>
|
|
<div class="card"><h3><i class="fas fa-check" style="color:#10b981"></i> Safe Alternatives</h3>
|
|
<div class="spam-words">
|
|
<span class="spam-word good">complimentary</span>
|
|
<span class="spam-word good">no cost</span>
|
|
<span class="spam-word good">valued customer</span>
|
|
<span class="spam-word good">thank you</span>
|
|
<span class="spam-word good">invitation</span>
|
|
<span class="spam-word good">update</span>
|
|
<span class="spam-word good">news</span>
|
|
<span class="spam-word good">announcement</span>
|
|
<span class="spam-word good">resource</span>
|
|
<span class="spam-word good">guide</span>
|
|
<span class="spam-word good">insight</span>
|
|
<span class="spam-word good">tips</span>
|
|
</div></div>
|
|
</div>
|
|
</div>
|
|
<script>function showTab(n){document.querySelectorAll('.tab').forEach((t,i)=>{t.classList.toggle('active',i==n)});document.querySelectorAll('.panel').forEach((p,i)=>{p.classList.toggle('active',i==n)})}</script><?php include("includes/chatbot-widget.php"); ?>
|
|
|
|
</body></html>
|