<html>
<head>
</head>
<body>
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
require_once('config.php');
$url="https://www.odeveticaret.xyz/kitapadminim"; 
$cookie="cookie.txt";
$postdata = http_build_query(array( 'email' => $username, 'sifre' => $password));
$ch = curl_init(); 
curl_setopt ($ch, CURLOPT_URL, $url); 
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE); 
curl_setopt ($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); 
curl_setopt ($ch, CURLOPT_TIMEOUT, 60); 
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1); 
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt ($ch, CURLOPT_COOKIEJAR, $cookie); 
curl_setopt ($ch, CURLOPT_REFERER, $url); 
curl_setopt($ch, CURLOPT_AUTOREFERER, false);
curl_setopt($ch, CURLOPT_ENCODING, 'gzip,deflate');
 
curl_setopt ($ch, CURLOPT_POSTFIELDS, $postdata); 
curl_setopt ($ch, CURLOPT_POST, 1); 
curl_exec($ch);
 
curl_setopt($ch, CURLOPT_URL, "https://www.odeveticaret.xyz/kitapadminim/kirala";);
$html = curl_exec($ch);
echo $html;
 
preg_match_all('@<h4 class="overflow-hidden-ellipsis">(.*?)</h4>@si',$html,$title);
preg_match_all('@<h5><strong>(.*?)</strong></h5>@si',$html,$link);
date_default_timezone_set('Asia/Istanbul');
echo date('H:i:s'); 
echo '<hr>';
$i=0;
foreach($title[1] as $ttl){
$a = explode('<a href="',$link[1][$i]);
$a = explode('"',$a[1]);
$ttl = explode(' ',$ttl);
echo $ttl[0].' - <a style="text-decoration:none;color:#65656e" href="'.$a[0].'" target="_blank">'.$a[0].'</a>';    
echo '<br>';
if($ttl[0] == $server){$srlink = $a[0].'#guvenlikKoduInput';}
$i++;
}
curl_close($ch);
 
if($detect === true){
?>
    // burada js kodları içine php eklendi
    <script type="text/javascript">
    var replace = <?=$srlink?>;
    if($('#server:contains("'+<?=$server;?>+'")').length > 0) {
       window.location.replace(replace);
       alert('başarılı');   // başarılı uyarısı alır ve location çalışmazsa hata var replace den kaynaklı
    }
    </script>
<?php
}
?>
</body>
</html>
kod hatasız çalışırsa alert kısmını silebilirsin