Forum Moderators: open

Message Too Old, No Replies

Email question -- javascript + php + html

How do I get my link to pop up with no headers.

         

casa3311

9:23 pm on Mar 29, 2003 (gmt 0)

10+ Year Member



When my members (small limited group) want/need to reset or change their password, I send them an html format email link to click. When they click it, their password is changed or reset and the login window is supposed to open up. It does open up, BUT not in the way I want it to. I don't want the address line or the file,edit,etc... line, or the back, forward,stop,ect... line. Even if I close all the windows that are open, it still comes up with the full page. Is there anyway to keep this from happening?

Here's my javascript code at window.js:
function adminWindow() {
var fileName="http://www.mysite.org/admin/index.php";
detailwindow = window.open(fileName, "admin", "width=700, height=595, top=5, left=5, toolbar=no, location=no, directories=no, status=no, menubar=no, resizable=yes, scrollbars=yes");
detailwindow.focus();
return false;
}

Here's my php code that sends the message:
$temppw = "temp";
$resetpw = crypt($temppw, $salt);
echo "<div align='center'><span class='txtBL14bC'>Information on resetting your password has been mailed to your email address! Please check it and follow the instructions!</span></div>";
$e_mail = $emailIN;
$title = "Reset Password Request for Madison Academy Admin Access";
$content = "<html>";
$content .= "<head>";
$content .= "<SCRIPT LANGUAGE='JavaScript' SRC='http://www.mysite.org/library/window.js'></SCRIPT>";
$content .= "<style type='text/css'>";
$content .= "BODY,P { font-family: arial,helvetic,sans-serif; font-size: 14px; }";
$content .= "A { font-weight: bold; text-decoration: none; color: #000000; }";
$content .= "A:visited { font-weight: bold; text-decoration: none; color: #000000; }";
$content .= "A:hover { font-weight: bold; text-decoration: underline; color: #660033; }";
$content .= "</style>";
$content .= "</head>";
$content .= "<body>";
$content .= "<p>Dear ".$nameIN.",</p>";
$content .= "<p>Your request to reset your password has been received.<br>Once your password has been reset you will be required to change your password.</p>";
$content .= "<p>To change your password, you will need the following information:</p>";
$content .= "<p>Username: ".$userIN."<br>Password: ".$temppw."</p>";
$content .= "<p><a href='http://www.mysite.org/admin/activate.php?id=".$idIN."&code=".$resetpw."&activate=reset' onClick='return adminWindow()'>Click Here</a> to finish activating your new password.</p>";
$content .= "<p>Thanks!<br>The Madison Academy Webmaster</p>";
$content .= "<p>This is an automated response, please do not reply!</p>";
$content .= "</body>";
$content .= "</html>";
$headers = "From:webmaster<webmaster@mysite.org>\r\n";
$headers .= "Reply-To:webmaster@mysite.org\r\n";
$headers .= "Content-Type: text/html; charset=\"ISO-8859-1\" \r\n";
$headers .= "X-Mailer: PHP/".phpversion();
mail("$e_mail","$title","$content","$headers");

Everything works as it should, except that the admin window script.

ShawnR

2:28 pm on Mar 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi Casa

I feel awkward saying 'welcome', as I am new here too, but it seems a tradition to respond to first-time posters with 'Welcome'... so Welcome [webmasterworld.com]

My guess would be that the email client doesn't support JavaScript, so it is just doing the <a href='http://www.mysite.org/admin/activate.php?id=".$idIN."&code=".$resetpw."&activate=reset'> part, and adminWindow() never gets called.

I have 2 suggestions. neither of them are very elegant, so I hope someone with more knowledge can suggest something better.

One solution might be to change the window attributes using a function called by the onload() method. I think this is really difficult and browser dependant. For example, in Netscape, the following:

<script language="Javascript">
onload = function() {
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserWrite");
window.statusbar.visible=false;
window.menubar.visible=false;
window.locationbar.visible=false;
window.toolbar.visible=false;
window.statusbar.visible=false;
}
</script>

You either need to sign your script or call the 'enablePrivilege' method, which brings up a dialog box telling the visitor you are increasing privileges...

Another solution is to have the <a href > tag in the email refer to an html file, which calls your adminWindow() in its onload() method, and then closes itself.

Shawn