|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general Digest 7 Oct 2004 16:42:37 -0000 Issue 3039
php-general-digest-help
lists.php.net
Date: Thu Oct 07 2004 - 11:42:37 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
php-general Digest 7 Oct 2004 16:42:37 -0000 Issue 3039
Topics (messages 198792 through 198857):
AutoLogin
198792 by: Sagar C Nannapaneni
198799 by: Petar Nedyalkov
Is it possible??
198793 by: Sagar C Nannapaneni
198800 by: Petar Nedyalkov
How to implement mass emailing?
198794 by: Tumurbaatar S.
198795 by: zareef ahmed
198807 by: RaTT
198819 by: Marco Tabini
198826 by: Tumurbaatar S.
getting rid of NOTICE
198796 by: Roger Thomas
198797 by: zareef ahmed
198804 by: Roger Thomas
198809 by: Marek Kilimajer
198811 by: M. Sokolewicz
198818 by: Robin Vickery
PHP with IMAP support
198798 by: Timothy Johnson
Re: Newsgroups Space
198801 by: Petar Nedyalkov
Re: pdf_open_pdi_page
198802 by: Hendrik Schmieder
198821 by: Matt M.
198838 by: Hendrik Schmieder
198849 by: Matt M.
198854 by: Matt M.
[PHP5] How to knwo object class name in a function called statically ?
198803 by: Frédéric Hardy
PHP and Lotus Notes
198805 by: Terence
SOMETIMES, my SID gets embedded in the URL ???
198806 by: PHPDiscuss - PHP Newsgroups and mailing lists
198808 by: Marek Kilimajer
198810 by: PHPDiscuss - PHP Newsgroups and mailing lists
Re: [PHP5] How to knwo object class name in a function called statically
198812 by: M. Sokolewicz
198813 by: Marek Kilimajer
Re: [PHP5] How to knwo object class name in a function
198814 by: M. Sokolewicz
Re: Regular Expression - highlighting
198815 by: Aidan Lister
Set up cron using PHP
198816 by: Sheni R. Meledath
198817 by: Petar Nedyalkov
198820 by: M. Sokolewicz
198822 by: Petar Nedyalkov
198824 by: M. Sokolewicz
198829 by: Petar Nedyalkov
198832 by: Alexandru E. Ungur
Muti-Dimensional Array Help Please
198823 by: Nick Wilson
198825 by: M. Sokolewicz
198827 by: Ed Lazor
198828 by: Nick Wilson
198831 by: M. Sokolewicz
198833 by: Nick Wilson
198834 by: Matt M.
Page cannot be displayed after form submission
198830 by: Philip Thompson
198837 by: Marek Kilimajer
anonymous from address using mail()
198835 by: Sagar C Nannapaneni
198845 by: Greg Donald
198847 by: Ed Lazor
Re: PHP posting confirmation for denis.gerasimov
vekos.ru
198836 by: Denis Gerasimov
198846 by: Greg Donald
session_save_path
198839 by: Al
198842 by: John Holmes
198848 by: Ed Lazor
198851 by: Al
198855 by: Al
198856 by: Al
Re: Referencing a "constant" class variable
198840 by: Chris Boget
mcrypt install question
198841 by: Ed Lazor
198843 by: Greg Donald
198850 by: Ed Lazor
198852 by: Greg Donald
Re: displaying blob images from a mssql db
198844 by: Jensen, Kimberlee
Help with Array Sorting Please
198853 by: Nick Wilson
performance: large includes vs small includes with lots of reads
198857 by: Hans H. Anderson
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
BlankHi all,
I have a website which has a login form with username and password.
How can i login into that website providing the username and pwd from
the php script. I know that this can be done...but wonder how.
The website uses a JSP files with jsp session and also before
logging in..it asks for ssl authentication.
Ur help will b a great help to me...
Regards,
/sagar
attached mail follows:
On Thursday 07 October 2004 07:57, Sagar C Nannapaneni wrote:
> BlankHi all,
> I have a website which has a login form with username and password.
> How can i login into that website providing the username and pwd from
> the php script. I know that this can be done...but wonder how.
> The website uses a JSP files with jsp session and also before
> logging in..it asks for ssl authentication.
Use cURL ;-)
>
> Ur help will b a great help to me...
>
> Regards,
> /sagar
--
Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)
---------------------------------------------------------------------
Orbitel - the New Generation Telecom! See www.orbitel.bg.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQBBZO2PLT98C3rkVDYRAgGBAKCQyJAzt5XkzHZmo4278Mdj32mIvQCaAiMr
QkhfXDNR1+TqJrJ4fsltyh0=
=4X+e
-----END PGP SIGNATURE-----
attached mail follows:
BlankThis may sound strange..but is there a way out???
I need to know where the client moves from my page.
Even using frames...like my page will b in the top frame
of the page and the user can browse his stuff in the lower
frame..so can v find from the top page whats the user is
browsing???
I rreally wonder...i badly need the solution :(
/sagar
attached mail follows:
On Thursday 07 October 2004 08:26, Sagar C Nannapaneni wrote:
> BlankThis may sound strange..but is there a way out???
>
> I need to know where the client moves from my page.
> Even using frames...like my page will b in the top frame
> of the page and the user can browse his stuff in the lower
> frame..so can v find from the top page whats the user is
> browsing???
If you control both pages - i.e. you have access to the applications - you may
use javascript to send signals from the second frame to the first. But have
in mind that if the domain of both applications is not equal you'll have to
set it via javascript explicitly.
>
> I rreally wonder...i badly need the solution :(
>
> /sagar
--
Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)
---------------------------------------------------------------------
Orbitel - the New Generation Telecom! See www.orbitel.bg.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iD4DBQBBZO44LT98C3rkVDYRAoVFAJ9/drZ1ukKFgIqlngxNvKkARKDtWwCWKAp5
OWv0ePwHNd0ZIGIvtMVZgw==
=JFtP
-----END PGP SIGNATURE-----
attached mail follows:
The scenario is:
1. Site administrator logs into his admin page and writes
some message on a form.
2. After clicking submit the web script should broadcast
this message to several hundred subscribers.
And I'm wonder how to implement this on PHP.
Sending an email to each subscribers can take
a much time and PHP will stop after max_execution_time.
Any ideas?
attached mail follows:
--- "Tumurbaatar S." <tumurbaatar
datacom.mn> wrote:
> The scenario is:
>
> 1. Site administrator logs into his admin page and
> writes
> some message on a form.
> 2. After clicking submit the web script should
> broadcast
> this message to several hundred subscribers.
If you want to send the message as email mail() is the
only option.
>
> And I'm wonder how to implement this on PHP.
> Sending an email to each subscribers can take
> a much time and PHP will stop after
> max_execution_time.
you can set max time by set_time_limit(), for disable
time limit just use set_time_limit(0).
BTW register_shutdown_function() can be helpfull in
handling performance related doubts.
zareef ahmed
> Any ideas?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
=====
Zareef Ahmed :: A PHP Developer in Delhi ( India ).
Homepage :: http://www.zasaifi.com/zareef_ahmed.php
_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com
attached mail follows:
Hi,
you can create a mailscript to run seperartly in the background, so
when a administrator wishes to send a mass mail, it writes the content
to a database and then executes a stand alone mailing script eg:
exec(' php phpmailscript.php > logflile.txt &'); use the & to run the
script in the background.
This script can then pull info from a db (user and content) and mail
individually and log that the user was sent a email. This will also
save you the hassel of worring about administrators closing the
browser and having to resend the mail again and if there are thousands
of emails you can then schedual email's to be sent at specific times,
in the evening for example.
HTH
Jarratt
On Wed, 6 Oct 2004 22:58:59 -0700 (PDT), zareef ahmed <zasaifi
yahoo.com> wrote:
>
> --- "Tumurbaatar S." <tumurbaatar
datacom.mn> wrote:
>
> > The scenario is:
> >
> > 1. Site administrator logs into his admin page and
> > writes
> > some message on a form.
> > 2. After clicking submit the web script should
> > broadcast
> > this message to several hundred subscribers.
>
> If you want to send the message as email mail() is the
> only option.
> >
> > And I'm wonder how to implement this on PHP.
> > Sending an email to each subscribers can take
> > a much time and PHP will stop after
> > max_execution_time.
> you can set max time by set_time_limit(), for disable
> time limit just use set_time_limit(0).
>
> BTW register_shutdown_function() can be helpfull in
> handling performance related doubts.
>
> zareef ahmed
>
> > Any ideas?
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
> =====
> Zareef Ahmed :: A PHP Developer in Delhi ( India ).
> Homepage :: http://www.zasaifi.com/zareef_ahmed.php
>
>
> _______________________________
> Do you Yahoo!?
> Declare Yourself - Register online to vote today!
> http://vote.yahoo.com
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
attached mail follows:
Well, you do have a number of options. First, as someone suggested, you
can write a CLI script that doesn't depend on a web browser being
connected to run. That's probably the best solution overall, because you
have the most control over what happens. You can even trigger it
indirectly through a call to a web page.
If you want to run the script through the web, you can set_time_limit(0)
to prevent your script from timing out and register_shutdown_function()
to ensure that your script continues running even if the user terminates
the connection from the browser. Because of this, though, you will also
need a mechanism that makes it possible for the script to determine
whether there is another instance of the script running, so that you can
prevent an overanxious usre from refreshing your script multiple times
because he can't tell that it's still sending out mail and hit your
mailing list more than once.
Finally, you will need a fast mailing mechanism. mail() is not your only
option--you can interface directly with any mailer through SMTP or
pipes, for example--but in my experience, you don't need to go any
further to make things work properly. What you really need, is a fast
MTA that is capable of queueing your messages and deliverying them
efficiently, like qmail. If you want an easier way of composing e-mail
programmatically, you may want to take a look at PHPMailer
(http://phpmailer.sourceforge.net/), which can simplify things
significantly and can also interface directly with a fast MTA like qmail.
We use a combination of these techniques to send out tens of thousands
of notifications once every month, and never had a problem with it.
HTH,
Marco Tabini
--
php|architect
The PHP Magazine for PHP Professionals
http://www.phparch.com
Tumurbaatar S. wrote:
> The scenario is:
>
> 1. Site administrator logs into his admin page and writes
> some message on a form.
> 2. After clicking submit the web script should broadcast
> this message to several hundred subscribers.
>
> And I'm wonder how to implement this on PHP.
> Sending an email to each subscribers can take
> a much time and PHP will stop after max_execution_time.
> Any ideas?
>
attached mail follows:
Thank you, all!
attached mail follows:
I have this short script (below) that does checking whether a userid has an associated jpegPhoto in an LDAP database. The script is working fine but gave a 'Notice' msg bcos I made error_reporting to report all errors.
Notice: Undefined index: jpegphoto in test.php on line 34
Question: How do I make the Notice go away without changing error reporting to error_reporting (E_ALL & ~E_NOTICE) ?
Please advise.
--
roger
<?
require_once "config.inc";
error_reporting (E_ALL);
$ds =
connectBindServer(LDAP_RDN, LDAP_PASS);
if ($ds) {
$what2return = array("givenName","sn","jpegPhoto");
$searchFilter = "(uid=roger
example.com)";
$sr = ldap_search($ds, LDAP_BASEDN, $searchFilter,$what2return);
$resultEntries = ldap_get_entries($ds, $sr);
closeConn($ds);
if ($resultEntries["count"] == 0) {
print "user not found";
exit;
}
else {
$gn = $resultEntries[0]["givenname"];
$sn = $resultEntries[0]["sn"];
$photo = $resultEntries[0]["jpegphoto"];
if ($photo['count'] == 1)
print "photo available";
else
print "photo not available";
}
}
?>
---------------------------------------------------
Sign Up for free Email at http://ureg.home.net.my/
---------------------------------------------------
attached mail follows:
--- Roger Thomas <sniper
home.net.my> wrote:
> I have this short script (below) that does checking
> whether a userid has an associated jpegPhoto in an
> LDAP database. The script is working fine but gave a
> 'Notice' msg bcos I made error_reporting to report
> all errors.
>
> Notice: Undefined index: jpegphoto in test.php on
> line 34
>
> Question: How do I make the Notice go away without
> changing error reporting to error_reporting (E_ALL &
> ~E_NOTICE) ?
>
> Please advise.
>
> --
> roger
>
> <?
> require_once "config.inc";
> error_reporting (E_ALL);
>
> $ds =
connectBindServer(LDAP_RDN, LDAP_PASS);
> if ($ds) {
> $what2return =
> array("givenName","sn","jpegPhoto");
You have define "jpegPhoto" Note Caps P.
> $searchFilter = "(uid=roger
example.com)";
> $sr = ldap_search($ds, LDAP_BASEDN,
> $searchFilter,$what2return);
> $resultEntries = ldap_get_entries($ds, $sr);
> closeConn($ds);
>
> if ($resultEntries["count"] == 0) {
> print "user not found";
> exit;
> }
> else {
> $gn = $resultEntries[0]["givenname"];
> $sn = $resultEntries[0]["sn"];
> $photo = $resultEntries[0]["jpegphoto"];
here p is small in jpegphoto.
Got it ...
zareef ahmed
> if ($photo['count'] == 1)
> print "photo available";
> else
> print "photo not available";
> }
> }
>
> ?>
>
>
>
> ---------------------------------------------------
> Sign Up for free Email at http://ureg.home.net.my/
> ---------------------------------------------------
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
=====
Zareef Ahmed :: A PHP Developer in Delhi ( India ).
Homepage :: http://www.zasaifi.com/zareef_ahmed.php
_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com
attached mail follows:
I dont know how to explain this but when you work with an ldap attribute, they are case sensitive. jpegPhoto was what the schema was written with.
However when you retrieve that into PHP, you accessed them with all lower case. So accessing userPassword attribute in ldap will become userpassword in PHP.
Just to satisfy your curiosity, I have changed that to your advise with running the script produces identical result.
--
roger
Quoting zareef ahmed <zasaifi
yahoo.com>:
>
> --- Roger Thomas <sniper
home.net.my> wrote:
>
> > I have this short script (below) that does checking
> > whether a userid has an associated jpegPhoto in an
> > LDAP database. The script is working fine but gave a
> > 'Notice' msg bcos I made error_reporting to report
> > all errors.
> >
> > Notice: Undefined index: jpegphoto in test.php on
> > line 34
> >
> > Question: How do I make the Notice go away without
> > changing error reporting to error_reporting (E_ALL &
> > ~E_NOTICE) ?
> >
> > Please advise.
> >
> > --
> > roger
> >
> > <?
> > require_once "config.inc";
> > error_reporting (E_ALL);
> >
> > $ds =
connectBindServer(LDAP_RDN, LDAP_PASS);
> > if ($ds) {
> > $what2return =
> > array("givenName","sn","jpegPhoto");
>
> You have define "jpegPhoto" Note Caps P.
>
> > $searchFilter = "(uid=roger
example.com)";
> > $sr = ldap_search($ds, LDAP_BASEDN,
> > $searchFilter,$what2return);
> > $resultEntries = ldap_get_entries($ds, $sr);
> > closeConn($ds);
> >
> > if ($resultEntries["count"] == 0) {
> > print "user not found";
> > exit;
> > }
> > else {
> > $gn = $resultEntries[0]["givenname"];
> > $sn = $resultEntries[0]["sn"];
> > $photo = $resultEntries[0]["jpegphoto"];
>
> here p is small in jpegphoto.
>
> Got it ...
>
> zareef ahmed
> > if ($photo['count'] == 1)
> > print "photo available";
> > else
> > print "photo not available";
> > }
> > }
> >
> > ?>
> >
> >
> >
> > ---------------------------------------------------
> > Sign Up for free Email at http://ureg.home.net.my/
> > ---------------------------------------------------
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
> =====
> Zareef Ahmed :: A PHP Developer in Delhi ( India ).
> Homepage :: http://www.zasaifi.com/zareef_ahmed.php
>
>
>
> _______________________________
> Do you Yahoo!?
> Declare Yourself - Register online to vote today!
> http://vote.yahoo.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
---------------------------------------------------
Sign Up for free Email at http://ureg.home.net.my/
---------------------------------------------------
attached mail follows:
Roger Thomas wrote:
> I dont know how to explain this but when you work with an ldap attribute, they are case sensitive. jpegPhoto was what the schema was written with.
>
> However when you retrieve that into PHP, you accessed them with all lower case. So accessing userPassword attribute in ldap will become userpassword in PHP.
>
> Just to satisfy your curiosity, I have changed that to your advise with running the script produces identical result.
>
You can either:
1. prepend
in front of the variable, which supresses notices and warnings
2. use isset() or array_key_exists() to check for the existance of the key.
attached mail follows:
Marek Kilimajer wrote:
> Roger Thomas wrote:
>
>> I dont know how to explain this but when you work with an ldap
>> attribute, they are case sensitive. jpegPhoto was what the schema was
>> written with.
>>
>> However when you retrieve that into PHP, you accessed them with all
>> lower case. So accessing userPassword attribute in ldap will become
>> userpassword in PHP.
>>
>> Just to satisfy your curiosity, I have changed that to your advise
>> with running the script produces identical result.
>>
>
> You can either:
>
> 1. prepend
in front of the variable, which supresses notices and warnings
that's a very ugly use... If you're sure it'll throw a notice, then
initialize the variable.
If you're unsure about aby of your variables, and don't want to appear
as if you were a clean coder, you can set
error_reporting(E_ALL&~E_NOTICE), which'll show E_ALL AND NOT E_NOTICE :)
>
> 2. use isset() or array_key_exists() to check for the existance of the key.
attached mail follows:
On Thu, 7 Oct 2004 14:04:00 +0800, Roger Thomas <sniper
home.net.my> wrote:
> I have this short script (below) that does checking whether a userid has an associated jpegPhoto in an LDAP database. The script is working fine but gave a 'Notice' msg bcos I made error_reporting to report all errors.
>
> Notice: Undefined index: jpegphoto in test.php on line 34
>
> Question: How do I make the Notice go away without changing error reporting to error_reporting (E_ALL & ~E_NOTICE) ?
> [...]
> $photo = $resultEntries[0]["jpegphoto"];
It's complaining because you're trying to read from an array index
that hasn't been set, Assuming this isn't a typo or something, if you
want to avoid the notice you normally have two options:
1. initialise all the indexes that you plan to use.
2. check whether the index has been set before you try to read from it.
In this case, you're pretty much stuck with the second option as
you're getting the array from an external source.
So do something like this:
$photo = isset($resultEntries[0]["jpegphoto"]) ?
$resultEntries[0]["jpegphoto"] : array('count' => 0);
-robin
attached mail follows:
Not sure if this is the right place to post this, but I am trying to get
PHP installed with IMAP support. It says that I need to install using
the --with-imap=/dir but how do I do that with Gentoo?
attached mail follows:
On Wednesday 06 October 2004 22:53, Joe Crawford wrote:
> i know this isn't completely related to php but i am creating a web based
> news reader in php, how much disk space do you think i need to run my own
> local news server?
depends on the number of external news sources you'll import ;-)
--
Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)
---------------------------------------------------------------------
Orbitel - the New Generation Telecom! See www.orbitel.bg.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQBBZO6ALT98C3rkVDYRAn4TAJ44On/LOa9UlXTD1W69oihkZ4cqmwCfV6/G
vRKrad7Xq9ja6LcBsEMJMGs=
=bizP
-----END PGP SIGNATURE-----
attached mail follows:
Matt M. schrieb:
>>*Fatal error*: PDFlib error: [2016] PDF_open_pdi: PDF import (PDI) not
>>supported in this configuration in
>>*d:\worksheet-server\wss\html\pdf\test2.php* on line *7*
>>
>>
>
>I could be wrong but I think you need a special license for this functionality.
>
>
>
Do you have a source for your assumption ?
Hendrik
attached mail follows:
> Do you have a source for your assumption ?
to use pdi you need PDFlib Personalization Server (PPS)
http://www.pdflib.com/products/pdflib/pps.html
attached mail follows:
Matt M. schrieb:
>>Do you have a source for your assumption ?
>>
>>
>
>to use pdi you need PDFlib Personalization Server (PPS)
>http://www.pdflib.com/products/pdflib/pps.html
>
>
>
I was on that page.
There's nothing which comes close to your assumption.
with best regards
Hendrik
attached mail follows:
> I was on that page.
> There's nothing which comes close to your assumption.
sorry, wrong link you dont need PDFlib+PDI. Is that the license that you have?
here is an assumption. I assumed you would read the pdflib manual, did you see?
Note All functions described in this section require PDFlib+PDI. The
PDF import library (PDI) is not contained in PDFlib or PDFlib Lite.
Although PDI is integrated in all precompiled editions of PDFlib, a
license key for PDI (or PPS, which includes PDI) is required.
attached mail follows:
> sorry, wrong link you dont need PDFlib+PDI. Is that the license that you have?
I mean you "do need"
attached mail follows:
Hello -
I have this code :
abstract class foo
{
private __construct() {}
public static getInstance()
{
static $instance = null;
if (is_null($instance) == false)
return $instance;
else
{
$class = __CLASS__;
return new $class();
}
}
}
class extendedFoo extends foo
{
...
}
$instance = extendedFoo::getInstance();
echo (get_class($instance));
My problem is that get_class($instance) return "foo" instead of
"extendedFoo" !!!
How to knwo the calling object type in a function called statically ?
Reflection ? Other solution ??? Bug ????
I can resolve my probleme with a extendedFoo::getInstance() function,
and adding a parameter $class to foo::getInstance(), but i don't want
duplicated code in all foo subclass...
Fred -
attached mail follows:
Hi List,
I googled a bit but didnt get much. Are there tools other than the ones
on the PHP website (which are EXPERIMENTAL) that can be used to access
the Lotus notes framework, such as databases / tables / data from PHP.
Any tips out there for integration issues. Our company is looking at
bringing in Lotus but keep our existing PHP applications. Can PHP access
the Lotus DB for authentication?
Thanks for any tips / help
attached mail follows:
he problem is that SOMETIMES, my SID gets embedded in the URL, although at
the begining of every page I have this code:
ini_set(session.use_only_cookies, "1");
session_set_cookie_params(60*60);
session_start();
session_register("blabla");
if (!$_SESSION["logged_in"])
session_destroy();
etc, etc;
So there are days/times when the SID isn't embedded in the URL (and in the
links of the page), and days/times when it is, regardless of what value
$_SESSION["logged_in"] has.
I tested the value returned by ini_set and it's always different from
false.
What gives ???
attached mail follows:
PHPDiscuss - PHP Newsgroups and mailing lists wrote:
> he problem is that SOMETIMES, my SID gets embedded in the URL, although at
> the begining of every page I have this code:
>
> ini_set(session.use_only_cookies, "1");
The above sets sessionuse_only_cookies to 1. I did not miss a dot,
session and use_only_cookies are interpreted as constants. You need quotes:
ini_set('session.use_only_cookies', "1");
> session_set_cookie_params(60*60);
> session_start();
> session_register("blabla");
> if (!$_SESSION["logged_in"])
> session_destroy();
> etc, etc;
>
> So there are days/times when the SID isn't embedded in the URL (and in the
> links of the page), and days/times when it is, regardless of what value
> $_SESSION["logged_in"] has.
> I tested the value returned by ini_set and it's always different from
> false.
> What gives ???
>
attached mail follows:
Wow, thank you, it was so obvious!
Marek Kilimajer wrote:
> PHPDiscuss - PHP Newsgroups and mailing lists wrote:
> > he problem is that SOMETIMES, my SID gets embedded in the URL, although at
> > the begining of every page I have this code:
> >
> > ini_set(session.use_only_cookies, "1");
> The above sets sessionuse_only_cookies to 1. I did not miss a dot,
> session and use_only_cookies are interpreted as constants. You need quotes:
> ini_set('session.use_only_cookies', "1");
> > session_set_cookie_params(60*60);
> > session_start();
> > session_register("blabla");
> > if (!$_SESSION["logged_in"])
> > session_destroy();
> > etc, etc;
> >
> > So there are days/times when the SID isn't embedded in the URL (and in the
> > links of the page), and days/times when it is, regardless of what value
> > $_SESSION["logged_in"] has.
> > I tested the value returned by ini_set and it's always different from
> > false.
> > What gives ???
> >
attached mail follows:
Frédéric hardy wrote:
> Hello -
>
> I have this code :
>
> abstract class foo
> {
> private __construct() {}
>
> public static getInstance()
> {
> static $instance = null;
>
> if (is_null($instance) == false)
> return $instance;
> else
> {
> $class = __CLASS__;
> return new $class();
> }
> }
> }
>
> class extendedFoo extends foo
> {
> ...
> }
>
> $instance = extendedFoo::getInstance();
>
> echo (get_class($instance));
>
> My problem is that get_class($instance) return "foo" instead of
> "extendedFoo" !!!
>
> How to knwo the calling object type in a function called statically ?
> Reflection ? Other solution ??? Bug ????
>
> I can resolve my probleme with a extendedFoo::getInstance() function,
> and adding a parameter $class to foo::getInstance(), but i don't want
> duplicated code in all foo subclass...
>
> Fred -
this is a completely expected result. What you're doing is:
statically calling function a() which is defined in a PARENT class.
Inside this parent class, the function calls __CLASS__, which is a magic
constant, holding the name of the class it's in AT THAT MOMENT, and the
class it IS in is the parent class!.
There is no easy way to do what you ask for. If you were using
non-static objects/functions, then you could use get_class($this), which
would work just fine. However, when using it statically, $this does not
exist... so...
attached mail follows:
M. Sokolewicz wrote:
> Frédéric hardy wrote:
>
>> Hello -
>>
>> I have this code :
>>
>> abstract class foo
>> {
>> private __construct() {}
>>
>> public static getInstance()
>> {
>> static $instance = null;
>>
>> if (is_null($instance) == false)
>> return $instance;
>> else
>> {
>> $class = __CLASS__;
>> return new $class();
>> }
>> }
>> }
>>
>> class extendedFoo extends foo
>> {
>> ...
>> }
>>
>> $instance = extendedFoo::getInstance();
>>
>> echo (get_class($instance));
>>
>> My problem is that get_class($instance) return "foo" instead of
>> "extendedFoo" !!!
>>
>> How to knwo the calling object type in a function called statically ?
>> Reflection ? Other solution ??? Bug ????
>>
>> I can resolve my probleme with a extendedFoo::getInstance() function,
>> and adding a parameter $class to foo::getInstance(), but i don't want
>> duplicated code in all foo subclass...
>>
>> Fred -
>
> this is a completely expected result. What you're doing is:
> statically calling function a() which is defined in a PARENT class.
> Inside this parent class, the function calls __CLASS__, which is a magic
> constant, holding the name of the class it's in AT THAT MOMENT, and the
> class it IS in is the parent class!.
>
> There is no easy way to do what you ask for. If you were using
> non-static objects/functions, then you could use get_class($this), which
> would work just fine. However, when using it statically, $this does not
> exist... so...
>
debug_backtrace()?
Not really inteded for this purpose :)
attached mail follows:
Marek Kilimajer wrote:
> M. Sokolewicz wrote:
>
>> Frédéric hardy wrote:
>>
>>> Hello -
>>>
>>> I have this code :
>>>
>>> abstract class foo
>>> {
>>> private __construct() {}
>>>
>>> public static getInstance()
>>> {
>>> static $instance = null;
>>>
>>> if (is_null($instance) == false)
>>> return $instance;
>>> else
>>> {
>>> $class = __CLASS__;
>>> return new $class();
>>> }
>>> }
>>> }
>>>
>>> class extendedFoo extends foo
>>> {
>>> ...
>>> }
>>>
>>> $instance = extendedFoo::getInstance();
>>>
>>> echo (get_class($instance));
>>>
>>> My problem is that get_class($instance) return "foo" instead of
>>> "extendedFoo" !!!
>>>
>>> How to knwo the calling object type in a function called statically ?
>>> Reflection ? Other solution ??? Bug ????
>>>
>>> I can resolve my probleme with a extendedFoo::getInstance() function,
>>> and adding a parameter $class to foo::getInstance(), but i don't want
>>> duplicated code in all foo subclass...
>>>
>>> Fred -
>>
>>
>> this is a completely expected result. What you're doing is:
>> statically calling function a() which is defined in a PARENT class.
>> Inside this parent class, the function calls __CLASS__, which is a
>> magic constant, holding the name of the class it's in AT THAT MOMENT,
>> and the class it IS in is the parent class!.
>>
>> There is no easy way to do what you ask for. If you were using
>> non-static objects/functions, then you could use get_class($this),
>> which would work just fine. However, when using it statically, $this
>> does not exist... so...
>>
>
> debug_backtrace()?
>
> Not really inteded for this purpose :)
that's a possibility... surely not the Reflection API though =/ it only
works on static objects AFAIK (or new instances)
attached mail follows:
Hi Michael,
Thanks very much for the assistance, I'll have to investigate further!
Kind Regards,
Aidan Lister
"Michael Sims" <michaels
crye-leike.com> wrote in message
news:EOEIIEMPJGBOGHFJBKAFEEDICBAA.michaels
crye-leike.com...
> Aidan Lister wrote:
>> Hello list,
>>
>> I'm pretty terrible with regular expressions, I was wondering if
>> someone would be able to help me with this
>> http://paste.phpfi.com/31964
>>
>> The problem is detailed in the above link. Basically I need to match
>> the contents of any HTML tag, except a link. I'm pretty sure a
>> lookbehind set is needed in the center (%s) bit.
>>
>> Any suggestions would be appreciated, but it's not quite as simple as
>> it sounds - if possible please make sure you run the above script and
>> see if it "PASSED".
>
> So basically, you want to put a link around "foo", only if it doesn't
> already have one, right?
>
> The problem with look-behind assertions is that they have to be
> fixed-width.
> If you're certain of what kind of data you're going to be dealing with
> then
> this may be sufficient. For example, I came up with a regex that will
> PASS
> your script but I doubt seriously that it'll be very useful to you as it
> would be easy to break it by coming up with various test cases. For your
> single test case, however, this works:
>
> /(?<!<a href="foo">)(?<!<a href=")(foo)/
>
> The problem is that HTML tags can be split across lines...they have have
> any
> variable amount of whitespace within the tag...they can have other
> attributes (class, id, onClick), etc. Since look behind assertions have
> to
> be fixed width it'd be impossible (IMHO) to come up with a single regex
> that
> would match all cases, unless the input data was uniform. For example,
> stuff like
>
> <a href = "foo" ID="id1" class="redlink"
> onClick="javascript:someFunction();">foo</a>
>
> and its infinite variants could not be trapped for with a single regex
> since
> you cannot have an infinite number of fixed width look-behind assertions.
> If quantifying modifiers such as '*', '+', and '?' were allowed in
> look-behind assertions it would be possible, but they aren't (see "man
> perlre").
>
> If your data is coming from unknown sources you'll probably have to use a
> full fledged HTML parser to pull out text that isn't already part of an
> <a>
> tag. I know there are several of these available for perl and I'm sure
> there are for PHP too but I'm unaware of them.
>
> Sorry if this isn't terribly helpful. Maybe I'm overlooking something and
> someone else will point out a simple way to accomplish what you're trying
> to
> do...
attached mail follows:
Hello:
We need to set up a cron to send an automated email at regular
intervals. For this I need to execute a PHP file which retrieves the
required information to be mailed. On my virtual server PHP is loaded as a
module. Could you please let me know how can I execute a PHP file from the
shell prompt.
I have tried with the following commands:
% virtual /usr/local/etc/httpd/htdocs/onlineeml.php
It gives the below error:
/usr/local/etc/httpd/htdocs/onlineeml.php: cannot open ?php: no
such file
I am not able to execute any general php related commands (Eg: php
-v, man p ect)from the Shell prompt. I am getting the error message as
"php: Command not found.". I think this is because PHP is loaded as a
module an not as a CGI version. In this context, could you please provide
some details in executing a PHP script from the Shell prompt when the PHP
is loaded as a module.
Regards
Sheni R Meledath
Assistant Manager - Web Development
*****************************************************************
Cyber Gear LLC
P.O. Box 53735
Dubai, United Arab Emirates
Tel: (971 4) 331-2627, Fax: (971 4) 331-8812
Email: sheni
cyber-gear.com, http://www.cyber-gear.com
VISIT OUR ASSOCIATE SITES:
http://www.Click2Advertising.com
http://www.DubaiCityGuide.com
http://www.MiddleEastDirectory.com
http://www.MiddleEastEvents.com
http://www.MiddleEastPostBox.com
http://www.PressReleaseNetwork.com
*****************************************************************
This message has been checked for all known viruses by McAfee. No liability
is accepted by virtue of checking this message and you are recommended to
have in place your own anti-virus detection procedures.
attached mail follows:
On Thursday 07 October 2004 13:17, Sheni R. Meledath wrote:
> Hello:
>
> We need to set up a cron to send an automated email at regular
> intervals. For this I need to execute a PHP file which retrieves the
> required information to be mailed. On my virtual server PHP is loaded as a
> module. Could you please let me know how can I execute a PHP file from the
> shell prompt.
>
> I have tried with the following commands:
> % virtual /usr/local/etc/httpd/htdocs/onlineeml.php
>
> It gives the below error:
> /usr/local/etc/httpd/htdocs/onlineeml.php: cannot open ?php: no
> such file
just insert:
#!/usr/bin/php -q
in the first line of the script and make it executable (chmod u+x .... ).
>
> I am not able to execute any general php related commands (Eg: php
> -v, man p ect)from the Shell prompt. I am getting the error message as
> "php: Command not found.". I think this is because PHP is loaded as a
> module an not as a CGI version. In this context, could you please provide
> some details in executing a PHP script from the Shell prompt when the PHP
> is loaded as a module.
>
>
>
> Regards
>
> Sheni R Meledath
> Assistant Manager - Web Development
> *****************************************************************
> Cyber Gear LLC
> P.O. Box 53735
> Dubai, United Arab Emirates
> Tel: (971 4) 331-2627, Fax: (971 4) 331-8812
> Email: sheni
cyber-gear.com, http://www.cyber-gear.com
>
> VISIT OUR ASSOCIATE SITES:
> http://www.Click2Advertising.com
> http://www.DubaiCityGuide.com
> http://www.MiddleEastDirectory.com
> http://www.MiddleEastEvents.com
> http://www.MiddleEastPostBox.com
> http://www.PressReleaseNetwork.com
> *****************************************************************
>
> This message has been checked for all known viruses by McAfee. No liability
> is accepted by virtue of checking this message and you are recommended to
> have in place your own anti-virus detection procedures.
--
Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)
---------------------------------------------------------------------
Orbitel - the New Generation Telecom! See www.orbitel.bg.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQBBZSHPLT98C3rkVDYRAiKzAJ44oMzMzqEGZcS9eLhl6IiGqGTitACeJT7G
boK+mCiVyaMUjKL2CPjs6Mg=
=jykN
-----END PGP SIGNATURE-----
attached mail follows:
Petar Nedyalkov wrote:
> On Thursday 07 October 2004 13:17, Sheni R. Meledath wrote:
>
>>Hello:
>>
>> We need to set up a cron to send an automated email at regular
>>intervals. For this I need to execute a PHP file which retrieves the
>>required information to be mailed. On my virtual server PHP is loaded as a
>>module. Could you please let me know how can I execute a PHP file from the
>>shell prompt.
>>
>> I have tried with the following commands:
>> % virtual /usr/local/etc/httpd/htdocs/onlineeml.php
>>
>> It gives the below error:
>> /usr/local/etc/httpd/htdocs/onlineeml.php: cannot open ?php: no
>>such file
>
>
> just insert:
> #!/usr/bin/php -q
>
> in the first line of the script and make it executable (chmod u+x .... ).
>
>
>> I am not able to execute any general php related commands (Eg: php
>>-v, man p ect)from the Shell prompt. I am getting the error message as
>>"php: Command not found.". I think this is because PHP is loaded as a
>>module an not as a CGI version. In this context, could you please provide
>>some details in executing a PHP script from the Shell prompt when the PHP
>>is loaded as a module.
>>
>>
>>
>>Regards
>>
>>Sheni R Meledath
>>Assistant Manager - Web Development
>>*****************************************************************
>>Cyber Gear LLC
>>P.O. Box 53735
>>Dubai, United Arab Emirates
>>Tel: (971 4) 331-2627, Fax: (971 4) 331-8812
>>Email: sheni
cyber-gear.com, http://www.cyber-gear.com
>>
>>VISIT OUR ASSOCIATE SITES:
>>http://www.Click2Advertising.com
>>http://www.DubaiCityGuide.com
>>http://www.MiddleEastDirectory.com
>>http://www.MiddleEastEvents.com
>>http://www.MiddleEastPostBox.com
>>http://www.PressReleaseNetwork.com
>>*****************************************************************
>>
>>This message has been checked for all known viruses by McAfee. No liability
>>is accepted by virtue of checking this message and you are recommended to
>>have in place your own anti-virus detection procedures.
>
>
actually, that path you gave depends on the system (OS), the way it's
installed and a whole bunch of other stuff. I agree it is the default,
and most common, location though.
A different way of executing such scripts is by adding a cronjob like
* * * * * * /usr/bin/php -q /path/to/script
This does exactly the same as what Petar said, except that the script is
passed to the interpreter, and thus the user that the crondaemon runs
the script as only needs read (and doesn't need execute) permission to
the script.
However; To find out the path to the interpreter, since you're saying
you can't just call 'php -v' or any such commands, we'll need to
investigate further.
One way of doing this is a bit "ugly", but it works. Instead of calling
PHP directly, we'll call the server and request the php script (if you
want, you can add tons of security shit in the call). We'll be doing
this using wget (on Linux systems).
Imagine you'd like to run the following script:
<?php
// (let's presume it's located in www.example.net/scripts/bin/mail.php)
if($_GET['user'] == 'a' && $_GET['pass'] == 'b') {
mail('test
example.com', 'sub','body');
} else {
header('Status: 404 Not Found');
exit;
}
?>
You can call this as follows:
----
* * * * * * wget
http://www.example.net/scripts/bin/mail.php?user=a&pass=b ; rm -f ./mail.php
----
The first part will call the server via an http connection to run the
script and show its output. It then downloads it to the directory run
from, and saves it. That is what wget does. The second part, after the
semicolon, the 'rm -f ./mail.php' will make sure to get rid of the file
after it's been run.
I hope this small example, will help you ;)
- Tul
attached mail follows:
On Thursday 07 October 2004 15:32, M. Sokolewicz wrote:
> Petar Nedyalkov wrote:
> > On Thursday 07 October 2004 13:17, Sheni R. Meledath wrote:
> >>Hello:
> >>
> >> We need to set up a cron to send an automated email at regular
> >>intervals. For this I need to execute a PHP file which retrieves the
> >>required information to be mailed. On my virtual server PHP is loaded as
> >> a module. Could you please let me know how can I execute a PHP file from
> >> the shell prompt.
> >>
> >> I have tried with the following commands:
> >> % virtual /usr/local/etc/httpd/htdocs/onlineeml.php
> >>
> >> It gives the below error:
> >> /usr/local/etc/httpd/htdocs/onlineeml.php: cannot open ?php: no
> >>such file
> >
> > just insert:
> > #!/usr/bin/php -q
> >
> > in the first line of the script and make it executable (chmod u+x .... ).
> >
> >> I am not able to execute any general php related commands (Eg:
> >> php -v, man p ect)from the Shell prompt. I am getting the error message
> >> as "php: Command not found.". I think this is because PHP is loaded as a
> >> module an not as a CGI version. In this context, could you please
> >> provide some details in executing a PHP script from the Shell prompt
> >> when the PHP is loaded as a module.
> >>
> >>
> >>
> >>Regards
> >>
> >>Sheni R Meledath
> >>Assistant Manager - Web Development
> >>*****************************************************************
> >>Cyber Gear LLC
> >>P.O. Box 53735
> >>Dubai, United Arab Emirates
> >>Tel: (971 4) 331-2627, Fax: (971 4) 331-8812
> >>Email: sheni
cyber-gear.com, http://www.cyber-gear.com
> >>
> >>VISIT OUR ASSOCIATE SITES:
> >>http://www.Click2Advertising.com
> >>http://www.DubaiCityGuide.com
> >>http://www.MiddleEastDirectory.com
> >>http://www.MiddleEastEvents.com
> >>http://www.MiddleEastPostBox.com
> >>http://www.PressReleaseNetwork.com
> >>*****************************************************************
> >>
> >>This message has been checked for all known viruses by McAfee. No
> >> liability is accepted by virtue of checking this message and you are
> >> recommended to have in place your own anti-virus detection procedures.
>
> actually, that path you gave depends on the system (OS), the way it's
> installed and a whole bunch of other stuff. I agree it is the default,
> and most common, location though.
Yes, of course ;-)
>
> A different way of executing such scripts is by adding a cronjob like
> * * * * * * /usr/bin/php -q /path/to/script
>
> This does exactly the same as what Petar said, except that the script is
> passed to the interpreter, and thus the user that the crondaemon runs
> the script as only needs read (and doesn't need execute) permission to
> the script.
Your way is better for cronjob use, mine is better if the user needs to deploy
the script not only as a cronjob.
>
> However; To find out the path to the interpreter, since you're saying
> you can't just call 'php -v' or any such commands, we'll need to
> investigate further.
>
> One way of doing this is a bit "ugly", but it works. Instead of calling
> PHP directly, we'll call the server and request the php script (if you
> want, you can add tons of security shit in the call). We'll be doing
> this using wget (on Linux systems).
This workaround is fine, but I think using lynx or any similar browser can
save the "rm -f" part.
>
> Imagine you'd like to run the following script:
> <?php
> // (let's presume it's located in www.example.net/scripts/bin/mail.php)
> if($_GET['user'] == 'a' && $_GET['pass'] == 'b') {
> mail('test
example.com', 'sub','body');
> } else {
> header('Status: 404 Not Found');
> exit;
> }
> ?>
>
> You can call this as follows:
> ----
> * * * * * * wget
> http://www.example.net/scripts/bin/mail.php?user=a&pass=b ; rm -f
> ./mail.php ----
>
> The first part will call the server via an http connection to run the
> script and show its output. It then downloads it to the directory run
> from, and saves it. That is what wget does. The second part, after the
> semicolon, the 'rm -f ./mail.php' will make sure to get rid of the file
> after it's been run.
>
> I hope this small example, will help you ;)
>
> - Tul
--
Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)
---------------------------------------------------------------------
Orbitel - the New Generation Telecom! See www.orbitel.bg.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQBBZT8qLT98C3rkVDYRAn3aAJ9SrbnkaELBEY/DHDzB+kUca8SfiQCghBUr
L0se0LfM5mAbj624F1+9ef8=
=Qeit
-----END PGP SIGNATURE-----
attached mail follows:
Petar Nedyalkov wrote:
[snip]
> Your way is better for cronjob use, mine is better if the user needs to deploy
> the script not only as a cronjob.
[/snip]
I agree ;)
[snip]
> This workaround is fine, but I think using lynx or any similar browser can
> save the "rm -f" part.
[/snip]yes... but wouldn't you be stuck with a running shell-instance
after this? never really tried... so I wouldn't know :)
attached mail follows:
On Thursday 07 October 2004 16:27, M. Sokolewicz wrote:
> Petar Nedyalkov wrote:
> [snip]
>
> > Your way is better for cronjob use, mine is better if the user needs to
> > deploy the script not only as a cronjob.
>
> [/snip]
> I agree ;)
>
> [snip]
>
> > This workaround is fine, but I think using lynx or any similar browser
> > can save the "rm -f" part.
>
> [/snip]yes... but wouldn't you be stuck with a running shell-instance
> after this? never really tried... so I wouldn't know :)
Try lynx -source http://bu.orbitel.bg for instance.
Then you can catch the output and analyze it - if the php sends an text exit
status, that's fine.
--
Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)
---------------------------------------------------------------------
Orbitel - the New Generation Telecom! See www.orbitel.bg.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQBBZUhbLT98C3rkVDYRAi9cAJ90NMLHRQNsFb49iTZt3Yyfdr/4egCfchLr
3/ia2YmvIkIFO9r8OG6jZO0=
=8bpb
-----END PGP SIGNATURE-----
attached mail follows:
/* sender: "M. Sokolewicz" date: "Thu, Oct 07, 2004 at 02:32:17PM +0200" */
> ...
> You can call this as follows:
> ----
> * * * * * * wget
> http://www.example.net/scripts/bin/mail.php?user=a&pass=b ; rm -f ./mail.php
> ----
>
> The first part will call the server via an http connection to run the
> script and show its output. It then downloads it to the directory run
> from, and saves it. That is what wget does. The second part, after the
> semicolon, the 'rm -f ./mail.php' will make sure to get rid of the file
> after it's been run.
Very nice solution :)
Just one observation: you can use the -O parameter of wget, and get rid of rm
----
* * * * * * wget http://www.example.net/scripts/bin/mail.php?user=a&pass=b -O /dev/null
----
Alex
attached mail follows:
hello all,
I have some text files in a directory that contain newline delimited IP
addresses. Here is what i would like to do with them, and what i have
achieved so far:
I read the files into a multi-dimensional array like: (pseudo code)
array(IP_blocks) = (
File_number[1] = array('ip1', 'ip2', 'ip3')
File_number[2] = array('ip1', 'ip2', 'ip3')
File_number[3] = array('ip1', 'ip2', 'ip3')
)
the ip files have variable numbers of ips, some have 5 ips, some 40
etc..
What i want to do is to run a loop through the whole thing doing a task
on each IP address. Easy so far right? - Well, where im stuck is that i
want to operate on them like this:
do_stuff(File_number[1][ip1])
do_stuff(File_number[2][ip1])
do_stuff(File_number[3][ip1])
do_stuff(File_number[1][ip2])
do_stuff(File_number[2][ip2])
do_stuff(File_number[3][ip2])
I cant even get that far LoL! but then there is the problem of what
happens when there is no IP left in an array? (its a short file of
ips..)? - I need to start that particular array back at the beggining
but continue the cycle (it doesnt matter that an ip is worked on more
than once..)
Here is the *actual* code I have so far:
##CODE
<?php
/*
* Open the proxies dir and read all of the
* ips contained within each file into a mutidimensional
* array ($machines)
*/
$dir = dir('proxies');
while(FALSE !== ($file = $dir->read())) {
if($file != '.' && $file != '..') {
$machines[$file] = file($dir->path . '/' .$file);
}
}
$dir->close();
foreach($machines as $machineId => $ips) {
// do stuff here
}
###END CODE
Im not really expecting anyone to be able to do my work for me but some
*guidance* regardig how to tackle this problem would be magnificent...
Thankyou..
--
Nick W
attached mail follows:
Nick Wilson wrote:
> hello all,
>
> I have some text files in a directory that contain newline delimited IP
> addresses. Here is what i would like to do with them, and what i have
> achieved so far:
>
> I read the files into a multi-dimensional array like: (pseudo code)
>
> array(IP_blocks) = (
> File_number[1] = array('ip1', 'ip2', 'ip3')
> File_number[2] = array('ip1', 'ip2', 'ip3')
> File_number[3] = array('ip1', 'ip2', 'ip3')
> )
>
> the ip files have variable numbers of ips, some have 5 ips, some 40
> etc..
>
> What i want to do is to run a loop through the whole thing doing a task
> on each IP address. Easy so far right? - Well, where im stuck is that i
> want to operate on them like this:
>
> do_stuff(File_number[1][ip1])
> do_stuff(File_number[2][ip1])
> do_stuff(File_number[3][ip1])
> do_stuff(File_number[1][ip2])
> do_stuff(File_number[2][ip2])
> do_stuff(File_number[3][ip2])
>
> I cant even get that far LoL! but then there is the problem of what
> happens when there is no IP left in an array? (its a short file of
> ips..)? - I need to start that particular array back at the beggining
> but continue the cycle (it doesnt matter that an ip is worked on more
> than once..)
>
> Here is the *actual* code I have so far:
>
> ##CODE
> <?php
> /*
> * Open the proxies dir and read all of the
> * ips contained within each file into a mutidimensional
> * array ($machines)
> */
> $dir = dir('proxies');
> while(FALSE !== ($file = $dir->read())) {
> if($file != '.' && $file != '..') {
> $machines[$file] = file($dir->path . '/' .$file);
> }
> }
> $dir->close();
>
> foreach($machines as $machineId => $ips) {
> // do stuff here
> }
> ###END CODE
>
> Im not really expecting anyone to be able to do my work for me but some
> *guidance* regardig how to tackle this problem would be magnificent...
>
> Thankyou..
>
if it doesn't matter in what order they are all processed, then you
could so it like this:
<?php
foreach($machines as $machineId => $ips) {
foreach($ips as $ip) {
do_stuff($ip);
}
}
?>
However, if it does matter, then I suggest a different way. This would
order them by their 2nd index, not the first (meaning by
$machines[1][1], $machines[2][1], etc);
<?php
$max = 0;
foreach($machines as $machineId => $ips) {
$max = ($max >= count($ips) ? $max : count($ips));
}
for($i=0;$i<$max;$i++) {
foreach($machines as $machineId => $ips) {
if(isset($ips[$i])) {
do_stuff($ips[$i]);
} else {
continue;
}
}
}
?>
but that's just my point of view ;)
attached mail follows:
> -----Original Message-----
> From: Nick Wilson [mailto:nick
stylesheet.org]
> Sent: Thursday, October 07, 2004 6:40 AM
> To: php-general
> Subject: [PHP] Muti-Dimensional Array Help Please
>
> hello all,
>
> I have some text files in a directory that contain newline delimited IP
> addresses. Here is what i would like to do with them, and what i have
> achieved so far:
>
> I read the files into a multi-dimensional array like: (pseudo code)
>
> array(IP_blocks) = (
> File_number[1] = array('ip1', 'ip2', 'ip3')
> File_number[2] = array('ip1', 'ip2', 'ip3')
> File_number[3] = array('ip1', 'ip2', 'ip3')
> )
>
> the ip files have variable numbers of ips, some have 5 ips, some 40
> etc..
>
> What i want to do is to run a loop through the whole thing doing a task
> on each IP address. Easy so far right? - Well, where im stuck is that i
> want to operate on them like this:
>
> do_stuff(File_number[1][ip1])
> do_stuff(File_number[2][ip1])
> do_stuff(File_number[3][ip1])
> do_stuff(File_number[1][ip2])
> do_stuff(File_number[2][ip2])
> do_stuff(File_number[3][ip2])
>
> I cant even get that far LoL! but then there is the problem of what
> happens when there is no IP left in an array? (its a short file of
> ips..)? - I need to start that particular array back at the beggining
> but continue the cycle (it doesnt matter that an ip is worked on more
> than once..)
>
> Here is the *actual* code I have so far:
>
> ##CODE
> <?php
> /*
> * Open the proxies dir and read all of the
> * ips contained within each file into a mutidimensional
> * array ($machines)
> */
> $dir = dir('proxies');
> while(FALSE !== ($file = $dir->read())) {
> if($file != '.' && $file != '..') {
> $machines[$file] = file($dir->path . '/' .$file);
> }
> }
> $dir->close();
>
> foreach($machines as $machineId => $ips) {
> // do stuff here
> }
> ###END CODE
>
> Im not really expecting anyone to be able to do my work for me but some
> *guidance* regardig how to tackle this problem would be magnificent...
It looks like you're hading in the right direction. You've grabbed an array
of each file. Then cycle through that array and read data from each file.
The fread function will allow you to pull data from each file line by line,
so you can store each line in an array. Using your idea of pseudo-code:
$data = array();
$i = 1;
foreach ( file ) {
$n = 1;
fp = fopen
while ($line = fread() ){
$data[$i][$n] = $line;
}
}
foreach ($data as $key => $line ) {
foreach ($line as $line_number => $ip) {
// do stuff
}
}
attached mail follows:
* and then M. Sokolewicz declared....
> However, if it does matter, then I suggest a different way. This would
Yes, it does matter, a *lot* ;-)
I have to hit each machine in order, choosing an IP from that machine
and using it do 'do_stuff()'
> order them by their 2nd index, not the first (meaning by
> $machines[1][1], $machines[2][1], etc);
> <?php
> $max = 0;
> foreach($machines as $machineId => $ips) {
> $max = ($max >= count($ips) ? $max : count($ips));
> }
>
> for($i=0;$i<$max;$i++) {
> foreach($machines as $machineId => $ips) {
> if(isset($ips[$i])) {
> do_stuff($ips[$i]);
> } else {
> continue;
> }
> }
> }
> ?>
Would that work with what i said above? im afraid i've never got the
hang of the ? operator and dont really understand your code, sorry...
thanks very much..
--
Nick W
attached mail follows:
Nick Wilson wrote:
> * and then M. Sokolewicz declared....
>
>>However, if it does matter, then I suggest a different way. This would
>
>
> Yes, it does matter, a *lot* ;-)
> I have to hit each machine in order, choosing an IP from that machine
> and using it do 'do_stuff()'
>
>
>>order them by their 2nd index, not the first (meaning by
>>$machines[1][1], $machines[2][1], etc);
>><?php
>>$max = 0;
>>foreach($machines as $machineId => $ips) {
>> $max = ($max >= count($ips) ? $max : count($ips));
>>}
>>
>>for($i=0;$i<$max;$i++) {
>> foreach($machines as $machineId => $ips) {
>> if(isset($ips[$i])) {
>> do_stuff($ips[$i]);
>> } else {
>> continue;
>> }
>> }
>>}
>>?>
>
>
> Would that work with what i said above? im afraid i've never got the
> hang of the ? operator and dont really understand your code, sorry...
>
> thanks very much..
>
$max = ($max >= count($ips) ? $max : count($ips));
just means the following:
if($max >= count($ips) {
$max = $max;
} else {
$max = count($ips);
}
:)
attached mail follows:
* and then Ed Lazor declared....
> It looks like you're hading in the right direction. You've grabbed an array
> of each file. Then cycle through that array and read data from each file.
> The fread function will allow you to pull data from each file line by line,
> so you can store each line in an array. Using your idea of pseudo-code:
>
> $data = array();
> $i = 1;
> foreach ( file ) {
> $n = 1;
> fp = fopen
> while ($line = fread() ){
> $data[$i][$n] = $line;
> }
> }
>
> foreach ($data as $key => $line ) {
> foreach ($line as $line_number => $ip) {
> // do stuff
> }
> }
hehe, not sure i get it but im playing with it ;-) i need to see code in
action for my head to understand it. I did have one rather good though
though (i think): If i can create an array with all of the ips in order
like this
123.123.123.1 // 1st IP from machine 1
123.123.123.2 // 1st IP from machine 2
123.123.123.3 // 1st IP from machine 3
123.123.123.4 // 2nd IP from machine 1
123.123.123.5 // 2nd IP from machine 2
123.123.123.4 // 2nd IP from machine 3
etc...
then i would have *exactly* what the application needs. Does that make
the problem any easier?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--
Nick W
attached mail follows:
>$max = ($max >= count($ips) ? $max : count($ips));
if ($max >= count($ips)) {
$max = $max;
} else {
$max = count($ips);
}
attached mail follows:
Hi all.
I have a form that calls the same page whenever it is submitted. It
does some error-checking to make sure that all the appropriate fields
were filled in by the user. So, if there's an error, it stays on the
same page and lets the user know what they need to fill in.
However, I get `Page cannot be displayed` error if the page calls
itself and has to reload some data.... but only in IE for Windows. If I
hit the `Refresh` button, the page shows up and all the appropriate
fields are filled in or not filled in with the specified error message.
It does not give the `Page cannot be displayed` error in other
browsers: Mozilla and Firefox for Windoze, Safari and IE for Mac.
Despite the fact that IE for Windoze is immensely inferior, is there a
reason/get-around for this happening?
I can actually fix it to where it doesn't do it, but it's a hack. I
have the form actually call a different page - but then that page just
has an automatic redirect back to the original page. And all the
information shows up correctly without the `Page cannot be displayed.`
Thanks for staying in tuned this far. Anyone have any thoughts on why
this is happening?
Thanks in advance.
~Philip
attached mail follows:
Philip Thompson wrote:
> Hi all.
>
> I have a form that calls the same page whenever it is submitted. It does
> some error-checking to make sure that all the appropriate fields were
> filled in by the user. So, if there's an error, it stays on the same
> page and lets the user know what they need to fill in.
>
> However, I get `Page cannot be displayed` error if the page calls itself
> and has to reload some data.... but only in IE for Windows. If I hit the
> `Refresh` button, the page shows up and all the appropriate fields are
> filled in or not filled in with the specified error message.
>
> It does not give the `Page cannot be displayed` error in other browsers:
> Mozilla and Firefox for Windoze, Safari and IE for Mac. Despite the fact
> that IE for Windoze is immensely inferior, is there a reason/get-around
> for this happening?
>
> I can actually fix it to where it doesn't do it, but it's a hack. I have
> the form actually call a different page - but then that page just has an
> automatic redirect back to the original page. And all the information
> shows up correctly without the `Page cannot be displayed.`
>
> Thanks for staying in tuned this far. Anyone have any thoughts on why
> this is happening?
https? sessions?
attached mail follows:
Hi all,
I'm using mail("nsagarchand
yahoo.com",$subject,$message,$mail_from);
But i get an email with a from address as anonymous
<myserver.com>
I want to show the from address to be like "From : Sagar"
plzz help me out
/sagar
attached mail follows:
On Thu, 7 Oct 2004 20:29:25 +0530, sagar <sagar
rythumithra.com> wrote:
> I'm using mail("nsagarchand
yahoo.com",$subject,$message,$mail_from);
>
> But i get an email with a from address as anonymous
<myserver.com>
>
> I want to show the from address to be like "From : Sagar"
> plzz help me out
What is $mail_from defined as?
It should be a "From: " header with the required \r\n at the end.
--
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/
attached mail follows:
$mail_from = "From: Sagar";
> -----Original Message-----
> Hi all,
>
> I'm using mail("nsagarchand
yahoo.com",$subject,$message,$mail_from);
>
> But i get an email with a from address as anonymous
<myserver.com>
>
> I want to show the from address to be like "From : Sagar"
> plzz help me out
>
> /sagar
attached mail follows:
Hello all,
Sorry, that is wrong mailing list, but... :-)
Can anybody hint me what is this anti-spam filter (see forwarded email
below)? We all are tooooo tired of spam, so that could be a very good
solution.
Is it vilter-spamd (see headers) or I am wrong?
Thank you.
Best regards, Denis Gerasimov
Outsourcing Services Manager,
VEKOS, Ltd.
www.vekos.ru
> -----Original Message-----
> From: PHP Automoderator [mailto:confirm
php.net]
> Sent: Thursday, October 07, 2004 12:24 PM
> To: denis.gerasimov
vekos.ru
> Subject: PHP posting confirmation for denis.gerasimov
vekos.ru
>
> This is an automatic reply to an email you sent to a PHP project
> mailing address protected by our 'self-moderation' system. To reduce
> the amount of spam received at these addresses, we require you to
> confirm that you're a real person before your email will be allowed
> through.
>
> All you have to do in order to have your original message sent is
> send an email to confirm
php.net with the following text (square
> brackets and all):
>
> [confirm: d4a6e9c33aa9023bea60b2f773879f74 denis.gerasimov
vekos.ru]
>
> which you should be able to do simply by replying to this email.
> (Don't worry, any leading text added for quoting will simply be
> ignored.)
>
> After we have received your confirmation, "denis.gerasimov
vekos.ru"
> will be added to the list of pre-approved mail addresses for all of
> the PHP project mail addresses, your original message will be
> delivered, and future emails from that address will be delivered
> without delay automatically.
>
> You will not receive any confirmation of your confirmation -- your
> original message (and any other messages you have sent since then)
> will simply be sent to its original destination (possibly after a
> short delay).
>
> Sorry for the hassle, but the volume of unsolicited commercial email
> sent to these addresses has made this step necessary.
>
> --- Your original email is below.
>
> Return-Path: <denis.gerasimov
vekos.ru>
> Received: from ([195.161.208.130:2394])
> by osu1.php.net (ecelerity 1.2.1) with SMTP
> id 3A/06-29438-76DF4614; Thu, 07 Oct 2004 01:25:12 -0700
> Received: from setteh-mtc.relinfo.ru (setteh-mtc.relinfo.ru
> [195.161.211.134])
> by aqua.relinfo.ru (8.12.11/8.12.11) with ESMTP id i978MmEH090641;
> Thu, 7 Oct 2004 12:22:48 +0400 (MSD)
> (envelope-from denis.gerasimov
vekos.ru)
> Received: from win2kprows03 ([195.161.219.41])
> by setteh-mtc.relinfo.ru (8.12.8/8.12.8) with ESMTP id
> i978MWCE010717;
> Thu, 7 Oct 2004 12:22:34 +0400
> Message-Id: <200410070822.i978MWCE010717
setteh-mtc.relinfo.ru>
> From: "Denis Gerasimov" <denis.gerasimov
vekos.ru>
> To: "PEAR General ML" <pear-general
lists.php.net>, <mj
php.net>,
> <yavo
siava.org>, <jflemer
alum.rpi.edu>
> Subject: Auth package bugs
> Date: Thu, 7 Oct 2004 12:22:18 +0400
> Organization: VEKOS, Ltd.
> MIME-Version: 1.0
> Content-Type: text/plain;
> charset="us-ascii"
> Content-Transfer-Encoding: 7bit
> X-Mailer: Microsoft Office Outlook, Build 11.0.5510
> Thread-Index: AcSl/hWvZyzWzef1QLerJqydvBKvoQGRLu2g
> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
> X-Spam-Checker: smtp-vilter
> X-SMTP-Vilter-Version: 1.1.4
> X-SMTP-Vilter-Backend: vilter-spamd
> X-Spam-Score: -0.7
> X-Spam-Threshold: 5.0
> X-Spam-Probability: -0.1
> Received-SPF: unknown (osu1.php.net: domain
> vekos.ru does not designate 195.161.208.130 as permitted sender)
> Delivered-To: mj
php.net
>
>
> Hello all,
>
> I didn't see any reaction on my previous message so let me try again.