php-general Digest 2 Nov 2005 04:41:48 -0000 Issue 3770
Topics (messages 224908 through 224928):
Re: Managing files on the client
224908 by: Jay Blanchard
224914 by: James Benson
224923 by: Unknown Unknown
hotmail don't accept this message function any more!!
224909 by: Rasim ÞEN
224910 by: xfedex
224911 by: Gustavo Narea
proc_open, fwrite, 16384 bytes magic
224912 by: Max Belushkin
224918 by: Jochem Maas
Fsockopen error
224913 by: Robert Prentice
returning elements from array 1 not in array 2
224915 by: blackwater dev
224916 by: Joseph Tura
question regarding Reflection
224917 by: Manish Marathe
224919 by: Manish Marathe
224928 by: Jochem Maas
str_ireplace problems.
224920 by: Daniel Spain
224921 by: Gustavo Narea
224922 by: Gustavo Narea
Re: str_ireplace problems. [Solved]
224924 by: Daniel Spain
PHP and MSSQL on Linux
224925 by: Robbert van Andel
Help with new config
224926 by: John Taylor-Johnston
224927 by: Rob Agar
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:
[email protected]
----------------------------------------------------------------------
--- Begin Message ---
[snip]
Using opendir() references directories on the server. Is there a similar
function for referencing directoies on the client (browser) side?
[/snip]
JavaScript is client side.
--- End Message ---
--- Begin Message ---
No, its not possible without asking the client to install some software!
dcook wrote:
Hello all:
Using opendir() references directories on the server. Is there a similar
function for referencing directoies on the client (browser) side?
-dc
--- End Message ---
--- Begin Message ---
you could also use javascript and forms, and maybe open up an iframe with
query strings probably
--- End Message ---
--- Begin Message ---
Hi,
This function was working until this morning, but now I couldn't send any
email to hotmail. What is the problem, any idea?
============================================================================
==================
function
SendMail($From,$FromName,$To,$ToName,$Subject,$Text,$Html,$AttmFiles,$bcc,$m
emberid,$MemberSurname,$mtype="tbl"){
$MemberId=$memberid;
$MemberName=$ToName;
$MemberSurname=$MemberSurname;
$MemberEmail=$To;
$Subject=$Subject;
$MailBody=$Html;
$OB="----=_OuterBoundary_000";
$IB="----=_InnerBoundery_001";
$Html=$Html?$Html:preg_replace("/\n/","{br}",$Text)
or die("neither text nor html part present.");
$Text=$Text?$Text:"Sorry, but you need an html mailer to read this mail.";
$From or die("sender address missing");
$To or die("recipient address missing");
$headers ="MIME-Version: 1.0\r\n";
$headers.="From: ".$FromName." <".$From.">\n";
$headers.="To: ".$ToName." <".$To.">\n";
$headers.="Reply-To: ".$FromName." <".$From.">\n";
// $headers.="Reply-To: \n";
$headers.="X-Priority: 1\n";
$headers.="X-MSMail-Priority: High\n";
$headers.="X-Mailer: My PHP Mailer\n";
$headers.="Content-Type: multipart/mixed;\n\tboundary=\"".$OB."\"\n";
$headers .= "BCC:".$bcc."\n";
//Messages start with text/html alternatives in OB
$Msg ="This is a multi-part message in MIME format.\n";
$Msg.="\n--".$OB."\n";
$Msg.="Content-Type: multipart/alternative;\n\tboundary=\"".$IB."\"\n\n";
//plaintext section
$Msg.="\n--".$IB."\n";
$Msg.="Content-Type: text/plain;\n\tcharset=\"iso-8859-9\"\n";
$Msg.="Content-Transfer-Encoding: quoted-printable\n\n";
// plaintext goes here
$Msg.=$Text."\n\n";
// html section
$Msg.="\n--".$IB."\n";
$Msg.="Content-Type: text/html;\n\tcharset=\"iso-8859-9\"\n";
$Msg.="Content-Transfer-Encoding: base64\n\n";
// html goes here
$Msg.=chunk_split(base64_encode($Html))."\n\n";
// end of IB
$Msg.="\n--".$IB."--\n";
// attachments
if($AttmFiles){
foreach($AttmFiles as $AttmFile){
$patharray = explode ("/", $AttmFile);
$FileName=$patharray[count($patharray)-1];
$Msg.= "\n--".$OB."\n";
$Msg.="Content-Type:
application/octetstream;\n\tname=\"".$FileName."\"\n";
$Msg.="Content-Transfer-Encoding: base64\n";
$Msg.="Content-Disposition:
attachment;\n\tfilename=\"".$FileName."\"\n\n";
//file goes here
$fd=fopen ($AttmFile, "r");
$FileContent=fread($fd,filesize($AttmFile));
fclose ($fd);
$FileContent=chunk_split(base64_encode($FileContent));
$Msg.=$FileContent;
$Msg.="\n\n";
}
}
//message ends
$Msg.="\n--".$OB."--\n";
if(mail($To,$Subject,$Msg,$headers)){ //1.test
==============================================================
thanks in advance
rasim
--- End Message ---
--- Begin Message ---
Hi,
On 11/1/05, Rasim ÞEN <[EMAIL PROTECTED]> wrote:
> Hi,
>
> This function was working until this morning, but now I couldn't send any
> email to hotmail. What is the problem, any idea?
>
>
>
> ============================================================================
> ==================
>
>
> function
> SendMail($From,$FromName,$To,$ToName,$Subject,$Text,$Html,$AttmFiles,$bcc,$m
> emberid,$MemberSurname,$mtype="tbl"){
>
> $MemberId=$memberid;
> $MemberName=$ToName;
> $MemberSurname=$MemberSurname;
> $MemberEmail=$To;
> $Subject=$Subject;
> $MailBody=$Html;
>
> $OB="----=_OuterBoundary_000";
> $IB="----=_InnerBoundery_001";
> $Html=$Html?$Html:preg_replace("/\n/","{br}",$Text)
> or die("neither text nor html part present.");
> $Text=$Text?$Text:"Sorry, but you need an html mailer to read this mail.";
> $From or die("sender address missing");
> $To or die("recipient address missing");
>
> $headers ="MIME-Version: 1.0\r\n";
> $headers.="From: ".$FromName." <".$From.">\n";
> $headers.="To: ".$ToName." <".$To.">\n";
> $headers.="Reply-To: ".$FromName." <".$From.">\n";
> // $headers.="Reply-To: \n";
> $headers.="X-Priority: 1\n";
> $headers.="X-MSMail-Priority: High\n";
> $headers.="X-Mailer: My PHP Mailer\n";
> $headers.="Content-Type: multipart/mixed;\n\tboundary=\"".$OB."\"\n";
> $headers .= "BCC:".$bcc."\n";
> //Messages start with text/html alternatives in OB
> $Msg ="This is a multi-part message in MIME format.\n";
> $Msg.="\n--".$OB."\n";
> $Msg.="Content-Type: multipart/alternative;\n\tboundary=\"".$IB."\"\n\n";
>
> //plaintext section
> $Msg.="\n--".$IB."\n";
> $Msg.="Content-Type: text/plain;\n\tcharset=\"iso-8859-9\"\n";
> $Msg.="Content-Transfer-Encoding: quoted-printable\n\n";
> // plaintext goes here
> $Msg.=$Text."\n\n";
>
> // html section
> $Msg.="\n--".$IB."\n";
> $Msg.="Content-Type: text/html;\n\tcharset=\"iso-8859-9\"\n";
> $Msg.="Content-Transfer-Encoding: base64\n\n";
> // html goes here
> $Msg.=chunk_split(base64_encode($Html))."\n\n";
>
> // end of IB
> $Msg.="\n--".$IB."--\n";
>
> // attachments
> if($AttmFiles){
> foreach($AttmFiles as $AttmFile){
> $patharray = explode ("/", $AttmFile);
> $FileName=$patharray[count($patharray)-1];
> $Msg.= "\n--".$OB."\n";
> $Msg.="Content-Type:
> application/octetstream;\n\tname=\"".$FileName."\"\n";
> $Msg.="Content-Transfer-Encoding: base64\n";
> $Msg.="Content-Disposition:
> attachment;\n\tfilename=\"".$FileName."\"\n\n";
>
> //file goes here
> $fd=fopen ($AttmFile, "r");
> $FileContent=fread($fd,filesize($AttmFile));
> fclose ($fd);
> $FileContent=chunk_split(base64_encode($FileContent));
> $Msg.=$FileContent;
> $Msg.="\n\n";
> }
> }
>
> //message ends
> $Msg.="\n--".$OB."--\n";
>
> if(mail($To,$Subject,$Msg,$headers)){ //1.test
>
> ==============================================================
>
>
> thanks in advance
> rasim
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
The function works fine if you send it to a different domain? I think
it's not a hotmail problem, instead, may be a configuration problem in
your webserver.
Saludos!
Fede.
--- End Message ---
--- Begin Message ---
Hello.
xfedex wrote:
The function works fine if you send it to a different domain? I think
it's not a hotmail problem, instead, may be a configuration problem in
your webserver.
Saludos!
Fede.
I agree with Fede.
On the other hand, Have you changed any setting in your Hotmail account?
Have you searched for that message into the junk mail folder?
--
Best regards,
Gustavo Narea.
PHP Documentation - Spanish Translation Team.
Valencia, Venezuela.
--- End Message ---
--- Begin Message ---
Hi everyone,
I've ran into a rather strange problem with Apache 2.0.x, PHP 4.4.0,
FreeBSD. When I proc_open qmail-inject, the first 16384 bytes from a
buffer are accepted perfectly, which makes it an exact 16 KB. If a
buffer is larger, the rest is discarded. No errors appear anywhere - and
I think I've looked just about everywhere I could think of by now. This
problem does not manifest itself on a different installation of Apache
2.0.x, PHP 4.3.8, SUSE Linux, but tested against postfix, up to sizes of
95 KB.
I've searched Google all over, but could not find any hints. My best
guess so far is that I'm missing something in configuration directives,
or it's a qmail problem - although, with qmail-inject fed via cat,
everything works just fine, regardless of size.
I would be grateful for any hints. Thanks!
--- End Message ---
--- Begin Message ---
Max Belushkin wrote:
Hi everyone,
I've ran into a rather strange problem with Apache 2.0.x, PHP 4.4.0,
FreeBSD. When I proc_open qmail-inject, the first 16384 bytes from a
buffer are accepted perfectly, which makes it an exact 16 KB. If a
buffer is larger, the rest is discarded. No errors appear anywhere - and
I think I've looked just about everywhere I could think of by now. This
problem does not manifest itself on a different installation of Apache
2.0.x, PHP 4.3.8, SUSE Linux, but tested against postfix, up to sizes of
95 KB.
I've searched Google all over, but could not find any hints. My best
guess so far is that I'm missing something in configuration directives,
or it's a qmail problem - although, with qmail-inject fed via cat,
everything works just fine, regardless of size.
can you proc_open() anything else and get it to accept more than 16KB ?
also 4.4.1 is out.
I would be grateful for any hints. Thanks!
--- End Message ---
--- Begin Message ---
I am attempting to connect to a remote server using fsockopen to post
data to a php file. Here is the error i get:
Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed:
Name or service not known (is your IPV6 configuration correct? If
this error happens all the time, try reconfiguring PHP using --
disable-ipv6 option to configure) in /home/customerservice/docs/
admin_ahmed/test.php on line 37
Here is the code i am using:
$reply = http_post("https://www.safetrustprocessing.com", 80, "/
xml_order_processing.php", array("myXml" => $xml));
function http_post ($server, $port, $url, $vars) {
$user_agent = "Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)";
$urlencoded = "";
while (list($key,$value) = each($vars))
$urlencoded.= urlencode($key) . "=" . urlencode($value) . "&";
$urlencoded = substr($urlencoded,0,-1);
$content_length = strlen($urlencoded);
$headers = "POST $url HTTP/1.1
Accept: */*
Accept-Language: en-au
Content-Type: application/x-www-form-urlencoded
User-Agent: $user_agent
Host: $server
Connection: Keep-Alive
Cache-Control: no-cache
Content-Length: $content_length
";
$fp = fsockopen($server, $port, $errno, $errstr);
if (!$fp) {
return false;
}
fputs($fp, $headers);
fputs($fp, $urlencoded);
$ret = "";
while (!feof($fp))
$ret.= fgets($fp, 1024);
fclose($fp);
return $ret;
}
Any ideas on the problem?
Robert
--- End Message ---
--- Begin Message ---
I have two different arrays. What is the function to remove all of
the elements from array 1 that are not in array 2 and return them.
Array_diff seems to give me that plus ones with different values, I
simply want all of the ones from one array that are not in another
array and want them removed from the one array.
Thanks.
--- End Message ---
--- Begin Message ---
What is the function to remove all of
the elements from array 1 that are not in array 2 and return them.
Try: array_diff($arr1, array_intersect($arr1, $arr2));
--- End Message ---
--- Begin Message ---
Hello All,
I am developing a unit test generator for PHP. The generated tests would be
PHPUnit2 compatible and I will be using the Reflection API to generate the
tests. The tests would be generated only for classes and written on PHP
5.0.3 compatible.
My question is to use the Reflection API, I need to import the original
class for which I am generating tests. For example to generate a tests for
class Company which is in Company.php:
include_once('company.php');
$c = new ReflectionClass('Company');
If I have to generate test for many classes at once, it would be foolish to
have them included in my file on the runtime. Am I understanding it
correctly ?
Thank you for your help
Manish Marathe
SpikeSource, Inc.
http://developer.spikesource.com
--- End Message ---
--- Begin Message ---
I am developing a unit test generator for PHP. The generated tests would be
PHPUnit2 compatible and I will be using the Reflection API to generate the
tests. The tests would be generated only for classes and written on PHP
5.0.3 compatible.
My question is to use the Reflection API, I need to import the original
class for which I am generating tests. For example to generate a tests for
class Company which is in Company.php:
include_once('company.php');
$c = new ReflectionClass('Company');
If I have to generate test for many classes at once, it would be foolish to
have them included in my file on the runtime. Am I understanding it
correctly ?
Thank you for your help
Manish Marathe
SpikeSource, Inc.
http://developer.spikesource.com
--- End Message ---
--- Begin Message ---
Manish Marathe wrote:
Hello All,
I am developing a unit test generator for PHP. The generated tests would be
PHPUnit2 compatible and I will be using the Reflection API to generate the
tests. The tests would be generated only for classes and written on PHP
5.0.3 compatible.
My question is to use the Reflection API, I need to import the original
class for which I am generating tests. For example to generate a tests for
class Company which is in Company.php:
include_once('company.php');
$c = new ReflectionClass('Company');
If I have to generate test for many classes at once, it would be foolish to
have them included in my file on the runtime. Am I understanding it
a complex app can have 100's of classes, not usually all loaded at once but
still.
the upper limit is depends on how much memory your generation process is allowed
to grow to, how often you [need to] run it, how process-intensive it is to run
the generation and how big your iron is.
you might consider using forking in a master process and letting a series of
child processes each handle a chunk of all the classes to generate tests for,
basically running in parallel.
I don't see how you can avoid loading many classes 'at once', why do you
think this is foolish [by definition]?
hth.
correctly ?
Thank you for your help
Manish Marathe
SpikeSource, Inc.
http://developer.spikesource.com
--- End Message ---
--- Begin Message ---
Greetings!
I'm writing a quick and dirty tool which converts directory paths into
internet friendly paths..
So converting this: C:\PHP
to this: file:\\server01\share\PHP
Everything else works, except this line of code.. Is there some
problem I'm overlooking? My PHP skills are limited to database
manipulation, so string functions other than nl2br are beyond me...
The code I'm using is:
//Remove the drive letter and replace it with a single slash
$step1 = str_ireplace("T:\\", "\\", $_POST['path']);
In context:
//Remove the drive letter and replace it with a single slash
$step1 = str_ireplace("T:\\", "\\", $_POST['path']);
$step2 = "file:\\\\server01\\staffpub".$step1;
$html = "<a href=\"".$step2staff."\">Staff</a><br />";
$result = htmlspecialchars($html);
--
Fare thee well,
Daniel "TheHeadSage" Spain
*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~
E-mail: [EMAIL PROTECTED]
Mob: +61 0407 057 580
--- End Message ---
--- Begin Message ---
Hi, Daniel.
Daniel Spain wrote:
//Remove the drive letter and replace it with a single slash
$step1 = str_ireplace("T:\\", "\\", $_POST['path']);
$step2 = "file:\\\\server01\\staffpub".$step1;
$html = "<a href=\"".$step2staff."\">Staff</a><br />";
$result = htmlspecialchars($html);
Where is the definition of $step2staff?
On the other hand, What's the problem? What is what you get? Do you get
any error message?
--
Best regards,
Gustavo Narea.
PHP Documentation - Spanish Translation Team.
Valencia, Venezuela.
--- End Message ---
--- Begin Message ---
Daniel Spain wrote:
//Remove the drive letter and replace it with a single slash
$step1 = str_ireplace("T:\\", "\\", $_POST['path']);
I would use:
$step1 = ereg_replace(trim("^[:alpha:]"),"",$_POST['path']);
This will remove the first letter of the string. You should use this,
unless this letter is "T" forever. As far as I can see, this is for
Windows, and the letter may change depending on the machine.
On the other hand, you should verify that the user is sending you a
right path.
The instruction I suggested you is based on Regular Expressions. If you
want to get more information about them, I suggest you:
http://www.regular-expressions.info
PS: If get_magic_quotes_gpc() returns true, you should use
stripslashes() too:
$step1 = ereg_replace(trim("^[:alpha:]"),"", stripslashes($_POST['path']));
--
Best regards,
Gustavo Narea.
PHP Documentation - Spanish Translation Team.
Valencia, Venezuela.
--- End Message ---
--- Begin Message ---
I've solved the problem. Turns out it wasn't my fault, but the other
network admins...
He said he installed PHP 5.. Turns out that in his mind 5 = 4. So I
changed from str_ireplace to str_replace and it all works.
Thanks for the website though!
On 02/11/05, Gustavo Narea <[EMAIL PROTECTED]> wrote:
> Daniel Spain wrote:
> > //Remove the drive letter and replace it with a single slash
> > $step1 = str_ireplace("T:\\", "\\", $_POST['path']);
>
> I would use:
> $step1 = ereg_replace(trim("^[:alpha:]"),"",$_POST['path']);
>
> This will remove the first letter of the string. You should use this,
> unless this letter is "T" forever. As far as I can see, this is for
> Windows, and the letter may change depending on the machine.
>
> On the other hand, you should verify that the user is sending you a
> right path.
>
> The instruction I suggested you is based on Regular Expressions. If you
> want to get more information about them, I suggest you:
> http://www.regular-expressions.info
>
> PS: If get_magic_quotes_gpc() returns true, you should use
> stripslashes() too:
> $step1 = ereg_replace(trim("^[:alpha:]"),"", stripslashes($_POST['path']));
>
> --
> Best regards,
>
> Gustavo Narea.
> PHP Documentation - Spanish Translation Team.
> Valencia, Venezuela.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Fare thee well,
Daniel "TheHeadSage" Spain
*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~
E-mail: [EMAIL PROTECTED]
Mob: +61 0407 057 580
--- End Message ---
--- Begin Message ---
A few months back I wrote the list asking for help making a connection to a
MS SQL database from our linux webserver. At that time I was able to make a
successfull connection on Fedora Core 1 after installing php-mssql.rpm and a
freetds rpm. When I upgradd to FC4, I was unable to continue my project
because the RPMs had not been built for PHP5.0.4, whic is the version we run
now.
Today, I was able to get the version of php-mssql I needed and installed it
successfully. I am able to make a connection to our ms sql server using
tsql. There is a mssql.ini file in the php.d directory and the mssql.so
file is in /usr/lib/php/modules/. Using the get_loaded_extensions fuction,
I see that mssql is a loaded module and the phpinfo() function shows me
mssql configuration files. All indicators tell me that I should be able to
connect.
Obvsiously, since I'm posting to the list, you can guess that it's not
working. The error message I get back is useless as I'm only told that the
connection failed. Does anyone know anything else I need to check to get
the connection working?
Upon troubleshooting, I found that there is no traffic going to database
server when I used TCPDUMP. There is traffic going when I use tsql.
Thank you,
Robbert van Andel
--- End Message ---
--- Begin Message ---
New server, new config. PHP 4.3.9 and new mysql db.
phpmyadmin works among other scripts, including:
http://compcanlit.usherbrooke.ca/whovisits.php
But this bugger won't:
http://testesp.flsh.usherbrooke.ca/testdb.phps
http://testesp.flsh.usherbrooke.ca/phpinfo.php
I cannot even see the "aa\naa<?php ..."
All I get is <html><body></body></html>
It's mysql related, that is for sure.
Any inspiration?
John
--- End Message ---
--- Begin Message ---
hi John
You'll probably see whats up if you tell php to spit out error messages
- set display_errors = 1 in php.ini
hth
Rob
> -----Original Message-----
> From: John Taylor-Johnston
> [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, 1 November 2005 12:32 PM
> To: PHP-General
> Subject: [PHP] Help with new config
>
>
> New server, new config. PHP 4.3.9 and new mysql db.
>
> phpmyadmin works among other scripts, including:
> http://compcanlit.usherbrooke.ca/whovisits.php
>
> But this bugger won't:
>
http://testesp.flsh.usherbrooke.ca/testdb.phps
http://testesp.flsh.usherbrooke.ca/phpinfo.php
I cannot even see the "aa\naa<?php ..."
All I get is <html><body></body></html>
It's mysql related, that is for sure.
Any inspiration?
John
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---