Hey I need a PHP script that would load in a JavaScript call up for example below... <script type="text/javascript" src="http://example.com/script.php"></script> I need PHP that looks for a cookie and if its not found loads a .js file? Anyone know how this could be done? +rep for anyone with a script!
Make the cookies with: setcookie('nojs','blah',time()+86400); //expires in 24 hours PHP: check if it exists: if(isset($_COOKIE[nojs])){ echo 'It exists!'; } else{ //execute js } PHP: hope it helps
if(isset($_COOKIE[nojs])){ echo 'It exists!';}else{ //execute js} PHP: How would I put that together to work? Where does the JS file go?