LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-10-2003, 02:42 PM   #1
spank
Member
 
Registered: Aug 2003
Location: Romania
Distribution: Ubuntu 6.06
Posts: 278

Rep: Reputation: 30
php open in a new window


I want to modify a php to open (on the push of a button) to open its content in a new window. how can I do that ?
(i have squirrelmail and on the push of the login button i want the content of the mailbox to open in a new window)
thank you!
 
Old 12-10-2003, 05:05 PM   #2
codedv
Member
 
Registered: Nov 2003
Location: Slough, UK
Distribution: Debian
Posts: 146

Rep: Reputation: 15
Use the target attribute of the form to open it in a blank window:
Code:
<form method="post" action="whereever.php" target="_blank">
<input type="text" name="somevalue" />
<input type="submit" />
</form>
target="_blank" causes the form to be submitted and its output put in a new window.
 
Old 12-11-2003, 06:24 AM   #3
spank
Member
 
Registered: Aug 2003
Location: Romania
Distribution: Ubuntu 6.06
Posts: 278

Original Poster
Rep: Reputation: 30
<?php

/**
* login.php -- simple login screen
*
* Copyright (c) 1999-2002 The SquirrelMail Project Team
* Licensed under the GNU GPL. For full terms see the file COPYING.
*
* This a simple login screen. Some housekeeping is done to clean
* cookies and find language.
*
* $Id: login.php,v 1.76.2.5 2002/10/08 18:00:28 jmunro Exp $
*/

if (isset($_GET['emailaddress'])) {
$emailaddress = $_GET['emailaddress'];
}

$rcptaddress = '';
if (isset($emailaddress)) {
if (stristr($emailaddress, 'mailto:')) {
$rcptaddress = substr($emailaddress, 7);
} else {
$rcptaddress = $emailaddress;
}

if (($pos = strpos($rcptaddress, '?')) !== false) {
$a = substr($rcptaddress, $pos + 1);
$rcptaddress = substr($rcptaddress, 0, $pos);
$a = explode('=', $a, 2);
if (isset($a[1])) {
$name = urldecode($a[0]);
$val = urldecode($a[1]);
global $$name;
$$name = $val;
}
}

/* At this point, we have parsed a lot of the mailto stuff. */
/* Let's do the rest -- CC, BCC, Subject, Body */
/* Note: They can all be case insensitive */
foreach ($GLOBALS as $k => $v) {
$key = strtolower($k);
$value = urlencode($v);
if ($key == 'cc') {
$rcptaddress .= '&amp;send_to_cc=' . $value;
} else if ($key == 'bcc') {
$rcptaddress .= '&amp;send_to_bcc=' . $value;
} else if ($key == 'subject') {
$rcptaddress .= '&amp;subject=' . $value;
} else if ($key == 'body') {
$rcptaddress .= '&amp;body=' . $value;
}
}

/* Double-encode in this fashion to get past redirect.php properly. */
$rcptaddress = urlencode($rcptaddress);
}

require_once('../functions/strings.php');
require_once('../config/config.php');
require_once('../src/global.php');
require_once('../functions/i18n.php');
require_once('../functions/plugin.php');
require_once('../functions/constants.php');
require_once('../functions/page_header.php');

/*
* $squirrelmail_language is set by a cookie when the user selects
* language and logs out
*/
if (isset($_COOKIE['squirrelmail_language'])) {
$squirrelmail_language = $_COOKIE['squirrelmail_language'];
}
set_up_language($squirrelmail_language, TRUE);

/**
* Find out the base URI to set cookies.
*/
if (!function_exists('sqm_baseuri')){
require_once('../functions/display_messages.php');
}
$base_uri = sqm_baseuri();

/*
* In case the last session was not terminated properly, make sure
* we get a new one.
*/

sqsession_destroy();
header('Pragma: no-cache');

do_hook('login_cookie');

/* Output the javascript onload function. */

$header = "<SCRIPT LANGUAGE=\"JavaScript\" TYPE=\"text/javascript\">\n" .
"<!--\n".
" function squirrelmail_loginpage_onload() {\n".
" document.forms[0].js_autodetect_results.value = '" . SMPREF_JS_ON . "';\n".
' document.forms[0].elements[' . (isset($loginname) ? 1 : 0) . "].focus();\n".
" }\n".
"// -->\n".
"</script>\n";
$custom_css = 'none';
displayHtmlHeader( "$org_name - " . _("Login"), $header, FALSE );

/* Set the title of this page. */
echo '<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000CC" VLINK="#0000CC" ALINK="#0000CC" onLoad="squirrelmail_loginpage_onload();">'.
"\n<FORM ACTION=\"redirect.php\" METHOD=\"POST\">\n";

$username_form_name = 'login_username';
$password_form_name = 'secretkey';
do_hook('login_top');

$loginname_value = (isset($loginname) ? htmlspecialchars($loginname) : '');

/* Display width and height like good little people */
$width_and_height = '';
if (isset($org_logo_width) && is_numeric($org_logo_width) && $org_logo_width>0) {
$width_and_height = " WIDTH=\"$org_logo_width\"";
}
if (isset($org_logo_height) && is_numeric($org_logo_height) && $org_logo_height>0) {
$width_and_height .= " HEIGHT=\"$org_logo_height\"";
}

echo '<CENTER>'.
" <IMG SRC=\"$org_logo\" ALT=\"" . sprintf(_("%s Logo"), $org_name) .
"\"$width_and_height><BR>\n".
( $hide_sm_attributions ? '' :
'<SMALL>' . sprintf (_(" "), $version) . "<BR>\n".
' ' . _(" ") . "<BR></SMALL>\n" ) .
"</CENTER>\n".

"<CENTER>\n".
"<TABLE COLS=\"1\" WIDTH=\"350\">\n".
" <TR><TD ALIGN=CENTER BGCOLOR=\"#DCDCDC\">\n".
' <B>' . sprintf (_("%s Login"), $org_name) . "</B>\n".
" </TD></TR>".
" <TR><TD BGCOLOR=\"#FFFFFF\"><TABLE COLS=2 WIDTH=\"100%\">\n".
" <TR>\n".
' <TD WIDTH="30%" ALIGN=right>' . _("Name:") . "</TD>\n".
" <TD WIDTH=\"*\" ALIGN=left>\n".
" <INPUT TYPE=TEXT NAME=\"$username_form_name\" VALUE=\"$loginname_value\">\n".
" </TD>\n".
" </TR>\n".
" <TR>\n".
' <TD WIDTH="30%" ALIGN=right>' . _("Password:") . "</TD>\n".
" <TD WIDTH=\"*\" ALIGN=left>\n".
" <INPUT TYPE=PASSWORD NAME=\"$password_form_name\">\n".
" <INPUT TYPE=HIDDEN NAME=\"js_autodetect_results\" VALUE=\"" . SMPREF_JS_OFF . "\">\n".
" <INPUT TYPE=HIDDEN NAME=\"just_logged_in\" value=1>\n";
if ($rcptaddress != '') {
echo " <INPUT TYPE=HIDDEN NAME=\"rcptemail\" VALUE=\"".htmlspecialchars($rcptaddress)."\">\n";
}
echo " </TD>\n".
" </TR>\n".
" </TABLE></TD></TR>\n".
" <TR><TD>\n".
' <CENTER><INPUT TYPE=SUBMIT VALUE="' . _("L0gin") . "\"></CENTER>\n".
" </TD></TR>\n".
"</TABLE>\n".
"</CENTER>\n";

do_hook('login_form');
echo "</FORM>\n";

do_hook('login_bottom');
echo "</BODY>\n".
"</HTML>\n";
?>



I don't have no target atribute
 
Old 12-11-2003, 07:03 AM   #4
nephilim
Member
 
Registered: Aug 2003
Location: Belgium
Distribution: Debian (server), Kubuntu (desktop)
Posts: 248

Rep: Reputation: 30
No, you don't, that's why you have to type it

change

<FORM ACTION=\"redirect.php\" METHOD=\"POST\">

to

<FORM ACTION=\"redirect.php\" target=\"_blank\" METHOD=\"POST\">
 
Old 12-11-2003, 08:28 AM   #5
codedv
Member
 
Registered: Nov 2003
Location: Slough, UK
Distribution: Debian
Posts: 146

Rep: Reputation: 15
 
Old 12-11-2003, 11:19 AM   #6
spank
Member
 
Registered: Aug 2003
Location: Romania
Distribution: Ubuntu 6.06
Posts: 278

Original Poster
Rep: Reputation: 30
don't make fun of me... i'm /dev/null at php
 
Old 12-11-2003, 11:30 PM   #7
nephilim
Member
 
Registered: Aug 2003
Location: Belgium
Distribution: Debian (server), Kubuntu (desktop)
Posts: 248

Rep: Reputation: 30
OK, sorry about that. Actually, this is not a PHP problem but a HTML issue.

Did you change the line as I suggested above?
 
Old 12-12-2003, 03:00 PM   #8
spank
Member
 
Registered: Aug 2003
Location: Romania
Distribution: Ubuntu 6.06
Posts: 278

Original Poster
Rep: Reputation: 30
yes it works
thanks a milion
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Javascript - what to use rather than window.close() then window.open() davee Programming 2 04-11-2005 08:28 AM
open in same window burnt_toast Fedora 6 09-28-2004 11:45 PM
Only can open one window foxc98 Linux - General 3 08-09-2004 02:36 PM
php open in a new window spank Linux - Software 3 12-12-2003 06:05 AM
Open Source window$ manojrkrish Linux - General 4 12-03-2002 05:34 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:33 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration