hi everyone,
After so much hard work finally figured it out. hey thanx to my buddy JAHUFER 🙂 Thanx for u r help man really appreciate it.
Here the answer just in case if anyone want to do the same thing :
Instead of using a php variable i used sessions. heres the findings for you guys,
index.php
<?php
session_start();
$_SESSION['allow_script']=1;
?>
<html>
<head>
<title> new document </title>
<script language="javascript" type="text/javascript" src="linker.php"></script>
</head>
<body>
<input type="button" name="b1" value="click me" onclick="show();">
</body>
</html>
linker.php
<?php
session_start();
if($_SESSION['allow_script'])
{
?>
function show()
{
alert('niro');
}
<?php
}
else
{
?>
no way you cannt have my jscript
<?php
}
unset($_SESSION['allow_script']);
?>
hope this is useful to you all 😃
if you found any bugs in this code please let me know.
Regards,
Niroshan