Antec
06-12-2008, 12:44 PM
I am having trouble getting this code to work correctly. What I am trying to do is on my site i will have a button that will open this popup window with a login form and what i would like it to do is when the form is submitted i want the window to close and the main page to redirect to whatever page i would like it sent to. And if the login information is wrong i would like the popup window to stay open and say that it is wrong in red letters at the top.
Here is the code for the popup window:
<?php
if($target == "LogIn") {
if($view == "Form") {
echo '
<script language="JavaScript" src="window.js">
</SCRIPT>
<style type="text/css">
<!--
body {
background-color: #000000;
}
-->
</style>
<FORM action="index.php?act=Login&CODE=50" onSubmit="javascript:login();" method="post" name="mlogin">
<p>
<font face="verdana" color="#76a5d5" size="1"><B> Username: </b></font><INPUT class="textInput1" style="border: 1px solid #76A5D5; font-family: verdana, helvetica, sans-serif; font-size: 11px; padding: 2px; vertical-align: middle; margin: 0; width: 80px" type="username" size="25" name="username" value="Username"/>
<br>
<FONT face="verdana" color="#76a5d5" size="1"><B> Password: </b></font><INPUT class="textInput1" style="border: 1px solid #76A5D5; font-family: verdana, helvetica, sans-serif; font-size: 11px; padding: 2px; vertical-align: middle; margin: 0; width: 80px" type="password" size="25" name="password" value="*******"/> <INPUT type="image" src="images/login.jpg" ALT="Click Here to Login!" BORDER="0" ALIGN="middle" value="submit" name="submit">
</p>
</form>';
}
}
?>
Code for the javascript:
//Open up a new window with specific dimensions
function info(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=300,height=100,left = 300,top = 500');");
}
<!--
function login() {
setTimeout('window.close()',2000);
opener.location.href='/main/index.php';
}
//-->
Any help would be greatly appreciated
Here is the code for the popup window:
<?php
if($target == "LogIn") {
if($view == "Form") {
echo '
<script language="JavaScript" src="window.js">
</SCRIPT>
<style type="text/css">
<!--
body {
background-color: #000000;
}
-->
</style>
<FORM action="index.php?act=Login&CODE=50" onSubmit="javascript:login();" method="post" name="mlogin">
<p>
<font face="verdana" color="#76a5d5" size="1"><B> Username: </b></font><INPUT class="textInput1" style="border: 1px solid #76A5D5; font-family: verdana, helvetica, sans-serif; font-size: 11px; padding: 2px; vertical-align: middle; margin: 0; width: 80px" type="username" size="25" name="username" value="Username"/>
<br>
<FONT face="verdana" color="#76a5d5" size="1"><B> Password: </b></font><INPUT class="textInput1" style="border: 1px solid #76A5D5; font-family: verdana, helvetica, sans-serif; font-size: 11px; padding: 2px; vertical-align: middle; margin: 0; width: 80px" type="password" size="25" name="password" value="*******"/> <INPUT type="image" src="images/login.jpg" ALT="Click Here to Login!" BORDER="0" ALIGN="middle" value="submit" name="submit">
</p>
</form>';
}
}
?>
Code for the javascript:
//Open up a new window with specific dimensions
function info(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=300,height=100,left = 300,top = 500');");
}
<!--
function login() {
setTimeout('window.close()',2000);
opener.location.href='/main/index.php';
}
//-->
Any help would be greatly appreciated