[PHP] PHP 4.2.1 vs. 4.2.3

2003-02-21 Thread Rob
Hi there,

I was wondering if anyone could tell me what the difference is between PHP
4.2.1 and 4.2.3?? I am already aware of the POST exploit
(http://online.securityfocus.com/archive/1/283533/2002-07-19/2002-07-25/0)
in 4.2.1.  How easy is it to actually expoloit this bug?
Are there any other differences (I looked around the php site but couldn't
find anything to tell me what the differences are - if there
is somewhere just please point me to it)?

The reason I ask is that we are trying to run PHP 4.2.3 through IPlanet 6SP5
on Solaris, but it keeps crashing on the db_return function (and
the webserver reboots).  According to the IPlanet docs, IPlant runs fine
with PHP 4.2.1, so we want to downgrade, but I want to ensure that
we're not using anything in our app that relies on special 4.2.3
functionality.  If anyone can comment on the whole IPlanet/Solaris thing
(I've already read all the stuff in the php docs about installing PHP on
Solaris and I followed the instructions faithfully) I would
also appreciate that.

Thanks

---
Rob

******
Rob Cherry
mailto:[EMAIL PROTECTED]
+27 21 447 7440
Jam Warehouse RSA
Smart Business Innovation
http://www.jamwarehouse.com
**


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] php crashes iplanet

2003-02-19 Thread Rob
Hi,

We're trying to run PHP 4.3 on a Solaris 5.8 box running IPlanet 6.  We've
tests our PHP
app on an Apache/FreeBSD config and it runs fine.  However, when we trying
to
get it running on the Solaris box the server crashes every few minutes with
the following error message:

[17/Feb/2003:14:32:03] catastrophe ( 4723): Server crash detected (signal
SIGBUS)
[17/Feb/2003:14:32:03] info ( 4723): Crash occurred in NSAPI SAF
php4_execute
[17/Feb/2003:14:32:03] info ( 4723): Crash occurred in function _db_return_
from module /usr/iplanet/es60sp5/bin/libphp4.so

[17/Feb/2003:14:32:08] config ( 4725): SIGSEGV 11 segmentation violation

[17/Feb/2003:14:32:08] config ( 4725): si_signo [11]: SEGV

[17/Feb/2003:14:32:08] config ( 4725): si_errno [0]:

[17/Feb/2003:14:32:08] config ( 4725): si_code [1]: SEGV_MAPERR [addr:
0x646d7300]

Any help would be much appreciated.

Thanks

---
Rob

******
Rob Cherry
mailto:[EMAIL PROTECTED]
+27 21 447 7440
Jam Warehouse RSA
Smart Business Innovation
http://www.jamwarehouse.com
**



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] newbie query

2003-07-06 Thread rob
on 7/7/03 2:31 AM, Burhan Khalid at [EMAIL PROTECTED] wrote:
dear list
My server runs requires that if I want to write to file that I place my php
script in the cgi-bin and it treats it as a cgi script. I am new to this and
cannot get it to work. Would anyone know of a tutorial I could use to get
the hang of doing this. Apart from this my php pages work fine
Thanks
RB


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Max Array Size in Post?

2003-03-19 Thread Rob
I have a database driven music web site that allows the admin to create
photo galleries. The photos and captions are entered using a form which
allows the admin to upload a small and large photo. The number of photos is
requested in a form that calls this entry form. The code looks like this:

   for($a=1;$a<$requestCount+1;$a++){
   ?>

 
  PhotoBig #:
 
 
  
 


 
  PhotoSmall #:
 
 
  
 


 
  Caption #:
 
 
  >
 

   http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP from behind a proxy-server ??

2002-10-16 Thread Rob

hi,

i'm trying to get phpMySetiStats (phpmysetistats.sourceforge.net)
running on my NT4 box (Apache 2.0.39, PHP 4.2.3 and MySQL 3.23.52). 
problem is that i am behind a proxy server and can not get the 'file'
function to work to retrieve my stats from the Berkeley server ...
i've searched the net & groups and noticed that i'm not the first one
to run into this problem ; but could not find any answers ...

anybody here knows how to use 'file' thru a proxy ?

Rob

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] PHP session won't die!

2003-11-08 Thread rob
I cannot, for the love of Job, get a login session to die!   I am defining my sessions 
using the $_SESSION superglobal, register_globals is off, and I have tried about 15 
combinations of unset(), session_unregister(), session_destroy(), session_unset(), 
$_SESSION = array(), and even setcookie using a time in the past.  As soon as a user 
gets back to a pagePlease, if you can offer me any information on how a page with a 
session_start call, everything is magically restored as though I never touched the 
sessions.  Please, if you have any idea what the DEFINATIVE way to absolutely and 
completely kill this session is OR if you know where I should post this question, I 
would be forever in debt!

Thanks for your time.

Rob.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] if php is so great, why is it so hard to make it work?

2001-01-16 Thread Rob

You can get problems when you install and run IIS AND Apache at the same
time... I think the last message was clear enough???

-Oorspronkelijk bericht-
Van: Serge Montmarquette [mailto:[EMAIL PROTECTED]]
Verzonden: dinsdag 16 januari 2001 19:14
Aan: [EMAIL PROTECTED]
Onderwerp: [PHP] if php is so great, why is it so hard to make it work?


if php is so great, why is it so hard to make it work?
please...someone ...for win2000 nt 5.0 ...I have apache, iis installed
...nothing's working, did changes to php.ini, my registry...httpd.conf
nothing! nothing! nothig!!!


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Sending secure mail

2007-02-04 Thread Rob

I need to send a large number of emails (not spam!) through an external
SMTP server that requires TLS and a username/password. I have some
control over the SMTP server but very little over the web server where
the scripts reside. How do I connect with TLS, authenticate and send the
mail?

I had problems with mail() originally (one of the reasons why we now
have a dedicated mail server) and I had to connect to the SMTP server by
hand with sockets and go through the SMTP steps by hand. I can connect
to the new server with following code.

$sock = fsockopen( 'smtp.eg.com', 25, $errNo, $errStr );

However, when I send the "rcpt to:" line, I'm told I don't have access
to the relay - i.e. I need to log in. This is where my knowledge of SMTP
reaches it's limit but I've read about the "auth login" command,
however, it says it needs to be run over an encrypted connection, i.e.
TLS. I can't disable this on the server, other services need TLS to be
on the SMTP server.

I've tried changing "smtp.example.com" to "tls://smtp.example.com" but
it then fails to connect at all ($errNo is "115", $errStr is "Operation
now in progress"). If I connect and send starttls, I don't get any more
data from the server and I've no idea what it's waiting for, be it a
public key or whatever. FWIW, the email server's certificate is a dodgy,
home made one which throws up a security error when tested with a mail
client, but once accepted it is fine.

Is there an easier way to do this? If not, how do I get the connection
so I can get to and "rcpt to:" line and beyond?

Thanks,
Rob

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: SimpleXML & libxml options (XInclude)

2007-02-28 Thread Rob

Ben Roberts wrote:

I'm trying to get the SimpleXML extension to read an XML file and 
process the XInclude statements within the XML file.


The SimpleXML docs state that libxml options may be specified using the 
predefined constants that are available when PHP is compiled with libxml 
support (as it is when you use SimpleXML).

http://uk2.php.net/manual/en/function.simplexml-element-construct.php


LIBMLXML_XINLCUDE currently only works with XMLReader.

You would need to import your doc to DOM and then processes the xinclude:

  $xml_file = './master.xml';

  $xml = new SimpleXMLElement($xml_file, 0, true);
  $dom = dom_import_simplexml($xml);
  $dom->ownerDocument->xinclude();
    
  print_r($xml);

Rob

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] stream_read function for registered wrapper class.

2012-09-19 Thread Rob
I have a very large XML file that I have to process.  It's about 7 GB. 
Some of the individual elements that I need are larger than 8192 bytes.   
I'm trying to write a Stream wrapper class to give me a specific element 
at a time, but I keep running into issues with the stream wrapper and 
fread, stream_get_content functions.

fread will never return more than 8192 bytes (is that a bug?), so I can't 
use that at all.  When I use stream_get_content, and pass in 16384, weird 
things happen in my stream_read method.  If I return 16384 bytes, it gets 
truncated to 8192, and the stream_read method is called again and again, 
until the total returned is 16384.  Normally, stream_read is called twice 
in this case (since it "returns" 8192 both times).

This really screws up what I'm trying to do with this stream wrapper.  
Admittedly, I don't know much about stream wrappers.  This is my first 
one, and I can't find much relevant documentation on them.  But it 
doesn't seem like it's working correctly to me.  If I ask for 16384 bytes 
with fread, shouldn't it give me 16384 bytes?  And if I return 16384 
bytes when I use stream_get_contents, shouldn't it return 16384 bytes the 
first time?

Thanks for any help.

  -- Rob


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] stream_read function for registered wrapper class.

2012-09-19 Thread Rob
Sorry, I just realized my replies were going to email instead of the news 
group.

I'm going to try upgrading to php 5.4 so I have access to this:

http://php.net/manual/en/function.stream-set-chunk-size.php

And see if that fixes some of my problems.  Thanks for the suggestions.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: stream_read function for registered wrapper class.

2012-09-19 Thread Rob
Followup:

I installed php 5.4.7 and tried using stream_set_chunk_size.  It is now 
working as expected with stream_get_contents.

Here is my stream wrapper class:

http://pastebin.com/aGhxSuQh

Here is how it is used:

http://pastebin.com/jd42uxiy

Hope that helps someone else that is having issues with stream wrappers.

  -- Rob


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Beginner Question-Solution-packages

2004-04-09 Thread rob
On 10/4/04 1:37 AM, "jon roig" <[EMAIL PROTECTED]> wrote:

Thank you for your help! Php and mysql ship on MAC OSX servers but not on on
the normal machines.
Apple provides support for these two at
http://developer.apple.com/internet/opensource/osdb.html for help on MySQL
on MAC OSX including step by step instructions on how to install it.
Assistance with PHP is found at
http://developer.apple.com/internet/opensource/php.html including help on
how to install it.
I have not found integrated packages for Macs like FoxPro but the above
links will get you up and running.
Marc Linnage has a standalone installer for the latest release of PHP for
OSX at http://www.entropy.ch/software/macosx/php/- very easy to install for
beginners.
I had trouble installing MySQL(from MySQL.com) but found the server
logistics package a breeze at http://www.serverlogistics.com/mysql.php
Once again thks for pointing me to the developer section at Apple
RB

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Working with XML: DomDocument or SimpleXML?

2007-09-21 Thread Rob

Colin Guthrie wrote:




I know I definitely want to do XSLT stuff and for that I need to use
DomDocument (I'm sure there are other ways but this works fine for me so
far!).


Fairly unknown tidbit: you can pass SimpleXML objects to the XSL 
extension. XSL will use the document from it.





I'll phrase it better: one can easily convert a SimpleXML object to a
DomDocument[1], but nothing is "free" (in terms of time taken and memory
requirements etc.), so really I guess I want to ask if the trade off of
the simplicity of working with SimpleXML is worth it considering the
overhead of the conversion process to a DomDocument for subsequent XSLT
transforms etc?


Conversion is easy and the time/memory is negligible due to how the 
interoperability was designed. The whole purpose of it is so you can go 
back and forth to use whichever API suits you need at the time.



if ($xml instanceof SimpleXMLElement)
{
  $rv = new DOMDocument('1.0', 'utf-8');
  $node = dom_import_simplexml($xml);
  $node = $rv->importNode($node, true);
  $rv->appendChild($node);
  return $rv;
}


Why??? If you really want a DOMDocument object why are you creating a 
new document, copying nodes and incurring all the additional overhead?


if ($xml instanceof SimpleXMLElement)
{
   /* No copying, just use the existing XML tree directly */
   $node = dom_import_simplexml($xml);
   return $node->ownerDocument;
}

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Working with XML: DomDocument or SimpleXML?

2007-09-21 Thread Rob

Colin Guthrie wrote:

Rob wrote:



if ($xml instanceof SimpleXMLElement)
{
   /* No copying, just use the existing XML tree directly */
   $node = dom_import_simplexml($xml);
   return $node->ownerDocument;
}


Yeah I had that initially too but that did not produce a DOMDocument
Object but a DOMNode Object (or something like that will have to
test again as memory is corrupted - there /was/ a reason, and stupid me
didn't comment the code.).


It had to have been for some other reason as the return type for the 
above example is a DOMDocument. A raw DOMNode is *NEVER* returned from 
the DOM extension. It is simply a base class for most of the DOM 
classes, such as DOMDocument.


Rob

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Proposal of DOM boolean property: DOMDocument::omitXMLDeclaration

2007-10-22 Thread Rob

Freyjkell wrote:

(bool) DOMDocument::omitXMLDeclaration;

Does not need a comment. Implemented in XSLT.

// I sent this post to php.xml.dev, but I didn't get reply for long time.


parser option LIBXML_NOXMLDECL or if no DTD just save the root element.

Rob

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Proposal of DOM non-standard method: DOMDocument::loadCharacterEntitiesFromDtd($path)

2007-10-22 Thread Rob

Freyjkell wrote:

DOMDocument::loadCharacterEntitiesFromDtd($path);

I like to load character entities (not whole document type definition).

When I try to do that by creating my own DTD with only character
entities, and setting resolveExternals to true, then DTD parser
complains that it didn't occur root definition.

The proposed method, if called before DOMDocument::load/loadXML(), would
get character entities from DTD (and its modules) and apply them during
parsing XML. If called multiply, or if XML contains a DTD reference,
entities put before would be overwritten.

// I sent this post to php.xml.dev, but I didn't get reply for long time.

A day or two is not a long time and some things are not cut and dry, 
requiring a little time to think about it. If you want to override the 
DTD, you should look at using catalogs or create a custom stream handler 
to alter the XML document as it is parsed.


Rob

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] DOM API Namespaces - help?

2008-01-24 Thread Rob

Hi Nathan,

You need to retrieve the attribute based on the xmlns namespace.

Nathan Rixham wrote:
Thanks Jessen, I'm using the DOM API (domdocument) in PHP 5 - and yes 
pull xmlns:xi="http://www.w3.org/2001/XInclude"; from the chapter or 
indeed any namespaces defined in the root node and store them in a 
variable.


If anybody could shed any light it'd be greatly appreciated.


$xml = '
http://www.w3.org/2001/XInclude";>

';

$dom = new DOMDocument();
$dom->loadXML($xml);
$root = $dom->documentElement;
$attr = $root->getAttributeNS('http://www.w3.org/2000/xmlns/', 'xi');
var_dump($attr);

Rob



Nathan

Per Jessen wrote:

Nathan Rixham wrote:


but assuming the above file is:

http://www.w3.org/2001/XInclude";>



how would one retrieve xmlns:xi="http://www.w3.org/2001/XInclude";


When you say 'retrieve', what do you really mean?  You need to get the
namespace value into a PHP variable?
I would probably look at the namespace-uri() function in XSLT, but I
don't know if you're using XSLT?


/Per Jessen, Zürich


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] DOM API Namespaces - help?

2008-01-24 Thread Rob

Hi Nathan,

Nathan Rixham wrote:

Cheers Rob,

But this is the problem, I don't know what the namespace/prefix is! ie 
"xi" and the following doesn't work:


$root->getAttributeNS('http://www.w3.org/2000/xmlns/', '*');

further xmlns is ?not? a prefix so this won't work either..
$root->lookupPrefix('http://www.w3.org/2000/xmlns/');

we need to assume that we don't know the document we're working on, thus 
we don't know:

a] if it has any namespaces defined
b] if any, what the namespaces are
c] if any, what the prefixes are.

And I still can't find any way of finding this out, it should be simple 
enough surely?


still help!?



There are a couple of ways to do this.
Using only DOM, you can grab the namespaces via XPath:

$root = $dom->documentElement;
$xpath = new DOMXPath($dom);
$nodes = $xpath->query('namespace::*');
foreach ($nodes AS $node) {
print "x: ".$node->localName."\n";
}


A simpler solution is to use simplexml:
$sxe = simplexml_import_dom($root);
var_dump($sxe->getDocNamespaces(true));

Rob




Nathan

Rob wrote:

Hi Nathan,

You need to retrieve the attribute based on the xmlns namespace.

Nathan Rixham wrote:
Thanks Jessen, I'm using the DOM API (domdocument) in PHP 5 - and yes 
pull xmlns:xi="http://www.w3.org/2001/XInclude"; from the chapter or 
indeed any namespaces defined in the root node and store them in a 
variable.


If anybody could shed any light it'd be greatly appreciated.


$xml = '
http://www.w3.org/2001/XInclude";>

';

$dom = new DOMDocument();
$dom->loadXML($xml);
$root = $dom->documentElement;
$attr = $root->getAttributeNS('http://www.w3.org/2000/xmlns/', 'xi');
var_dump($attr);

Rob



Nathan

Per Jessen wrote:

Nathan Rixham wrote:


but assuming the above file is:

http://www.w3.org/2001/XInclude";>



how would one retrieve xmlns:xi="http://www.w3.org/2001/XInclude";


When you say 'retrieve', what do you really mean?  You need to get the
namespace value into a PHP variable?
I would probably look at the namespace-uri() function in XSLT, but I
don't know if you're using XSLT?


/Per Jessen, Zürich


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] DOM Question. No pun intended.

2006-09-14 Thread Rob

[EMAIL PROTECTED] wrote:

Satyam,

I don't see any "innerHTML" or "outerHTML" in relation to PHP DOM.  I'm 
familiar
with them from a Javascript standpoint, but no references when it comes 
to PHP

DOM.

Regards,
Mike


Now that you have the element, why not just call:
$doc->saveXML($node);

Rob

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: loadHTML/loadHTMLFile - DOM functions

2006-09-15 Thread Rob

How are you getting that output?

Remember most of the functionality - other than the saveXML(), 
saveHTML() functions - output using UTF-8 (which you would need to 
convert to what ever encoding you need).


Rob

Leonidas Safran wrote:

Hello all,

Again a question on the new DOM functions...

The loadHTML function doesn't support any attribute and I'm wondering how to handle non-text content. Image tags from source 
webpage are loaded as "objects" or whatever; they appear as special chars("show source" from browser shows 
big empty spaces)... Isn't it possible to "load" the real source code? Special characters, like the german 
"ä" is also badly converted into some bizarr "ä" equivalent...

I tried both functions loadHTML($string) ($string = file_gets_content(url)) and 
loadHTMLFile(url). Both with the same result...

Has anyone an idea how to do it?

Thanks

LS


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: loadHTML/loadHTMLFile - DOM functions

2006-09-15 Thread Rob
Is there a meta tag that specifies the encoding? When loading HTML that 
is also used to determine the encoding. I think I need to clarify the 
encoding issue:
	I'll bet when the document is loading, the encoding is being properly 
detected. When working with the elements however you are getting hung up 
on the UTF-8 factor


you probably do something like the following:

$myelement = getElementById('someid');
print $myelement->textContent;

That right there will output the textual content in UTF-8 (the garbled 
characters). It does not take into consideration the encoding used in 
the origional document. This is just how the xml functions work. Now...


You really need to do something like:

$text = $myelement->textContent;
print iconv("UTF-8", , $text);

If the encoding is in the meta tag, typically encountered as:


If you add the content to a dom node, you do not change the encoding 
since the functions all work on UTF-8. The document to which the content 
is being added however, must be set to use the desired encoding. I am 
assuming you are doing what I previously explained though.


Rob


Leonidas Safran wrote:

Hello Rob,

Thanks for answering (so fast)... :-)

Remember most of the functionality - other than the saveXML(), 
saveHTML() functions - output using UTF-8 
(which you would need to convert to what ever encoding you need).


Well I did try before loadHTML call:

$doc = new DomDocument('1.0', 'iso-8859-1'); 


This does nothing. loadHTML() causes a new underlying document and 
replaces the one you created with the new DOMDocument() call. That is 
only pertinant when you are manually building a document.




Maybe it's a problem that the source webpage I'm loading has no charset 
declaration. It solely uses:

http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
http://www.w3.org/1999/xhtml";>

Don't know if that has an influence...


How are you getting that output?


About the output I make, I don't use the saveHTML function because I just cut some parts 
of the source (grabbed with getElementById() and other related functions) and only need 
them, so I just "echo" them into a new document.


LS


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: loadHTML/loadHTMLFile - DOM functions

2006-09-17 Thread Rob

Leonidas Safran wrote:
 > I tried following:


I downloaded the ominous html page, coded it as UTF-8 (with text-editor option) 
and added a metag-tag declaring utf-8 encoding:


I checked that the special characters were written correctly then (actually I had to correct them). 


Then I used the function:
$doc = new DomDocument('1.0', 'UTF-8');

The result is still the same, special chars are displayed wrong. Different wrong than before :-) 
but still wrong... ("ä" is now "ä").

I tried analogy to do the same with "ISO-8859-1" but it's not getting better...

So, fazit, even converting the whole document in UTF-8 and adding UTF-8 charset 
declaration to it, doesn't help me handling special chars...

And what about the img-tags which are converted into what ever invisible chars 
(empty spaces looking at the source code)...?


Do you have your code somewhere?

Another thing I realized that I failed to mention before is that
using saveXML($element) will serialize the full element, but outputs it 
in UTF-8 encoding. Have you tried converting the output of that to the 
encoding of the original HTML page?


Rob

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: loadHTML/loadHTMLFile - DOM functions

2006-09-17 Thread Rob

Leonidas Safran wrote:

Hello Rob,


Do you have your code somewhere?


Yes, I paste it below. There are two files, one for HTML output (which I make invisible 
with style declaration "display:none;" and the second file is a javascript 
function which is supposed to output the content...


Try this line:

$this->ticker .= utf8_decode($child_elements->item($j)->textContent);

Your original HTML document is ISO-8859-1, so when you want the text I 
think you want to convert the UTF-8 (Internally DOM document works with 
UTF-8) to ISO-8859-1. Just using the utf8_decode function here from 
ext/xml. This elminates those  characters you were getting.


Rob

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] DOMDocument->saveXML()

2006-09-18 Thread Rob

Chris Boget wrote:

Perhaps you missed my reply.
If you pass the root node then you get the entire document without the 
XML declaration.

That's both elegant and built-in.


In the future there will be an save option to perform this. This was 
only made possible in recent libxml releases so has not been enabled yet 
in DOM (although the constant has been defined in ext/libxml).




I didn't miss it.  But you have to pass in the root DomNode object. The 
only way to get it is by doing the following:


$nodeList = $doc->getElementsByTagname( 'RootTagName' );
echo $doc->saveXML( $nodeList->item( 0 ));


echo $doc->saveXML($doc->documentElement);



So unless your root node has an ID, that seems pretty excessive.  Now 
you have the wasted resources that $nodeList is using.  While it is 
crude, I believe it is both faster and less resource intensive to just do:


echo str_replace( '', '', $doc->saveXML());


Doing that (although it wont work if encoding is also output in xml 
declaration) also maintains document encoding. Doing the previous will 
output the document element and its subtree in UTF-8 (of course this is 
to be expected as you are dropping any possibility of providing an 
indication of the encoding)




It would be really nice if you could also specify a string value -- the 
name of the root node.


Why? documentElement property works just fine and is much more flexible.

Rob

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Prevent XSS using DOM Extension and/or SimpleXML

2006-11-14 Thread Rob

Raphael Martins wrote:

But I don´t know how to loop over every attribute for each tag in the 
DomTree.


Not sure if you need to do this element by element or just want all 
attributes, but here are two ways using DOM. They assume $dom is an 
already loaded DOMDocument.


1 - Use XPath:

$xPath = new DOMXPath($dom);
$nodelist = $xPath->query("//@*");
foreach ($nodelist AS $attr) {
print $attr->nodeName." ".$attr->nodeValue."\n";
}


2 - Walk the tree manually:

function checkElement($node) {
$attlist = $node->attributes;
foreach ($attlist AS $attr) {
print $attr->nodeName." ".$attr->nodeValue."\n";
}
if ($node->hasChildNodes()) {
foreach ($node->childNodes AS $child) {
if ($child->nodeType == XML_ELEMENT_NODE) {
checkElement($child);
}
        }
}
}

$root = $dom->documentElement;
checkElement($root);

Rob

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: DOMElement::setAttribute() manual example question

2006-03-03 Thread Rob

Andreas Korthaus wrote:

Hi!

I've a question regarding the example in DOMElement::setAttribute() 
chapter of the PHP manual: http://de3.php.net/dom-domelement-setattribute


There, an attribute is added to an element this way:

createElement("root");
$newnode = $doc->appendChild($node);
$newnode->setAttribute("align", "left");
echo $doc->saveXML();
?>

$doc->createElement() returns the created DOMElement, 
$doc->appendChild() returns the appended DOMNode. Isn't this the same 
object? Is it a reference?


I'm asking, because the following works too:

createElement("root");
$node->setAttribute("align", "left");
$doc->appendChild($node);
echo $doc->saveXML();
?>


I like the 2nd example more, because first you create an object 
(DOMElement), add some attributes to the object and after that append it 
somewhere to the DOM tree. The 1st example creates a new DOMElement 
object, appends it to the DOM tree, and adds the attributes not to the 
created object, but to another object (the DOMNode appended to the 
tree), which seems to be a reference to the original object.


Why does the manual prefer the (IMO less intuitive) 1st way? Is there a 
problem with the 2nd way?


Both ways are perfectly valid. $node and $newnode refer to the same 
object. It was written the 1st way to demonstrate the return value of 
appendChild(), because in many cases people create the element differently.


i.e.

$newnode = $doc->appendChild($doc->createElement("root"));
or
$newnode = $doc->appendChild(new DOMElement("root"));

Also, in the event $node is created using the new DOMElement syntax:

$node = new DOMElement("root");

the node is read only and must be appended into the tree before it can 
be modified, so the example just tries to be neutral here regarding the 
syntax used.


Rob

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: DOMElement::setAttribute() manual example question

2006-03-03 Thread Rob

Gustav Wiberg wrote:


Check out:
http://de3.php.net/manual/en/function.dom-domdocument-createelement.php
( This function creates a new instance of class DOMElement. This node 
will not show up in the document unless it is inserted with e.g. 
DOMNode->appendChild().)


I really don't understand WHY your next example is working...


Every example so far has called appendChild(). The only difference has 
been when at which point it is called to append the element and how the 
element to append has been created.


Rob

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: DOMElement::setAttribute() manual example question

2006-03-05 Thread Rob

Andreas Korthaus wrote:


$node = new DOMElement("root");

is read only, while

$node = $doc->createElement("root");

is not? Why?


$node = new DOMElement("root");
In this case the element is not associated with a document. In DOM, you 
really aren't supposed to have a node not associated with any document, 
but this syntax allows the DOM classes to be extended in PHP. Once the 
node is associated with a document, you then have full editing capabilities.


Rob

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: create xml root-element with xmlns and xsd link (using DOM)

2006-03-06 Thread Rob

Andreas Korthaus wrote:

Hi!

The XML-Code I have to create (http://news.php.net/php.general/231486), 
needs a root-element, with xmlns and XML schema link, something like that:


http://example.com/test";
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
  xsi:schemaLocation="http://example.com/test
  test.xsd">

Does DOM provide any means to add a XML schema link to the doc?

Now I'm doing it this way (which seems to work):

appendChild(new DOMElement('root', NULL,
  'http://example.com/test'));
$root->setAttributeNS('http://www.w3.org/2001/XMLSchema-instance',
  'xsi:schemaLocation', 'http://example.com/test test.xsd');
echo $doc->savexml();
?>

Does DOM provide nothing else?
Does anybody see any problems with this approach?


That's how namespaced attributes, which is nothing more than you are 
creating, are supposed to be created in DOM.


Rob

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: PHP4, domxml and xpath with Namespaces

2006-03-06 Thread Rob

Markus Fischer wrote:

Hi,

I haven't yet worked with namespaces in XML before when it comes to DOM
related methods. My source is an Office 2003 Excel XML and it contains
XML like:



http://www.w3.org/TR/REC-html40";>
 
 
  
   
   

How can I use an xpath expression to find e.g. all rows in Worksheet
"Sheet1" ?

My problem here is that the name of the Worksheet is in a namespace
attribute and I don't know how to express this as an xpath expression.

The following doesn't work, always returns an empty nodeset to me:
[EMAIL PROTECTED]:Name='Sheet1']

Can someone give me a push into the right direction?


You need to register the namespace and a prefix (prefix can be anything 
you want to use) with xpath and don't forget what the elements are 
within a default namespace coming from the 
xmlns="urn:schemas-microsoft-com:office:spreadsheet" namespace 
declaration on the Workbook element.


xpath_register_ns($xpath,"ss", 
"urn:schemas-microsoft-com:office:spreadsheet");


$nodeset = xpath_eval($xpath,"ss:[EMAIL PROTECTED]:Name='Sheet1']");

both the element and attribute are within the same namespace so the 
namespace and prefix are registered once and the prefix is used to 
identify both in the xpath expression.


Rob

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] include_once() isnt!

2004-02-03 Thread Rob
Ive programmed with C/C++ for years and have recently started to dabble in
PHP. Ive written a multi-part script for a friend and Ive run into a
problem.

Ive got 14 include files 3 of which are basic components that may or may not
be used by other components. One is an authorisation class, another is a
Dbase clas (For MySQL) and another is a file system component.

Now heres the problem. My authorisation component uses the DBase component.
Some of my other components use the DBase component only some of the time
and the Auth and DBase components some of the time and the Auth component
some of the time.  SO... In the Auth component ive included (via
include_once()) the DB component, because it needs it. NOW... in other
modules Ive included (via include_once()) the auth, DB, and gallery
components.
Heres where the problem lies. Each component is in a separate file, and when
I run the script, I get an arror saying I cant re-define the classes.
Which makes me believe that the include_once() function is trying to include
the other components even though they are already included. So, does that
mean that include_once() only works right when it is used in the same file?
It wont recognise that an include was already included in another include?
Have I confused you yet? I am.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Beginner Question

2004-04-08 Thread rob
I am a newcomer to PHP and I am looking for an intsallation package similar
to to FoxPro for MAC OSX 10.2.(Ie intsall appache, MY SQL and Latest version
of PHP) Does anyone know where I may find one?
Thanks RB

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: PHP DOM XHTML - let me set my own javascript from code

2005-10-19 Thread Rob

Petr Smith wrote:

but it encloses it to CDATA section automatically like this:

language="Javascript">


but I need it like this (because otherwise the javascript don't work):


//



First, script was using some bogus method names.
Secondly, you try to do anything like the following (which do work)?

$html = "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\";>\n".

"\n".
"http://www.w3.org/1999/xhtml\"; xml:lang=\"en\" 
lang=\"en\">\n".

"\n" .
"\n" .
"\n" .
"hello\n" .
"\n" .
"";
$dom = new DomDocument();
$dom->preserveWhiteSpace = true;
$dom->loadXML($html);
$params = $dom->getElementsByTagName('script');
foreach ($params as $param) {
$dat = $dom->createTextNode("\n//");
$param->appendChild($dat);
$dat  = $dom->createCDATASection("\n\nalert('ddd');\n\n//");
$param->appendChild($dat);
$dat = $dom->createTextNode("\n");
$param->appendChild($dat);
}
echo $dom->saveXML();

Could also do it using  through a comment node (following adds 
some linefeeds too):

foreach ($params as $param) {
$dat = $dom->createTextNode("\n");
$param->appendChild($dat);
$dat  = $dom->createComment("\n\nalert('ddd');\n\n");
$param->appendChild($dat);
$dat = $dom->createTextNode("\n");
$param->appendChild($dat);
}

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: DOM namespace prefix troubles


Ace McKool wrote:


What I'm trying to create is something like the following:
   

 
 
 I am unable to create the "" element with the "cac:" namespace
prefix. Any suggestions would be appreciated!



$dom = new DOMDocument("1.0", "UTF-8");
$root = $dom->createElement('Notes');
$dom->appendChild($root);

$root->setAttributeNS("http://www.w3.org/2000/xmlns/";, 'xmlns:cac',

'urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-1.0');

$child = 
$dom->createElementNS('urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-1.0', 


  'cac:Note');

$root->appendChild($child);

Hope that helps.

Rob

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] How to build a XML DTD on "the fly"?


Jared Williams wrote:


There is no real standard for creating DTDs on the fly, and therefore 
libxml/DOM doesn't have any methods afaik.

The one method DOMElement::setIDAttribute() should work I think, but whilst PHP 
has the method, doesn’t seem todo anything. :/


DocumentType nodes are read-only in DOM thus cannot be built on the fly. 
Also notice that not all components, such as ATTLIST, even have a node type.


setIDAttribute - thats on the TODO list. Were some previous libxml 
issues to be resolved before that could be implemented (so it will be 
added, but require a minimum libxml2 version to work).

Can always use xml:id attributes for that purpose for now though.

Rob

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] How to build a XML DTD on "the fly"?


Jared Williams wrote:

setAttributeNS('http://www.w3.org/XML/1998/namespace', 'id', 'abc') doesn’t 
work either, getElementById() still fails.


It does work as long as you are using libxml2-2.6.22

Rob

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: DomDocument::GetElementById - a workaround with external DTD


Erik Franzén wrote:

I did a typo in the threads post.

The dtd is:





but it gives the warning when DomDocument::validate() is called:

Warning:  Syntax of value for attribute S_iSectionId of 
CMAES_Model_DbSection is not valid in 

[PHP] Re: Php5 SOAP WSDL parsing


Simon Detheridge wrote:

The output says:

SoapFault exception: [WSDL] SOAP-ERROR: Parsing Schema: unexpected  in 
complexType in /var/www/localhost/htdocs/soap1.php:5 Stack trace: #0 
/var/www/localhost/htdocs/soap1.php(5): 
SoapClient->__construct('http://www.symg...') #1 {main}


attribute definitions have to come after a sequence.
See the symbol element definition in cml.xsd
The symset attribute must be defined after the sequence.

Rob

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: PHP5, Soap, WSDL, and unbounded xsd:choice types.


Simon Detheridge wrote:




What I want PHP to do, is enable me to access my 'bar' and 'baz' 
elements in the order in which they appear in the document, instead of 
having it glob them together for each type. However, I am unable to 
modify the output of the webservice itself as it interoperates nicely 
with other things already.


Can I get There from Here with PHP's own SoapClient, or do I have to 
parse the xml by hand?


I don't see how you could do it without altering the WSDL, which would 
alter the SOAP response. Your best bet if that is out of the question is 
to parse the portion of the response you need manually. You also need to 
be sure that the server is always going to send those elements in the 
exact order you are expecting.


Rob

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Test links?

First, I'd like to say that I'm not asking for anyone to write a script...
how would I go about checking a MySQL database of links to see if any are
down?

I've had some varying results with all the methods I've tried, so would like
to see if anyone has a proven method for doing this.

Thanks,
Robert




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Test links?

Well, the reason I didn't do that at first was that I could have done any of
the methods that I've tried incorrectly, which is why I figured I'd ask what
works and then focus on that method... but, I've tried to ping them, use
fopen, and use fsocketopen... but nothing says that I've used any of them
the way I should have :)  I also tried to use the scripts that I found at
hotscripts.com but I always seem to get inconsistent results and it must be
accurate.


"Jason Wong" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> On Saturday 30 November 2002 06:53, Rob Packer wrote:
> > First, I'd like to say that I'm not asking for anyone to write a
script...
> > how would I go about checking a MySQL database of links to see if any
are
> > down?
> >
> > I've had some varying results with all the methods I've tried, so would
> > like to see if anyone has a proven method for doing this.
>
> Why don't you briefly summarise what methods you have tried? That way
people
> won't reply with methods that you already know of.
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
>
> /*
> Between grand theft and a legal fee, there only stands a law degree.
> */
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Test links?

Okay, I'm confused... file, fopen, and fsockopen seem to say not found on
alot valid URLs...  does this look to be correct usage?
$url = $row[0]; // just get the url from the db
$fp = implode ('', file ($url));
 if (!$fp) {echo "Unable to access file"; }
 else { fclose($fp); echo "The link is working!"; }

It seems I always get this warning...

Warning: Supplied argument is not a valid File-Handle resource in
/web/home/nrc.net/www/robert/links4.php on line 11

If someone can tell me what I'm doing wrong, I'd appreciate it.

Thanks,
Robert



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Test links?

Thanks for the help and suggestions everybody!
I think some of my problems stemmed from the affiliate links being
redirected and PHP saw that as dead(so to speak)... but I think I got it
now. I made another column in the database to note a redirection for ones
that the url fails but the $url[host] passes.

Robert Packer


"Chris Hewitt" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Rob Packer wrote:
>
> >Okay, I'm confused... file, fopen, and fsockopen seem to say not found on
> >alot valid URLs...  does this look to be correct usage?
> >$url = $row[0]; // just get the url from the db
> >$fp = implode ('', file ($url));
> > if (!$fp) {echo "Unable to access file"; }
> > else { fclose($fp); echo "The link is working!"; }
> >
> >It seems I always get this warning...
> >
> >Warning: Supplied argument is not a valid File-Handle resource in
> >/web/home/nrc.net/www/robert/links4.php on line 11
> >
> I think you have assigned $fp to be the imploded string, not a file
> pointer. Thus fclose($fp) would generate an error. Given this, I'm not
> sure what  "if (!$fp)" would mean.
>
> HTH
> Chris
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Sessions, Cookies, and Subdomains

Hello, I've a bit of a problem and was wondering if anyone out there can help 
straighten it out.  I have never worked with cookies or php sessions before as the 
need for such has never presented itself before.  Up until this 
point I have been using a very customized version of PostNuke but things are to the 
point where I need a custom system from scratch.  I want to use php sessions for my 
user system because they seem to be more transparent to the 
visitor, but there are a few problems that I think I am going to run into based on 
what I've read.  I want to have my website split into several subdomains with a shared 
user system. That is to say that when someone logs into 
foo.mysite.com they'd also be logged into bar.mysite.com when they go to it.  It is my 
understanding that php sessions will not work in this way, being that each subdomain 
has its own sessions.  If this is the case, is there a 
way around this?  If it is the case and there isn't a way around this, is this able to 
be done with regular cookies?  Also, php sessions only last a certain amount of time.  
I'd like for users to remain logged in indefinitely if 
they choose to do so while logging in.  Assuming this is absolutely impossible in 
sessions, is it feasible to use php sessions as the basis of my user system, but use 
cookies as a secondary to it if users choose to remain logged 
in?  Any help at all would be really appreciated, because I'd like to get the new 
version of my site rolled out soon.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Does using msql_select_db excessively burn resources?

I plan to have my sites using several databases, but there is a common database they 
must all use.  Obviously I'll have to use "mysql_select_db" each time I change the 
database I wish to use.  Does this simply select the database 
and hold it as a variable until a query is made, or does it load it in a way that 
would potentially slow things down?



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Segmentation fault and var_dump()

Hello;

I'm getting a segmentation fault and I don't understand what it
means.  Kind of new to php debugging.

Background: Web server is generally error free.  I have some
complex php/MySQL applications installed.  I'm running it under
YellowDogLinux with php v4.23.

I'm trying to install a CVS version of the Horde project.  I'm
having a problem with horde in that it doesn't save configuration
values like it should.  The Horde developers recommended that I do
some debugging by placing a var_dump($_POST) call at a strategic
place in the script.  However, when I try to run the script with
that call active, the web browser responds back: "Connection
closed by server".  Checking the apache error log shows the
following:

[Wed Jan  8 21:36:38 2003] [notice] child pid 5261 exit signal
Segmentation fault (11)

What is wrong?  It only does this when the var_dump() is present;
comment it out and there is no segmentation fault (but the script
still doesn't work right).  With it present, the seg faults every
time.

TIA

Rob



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] php with mime magic?

I'm trying to get php compiled with mime magic, and it doesn't
appear to be working.

Here's my phpinfo page, showing the parameters I've used to
compile; it does show that I used '--enable-mime-magic' as
instructed in the docs at php.net:

http://horde.csd-bes.net/horde/test.php?mode=phpinfo (I need
mime-magic for the latest Horde).

My understanding is that there will be a section in phpinfo()
displaying mime magic settings when everything is good.  It is not
there at this time.

When I do the configure/make/make install, there are no complaints.

Is this an extention that requires a seperate module file like
mysql's mysql.so file?  If so, it's no where on my system.  I've
googled to find something of the sort with no luck.

I know also that I have to have a reference in php.ini pointing to
the magic.mime file; my entry says:

mime_magic.magicfile = "/usr/share/misc/magic.mime"

and I have verified that the magic.mime file is actually in the
location.

How do I figure out what's wrong?

Thanks




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Date Difference Errors

I have a function that I use to return the number of days between two dates.  It 
worked fine on my Mandrake 7.0 server running PHP 4.  I am trying to run it on a 
RedHat 8.0 box with the same version of PHP.  On Mandrake, strtotime() and mktime() 
returned a negative number for dates prior to 1970-01-01.  On the RH 8 box, they both 
return -1.  Is there any work around to calculating date differences for dates prior 
to 1970?

Rob



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Escaping Chars

I need to get a password value from a form, store it in a database and then
later be able to compare a login password to the one stored in the db.
This works great unless the password contains the '\' char.
magic_quotes_gpc is ON and magic_quotes_runtime is OFF.
As a klude, I tried just removing slashes from the input password using
stripslashes() before storing it in the db and then testing to see if
stripslashes(val from db)=stripslashes(val from form) in the login test to
see if they match.  (the user shouldn't even know that slashes are being
striped, so I have to strip them on each input).  They still don't match if
a slash is input for the original password storage, but I don't know why.

However, instead of this work-around (that doesn't even work), what I'd
really like to do is allow ANY character in the password, but take care of
all the quoting and escaping along the way (both ways...).

How is the best way to do that?
Thanks,
[EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] .htpasswd and PayPal generated passwords

I use PayPal to generate a username and password and then write them to
the .htpasswd file. If I were to switch to using a database (because
.htaccess seems to always prompt twice!) how would I perform the comparison
for the passwords? It would seem that everytime you generate an encrypted
password it's different. So how would you compare them? Also, does anyone
know what the encryption method used by PayPal is?

Thanks for any help...

Robert Packer



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] check expiration date

anyone know of a script for getting the current date and then calculating
when a provided expiration date would be?



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: .htpasswd and PayPal generated passwords

Hi David,
When using the IPN feature that PayPal offers, you can optionally have
them generate a username:password pair for you. That way it will be stored
at paypal and the user can check their history to retrieve it anytime.

Robert


"David Duong" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> btw - What do you mean by paypal generated passwords?  I am interested in
> using PayPal as an alternative to my current credit card handler.
>
> Just a link is appreciated.
>
> - David
>
>
> "Rob Packer" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > I use PayPal to generate a username and password and then write them
> to
> > the .htpasswd file. If I were to switch to using a database (because
> > .htaccess seems to always prompt twice!) how would I perform the
> comparison
> > for the passwords? It would seem that everytime you generate an
encrypted
> > password it's different. So how would you compare them? Also, does
anyone
> > know what the encryption method used by PayPal is?
> >
> > Thanks for any help...
> >
> > Robert Packer
> >
> >
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] What is the fastest method for changing php settings (save php.ini)?

I'm sorry if this question has been answered before, but I couldn't find 
anything in the archives.  I don't have access to php.ini and I was 
wondering which method for changing settings is the fastest.  Take, for 
example, "session.cache_expire".  This can be set via ini_set(), 
session_cache_expire(), or in .htaccess.  I have a handful of session- 
related settings that need to be set with each script and with that in 
mind, would it be faster to have .htaccess do the work or would ini_set be 
the optimum method?  And what of those, like "session.cache_expire", that 
have specific function that can be used?

Thanks ahead of time for any help.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] nested for loops

You're getting the data from your query outside of your loop.  That needs to
be part of your loop, otherwise, as you've seen, it just displays the first
record.  You could try something like this:

$cnt = 0;
while ($row = mysql_fetch_object($result))
{
  echo "$row->file_name$row->file_id";
  $cnt++;
  if ($cnt % 2)
    echo "";
}

HTH.

  -- Rob



"Micah Montoy" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Well, the for loop is now working but its not displaying what I want.  I
am
> pulling data from a DB and for every new  I would like to get the next
> result and if it reaches more then 2 columns, to start a new row.  This I
am
> not initally having a problem with.  That is the looping.  The problem I
am
> running into, is getting the the DB stuff to show.  Right now, I only one
> record and it shows for every single one.   Here is a snippet of the code.
>
> $result = mssql_query("SELECT * FROM files WHERE file_id = '$cat_name'
ORDER
> BY file_name ASC");
>
> $i = $col_num;
> $j = 0;
>
> $filename= mssql_result($result,0,"file_name");
> $fileID = mssql_result($result,0,"file_id");
>
> for ($k = 0; $k < mssql_num_rows($result); $k++) {
> //changes row color
> if (fmod($k, 2)){$rowColor = "$oddcolor";}else{$rowColor =
> "$evencolor";}
>
>echo ("");
>
>   for ($j = 0; $j < $i; $j++) {
>echo ("$filename".
> "Name: $getimage_name".
> "

[PHP] Re: php mysql array question

It shouldn't take a lot of code to put results into an array:
$query = "select * from table";
$r = mysql_result($query);
while ($row = mysql_fetch_object($r))
  $hold[] = $row;
(OR, to index by some id field in the database:)
  $hold[$row->id] = $row;
mysql_free_result($r);

Total of 5 lines.

  -- Rob




"Larry Brown" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Is there any php function to pull a query into an array?  I know there is
a
> way to get the first row of the results in an array, but I'm having to
loop
> through each row pushing the row onto an array to get the result I'm
looking
> for and it seems like a lot of code for something that I would think is
used
> a lot.
>
> Larry S. Brown
> Dimension Networks, Inc.
> (727) 723-8388
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Writing to files

You could try using the file() function.  Then loop backward through the
array or use array_reverse.



  -- Rob



"Jason Giangrande" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Any ideas on how I can print the lines of my file in reverse order,
> then?  Does fgets() always process from the beginning of the file even
> if you open the file with the pointer at the end?  I tried to get the
> line count of the file and go through each line of the file backwards
> but that doesn't seem to work, so either it's impossible or I'm going
> about it the wrong way.  Here's the code:
>
> $fh = fopen("data.txt", "a+") or die("Could not open file");
> $line_num = 0;
> while (! feof($fh)) {
> if ($line = fgets($fh, 1048576)) {
> $line_num++;
> }
> }
> while ($line_num != 0)) {
> if ($line = fgets($fh, 1048576)) {
> print $line;
> $line_num--;
> }
> }
>
> Thanks,
> Jason
>
>
> On Fri, 2003-07-11 at 15:04, David Nicholson wrote:
> > Hello,
> >
> >
> > This is a reply to an e-mail that you wrote on Fri, 11 Jul 2003 at
19:56,
> > lines prefixed by '>' were originally written by you.
> > > Is there a way to write to a beginning of a file without it
> > > overwriting
> > > data that's already there or do I have to write to the end of the file
> > > in order to preserve data?  I ask because it would be much easier to
> > > print the lines of the file out in order of last added first if I
> > > could
> > > add lines at the top of the file.
> >
> > Not without reading the entire file into a variable first then appending
> > that variable to the data you wish to add and saving the entire file
again
> > (which will obviously take longer than appending to the end of the
file).
> >
> > David.
> >
> > -- 
> > phpmachine :: The quick and easy to use service providing you with
> > professionally developed PHP scripts :: http://www.phpmachine.com/
> >
> >   Professional Web Development by David Nicholson
> > http://www.djnicholson.com/
> >
> > QuizSender.com - How well do your friends actually know you?
> >  http://www.quizsender.com/
> > (developed entirely in PHP)
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] omitting the #!

First of all, I apologize if I'm asking a question with an obvious answer.

I do my php development on a Windows 2000 machine. Whenever I move php apps
to the production server I have to add the path to php (#!/usr/bin/php) to
the top of every php file. Is there some way I can configure the Apache or
PHP so that I don't need to do this anymore? The server is Red Hat Linux 9.0
with Apache 2.0.40 and PHP 4.2.2. Thanks.
-Rob

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Include(remote HTML file) doesn't work since upgrade

"Police Trainee" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Warning: main(http://143.43.222.103/sga)
> [function.main]: failed to create stream: Invalid
> argument in
> /hsphere/local/home/domain/mydomain.com/includesite.php
> on line 2
>
> Warning: main() [function.main]: Failed opening
> 'http://143.43.222.103/sga' for inclusion
> (include_path='.:/usr/local/lib/php') in
> /hsphere/local/home/domain/mydomain.com/includesite.php
> on
> line 2
>


Ok - this is kinda weird, but I got it to work on my machine after getting
the same error.
I tried including a page off a different server and it worked just fine.  So
I started messing around and got the following to work for the page you're
trying to include:

  include('http://wiu.edu/SGA/');

Of course, the graphics don't show...
Don't ask me why that works instead, but it does for me.  Give it a shot.

  -- Rob






>
> > What happens when you try to include it?  Is there
> > an error?
> >
> >
> >
> > -- 
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>
> __
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software
> http://sitebuilder.yahoo.com



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Freeze Pane

I recently had to do something similar, except with the first row, instead
of the the first columns.  The way I did it was by creating two different
tables, and putting the second table inside a  tag something like
follows:



Here is an example I found on MS website about how to use this:

http://msdn.microsoft.com/workshop/samples/author/dhtml/refs/scrollTop.htm

Using this you can set how much data you want to display and then let it
create scroll bars right inside your page.  I think it's a little bit
cleaner than frames.

  -- Rob


"Jason Martyn" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
This is probably under the category of javascript, however I would like ot
know if it is possible to be done with php.

Let's say I have a table that is 30 columns wide and so the entire table
doesn't fit on the screen. Is it possible (with php) to "freeze columns"
while scrolling across so you don't lose the original 2 columns?

And since it probably isn't, can someone suggest a language that would cover
this subject?

Thanks,
Jay



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Store array as Session Variable


"Pushpinder Singh Garcha" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> $details is empty !!
>

I'd check your sql query and see if any rows are being returned.  Also, put
the initializing of the array ($company_name = array()) outside of your
loop, just in case.

I used to think that you had to serialize arrays before saving to session,
but apparently that's not the case.  Good to know.

  -- Rob



> Thanks
> --Pushpinder
>
>
> On Monday, July 28, 2003, at 03:31 PM, CPT John W. Holmes wrote:
>
> > $details is an array (just like $company_name was). Try to view
> > print_r($details); and see what you get.
> >
> > ---John Holmes...
> >
> > - Original Message -
> > From: "Pushpinder Singh Garcha" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Monday, July 28, 2003 3:18 PM
> > Subject: [PHP] Store array as Session Variable
> >
> >
> > hello All,
> >
> >   I am trying to store an array as a session variable.
> >
> > while ($row = mysql_fetch_array($result))
> > {
> > if ( !is_array($company_name) ) $company_name = array();
> >array_push($company_name, $row['company']);
> >
> > // try to register session variable
> >  $_SESSION['link'] = $company_name;
> >
> > }
> >
> >
> > Now when I try to access this session variable in another file...I am
> > getting a junk value.I am not sure if I am getting this right.
> >
> > $details = $_SESSION['link'];
> >   echo "LINK: ".$details."";
> >
> >
> > Can some one fill me in on this. Appreciate it !  Thanks in advance.
> >
> > --Pushpinder Singh
> >
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: include and imagejpg() weird behavior - maybe header?

"Oli" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I have a function that resizes images. If I put it in the same php file
that
> calles it it workes fine. Gives a nice thumbnail or whatever size I choose
> to display. If I however put it in a seperate file and include it and call
> it I get garbage and the following error:
>
> Warning: Cannot modify header information - headers already sent by
(output
> started at /home/edal/public_html/album/image.php
>
> Here is the resize function (in file image.php):
>function resize($filepath,$nw = 50,$string = '')
> {
> header("Content-type: image/jpeg");

The above line is causing your error.  According to the error, it's
something in your image.php file.  Is there a space or carriage return
before your opening php tag in image.php?

  -- Rob



> $im = imagecreatefromjpeg($filepath);
> $w  = imagesx ($im);
> $h  = imagesy ($im);
> $nh = round($h*$nw/$w,0);
> $newim  = imagecreatetruecolor($nw,$nh);
> $black  = imagecolorallocate($newim, 0, 0, 0);
> imagecopyresampled($newim,$im,0,0,0,0,$nw,$nh,$w,$h);
> imagestring($newim, 2, 5, 5, $string, $black);
> imagedestroy($im);
> return $newim;
> } ?>
>
> and the calling script:
>include 'image.php';
>   $image = resize('Capri.jpg',200,'Capri');
>   imagejpeg($image);
>   imagedestroy($image);
> ?>
>
> Any ideas?
>
> Oli
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: include and imagejpg() weird behavior - maybe header?

I copied and pasted your code into two different files, changed the image
name (of course) and it worked just fine on the first try for me.  You must
have something being output before your header() call.  If you can't find
it, send me your two files and I'll try running them on my server.

  -- Rob



"Oli" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Nobe, the image.php script starts with  Also if I comment out the header function I don't get the header error but
I
> get the gobbledygook (the picture data I guess). Combine the code in one
> script and all is fine, with or without the header function.
>
> Oli
>
>
> "Rob Adams" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > "Oli" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> > > I have a function that resizes images. If I put it in the same php
file
> > that
> > > calles it it workes fine. Gives a nice thumbnail or whatever size I
> choose
> > > to display. If I however put it in a seperate file and include it and
> call
> > > it I get garbage and the following error:
> > >
> > > Warning: Cannot modify header information - headers already sent by
> > (output
> > > started at /home/edal/public_html/album/image.php
> > >
> > > Here is the resize function (in file image.php):
> > >  > >   function resize($filepath,$nw = 50,$string = '')
> > > {
> > > header("Content-type: image/jpeg");
> >
> > The above line is causing your error.  According to the error, it's
> > something in your image.php file.  Is there a space or carriage return
> > before your opening php tag in image.php?
> >
> >   -- Rob
> >
> >
> >
> > > $im = imagecreatefromjpeg($filepath);
> > > $w  = imagesx ($im);
> > > $h  = imagesy ($im);
> > > $nh = round($h*$nw/$w,0);
> > > $newim  = imagecreatetruecolor($nw,$nh);
> > > $black  = imagecolorallocate($newim, 0, 0, 0);
> > > imagecopyresampled($newim,$im,0,0,0,0,$nw,$nh,$w,$h);
> > > imagestring($newim, 2, 5, 5, $string, $black);
> > > imagedestroy($im);
> > > return $newim;
> > > } ?>
> > >
> > > and the calling script:
> > >  > >   include 'image.php';
> > >   $image = resize('Capri.jpg',200,'Capri');
> > >   imagejpeg($image);
> > >   imagedestroy($image);
> > > ?>
> > >
> > > Any ideas?
> > >
> > > Oli
> > >
> > >
> >
> >
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] cookies on localhost WinXP

"Cpt John W. Holmes" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> From: "Steve Buehler" <[EMAIL PROTECTED]>
> > hm.  Looks like on my localhost I can't seta cookie like this:
> > setcookie ("coach_access[login_id]", "coach",0,"/","$cookhost");
> > if I change it to just:
> > setcookie ("coach_access_login_id", "coach",0,"/","$cookhost");
> > it will work.  But then my script won't work without a lot of re-writing
> > because it uses $coach_access[login_id] instead.  Any help here?  Am I
> just
> > doing something wrong?  I can't set it with the following either.
> > header('Set-Cookie: coach_access[login_id]=coach');
> > But can as:
> > header('Set-Cookie: coach_access_login_id_=coach');
> > but again, I would have to re-write a lot of script.
>
> You'd be better of if you re-wrote your code to make it correct, but you
> could just put:
>
> $coach_access['login_id'] = $_COOKIE['coach_access[login_id]'];
>
> Please don't tell us that you're storing login IDs in a cookie and
actually
> depending upon them for anything??

Um, why not?  I do it all the time, and if there is some security issue or
other reason to not do it I'd like to know so I can change my style in the
future.  I generally create a random hex string 40 chars long and store it
as a cookie called loginid.

  -- Rob



>
> ---John Holmes...
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: global scope issue


"Shawn McKenzie" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I'm having problems using global vars.  I have read the docs and all of
the
> notes but it's not helping.  Simplified example:

Simplified?  So maybe what you're giving us doesn't include the problem?
The scripts below work for me.

>
> /dir1/script2.php
>  $test = array ( 'a' => '1', 'b' => '2');
> ?>
>
> /dir1/script1.php
>  include("/dir1/script2.php");
> print_r($test);  //works great
> print_r($GLOBALS['test']);  //does not work
> ?>
>

When I've had similar problems it has almost always been because I'm trying
to access the variable inside a function without declaring it as global.

> This is a local include so the vars should be in the global scope right?
> Any help please?
>
> TIA
> -Shawn
>
>
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] strtotime()


"Jennifer Goodie" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> > > > strtotime( '+1 month', mktime( 0, 0, 0, 1, 1, 2003 ));
> > > > I get back the timestamp for 1/31/2003 and not 2/1/2003.
> > > Are you sure?
> >
> > Yeah, but I missed something in my above example.  If I did this:
> >
> > strtotime( '+1 month GMT', mktime( 0, 0, 0, 1, 1, 2003 ));
> >
> > It came back with 1/31/2003 and not 2/1/2003.  Removing the GMT
> > made it work.
>
> Are you somewhere behind GMT?  I get an hour shift when using GMT that
puts
> me in the previous day.  I'm GMT -8.  I can't think right now, but for
some
> reason it seems like it's shifting in the wrong direction or at least the
> opposite of what I'd expect.  I guess it is subtracting my 8 hours and
then
> shifting, making it 16:00 of the previous day.  It seems like it should
add
> 8 hours since GMT is 8 ahead of me.  This is making my head hurt, maybe
> someone else can make it make sense.
>
> # php
>  $ts = mktime( 0, 0, 0, 1, 1, 2003 );
> echo date ("Y-m-d H:i:s",$ts)."\n";
> $ts2 = strtotime('+1 month GMT', $ts);
> echo date ("Y-m-d H:i:s",$ts2)."\n";
> $ts3 = strtotime('+1 month', $ts);
> echo date ("Y-m-d H:i:s",$ts3)."\n";
> ?>
> X-Powered-By: PHP/4.2.3
> Content-type: text/html
>
> 2003-01-01 00:00:00
> 2003-01-31 16:00:00
> 2003-02-01 00:00:00
>

It is adjusting for your 8 hour differences.

Your server is -8 from GMT.
So when you set it to '+ 1 month GMT' it will set the date to one month from
the given date, but in GMT time.  So to convert back from GMT time to your
time, it needs to minus the 8 hours, and you get 4 PM the day before.

  -- Rob



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: global scope issue

Don't you just hate it when the thread your replying to has gone on to some
other thread that you didn't notice?

  -- Rob


"Rob Adams" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> "Shawn McKenzie" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > I'm having problems using global vars.  I have read the docs and all of
> the
> > notes but it's not helping.  Simplified example:
>
> Simplified?  So maybe what you're giving us doesn't include the problem?
> The scripts below work for me.
>
> >
> > /dir1/script2.php
> >  > $test = array ( 'a' => '1', 'b' => '2');
> > ?>
> >
> > /dir1/script1.php
> >  > include("/dir1/script2.php");
> > print_r($test);  //works great
> > print_r($GLOBALS['test']);  //does not work
> > ?>
> >
>
> When I've had similar problems it has almost always been because I'm
trying
> to access the variable inside a function without declaring it as global.
>
> > This is a local include so the vars should be in the global scope right?
> > Any help please?
> >
> > TIA
> > -Shawn
> >
> >
> >
> >
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: google style paginating

The Pear Pager class works like a champeen, too.  It'll paginate results 
however you'd like it to.

~Rob

Chris W. Parker wrote:
Robert Cummings <mailto:[EMAIL PROTECTED]>
on Thursday, August 21, 2003 4:46 PM said:

Don't retrieve ALL the queries then
only display a subset. Otherwise what's the point of using the LIMIT
clause for conservation of resources?  The "SELECT COUNT( * ) FROM
foo" query is usually optimized to be extremely fast so the first
query is almost negligible in contrast to the second.


Heh... I've never really used COUNT() so I'll have to see how much it
speeds up my searching. :)
Good idea!

Chris.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] float precision format not being kept

I have a list of floats that I need to put into an array, when I put 
them into an array manually the floats lose their format, for example:

$a = array(1=>3.50807443617658E-4);

print $a[1] returns: 0.00035080744361766

I'm familiar with round() and all the math functions, but I'm stumped.

Any light anyone can shed on this would be appreciated.  ;)

Thanks,

~Rob Yelvington

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] WYSIWYG editor for PHP

Active State's Komodo and Zend Studio are both awesome!  I used to use 
Dreamweaver, but it's syntax highlighting stinks...IMHO.

~Rob

Bix wrote:
I use dreamweaver in live data mode quite often, really works a treat!

Set up a a site and in the testing server, just set it as /beta or the like,
then edit your script, and run it in live data and you can feed it
post/get/cookie data on the fly.
"Jay Blanchard" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
[snip]
I need a WYSIWYG editor for PHP. That is all.
Can any1 advice me one( or more :-) )?
[/snip]
Dreamweaver?




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] how to keep decimals from rounding

Is there a way to surpress round() or number_format() from rounding 
decimal places?

I have a value of ".253338" being returned via a calc function.

I take that value and multiply by 100 because I want "25.333" to be 
displayed.

I've used round(), sprintf(), and number_format() and each of them 
rounds the value up.

I had a problem with precision earlier which I solved...my 'precision' 
setting in php.ini was set too low.  Is there something in php.ini that 
controls rounding?

Any heads up are appreciated!

Thanks,

~Rob

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Array Question

Creating an array that holds the 11 combined records from the two tables,
and sorting the array according to date:  (This depends on what type your
using to store dates in MySQL, and that the exact date is unique for each
record across both tables.  If the date isn't unique, it requires a little
modification to the assignment in the array and the display later on.)

date_field_name] = $tmp;
mysql_free_result($res);
// repeat previous 4 lines for table2.

sort($tbl_arr);

foreach($tbl_arr as $dt => $record)
  echo date(" -- date format -- ", $dt) . "$record->field1 -
$record->field2 - etc...";
?>

  -- Rob

"Mark McCulligh" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I can't link the two tables at all.
>
> I need to loop through one displaying its information, then loop through
the
> other table displaying its information.  For if I have 5 records in table
A
> and 6 records in table B, I get 11 records total. Each table only has 4-5
> fields and they exist in both table. The two tables have the same
structure
> minus one field.  The two tables should have been one table but I didn't
> design the database but have to make it work. Using I would use a view to
> make one master table then order it by the common date field. But MySQL
> doesn't have view let.
>
> The reason I can't just display one table after the other is that I need
the
> PHP page to have the results ordered by the common date field.
>
> I can't link the two tables together in the SQL.
>
> Mark.
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: 4 or 5 Fridays this month

>"Liam Gibbs" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>Is there any easy way of figuring out if there are 4 or if there are 5
Fridays in a given month? I have it >figured out using a loop, but I was
just wondering if there was a way that date() or strtotime() could >do it.


K - given a month and year of $month, $year:  (not really  much prettier
than a loop...)

function num_fridays($month, $year)
{
$fdom = mktime(0, 0, 0, $month, 1, $year);
$wday = date("w", $fdom);  // get weekday
if ($wday > 5 or $wday < 3) // 5 Fridays impossible.
return 4;
$lday = date("t", $fdom);  // get number of days in the month
$buffer = $lday - 28;
if ($wday >= (5 - $buffer) and ($wday <= 5))
return 5;
else
return 4;
}

This worked for me on a couple test months.

  -- Rob



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP Class for IP CIDR notation

does anyone know of a class that is able to extrapolate a list of IPs given an 
address in cidr notation. I have used the Net::Netmask module in perl, so I 
was just wondering if there was a PHP equivalent.

Thanks

Rob

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: ereg_replace question

"Todd Cary" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]

I have a string,
This does not work
  $fullpath = $HTTP_SERVER_VARS[PATH_TRANSLATED];
  $fullpath = ereg_replace("\\[^\\]+$","",$fullpath) . '\\';
What have I missed?
Todd



-- 
You could just use:

 $path = dirname($fullpath);

  -- Rob



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: ignored php.ini?

<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello,
>I have php 4.3.2 running as isapi module on windows 2000.
> I have a php.ini in d:\winnt
>
> but when I edit it the output from
>
>  
>
> is as before.
>
> Any hints? Many thanks in advance, bye
> _


Do you have a php.ini in the same directory that php.exe (or whatever dll)
is in?  It may be checking the local directory first before going to the
system directory.

  -- Rob



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Weird comparison error.

I don't need anything fixed, I'm just curious about something I noticed.

I'm doing a comparison between a variable and a hard coded char.  Like this:
if ($k1 == "n")

The variable is usually the first key in an array (0) so it should usually
evaluate false, but it was true every time until I changed it to:
if ($k1 === "n")

So I'm assuming that it decided that since $k1 was an int to convert "n" to
an int (which would be 0) and conclude that 0 does indeed equal "n".  So I
decided for fun to try:
if ("n" == $k1)

And it still was true everytime.  So why does it always try convert my
literal to an int instead of use the variable as a string?

Just curious.  Thanks.

  -- Rob



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Weird comparison error.


"Lars Torben Wilson" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Sat, 2003-06-28 at 11:28, Bobby Patel wrote:
> > In PHP there are two operators for comparisons, the double and triple
> > equivalance.
> >
> > Double equivalance just check's the boolean type so if (0 == 'n') is
> > translated to if (False == False), where as triple equivalance checks
the
> > data types as well so if (0==='n') becomes if
(Int(False)==String(False))
> > but since the data types don't match that would be False.
> >
> > to get a better reference check PHP.net for 'Bolean Types' , because  I
> > think I dodn't explain the double equivalance right, and also it will
> > clarify situations of the Null type.
> >
> > Bobby
>
> You got pretty close, but not quite. :) In the case of the equality
> operator '==', there is nothing specific to do with boolean evaluation
> going on. It just converts the string to its integer value implicitly
> before checking for equality, and according to the string->integer
> conversion rules, the string ends up being (int) 0 so the whole thing
> matches.
>
> Also, it might be easier to think about the identical operator '===' as
> just testing whether two values are identical, meaning that they are
> both of the same type, and that they both have the same value.


Yeah, I understand the difference between the double and triple '='.  I was
just surprised to find that when comparing what was two string values,
because one of the strings was '0', it decided to convert both strings to an
integer.  I'll just have to use the '===' or strcmp from now on.

>
> More information:
>
> http://www.php.net/manual/en/language.types.type-juggling.php
>
http://www.php.net/manual/en/language.types.string.php#language.types.string.conversion
>
> ...in fact, the whole 'Language' section of the manual has a bunch of
> stuff on this.
>
>
> Hope this helps,

Thanks.

>
> Torben


  -- Rob




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] not so


[0] would match the whole ip, I was hoping [1] and[2] would echo the next 2
found, but it doesn't
Thanks



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] not so


oops, no coffee yet

"Jason Wong" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> On Saturday 08 June 2002 22:36, Rob Packer wrote:
> > [0] would match the whole ip, I was hoping [1] and[2] would echo the
next 2
> > found, but it doesn't
>
> 1) Could you not start a new thread each time? It makes it difficult for
> people to help because your responses and their repsonses are all over the
> place.
>
> And a subject which matches the discussion in hand would be appreciated.
When
> people search through the archives and come across a thread named "not
so",
> what on earth are they supposed to make of that?
>
> 2) I asked you to show the format of your input file. Without knowing what
it
> looks like there's not much anyone can do to help you.
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
>
> /*
> Memory fault -- core...uh...um...core... Oh dammit, I forget!
> */
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Session wierdness


Is it possible to use PHP sessions reliably?
I get very inconsistent results.
I register session vars after a password check.
I use session_start at the top of every file.
I watch the /tmp directory for session files.
Within a few random page transitions the session data inside the registered
variables gets emptied. (for instance, $userid=$HTTP_SESSION_VARS['userid'];
 no longer returns the registered variable userid).
The session file is still there, but the value reported by session_id() is
different than the sessionid portion of any session filename.  At this point
session_destroy doesn't delete the session file either, so apparently it
doesn't know which session it is really in.
I've bought two books (Wrox and Vis Quickpro) and neither of these books
addresses possible session flakiness.
So, is it my flaky code, IE's cookie hijinks or maybe that PHP is not really
ready to do robust session management?
BTW: I am using PHP ver 4.0.6 (patched for file upload bug) on
Linux/Apache/MySQL

Any suggestions would be appreciated!
[EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Insert an array into MySQL


Hi, I've seen a few post for this same thing but I can't seem to get it
working. What I'm doing is taking a form with check boxes and putting them
into an array. Then I'm attempting to INSERT them into the db, one checkbox
value per row.

Okay,  well I've tries 2 ways that I think should work and they only insert
the first value. They both produce this error "Duplicate entry '0' for key
1" (which I don't understand) Anyway here is the code I'm trying...

(I'm not trying to use both blocks of code, just one or the other)

// First code
while(list($key,$value)=each($pagetype)){
//echo $value."";//test
$links="INSERT INTO $username_links (links) VALUES ('$value')";
$insert=mysql_query($links,$connection);

}

// Second code attempt
$number=count($pagetype);
for($a=0;$a<$number;$a++){
$links="INSERT INTO $username_links (links) VALUES ('$pagetype[$a]')";
$insert=mysql_query($links) or die(mysql_error());
//echo $pagetype[$a];//test
}




Thanks in advance...Robert



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Insert an array into MySQL



"John Holmes" <[EMAIL PROTECTED]> wrote in message
001201c21ab5$0df073a0$b402a8c0@mango">news:001201c21ab5$0df073a0$b402a8c0@mango...
> Your second method should work, but it's dependent on what your form
> looks like and how your table was created. You obviously have a key set
> for this column and you're trying to insert the same value twice, which
> makes an error.
>
> Show us what your form looks like, not the whole thing, just for the
> checkboxes. Also, what does your CREATE TABLE look like for the table
> your trying to insert this data into?
>
> ---John Holmes...
>
> > -Original Message-
> > From: Rob Packer [mailto:[EMAIL PROTECTED]]
> > Sent: Sunday, June 23, 2002 7:50 AM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] Insert an array into MySQL
> >
> > Hi, I've seen a few post for this same thing but I can't seem to get
> it
> > working. What I'm doing is taking a form with check boxes and putting
> them
> > into an array. Then I'm attempting to INSERT them into the db, one
> > checkbox
> > value per row.
> >
> > Okay,  well I've tries 2 ways that I think should work and they only
> > insert
> > the first value. They both produce this error "Duplicate entry '0' for
> key
> > 1" (which I don't understand) Anyway here is the code I'm trying...
> >
> > (I'm not trying to use both blocks of code, just one or the other)
> >
> > // First code
> > while(list($key,$value)=each($pagetype)){
> > //echo $value."";//test
> > $links="INSERT INTO $username_links (links) VALUES ('$value')";
> > $insert=mysql_query($links,$connection);
> >
> > }
> >
> > // Second code attempt
> > $number=count($pagetype);
> > for($a=0;$a<$number;$a++){
> > $links="INSERT INTO $username_links (links) VALUES ('$pagetype[$a]')";
> > $insert=mysql_query($links) or die(mysql_error());
> > //echo $pagetype[$a];//test
> > }
> >
> >
> >
> >
> > Thanks in advance...Robert
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Insert an array into MySQL


oops, sorry about the other post (I've got a baby that likes the
keyboard)...

Hi,

This is the form, which I had doubts about, but it seemed to put things into
the array correctly when I tested it by printing it out.
I can't see how, it will print
key=0
value=index.html
key=1
value=about.html
key=2
value=whats_new.html
when I test it and then have a duplicate key. It's saying that I have 2
$pagetype[0] correct? Anyhow, here's the form...

Home Page 
About Page  
What's New
Page
Contact Page
Favorite
Links 


The CREATE TABLE is this:
I define the table name from user input.

 $query_links="CREATE TABLE $username_links (id INT(4) not null, links
VARCHAR(20) not null, UNIQUE (id))";
 if(mysql_query($query_links,$connection)){
  echo "Links table created!";
 }else{
  echo "no links table made";
 }




thanks,
 Rob




"John Holmes" <[EMAIL PROTECTED]> wrote in message
001201c21ab5$0df073a0$b402a8c0@mango">news:001201c21ab5$0df073a0$b402a8c0@mango...
> Your second method should work, but it's dependent on what your form
> looks like and how your table was created. You obviously have a key set
> for this column and you're trying to insert the same value twice, which
> makes an error.
>
> Show us what your form looks like, not the whole thing, just for the
> checkboxes. Also, what does your CREATE TABLE look like for the table
> your trying to insert this data into?
>
> ---John Holmes...
>
> > -Original Message-
> > From: Rob Packer [mailto:[EMAIL PROTECTED]]
> > Sent: Sunday, June 23, 2002 7:50 AM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] Insert an array into MySQL
> >
> > Hi, I've seen a few post for this same thing but I can't seem to get
> it
> > working. What I'm doing is taking a form with check boxes and putting
> them
> > into an array. Then I'm attempting to INSERT them into the db, one
> > checkbox
> > value per row.
> >
> > Okay,  well I've tries 2 ways that I think should work and they only
> > insert
> > the first value. They both produce this error "Duplicate entry '0' for
> key
> > 1" (which I don't understand) Anyway here is the code I'm trying...
> >
> > (I'm not trying to use both blocks of code, just one or the other)
> >
> > // First code
> > while(list($key,$value)=each($pagetype)){
> > //echo $value."";//test
> > $links="INSERT INTO $username_links (links) VALUES ('$value')";
> > $insert=mysql_query($links,$connection);
> >
> > }
> >
> > // Second code attempt
> > $number=count($pagetype);
> > for($a=0;$a<$number;$a++){
> > $links="INSERT INTO $username_links (links) VALUES ('$pagetype[$a]')";
> > $insert=mysql_query($links) or die(mysql_error());
> > //echo $pagetype[$a];//test
> > }
> >
> >
> >
> >
> > Thanks in advance...Robert
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Insert an array into MySQL


Nevermind, I got it. I had Unique for a field which made it mad.




"Rob Packer" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> oops, sorry about the other post (I've got a baby that likes the
> keyboard)...
>
> Hi,
>
> This is the form, which I had doubts about, but it seemed to put things
into
> the array correctly when I tested it by printing it out.
> I can't see how, it will print
> key=0
> value=index.html
> key=1
> value=about.html
> key=2
> value=whats_new.html
> when I test it and then have a duplicate key. It's saying that I have 2
> $pagetype[0] correct? Anyhow, here's the form...
>
> Home Page 
> About Page  
> What's New
> Page
> Contact Page
> Favorite
> Links 
>
>
> The CREATE TABLE is this:
> I define the table name from user input.
>
>  $query_links="CREATE TABLE $username_links (id INT(4) not null, links
> VARCHAR(20) not null, UNIQUE (id))";
>  if(mysql_query($query_links,$connection)){
>   echo "Links table created!";
>  }else{
>   echo "no links table made";
>  }
>
>
>
>
> thanks,
>  Rob
>
>
>
>
> "John Holmes" <[EMAIL PROTECTED]> wrote in message
> 001201c21ab5$0df073a0$b402a8c0@mango">news:001201c21ab5$0df073a0$b402a8c0@mango...
> > Your second method should work, but it's dependent on what your form
> > looks like and how your table was created. You obviously have a key set
> > for this column and you're trying to insert the same value twice, which
> > makes an error.
> >
> > Show us what your form looks like, not the whole thing, just for the
> > checkboxes. Also, what does your CREATE TABLE look like for the table
> > your trying to insert this data into?
> >
> > ---John Holmes...
> >
> > > -Original Message-
> > > From: Rob Packer [mailto:[EMAIL PROTECTED]]
> > > Sent: Sunday, June 23, 2002 7:50 AM
> > > To: [EMAIL PROTECTED]
> > > Subject: [PHP] Insert an array into MySQL
> > >
> > > Hi, I've seen a few post for this same thing but I can't seem to get
> > it
> > > working. What I'm doing is taking a form with check boxes and putting
> > them
> > > into an array. Then I'm attempting to INSERT them into the db, one
> > > checkbox
> > > value per row.
> > >
> > > Okay,  well I've tries 2 ways that I think should work and they only
> > > insert
> > > the first value. They both produce this error "Duplicate entry '0' for
> > key
> > > 1" (which I don't understand) Anyway here is the code I'm trying...
> > >
> > > (I'm not trying to use both blocks of code, just one or the other)
> > >
> > > // First code
> > > while(list($key,$value)=each($pagetype)){
> > > //echo $value."";//test
> > > $links="INSERT INTO $username_links (links) VALUES ('$value')";
> > > $insert=mysql_query($links,$connection);
> > >
> > > }
> > >
> > > // Second code attempt
> > > $number=count($pagetype);
> > > for($a=0;$a<$number;$a++){
> > > $links="INSERT INTO $username_links (links) VALUES ('$pagetype[$a]')";
> > > $insert=mysql_query($links) or die(mysql_error());
> > > //echo $pagetype[$a];//test
> > > }
> > >
> > >
> > >
> > >
> > > Thanks in advance...Robert
> > >
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] how to keep decimals from rounding

Curt, thanks for the reply and the suggestion.  Truncating is exactly 
what I will do.

Thanks!

~Rob

Curt Zirzow wrote:
* Thus wrote Rob Yelvington ([EMAIL PROTECTED]):

Is there a way to surpress round() or number_format() from rounding 
decimal places?

I have a value of ".253338" being returned via a calc function.

I take that value and multiply by 100 because I want "25.333" to be 
displayed.

I've used round(), sprintf(), and number_format() and each of them 
rounds the value up.


One  would expect sprintf not too round, but, behold, it does.
According to bugs.php.net, it is not a bug.

I had a problem with precision earlier which I solved...my 'precision' 
setting in php.ini was set too low.  Is there something in php.ini that 
controls rounding?

Any heads up are appreciated!


Perhaps by truncating the string to your precision that you desire.

Curt
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Mail problem

[snip]
I have about 9000 addresses and can only successfully send about 2000
mails
before the page say complete/done.
[/snip]

Depending on your error reporting level, instead of ending normally you
should get a script timed out message.  If you're not getting that message,
it may be that your script is really only trying to send out 2000 emails.
Are you using some kind of database query to get the email addresses?  If
so, check how many rows are being returned.

  -- Rob

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Array of Classes

Greetings..

Doing some persistant connection socket-based PHP stuff and I'm trying to
figure out a few things:

1) How can I create an array of classes so they could be referenced, for
instance: $array[$uniqueID][$class->var] = 10; ?

2) Would it instantiate when that particular element was used and would the
constructor run at that point?

3) Any way to dispose/destroy of an object once it's done being used to free
up the resources?

Thanks,
Rob

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Array of Classes

Cheers!  Just what I was looking for. :)

Rob
"David Otton" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Mon, 6 Oct 2003 13:41:22 -0400, you wrote:
>
> >1) How can I create an array of classes so they could be referenced, for
> >instance: $array[$uniqueID][$class->var] = 10; ?
> >
> >2) Would it instantiate when that particular element was used and would
the
> >constructor run at that point?
> >
> >3) Any way to dispose/destroy of an object once it's done being used to
free
> >up the resources?
>
> 
> class A {
> function A () {
> echo ("Created");
> }
>
> function B ($s = "None") {
> echo ("input : $s");
> }
> }
>
> $C = array();
>
> for ($i = 0; $i < 3; $i++)
> {
> $C[$i] = new A();
> }
>
> for ($i = 0; $i < 3; $i++)
> {
> $C[$i]->B($i);
> }
>
> for ($i = 0; $i < 3; $i++)
> {
> unset ($C[$i]);
> }
>
> ?>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Smarty problem

"Webmaster" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> I already posted this question in the Smarty group, without success.
>
> I have a problem with Smarty. I wrote the following function that gets
data
> from a mysql database:
>
>  function showHeadlines()
>  {
>   global $db;
>   $entry_events = array();
>
>   if ($this->showold == "true")
>  {
>   $db->select("*", "news", "(d_kategorie = 'de_termin')", "d_datum
> ASC", "", "", "");
>
>   $entry_events = $db->fetch_array();
>
>   $this->assignVars('termineAus', $this->aTrans['termineAus']);
>$this->assignVars('entry_events', $entry_events);
>   }
>
> The template part looks like this:
>
> align="center">
> 
>   {$events}
>  
>  
>href="{$filenpath}?showold={$showold}">{$termineAus}
>  
>  {section name=i loop=$entry_events}


{foreach} seems to be a better choice to use here.  Whenenver I've had
problems with sections, changing them to foreachs usually fixes it.


>  
>  {$entry_events[i].d_datum}
> {$entry_events[i].d_zeit}
>  
>  
>  {$entry_events[i].d_ueberschrift}
>  
>  
>  {$place}: {$entry_events[i].d_ort}
>  
>  {/section}
>
>
>
> The problem is that the output in only garbage?
> Is there a logical problem ?
>
> Thank you very much

Welcome.

  -- Rob

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: what is the best PHP editor?

I like EditPlus too, but recently I've been using UltraEdit.
http://www.ultraedit.com/
$35 registration.  Has great column mode support.  I use the macros and
templates all the time.  Has a word file for PHP.

  -- Rob



"Dougd" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I currently use EditPlus - and like it -- is there anything else out there
> that is better and still reasonably priced.
>
> Thanks.
>
> -Doug

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: what is the best PHP editor?

I actually tried this a while ago, and must've had a really early version.
It showed a lot of promise, but there were too many problems, and the error
text was mostly German, so I couldn't tell what was wrong or how to fix it.
I'll have to give it another shot now.

  -- Rob



"Daniel Guerrier" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> http://www.phpedit.net
>
> It's good.
> How good, is up to you.
>
> --- Rob Adams <[EMAIL PROTECTED]> wrote:
> > I like EditPlus too, but recently I've been using
> > UltraEdit.
> > http://www.ultraedit.com/
> > $35 registration.  Has great column mode support.  I
> > use the macros and
> > templates all the time.  Has a word file for PHP.
> >
> >   -- Rob
> >
> >
> >
> > "Dougd" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> > > I currently use EditPlus - and like it -- is there
> > anything else out there
> > > that is better and still reasonably priced.
> > >
> > > Thanks.
> > >
> > > -Doug
> >
> > -- 
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>
> __
> Do you Yahoo!?
> The New Yahoo! Shopping - with improved product search
> http://shopping.yahoo.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Foreach Array Help


"Jed R. Brubaker" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Okay, total newbie when it comes to arrays, and I could really use some
> help. I sure this will be an easy one for you veterans out there.
>
> Here is the array ($code):
> array(2) {
>   ["total"]=>
>   int(1)
>   ["assign"]=>
>   array(1) {
> [1]=>
> array(3) {
>   ["type"]=>
>   string(10) "Transcript"
>   ["rows"]=>
>   string(3) "603"
>   ["codeapply"]=>
>   array(1) {
> [1]=>
> array(3) {
>   ["codeset"]=>
>   string(23) "FFT 6 Level Code System"
>   ["code_rows"]=>
>   string(3) "302"
>   ["code_complete"]=>
>   string(1) "2"
> }
>   }
> }
>   }
> }
>
> Here is the output code:
> foreach ($this->code['assign'] as $assign => $details)
> {
> foreach ($assign['codeapply'] as $codeapply => $ca_details)
> {
> echo "";
> echo"";
> echo$details['type']." ".$assign;
> echo"";
> echo"";
> echo"";
> echo$ca_details['codeset'];
> echo"";
> echo"";
> echo
> $ca_details['code_complete']."/".$ca_details['code_rows']." Items Coded";
> echo"";
> echo"";
> printf  (" %.0d%%",
> ($ca_details['code_complete']/$ca_details['code_rows'])*100);
> echo"";
> echo "";
> }
> }
>
> Output error:
> Warning: Cannot use a scalar value as an array
> Warning: Invalid argument supplied for foreach()
>
> Conceptually and practically I have been struggling with how to navigate
> levels of the arrays which are defined by a variable (e.g.
> $code['assign'][$i] for the assign ID and $code['assign'][$i][$j] for the

if $code['assign'][$i] has some integer value, then it is not an array.
if $code['assign'][$i][$j] has some integer value, then $code['assign'][$i]
is an array.

You have two mutually exclusive possibilities there.

Probably, what you want to do is something like:

$code['assign'][$i]['aid'] = (assign ID);
$code['assign'][$i][$j] = (whatever you want here);

(which, for simplicity, translates into something like:)

$code['assign'][1]['aid'] = 1;
$code['assign'][1]['1'] = 11;
$code['assign'][1]['2'] = 12;
$code['assign'][1]['3'] = 13;
$code['assign'][1]['4'] = 14;
$code['assign'][1]['5'] = 15;
etc.

  -- Rob




> codeapply ID on the assign ID).
>
> Thanks in advance!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Foreach Array Help


"Jed R. Brubaker" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> First of all, thanks for the response.
>
> Here is where I am getting lost:
> In $code['assign'][1] - "1" is the assignment ID, and I would like the
array
> to be able to hold a billion of these different assignments all with
> conceivably a billion codeapply ID as in
$code['assign'][1]['codeapply'][3],
> where "3" is the codeapply value. In other words, because each of these
> items directly under assign and codeapply are arrays because they hold
> sub-info, I have made the keys of these items the values.
>
> So - am I approaching this whole array thing wrong?

I still don't understand exactly what you want to do, but see below...

>
> Thanks.
>
> "Rob Adams" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> >
> > "Jed R. Brubaker" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> > > Okay, total newbie when it comes to arrays, and I could really use
some
> > > help. I sure this will be an easy one for you veterans out there.
> > >
> > > Here is the array ($code):
> > > array(2) {
> > >   ["total"]=>
> > >   int(1)
> > >   ["assign"]=>
> > >   array(1) {
> > > [1]=>
> > > array(3) {
> > >   ["type"]=>
> > >   string(10) "Transcript"
> > >   ["rows"]=>
> > >   string(3) "603"
> > >   ["codeapply"]=>
> > >   array(1) {
> > > [1]=>
> > > array(3) {
> > >   ["codeset"]=>
> > >   string(23) "FFT 6 Level Code System"
> > >   ["code_rows"]=>
> > >   string(3) "302"
> > >   ["code_complete"]=>
> > >   string(1) "2"
> > > }
> > >   }
> > > }
> > >   }
> > > }
> > >
> > > Here is the output code:
> > > foreach ($this->code['assign'] as $assign => $details)
> > > {

Here, $assign is a key from the $this->code['assign'] array.  Since,
according to the array above, assign has only one element, and the key to
that element is '1', $assign will always be one and this code run through
just once.  $details is an array with three key/value pairs.  They are
'type' => 'Transcript', 'rows' => '603', and 'codeapply' => (an array).

> > > foreach ($assign['codeapply'] as $codeapply =>
$ca_details)
> > > {

So, looking at this it looks like what you actually want to do is:
  foreach($details['codeapply'] ... )

$details['codeapply'] has a single key/value pair, which is ('1' => (an
array)).  This array can be reached by using $ca_details['codeset']... etc.

> > > echo "";
> > > echo"";
> > > echo$details['type']." ".$assign;
> > > echo"";
> > > echo"";
> > > echo"";
> > > echo$ca_details['codeset'];
> > > echo"";
> > > echo"";
> > > echo
> > > $ca_details['code_complete']."/".$ca_details['code_rows']." Items
> Coded";
> > > echo"";
> > > echo"";
> > > printf  (" %.0d%%",
> > > ($ca_details['code_complete']/$ca_details['code_rows'])*100);
> > >     echo"";
> > > echo "";
> > > }
> > > }
> > >
> > > Output error:
> > > Warning: Cannot use a scalar value as an array
> > > Warning: Invalid argument supplied for foreach()
> > >
> > > Conceptually and practically I have been struggling with how to
navigate
> > > levels of the arrays which are defined by a variable (e.g.
> > > $code['assign'][$i] for the assign ID and $code['assign'][$i][$j] for
> the
> >
> > if $code['assign'][$i] has some integer value, then it is not an array.
> > if $code['assign'][$i][$j] has some integer value, then
> $code['assign'][$i]
> > is an array.
> >
> > You have two mutually exclusive possibilities there.
> >
> > Probably, what you want to do is something like:
> >
> > $code['assign'][$i]['aid'] = (assign ID);
> > $code['assign'][$i][$j] = (whatever you want here);
> >
> > (which, for simplicity, translates into something like:)
> >
> > $code['assign'][1]['aid'] = 1;
> > $code['assign'][1]['1'] = 11;
> > $code['assign'][1]['2'] = 12;
> > $code['assign'][1]['3'] = 13;
> > $code['assign'][1]['4'] = 14;
> > $code['assign'][1]['5'] = 15;
> > etc.
> >
> >   -- Rob
> >
> >
> >
> >
> > > codeapply ID on the assign ID).
> > >
> > > Thanks in advance!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Simple array question

"René fournier" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Is there a simple way to return the key (name) of one element in an
> array? I looked up key() in the docs, but there are no examples or
> notes...

key() will do it, but you have to have the internal pointer already on the
element you want.  If you're not using next(), prev(), etc, then what you
probably want to use it array_search().

  -- Rob



>
> Thanks.
>
> ...Rene


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: including files from different sub directories

"Allex" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi all,
>
> What's the syntax for including/requiring files located in directories
> different than the root directory? Especially files from different sub
> directories under the root? Going down ("classes/globals.php") is ok,
> but going up ("../globals.php") makes problems
>
> Example:
>
> index.php: include_once('classes/globals.php') -> works fine;
> dbase.php: include_once('../globals.php') -> generates an error;
> controller.php:include_once('../dataaccess/dbase.php') -> error;
>
> root (dir)
> +-classes (dir)
> |  +-interface (dir)
> |  | |-controller.php
> |  +-dataaccess (dir)
> |  | |-dbase.php
> |  |globals.php
> |index.php
> |

What you probably need to do to go 'up' a directory is something like this:
$dir = dir($_SERVER['SCRIPT_FILENAME']);

Then take off the last directory.  Then either stay there or append another
directory name to it.
Try using strrchr().  Or there is probably a class somewhere to break a path
into all its parts.

  -- Rob



>
> I'm running PHP 4.3.2 with Apache 2 on WinXP box.
>
> Thanks,
> Allex

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] php sessions

"Chris Shiflett" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> --- "S.P.Vimala" <[EMAIL PROTECTED]> wrote:
> > How to create a unique session for every new browser instance?
>
> I'm not sure if this fits your definition of "new browser instance", but
there
> is no way for a remote Web server to distinguish between two instances of
the
> same browser running on the client machine.


That can't be true.  I don't claim to understand exactly how it works, but
here is what happens for me.  I have an application that I log into.  Once
I'm logged in, if I open the URL in another browser window, it just gives me
the login page.  My guess is that the first browser window is passing a
cookie identifying the session that the second one doesn't know about.  In
your case, when you're not using cookies, the session ID must be passed on
the URL.  I don't know much about using trans_sid, so i can't help you
further.

  -- Rob




>
> Maybe that explains something?
>
> Chris
>
> =
> My Blog
>  http://shiflett.org/
> HTTP Developer's Handbook
>  http://httphandbook.org/
> RAMP Training Courses
>  http://www.nyphp.org/ramp

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] php sessions


"Chris Shiflett" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> --- Rob Adams <[EMAIL PROTECTED]> wrote:
> > > I'm not sure if this fits your definition of "new browser
> > > instance", but there is no way for a remote Web server to
> > > distinguish between two instances of the same browser running
> > > on the client machine.
> >
> > That can't be true.
>
> It can, and it is.
>
> The only way a Web server could distinguish between them is if the
browsers

So there is a way, and it's not true.

Test it yourself.  Login to a PHP app using a standard browser and session
cookies and see for yourself.  I understand the philosophy of the web server
only seeing what the client sends it, but it looks like my client (IE6,
right here) does send different requests per instance.  It's not just 'in
theory.'


> sent something unique per instance within the HTTP request. So, you could
write
> a browser that does this in theory, but that doesn't really do you much
good
> unless you can convince your users to use it.
>
> It would be very unusual behavior, so I doubt anyone would want this.
>
> Chris
>
> =
> My Blog
>  http://shiflett.org/
> HTTP Developer's Handbook
>  http://httphandbook.org/
> RAMP Training Courses
>  http://www.nyphp.org/ramp

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] php sessions

I will test it, because it seems I don't understand this issue as much as I
could.  But I can already tell you results I see right now:

I open a web browser (IE) and login to my application.  I open another
window (IE) and goto the web application, and it asks me to login.  This is
all on the same computer.  (As I've explained all this before.)  Now,
perhaps I don't know what I'm talking about, and this is a different issue.
If so, I'm pretty sure you'll certainly try to set me straight.  If not,
then it certainly seems relevant to the discussion, and that my one client
(IE) is sending two different requests from two different windows on the
same computer.

  -- Rob


"Chris Shiflett" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> --- Rob Adams <[EMAIL PROTECTED]> wrote:
> > Test it yourself.
>
> With all due respect, it seems you should be doing the testing.
>
> > Login to a PHP app using a standard browser and session cookies
> > and see for yourself. I understand the philosophy of the web
> > server only seeing what the client sends it, but it looks like my
> > client (IE6, right here) does send different requests per instance.
>
> Then show us these requests and point out how they are different.
Otherwise, I
> have to assume you have no idea what you're talking about.
>
> Chris
>
> =
> My Blog
>  http://shiflett.org/
> HTTP Developer's Handbook
>  http://httphandbook.org/
> RAMP Training Courses
>  http://www.nyphp.org/ramp

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] php sessions

So you're saying if the session ID is passed in on the URL it will work.
But I'm using cookies.  The only thing that gets passed on the URL is a
pagename.  Perhaps there is something funky about my setup, but it has
always worked this way for me.

  -- Rob


"Cpt John W. Holmes" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> From: "Chris Shiflett" <[EMAIL PROTECTED]>
>
>
> > --- Rob Adams <[EMAIL PROTECTED]> wrote:
> > > Test it yourself.
> >
> > With all due respect, it seems you should be doing the testing.
> >
> > > Login to a PHP app using a standard browser and session cookies
> > > and see for yourself. I understand the philosophy of the web
> > > server only seeing what the client sends it, but it looks like my
> > > client (IE6, right here) does send different requests per instance.
> >
> > Then show us these requests and point out how they are different.
> Otherwise, I
> > have to assume you have no idea what you're talking about.
>
> If you are not relying on a cookie based session, then this will work.
Each
> login could be assigned a different session ID, so the requests for each
> browser will be different because of the different session IDs.
>
> ---John Holmes...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



  1   2   3   4   >