php-general Digest 4 Dec 2009 10:48:06 -0000 Issue 6471

Topics (messages 300236 through 300245):

Re: Compatiabilty issues
        300236 by: Julian Muscat Doublesin

Re: remove namespace from xml
        300237 by: Frank Arensmeier

XAMPP for windows (7)
        300238 by: Grega Leskovšek

Re: imagettftext() and East Asian Font rendering
        300239 by: Ashley Sheridan

amount of overlaping dates
        300240 by: Merlin Morgenstern
        300241 by: David Otton
        300242 by: Merlin Morgenstern
        300243 by: David Otton

Re: Finding out the first possible booking date with php
        300244 by: Gerardo Benitez

How to read a certificate and compute hash of it
        300245 by: Tanveer Chowdhury

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 ---
Will Have Linux installed on a 64 bit machine effect Apaches functionality?

On Wed, Dec 2, 2009 at 6:20 PM, Shawn McKenzie <[email protected]> wrote:

>  Ashley Sheridan wrote:
> > On Wed, 2009-12-02 at 12:17 +0100, Julian Muscat Doublesin wrote:
> >
> >> Sorry about the reply to all. the htaccess files worked correctly on a
> wamp
> >> setup I had. All this happened once I did the big move to apache.
> >>
> >> On Wed, Dec 2, 2009 at 12:10 PM, Ashley Sheridan
> >> <[email protected]>wrote:
> >>
> >>>   On Wed, 2009-12-02 at 12:10 +0100, Julian Muscat Doublesin wrote:
> >>>
> >>> I setup apache myself. That I'm sure of. I had a look at the php info
> and
> >>> saw that mod_write in enabled. I checked the conf file and made sure
> that
> >>> the AllowOverride is set to All.
> >>>
> >>> On Wed, Dec 2, 2009 at 11:55 AM, Ashley Sheridan <
> [email protected]>
> >>> wrote:
> >>>
> >>>
> >>>  On Wed, 2009-12-02 at 11:55 +0100, Julian Muscat Doublesin wrote:
> >>>
> >>> is this the issue.
> >>>
> >>> On Wed, Dec 2, 2009 at 11:55 AM, Julian Muscat Doublesin <
> >>> [email protected]> wrote:
> >>>
> >>> I am runnning both IIS and Apache. The php webites are hosted on
> Apacahe.
> >>>
> >>>
> >>>
> >>> On Wed, Dec 2, 2009 at 11:41 AM, Ashley Sheridan <
> [email protected]>
> >>> wrote:
> >>>
> >>>
> >>> On Wed, 2009-12-02 at 11:42 +0100, Julian Muscat Doublesin wrote:
> >>>
> >>> Yes - running IIS 7.
> >>>
> >>> On Wed, Dec 2, 2009 at 11:27 AM, Ashley Sheridan <
> [email protected]>
> >>> wrote:
> >>>
> >>>
> >>> On Wed, 2009-12-02 at 10:27 +0100, Julian Muscat Doublesin wrote:
> >>>
> >>> Hello Everyone,
> >>>
> >>> I am having trouble with the mod_rewrite. This is not working on
> windows
> >>> 64bit. I am also having trouble with the directory password protection.
> >>> However thse bot work perfectly on my UNIX Mac.
> >>>
> >>> >From my experince I can see that this is due to file system
> compatibility.
> >>> Can anyone confirm this. You would be of greate help as I am going
> through
> >>> HELL right now. Can any suggest the best Unix or Linx OS for hosting
> phph
> >>> websites and MySQL.
> >>>
> >>> Thank you very much in advanace.
> >>>
> >>>
> >>>
> >>> By any chance, are you using IIS on your Windows machine?
> >>>
> >>> Pretty much most hosting companies offer Linux web-hosting. My advice
> would
> >>> be to try and use a company based in the same country as you are,
> because
> >>> it's nice to be able to contact them during your hours when something
> goes
> >>> wrong. And be ready to accept that things may go wrong at some point.
> >>>
> >>>   Thanks,
> >>> Ash
> >>> http://www.ashleysheridan.co.uk
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>> That is why mod_rewrite isn't working! IIS doesn't support that. It has
> >>> something else instead, by a name I forget just now. Afaik, you have to
> >>> purchase the support for this other bit as an extra module though.
> >>>
> >>>
> >>>   Thanks,
> >>> Ash
> >>> http://www.ashleysheridan.co.uk
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>  Are you sure the PHP ones are running under Apache? Just to check, see
> >>> what you get in the $_SERVER array. Also, have you checked to see if
> >>> mod_rewrite is enabled in the httpd.conf file?
> >>>
> >>>
> >>>
> >>>   Thanks,
> >>> Ash
> >>> http://www.ashleysheridan.co.uk
> >>>
> >>>
> >>>
> >>>
> >>>
> >>> OK, what does your .htaccess file look like? Also, have you named it
> >>> correctly? It starts with a period (.) character, which Windows might
> >>> sometimes complain about.
> >>>
> >>> PS, don't forget to hit reply to all, as the last few messages I keep
> >>> having to copy the list back in!
> >>>
> >>>
> >>>   Thanks,
> >>> Ash
> >>> http://www.ashleysheridan.co.uk
> >>>
> >>>
> >>>
> >
> >
> > Erm, Wamp is Apache!
> >
> > Well, have you done other things in the .htaccess that are failing,
> > causing the whole thing to fail?
> >
>
> Or maybe not installed/enabled mod_rewrite?
>
>
> --
> Thanks!
> -Shawn
> http://www.spidean.com
>

--- End Message ---
--- Begin Message ---
2 dec 2009 kl. 19.12 skrev Augusto Flavio:

Hi all,


i'm trying to connect to a SOAP Server but i'm having a problem. Look
the xml that i need send to the server:

// THIS IS THE XML CORRECT THAT NEED BE SENT TO THE SERVER

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";>
<soap:Body>
<CalcPrecoPrazo xmlns="http://tempuri.org/";>
        <nCdEmpresa>XXXXX</nCdEmpresa>
        <sDsSenha>XXXXXX</sDsSenha>
        <nCdServico>40010</nCdServico>
        <sCepOrigem>30840300</sCepOrigem>
        <sCepDestino>30840280</sCepDestino>
        <nVlPeso>10</nVlPeso>
        <nCdFormato>1</nCdFormato>
        <nVlComprimento>20</nVlComprimento>
        <nVlAltura>5</nVlAltura>
        <nVlLargura>10</nVlLargura
        ><nVlDiametro>0</nVlDiametro>
        <sCdMaoPropria>S</sCdMaoPropria>
        <nVlValorDeclarado>300</nVlValorDeclarado>
        <sCdAvisoRecebimento>S</sCdAvisoRecebimento>
</CalcPrecoPrazo>
</soap:Body>
</soap:Envelope>


And now the xml that i'm sending to the SOAP Server.


//THIS IS THE XML THAT THE PHP IS SENDING
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:ns1="http://tempuri.org/";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/";
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";>
<SOAP-ENV:Body>
<ns1:CalcPrecoPrazo> // HOW CAN I REMOVE THIS NAMESPACE? ns1:
        <nCdEmpresa xsi:type="xsd:int">XXXXX</nCdEmpresa>
        <sDsSenha xsi:type="xsd:string">XXXXXX</sDsSenha>
        <nCdServico xsi:type="xsd:string">40096</nCdServico>
        <sCepOrigem xsi:type="xsd:string">30840280</sCepOrigem>
        <sCepDestino xsi:type="xsd:string">30840300</sCepDestino>
        <nVlPeso xsi:type="xsd:string">10</nVlPeso>
        <nCdFormato xsi:type="xsd:string">1</nCdFormato>
        <nVlComprimento xsi:type="xsd:string">5</nVlComprimento>
        <nVlAltura xsi:type="xsd:string">10</nVlAltura>
        <nVlLargura xsi:type="xsd:string">0</nVlLargura>
        <nVlDiametro xsi:type="xsd:string">300</nVlDiametro>
        <sCdMaoPropria xsi:type="xsd:string">N</sCdMaoPropria>
        <nVlValorDeclarado xsi:type="xsd:string">300</nVlValorDeclarado>
        <sCdAvisoRecebimento xsi:type="xsd:string">N</sCdAvisoRecebimento>
        </ns1:CalcPrecoPrazo>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>


How can i remove the ns1 from the Child CalcPrecoPrazo?

Some idea?



//here is the php code:

$client = new SoapClient(null, array('location' => $url,
                                    'uri'      =>
"http://tempuri.org/CalcPrecoPrazo";,
                                     'trace'    => 1 ));

$results = $client->CalcPrecoPrazo($empresaCod, $empresaSenha,
$codigoFrete, $cepOrigem, $cepDestino, $peso,
                                  (int)$formatoCd, (int)$comprimento, 
(int)$altura, (int)$largura,
(int)$VlDiametro,
$codMaoPropria, (float)$valor, $codAvisoRecebimento);


thanks




Augusto Morais

Although I never worked with SOAP so far, at least when it comes to XML namespaces, you need to explicitly set those somewhere in your code before use (which you haven't). Have you asked Google or even looked at the MAN pages? After two minutes of googling, I found this.

From the SOAP man page:

[...]
nico
25-Aug-2006 01:20
If you want to build a Soap Server for Microsoft Office's client (like Microsoft Office Research Service) you need to rewrite SOAP's namespaces :

<?php
// (...)

$server = new SoapServer($wsdl, array('uri' => $uri, 'classmap' => $classmap));
$server->setClass($class);
function callback($buffer)
{
$s = array('<ns1:RegistrationResponse>', 'ns1:', 'xmlns:ns1="urn:Microsoft.Search "'); $r = array('<RegistrationResponse xmlns="urn:Microsoft.Search">', '', '');
   return (str_replace($s, $r, $buffer));
}
ob_start('callback');
$server->handle();
ob_end_flush();

// (...)
?>

There are a complete example at this URL : 
http://touv.ouvaton.org/article.php3?id_article=104
[...]

I am sure there are other examples too.

/frank


--- End Message ---
--- Begin Message ---
Can smbd please explain me in XAMPP for windows what does SVC
checkboxes at modules Apache, Mysql, FileZilla, Mercury ... stands for
- when must they be checked and why?
The first time I start a service (eg Apache) it asks me where should I
allow it to communicate. Primarily it is checked only home network.
Should I  also allow this services to communicate on public networks?
- And how is this at home different them at library where different
people will use them?

Because I clicked too quick in allowing a service to communicate
through a network (home/public access) where can I change this in
windows 7 and win xp?

Thanks in advance, always,
-- Peace refuge: http://users.skavt.net/~gleskovs/
When the sun rises I receive and when it sets I forgive;) Grega Leskovšek

--- End Message ---
--- Begin Message ---
On Thu, 2009-12-03 at 03:12 +0700, shiplu wrote:

> Hello,
> 
> I am creating an app where I have to show east asian text in image.
> Those are utf8. Problem is when I try to display "কি হচ্ছে" in image,
> it shows "ক ি হ চ ্ ছ ে"  without the circles.
> How do I show it correctly.
> 
> Note: I am generating image, not html file.
> 
> 
> 
> -- 
> A K M Mokaddim
> My talks, talk.cmyweb.net
> Follow me, twitter.com/shiplu
> 
> Innovation distinguishes bet ... ... (ask Steve Jobs the rest)
> 


Erm, I'm not seeing the issue from your email. I can see the characters
in both examples, but the latter one has the dotted circles in. Is it
that your characters aren't displaying correctly? If you're creating the
images with GD, then you should note that it has a problem with any font
where the outlines have not been specified correctly for a glyph.
Usually I get this with accented characters like you are using in
OpenType fonts. There are some font programs which can attempt to
re-create the outlines that you might be able to use.

Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---
--- Begin Message ---
Hello again,

I am searching for a way to identify the amount of simultanious date ranges.

Example:

array start=('1.12', '5.12', '9.12');
array end =('8.12', '12.12', '16.12');

Looks like this in a table:
start   end
1.12    8.12
5.12    12.12
9.12    16.12

Obviously the first and last daterange do not overlap. So the amount of overlaping bookings is 2. But how to identify this with PHP?!

Any ideas?

Thank you for any help on this!!

Merlin

--- End Message ---
--- Begin Message ---
2009/12/3 Merlin Morgenstern <[email protected]>:

> I am searching for a way to identify the amount of simultanious date ranges.
>
> Example:
>
> array start=('1.12', '5.12', '9.12');
> array end =('8.12', '12.12', '16.12');
>
> Looks like this in a table:
> start   end
> 1.12    8.12
> 5.12    12.12
> 9.12    16.12
>
> Obviously the first and last daterange do not overlap. So the amount of
> overlaping bookings is 2. But how to identify this with PHP?!

Store the start and end times of each event in an SQL table.

SELECT COUNT(*) FROM `event` WHERE `start` <= NOW() AND `end` >= NOW()

gets you the number of events that are happening right now.

--- End Message ---
--- Begin Message ---
David Otton wrote:
2009/12/3 Merlin Morgenstern <[email protected]>:

I am searching for a way to identify the amount of simultanious date ranges.

Example:

array start=('1.12', '5.12', '9.12');
array end =('8.12', '12.12', '16.12');

Looks like this in a table:
start   end
1.12    8.12
5.12    12.12
9.12    16.12

Obviously the first and last daterange do not overlap. So the amount of
overlaping bookings is 2. But how to identify this with PHP?!

Store the start and end times of each event in an SQL table.

SELECT COUNT(*) FROM `event` WHERE `start` <= NOW() AND `end` >= NOW()

gets you the number of events that are happening right now.

That is what I thought first, too! But this does not work correct as there might be a booking starting for example tomorrow. There needs to be free place for the entire booking period.

I am a bit further now, but still stuck.

So far I could pull out all dates from the database that are within the range: SELECT * FROM `datetest` WHERE '2009-12-06' between start and end OR '2009-12-13' between start and end

Now the trick would be to find overlaps. Here is an example:

I have a table with following booking info:

start end
2009-12-01 2009-12-08
2009-12-05 2009-12-12
2009-12-09 2009-12-16

I want to find out the first possible booking range for 14 day period begining from 2009-12-06 at the earliest where a max of 3 bookings are present. The result schould be: 2009-12-06

First I am pulling out all dates between the desired range:

SELECT *
FROM `datetest`
WHERE '2009-12-06'
BETWEEN START AND END OR '2009-12-13'
BETWEEN START AND END
LIMIT 0 , 30

Now the tricky parts starts where I do not know how to find out that the first daterange in the table and the last daterange do not overlap.

Any ideas?

--- End Message ---
--- Begin Message ---
2009/12/3 Merlin Morgenstern <[email protected]>:

> That is what I thought first, too! But this does not work correct as there
> might be a booking starting for example tomorrow. There needs to be free
> place for the entire booking period.

Ah, of course. I see the problem now. It's an odd situation, because
you don't seem to care if room A is available for the first half of
the period, and room B is available for the second half - as long as
the number of rooms never goes above 3. Checking for a single room
being available continuously for that entire period would be a lot
simpler.

If your resolution is 1 minute, then I'd run the query for every
minute of the event. 5 minute or 15 minute resolution would mean doing
far fewer queries. If the event count ever goes above 3, you can
short-circuit. Something like (pseudo-code)...

function is_room_available($start, $end, $resolution, $max) {
    for($i = $start; $i < $end; $i+=$resolution)
    {
        $count = SELECT COUNT(*) FROM `event` WHERE `start` <= $i AND
`end` >= $i
        if($count => $max) {
            return false;
        }
    }
    return true;
}

But I think turning it around might be simpler. Think:

I have three rooms. For each room, can it accept a 4 hour booking
starting at time $time?

Then the number of queries is a function of the number of rooms,
rather than the length of the meeting.

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

I think that you could do a table with the periods such as

ID     Star      End       is_free
1      1.12      14.12     1
2      4.12      18.12     0
3      5.12      19.12     0

then you can search the first period free

with a query Mysql

$sql = "SELECT id FROM periods where is_free = '1' order by id asd"


i hope that i have helped you


Gerardo Benitez.


On Thu, Dec 3, 2009 at 5:26 AM, Merlin Morgenstern <[email protected]>wrote:

> Hello everybody,
>
> I am pretty much stuck with a problem and I was hoping to find some help
> here with you guys.
>
> A PHP Script with MySQL as DB has to find out the first possible booking
> period available. I can't figure out the logic behind and if there is a
> trick with PHP to do it.
>
> Following facts:
> - There can only be 3 bookings in the same time period
> - I want to find out the first period available
> - There should be a less as possible periods that are unbooked
>
> Example:
> Start   End
> 1.12    14.12
> 4.12    18.12
> 5.12    19.12
> In this example the first possible booking would be 14.12 - 28.12 as this
> is a time period where I can offer a place that holds a max of 3 bookings.
>
> My Problem now is how to pull this info and process it?
>
> Should I get all dates out of the DB and process them via PHP, or do a
> magical MYSQL Query (which by the way seems not to be possible in that case
> in my knowledge) ?
>
> Let's asume we go with PHP. Has somebody an idea how to form that kind of
> logic?
>
> Thank you for ANY help,
>
> merlin
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Gerardo Benitez

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

Currently I am doing some coding in php to match a client certifcate with an
openldap certificate of that same user just to verify.
I mean the user stored one copy of this certficate in openldap previously
and now when he shows his certificate to server the server will then fetch
that users certificate from ldap and match.

and later I want to do hash. Now in ldap its stored in .der format and in
browser its in .p12
So what I am doing is as below:

<?php
$HASH_ALG='md5';
include_once '../ldapconnect.php';
//////////////////////////////////////////////////////////////////////////////////
//Reading the client certificate from web server
$loginCert = openssl_x509_read ($_SERVER["SSL_CLIENT_CERT"]);

//convert the certificate into string
$pemb = chunk_split(base64_encode($loginCert), 64, "\n");
$pemb = "-----BEGIN CERTIFICATE-----\n".$pemb."-----END CERTIFICATE-----\n";

openssl_x509_export($pemb,$cert_pemb_string);

$login_cert_hash = hash ($HASH_ALG, $cert_pemb_string);
echo "Browser HASH= ". $login_cert_hash;
echo "<br />";

///////////////////////////////////////////////////////////////////////////////////

$userName=$_SERVER["SSL_CLIENT_S_DN_CN"];
$filter="(cn=$userName)";
$justthese = array ("userCertificate;binary");
$result=ldap_search ($ldapconnect,"ou=people,dc=example,dc=com", $filter);
$entry = ldap_first_entry($ldapconnect,$result);
$attributes= ldap_get_attributes($ldapconnect,$entry);
$cert_der =$attributes["userCertificate;binary"][0];

// converting der to pem
$pem = chunk_split(base64_encode($cert_der), 64, "\n");
$pem = "-----BEGIN CERTIFICATE-----\n".$pem."-----END CERTIFICATE-----\n";
openssl_x509_export($pem,$cert_pem_string);
$ldap_cert_hash = hash($HASH_ALG, $cert_pem_string);

Now finally I will match $login_cert_hash and $ldap_cert_hash but problem is
its always giving me the same output of hash even if I manually change the
certificate of client to make sure.
I don't get it.

Thank in advance.

--- End Message ---

Reply via email to