我有一个问题。我有一个弹出窗口,在用户在弹出窗口中创建房间后,我想关闭该弹出窗口,然后将打开器窗口重定向到新的 url。我有函数和一切,除了我不知道如何调用函数。(下面我已经写了我想要加载函数的位置)。
谢谢
<?php session_start(); ?>
<script type="text/javascript">
function CloseAndRefresh()
{
opener.location.href = "<?php echo $website_url; ?>/livechat.php?idim=<?php echo $perdorusi2; ?>&room=<?php echo $emri; ?>";
opener.focus();
self.close();
}
</script>
<?php
include_once('db.php');
$perdoruesi = $_GET['perdoruesi'];
if( strlen($_SESSION['id']) > '0' ) { $perdorusi2 = $_SESSION['id']; } else { $perdorusi2 = $perdoruesi; }
function makeRandomString($max=8) {
$i = 0;
$possible_keys = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
$keys_length = strlen($possible_keys);
$str = "";
while($i<$max) {
$rand = mt_rand(1,$keys_length-1);
$str.= $possible_keys[$rand];
$i++;
}
return $str;
}
$emri = makeRandomString();
$hidhnedb = mysql_query("INSERT INTO dbname(`row1`, `row2`) VALUES(NULL, '$emri')");
if($hidhnedb) {
$max=count($_SESSION['mysession']);
$i = $max + 1;
$_SESSION['mysession'][$i][$emri] = $emri;
?>
***Here is the the place where I want to call the javascript function but I do not know how to do that.***
<?php
} else { echo "Error!"; }
?>