php-general Digest 12 Jan 2006 13:33:36 -0000 Issue 3901

Topics (messages 228509 through 228523):

Apache2 PHP Downloadin Code
        228509 by: Ray Hauge

javascript in php page to use window.open()
        228510 by: Olga Urban
        228518 by: Rodolfo Andrade

private, public, protected in 4.3.11
        228511 by: Peter Lauri
        228512 by: David Robley
        228516 by: Aaron Koning

Re: Sending mail with php-
        228513 by: Sameer N Ingole
        228517 by: Jochem Maas

More newsgroup problems
        228514 by: Lester Caine

Re: array of checkbox values
        228515 by: Sjef

transferring db info
        228519 by: Ross
        228520 by: David Grant
        228522 by: Albert

Re: php + mysql - timstamp - calculate hours remaining
        228521 by: Gregory Machin

text size
        228523 by: Ross

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        php-general@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
Hello everyone,

I'm having some problems with one of our servers.  Recently Plesk overwrote 
our configuration file, and I'm trying to get the thing back online.  To make 
a long story short, I've got PHP working with http, but now that I've got the 
https virtual host set up, php doesn't work with it.  Instead apache just 
sends a file download request to the client, so I can download the entire 
source code, instead of viewing the results from PHP.

Has anyone run into an issue like this?  It's just so odd that the HTTP 
virtual host works just fine, but the HTTPS virtual host does not.

I've got all the appropriate:

LoadModule php4_module modules/libphp4.so
AddHandler php-script php
AddType application/x-httpd-php .php .php4 .php3 .phtml .inc
DirectoryIndex index.php index.php3

in the php.conf file.  I don't think I have to specify to turn the PHP engine 
on in the HTTPS virtual host, do I?

Thanks for any help,

Ray Hauge

--- End Message ---
--- Begin Message ---
Hi everyone,  
 
I am trying to open a new window after a successful function call (I
don't want to use <a href. and onclick). Here's what I have, but for
some reason, in IE the new window does not open (I have popup blockers
disabled). It opens in Mozilla, but with the wrong size. What am I doing
wrong here?
 
            if (insert($lname, $fname, $course, $date, $media1,
$media2))
                        {
                        echo "<script type=\"text/javascript\">\n";
                        echo "
window.open(\"add.html\",\"resizable=no,width=400,height=200\");";
                        echo "</script>\n\n";
                        }
            else
                        echo "Error adding a record.";
 
 
 
Thanks.
 
Olga

--- End Message ---
--- Begin Message ---
Hi Olga,

Your Javascript window.open() is missing one argument, the name of the
pop-up window:

window.open(\"add.html\",\"MyWindowName\",\"resizable=no,width=400,height=20
0\");

Best Regards,
Rodolfo Andrade

----- Original Message ----- 
From: Olga Urban
To: php-general@lists.php.net
Sent: Thursday, January 12, 2006 2:51 AM
Subject: [PHP] javascript in php page to use window.open()


Hi everyone,

I am trying to open a new window after a successful function call (I
don't want to use <a href. and onclick). Here's what I have, but for
some reason, in IE the new window does not open (I have popup blockers
disabled). It opens in Mozilla, but with the wrong size. What am I doing
wrong here?

            if (insert($lname, $fname, $course, $date, $media1,
$media2))
                        {
                        echo "<script type=\"text/javascript\">\n";
                        echo "
window.open(\"add.html\",\"resizable=no,width=400,height=200\");";
                        echo "</script>\n\n";
                        }
            else
                        echo "Error adding a record.";



Thanks.

Olga

--- End Message ---
--- Begin Message ---
Hi,

 

Example code that I try to run in version 4.3.11:

 

Class Page {

            private $myID;

 

            function Page() {

                        $this->myID=1;

}

 

            function getID() {

                        return $this->myID;

            }

 

}

 

But I get error message:

 

Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or
`T_VAR' or `'}'' in C:\Documents and Settings\Peter Lauri\My Documents\DWS
Asia\webserver\ework\classes\page.class.php on line 8

 

If I change to

            var $myID;

it works.

 

What is wrong?

 

/Peter

 

 

 


--- End Message ---
--- Begin Message ---
Peter Lauri wrote:

> Hi,
> 
> Example code that I try to run in version 4.3.11:
> 
> Class Page {
>     private $myID;
>             function Page() {
>                         $this->myID=1;
> }
> 
>             function getID() {
>                         return $this->myID;
>             }
> 
> }
> 
> But I get error message:
> 
> Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or
> `T_VAR' or `'}'' in C:\Documents and Settings\Peter Lauri\My Documents\DWS
> Asia\webserver\ework\classes\page.class.php on line 8
> 
> If I change to
>             var $myID;
> it works.
> 
> What is wrong?

I think you will find that the Visibility feature you are trying to use was
introduced with PHP 5


Cheers
-- 
David Robley

I'm sure it's in the manual somewhere...

--- End Message ---
--- Begin Message ---
"exception, final, php_user_filter, interface, implements, extends, public,
private, protected, abstract, clone, try, catch, throw" where not introduced
until PHP 5 (http://ca3.php.net/reserved).

Therefore, var is the only way to define member variables prior to PHP 5.

Aaron



On 1/11/06, Peter Lauri <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
>
>
> Example code that I try to run in version 4.3.11:
>
>
>
> Class Page {
>
>             private $myID;
>
>
>
>             function Page() {
>
>                         $this->myID=1;
>
> }
>
>
>
>             function getID() {
>
>                         return $this->myID;
>
>             }
>
>
>
> }
>
>
>
> But I get error message:
>
>
>
> Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or
> `T_VAR' or `'}'' in C:\Documents and Settings\Peter Lauri\My Documents\DWS
> Asia\webserver\ework\classes\page.class.php on line 8
>
>
>
> If I change to
>
>             var $myID;
>
> it works.
>
>
>
> What is wrong?
>
>
>
> /Peter
>
>
>
>
>
>
>
>
>

--- End Message ---
--- Begin Message ---
James Benson wrote:

alter the sendmail configuration file: /etc/mail/local-host-names

If that dont work you need to setup DNS for your machine.

James Benson wrote:

You need a domain name pointing to your IP address for a start, then you either need to configure php.ini to use the correct email or you should pass the additional param to sendmail, as shown below.


Taken from  php.net:

The additional_parameters parameter can be used to pass an additional parameter to the program configured to use when sending mail using the sendmail_path configuration setting. For example, this can be used to set the envelope sender address when using sendmail with the -f sendmail option.

The user that the webserver runs as should be added as a trusted user to the sendmail configuration to prevent a 'X-Warning' header from being added to the message when the envelope sender (-f) is set using this method. For sendmail users, this file is /etc/mail/trusted-users.



The additional_parameters parameter can be used to pass an additional parameter to the program configured to use when sending mail using the sendmail_path.
<?php
mail('[EMAIL PROTECTED]', 'the subject', 'the message', null,
   '[EMAIL PROTECTED]');
?>



James


Dotan Cohen wrote:

On my home Fedora Core 4 box I run Apache 2.0. Sometimes when sending
mail with php no mail is delivered, and I find this in the logs:

<<< 550-Verification failed for <[EMAIL PROTECTED]>
<<< 550-unrouteable mail domain "localhost.localdomain"
<<< 550 Sender verify failed

So I changed the only email address in httpd.conf to:
ServerAdmin [EMAIL PROTECTED]

But I still get the error! I did restart apache and even went so far as to
reboot the machine. If I cannot modify the parameter within apache,
then where should I modify it? Within php? Within sendmail?

Do you get this message for all the domains you send the mail to? or you get this message from some specific domains?
Did mails went to thses domains without problems earlier?
When you send mail to gmail.com address check if it is in buld or spam folder.

Regards,

--
Sameer N. Ingole
Blog: http://weblogic.noroot.org/

--- End Message ---
--- Begin Message ---
Richard Heyes wrote:
and phpmailer - thats also be known to help me from myself (when it comes to make a pig's ear of using the mail() function) - 3 cheers for Richard Heyes (you just know a class rocks when you can actually name the author by heart! :-).


Actually it's HTMLMimeMail - phpmailer is someone elses. :-)

P(*&#%)(*#% RE%) call me an ass.

ps - love the pointless refactoring for the php5 version. bravo! :-)


http://www.phpguru.org/mime.mail.html


--- End Message ---
--- Begin Message --- This is more a test, I have been trying to look at the lists on the newserver, but I am getting an error - "you are on a blocking list, connection refused"

So if this gets through via eMail where do I go next to get php.db and php.pecl.dev working again on news?

--
Lester Caine
-----------------------------
L.S.Caine Electronic Services
Treasurer - Firebird Foundation Inc.

--- End Message ---
--- Begin Message ---
Interesting way to solve the problem. I thought about checking whether the 
keys are present (if not the checkbox is set to "N".)
I wil definitily try this option as well.
Thxs all!
Sjef

"Al" <[EMAIL PROTECTED]> schreef in bericht 
news:[EMAIL PROTECTED]
> Sjef Janssen wrote:
>> Hallo,
>> I have a form with a number of checkboxes grouped together. The value of
>> these boxes is stored in an array: $used[]. Now I found that the value of
>> checked boxes (value = 'Y') are stored in the array while non checked 
>> boxes
>> are not stored at all. This makes the array incomplete as I want to have 
>> all
>> checkbox values in the array.
>> For example: for 4 checkboxes the values are
>> checkbox 1: array index  = 0 value = "Y"
>> checkbox 2: array index = 1 value = "Y"
>> checkbox 3: value = "N" : it does not occur in the array
>> checkbox 4: array index = 2 value = "Y"
>>
>> Is there a way to, as it were, complete the array and have all values
>> stored, even the "N" values? So that array index 2 has a value of "N", 
>> and
>> array index 3 is "Y".
>>
>> Thxs
>>
>> Sjef
>
> Seems like I recall solving this problem.  It's been a long time, so 
> you'll need to try it.
>
> For each checkbox set these two
> <input type="hidden" name="foo" value="no"><input type="checkbox" 
> name="foo" value="yes">
>
> You'll get $_POST[foo] as "no" or "yes" 

--- End Message ---
--- Begin Message ---
I am thinking about buying a vps for a year of so until a client of mine 
updates their dodgy server.


Can you just export the mysql? Will the pdfs be exported as binary data? 
Will I have to re-upload them? (there are hundereds).


R. 

--- End Message ---
--- Begin Message ---
Ross,

Ross wrote:
> Can you just export the mysql? Will the pdfs be exported as binary data? 
> Will I have to re-upload them? (there are hundereds).

Try using "mysqldump" to pull the data into a flat file full of SQL
statements.  You can then use the "mysql" command to reinsert the data.

David
-- 
David Grant
http://www.grant.org.uk/

--- End Message ---
--- Begin Message ---
David Grant wrote:
> Ross wrote:
> > Can you just export the mysql? Will the pdfs be exported as binary data?

> > Will I have to re-upload them? (there are hundereds).
>
> Try using "mysqldump" to pull the data into a flat file full of SQL
> statements.  You can then use the "mysql" command to reinsert the data.

An alternate method, which I found to be more reliable, would be to put the
database files in a tarball, transfer it to the new server and then extract
the tarball into the database directory.

I am running MySQL on a Linux server. The databases are in /var/lib/mysql.

If your database is called db then there will be a db directory in
/var/lib/mysql.

Before making the backup you either need to stop MySQL (preferred) or flush
all data to tables and make sure nothing is writing/reading to/from the
database.

To put it in a tarball:
origin# cd /var/lib/mysql
origin# tar cvf db_backup_20060112.tar db

You then copy that db_backup_20060112.tar file to the MySQL data directory
of your destination server and once it's there extract it again:
origin# scp db_backup_20060112.tar [EMAIL PROTECTED]
destination# cd /var/lib/mysql
destination# tar xvf db_backup_20060112.tar

You then might need to set permissions if the UID of your origin server
MySQL user and destination server MySQL user is not the same.

After starting MySQL server on your destination server you should have the
database exactly like it was on the original.

BTW you can transfer MySQL data files from a Windows machine to a Linux
machine and vice versa without any issues. There is a note in the MySQL
documentation of the formatting your Windows server should use (to do with
case sensitivity)

HTH

Albert

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.371 / Virus Database: 267.14.17/227 - Release Date: 2006/01/11
 

--- End Message ---
--- Begin Message ---
Many Thanks for the help.

OP 2 worked a treat.. now i need to run it at midnight,  I was  going to
write a  php script  and call  it vai  crontab,  but  how could  I iplament
this a  triger and stored procedure ?



On 1/10/06, M. Sokolewicz <[EMAIL PROTECTED]> wrote:
>
> David Grant wrote:
> > Gregory,
> >
> > David Grant wrote:
> >
> >>Gregory Machin wrote:
> >>
> >>>I have a table with a timestamp column and would like to use his to
> >>>calculate the age of the record . how would i go about this...
> >>>I would also like to exicute a mysql stament that pasess the tables and
> >>>removes fields older than say 72 hours. how would i go about this . ?
> >>
> >>A timestamp is the time in seconds (since Jan 1 1970), so you can
> >>ascertain the age in seconds by subtracting the stored timestamp from
> >>the current timestamp.
> >>
> >>You can find the current timestamp in MySQL using the
> >>CURRENT_TIMESTAMP() function.
> >>
> >>Once you have the age of the record, finding 72 hours is fairly trivial
> >>- 72 hours is 259200 seconds (72hrs * 60mins * 60secs).
> >>
> >>Therefore your query will be:
> >>
> >>DELETE FROM <TABLE> WHERE CURRENT_TIMESTAMP() - <FIELD> > 259200
> >
> >
> > Following Albert's reply, the query ought to read:
> >
> > DELETE FROM <TABLE> WHERE CURRENT_TIMESTAMP() - UNIX_TIMESTAMP(<FIELD> >
> > 259200
> >
> > David
> David, your solution is correct (though you made a typo; it should read:
> "DELETE FROM <TABLE> WHERE CURRENT_TIMESTAMP() - UNIX_TIMESTAMP(<FIELD>)
> > 259200"), though slow because mysql needs to calculate a timestamp,
> based on all the times/dates stored. Now, all these methods depend on
> how the OP stored the dates in his database. In general, there are 2
> ways which are used most often:
> 1 - As a UNIX timestamp (as per Albert's example), or
> 2 - As a MySQL-timestamp (as per ISO 8601; YYYY-MM-DD)
>
> If the OP uses #1 to store the date, the easiest way is to do a
> modification of David's solution, and do:
> "DELETE FROM <TABLE> WHERE <field> < UNIX_TIMESTAMP(NOW())-259200", this
> is a quick solution, because all MySQL now needs to do is compare an
> integer to an integer for each row (which is pretty fast).
> If the OP uses #2, then it's easier to use MySQL's built-in functions
> for date-comparison. It's actually faster than converting the dates to
> UNIX timestamps and comparing them as per #1, so let's do that. To
> achieve this, you can use mysql's own date functions:
> "DELETE FROM <TABLE> WHERE <field> < NOW()- INTERVAL 72 HOUR"
>
> hope this short discussion helped,
> - tul
>



--
Gregory Machin
[EMAIL PROTECTED]
[EMAIL PROTECTED]
www.linuxpro.co.za
www.exponent.co.za
Web Hosting Solutions
Scalable Linux Solutions
www.iberry.info (support and admin)

+27 72 524 8096

--- End Message ---
--- Begin Message ---
Hi,

I have a variable called $text_size which can be "small", "medium" or 
"large".

The value is submitted by a text link

 a href="<? $_SERVER['PHP_SELF'];  ?>?text_size=small" class="size1">A</a>
<a href="<? $_SERVER['PHP_SELF']; ?>?text_size=medium" class="size2">A</a>
<a href="<? $_SERVER['PHP_SELF']; ?>?text_size=large" class="size3">A


At the start of the page I initialise it to "small" if it hasn't been set

$text_size = isset($_GET['text_size'] ) ? $_GET['text_size'] : 'small'

What I want to do is store the most current value for $text_size in a 
session $_SESSION['text_size'] and then if I move to the next page start a 
session and use the strored value so the value is not reset on every page.


R. 

--- End Message ---

Reply via email to