[PHP] Re: [modauthkerb] Cannot retrieve KRB5CCNAME if logged in with kerberos ticket

2012-08-28 Thread Benjamin Kahn
On Tue, 2012-08-28 at 09:07 -0400, Mauricio Tavares wrote:
  https://bugzilla.redhat.com/show_bug.cgi?id=687975
  mod_auth_kerb using krb5passwd and keepalive and credential delegation
  loses delegation after first request on connection
 
   Good question, because it sure looks rather similar. 

Try the patch and see if it helps:
https://bugzilla.redhat.com/attachment.cgi?id=522350

Or try Fedora 17 or RHEL 6.3.


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



[PHP] Re: [modauthkerb] Cannot retrieve KRB5CCNAME if logged in with kerberos ticket

2012-08-27 Thread Benjamin Kahn
Maybe you are hitting this bug?

https://bugzilla.redhat.com/show_bug.cgi?id=687975 
mod_auth_kerb using krb5passwd and keepalive and credential delegation
loses delegation after first request on connection

On Mon, 2012-08-27 at 17:29 -0400, Mauricio Tavares wrote:
 Quick-n-easy question: I have my apache virtual host configured to use
 kerberos authentication:
 
 Location /
 AuthType KerberosV5
 KrbAuthRealms DOMAIN.COM
 KrbServiceName HTTP
 Krb5Keytab /etc/apache2/krb5.keytab
 KrbMethodNegotiate on
 KrbMethodK5Passwd on
 KrbAuthoritative off
 KrbSaveCredentials on
 Require valid-user
 /Location
 
 And then I created the following test page:
 
 html
 head
 titlePHP Test/title
 /head
 body
 h1PHP Kerberos Test/h1
 ?php
 echo user = {$_SERVER['PHP_AUTH_USER']}br/;
 echo REMOTE_USER={$_SERVER['REMOTE_USER']}br/;
 putenv(KRB5CCNAME={$_SERVER['KRB5CCNAME']});
 echo KRB5CCNAME={$_SERVER['KRB5CCNAME']}br/;
 
 exit();
 ?
   /body
 /html
 
 And I have mod_auth_kerb php5 modules enabled in apache. When I try to
 connect to the above test page using a kerberos ticket, I do see the
 PHP_AUTH_USER and REMOTE_USER (which are the same). But I get nothing
 in KRB5CCNAME. Now, if I destory my kerberos ticket and login using
 kerberos user/pw, At first I do get the filename associated with
 KRB5CCNAME. But, if I wait less than 15s to refresh the page, I get
 nothing for KRB5CCNAME; if I wait more than 15s, I will get the
 filename for KRB5CCNAME.
 
 Does anyone know what I may be doing wrong?
 
 --
 Live Security Virtual Conference
 Exclusive live event will cover all the ways today's security and 
 threat landscape has changed and how IT managers can respond. Discussions 
 will include endpoint security, mobile security and the latest in malware 
 threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
 ___
 modauthkerb-help mailing list
 modauthkerb-h...@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/modauthkerb-help



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



Re: [PHP] Swiftlet is quite possibly the smallest MVC framework you'll ever use.

2012-02-12 Thread Benjamin Hawkes-Lewis
On Sun, Feb 12, 2012 at 11:36 PM, Paul M Foster pa...@quillandmouse.com wrote:
 The more I've thought about it since then, the more I've considered it a
 Good Thing(tm). It makes troubleshooting existing code a whole lot
 easier. I don't have to wonder what the autoloader is doing or where the
 files are, on which the current file depends. It sort of obviates the
 autoloader stuff, but I'd rather do that than spend hours trying to
 track down which file in which directory contains the class which paints
 the screen blue or whatever.

Yeah, this is the sort of problem better handled by a tool than
switching away from autoloaders.

Exuberant Ctags is your friend.

--
Benjamin Hawkes-Lewis

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



Re: [PHP] Alternative session control system

2011-12-26 Thread Benjamin Hawkes-Lewis
On Mon, Dec 26, 2011 at 12:04 PM, Francisco M. Marzoa Alonso
franci...@marzoa.com wrote:
 I need an alternative session control system different from the PHP
 standard one, that does not need to use the headers, because it's for a
 series of scripts that will be accessed through AJAX javascript code
 inserted in different places of a web page which headers I do not
 control, so I cannot do an start_session before headers sent or
 setcookies neither.

Eh? Why can't you just use cookies on the requests and responses to
the server you do control?

AJAX implies that there are requests going to your server; if that's
not the case, then I think we need a much clear description of your
setup.

--
Benjamin Hawkes-Lewis

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



Re: [PHP] [php] static html search engine for php static html site

2011-12-26 Thread Benjamin Hawkes-Lewis
On Mon, Dec 26, 2011 at 1:17 PM, HELP LINE izod...@gmail.com wrote:
 Does any know of a better static search engine that i can integrate to my
 static php html site. it should not be Google or yahoo bing.

A search engine cannot itself be static, since it has to process
variable user input. Though I guess you could generate its indexes as
part of a static build process.

Solr and Sphinx would be examples of FOSS search engines you could use:

http://lucene.apache.org/solr/

http://sphinxsearch.com/

--
Benjamin Hawkes-Lewis

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



Re: [PHP] PHP page source charset

2011-12-19 Thread Benjamin Hawkes-Lewis
On Tue, Dec 20, 2011 at 2:44 AM, Rick Dwyer rpdw...@earthlink.net wrote:
 When I set my page charset from iso-8859-1 to utf-8

Set it how?

http://www.w3.org/International/O-HTTP-charset.en.php

, when I run it through
 the W3C validator, the validator returns an error that it can't validate the
 page because of an illegal character not covered by UTF-8.


 Sorry, I am unable to validate this document because on line 199 it
 contained one or more bytes that I cannot interpret as utf-8(in other words,
 the bytes found are not valid values in the specified Character Encoding).
 Please check both the content of the file and the character encoding
 indication.
 The error was: utf8 \x99 does not map to Unicode

 Line 199 is a line with my open PHP declaration:
 ?php

 Not sure why W3C is having a hard time with this.  Any ideas?

If you're looking up line references from a W3C validator in your PHP
code, then you're doing something very wrong and are perhaps
fundamentally confused. You need to distinguish between the PHP code
itself and the HTML that it generates and dispatches over the wire to
browsers and validators.

--
Benjamin Hawkes-Lewis

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



Re: [PHP] Local variable protection

2011-10-13 Thread Benjamin Coddington

On Oct 13, 2011, at 5:05 AM, Stuart Dallas wrote:

 On 12 Oct 2011, at 21:06, Benjamin Coddington wrote:
 
 Are there any assurances that function local variables are protected from 
 code calling the function?
 
 For example, I would like to provide some cryptographic functions such as
 
 function org_secure_string($string) {
  $org_key = a very random key;
  return hash($string, $key);
 }
 
 function org_reveal_string($hash) {
  $org_key = a very random key;
  return unhash($hash, $key);
 }
 
 I'd like to protect $org_key from any code following or using these 
 functions.  I've not yet found a way that it can be revealed, but I wonder 
 if anyone here can give me a definitive answer whether or not it is possible.
 
 Maybe I'm missing something, but whatever protection might exist within a 
 running PHP process, they'll simply be able to open your PHP file and see it 
 there. Even if you're using something like Zend Guard, the string literal 
 will not be difficult to extract.

We'll get around this by defining the functions in php's auto_prepend_file 
where we'll also restrict access to the file with open_basedir.

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



[PHP] Local variable protection

2011-10-12 Thread Benjamin Coddington
Are there any assurances that function local variables are protected from code 
calling the function?

For example, I would like to provide some cryptographic functions such as

function org_secure_string($string) {
$org_key = a very random key;
return hash($string, $key);
}

function org_reveal_string($hash) {
$org_key = a very random key;
return unhash($hash, $key);
}

I'd like to protect $org_key from any code following or using these functions.  
I've not yet found a way that it can be revealed, but I wonder if anyone here 
can give me a definitive answer whether or not it is possible.

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



Re: [PHP] Local variable protection

2011-10-12 Thread Benjamin Coddington
On Oct 12, 2011, at 4:24 PM, Ken Robinson wrote:

 Quoting Benjamin Coddington bcodd...@uvm.edu:
 
 Are there any assurances that function local variables are protected from 
 code calling the function?
 
 For example, I would like to provide some cryptographic functions such as
 
 function org_secure_string($string) {
  $org_key = a very random key;
  return hash($string, $key);
 }
 
 function org_reveal_string($hash) {
  $org_key = a very random key;
  return unhash($hash, $key);
 }
 
 I'd like to protect $org_key from any code following or using these 
 functions.  I've not yet found a way that it can be revealed, but I wonder 
 if anyone here can give me a definitive answer whether or not it is possible.
 
 It's called the scope of the variable. See 
 http://us3.php.net/manual/en/language.variables.scope.php
 
 Variables defined in a function are only available to the function where they 
 are defined.

Yes, but scope does not necessarily protect a value.  Within a function globals 
are out of scope, but their values can still be accessed through $GLOBALS.

Many languages have little-documented reflection features.  I am concerned 
about a determined person being capable of discovering the value of a variable 
within a function that has already been defined.  Is there a way to this?  Is 
there a way to examine the input buffer, or anything that has been read into 
the interpreter so far?  Certainly those values exist within the memory of the 
process, which can be accessed through other methods.

I'd be very happy if anyone is able to say it is not possible to do this, and 
explain why.

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



Re: [PHP] Issues with simplexml_load_string()

2011-10-07 Thread Benjamin Hawkes-Lewis
On Thu, Oct 6, 2011 at 9:50 PM, Christoph Boget jcbo...@hotmail.com wrote:
 It seems like when dealing with nodes which have CDATA, I cannot get
 access to both the attributes of that node and the CDATA of that node
 with the same simplexml_load_string() call.  Consider the following:

 $previewString =
 'rootmessage![CDATA[lkjlkjklj]]/messagebuttonsbutton
 name=Add Me![CDATA[This is my free form
 text]]/button/buttons/root';

 When passing LIBXML_NOCDATA:

 echo 'pre' . print_r( json_decode( json_encode(
 (array)simplexml_load_string( $previewString, 'SimpleXMLElement',
 LIBXML_NOCDATA | LIBXML_NOBLANKS )), 1 ), TRUE ) . '/pre';

 yields the following output :

 Array
 (
   [message] = lkjlkjklj
   [buttons] = Array
       (
           [button] = This is my free form text
       )
 )

 So I get the CDATA but I don't get the name attribute for the button.

http://us.php.net/manual/en/function.simplexml-load-string.php#80855 maybe?

--
Benjamin Hawkes-Lewis

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



Re: [PHP] Installing extensions

2011-09-18 Thread Benjamin Hawkes-Lewis
On Sun, Sep 18, 2011 at 8:21 PM, tamouse mailing lists
tamouse.li...@gmail.com wrote:
 I'm having a bit of trouble installing PHP extensions.

 I have the following in php.ini:

  extension_dir =
 .:/usr/local/lib/php/extensions:/usr/local/lib/php/extensions/no-debug-non-zts-20090626

 In /usr/local/lib/php/extensions/no-debug-non-zts-20090626, i have the
 following:

  -rwxr-xr-x  1 root  wheel   25652 Sep 18 13:04 geoip.so*
  -rwxr-xr-x  1 root  wheel  115536 Jul 13 16:55 iconv.a*
  -rwxr-xr-x  1 root  wheel   40556 Jul 13 16:55 iconv.so*

 but if I do php -i | grep -E '(iconv|geoip)' , i get nothing.

 So apparently the extensions aren't being added as I thought.

 System info:
  Mac OSX 10.5.8
  php 5.3.6

extension_dir controls where PHP looks for extensions that _could_
be dynamically loaded.

It does not dictate which extensions it loads at startup - that's extension.

http://php.net/manual/en/ini.core.php

http://www.php.net/manual/en/install.pecl.intro.php

--
Benjamin Hawkes-Lewis

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



Re: [PHP] HTML id attribute and arrays

2010-12-19 Thread Benjamin Hawkes-Lewis
On Sun, Dec 19, 2010 at 4:57 PM, Martin C m...@seznam.cz wrote:
 The name and id attributes do not have to be the same.

 Thank you, I thought it should be the same (for same reason, maybe
 compatibility between XHTML and HTML). But could not find anything on the
 net which states this. So my memories might be corrupted :)

You're probably thinking of:

http://www.w3.org/TR/html401/struct/links.html#h-12.2.3

The id and name attributes share the same name space. This means that
they cannot both define an anchor with the same name in the same
document. It is permissible to use both attributes to specify an
element's unique identifier for the following elements: A, APPLET,
FORM, FRAME, IFRAME, IMG, and MAP. When both attributes are used on a
single element, their values must be identical.

Confusing, the name attribute on a form field (input, textarea,
select, etc) is different to the name attribute on a a or form
element, so this rule does not apply to it.

--
Benjamin Hawkes-Lewis

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



Re: [PHP] HTML id attribute and arrays

2010-12-17 Thread Benjamin Hawkes-Lewis
Martin C m...@seznam.cz wrote:
 How should I follow the HTML specification while having the passed
 parameters automatically converted to arrays in PHP?

The name attribute, not the id attribute, is used as the key when
submitting form values.

The name and id attributes do not have to be the same.

--
Benjamin Hawkes-Lewis

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



Re: [PHP] Auto-generating HTML

2010-09-21 Thread Benjamin Hawkes-Lewis
On 20 Sep 2010, at 22:02, Bastien Koert wrote:
 The standard suggests that double quotes are to be used for HTML
 attributes.

Where?

--
Benjamin Hawkes-Lewis

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



Re: [PHP] XML DOM

2010-07-22 Thread Benjamin Hawkes-Lewis
On 21 Jul 2010, at 19:32, Ben Miller wrote:
 Problem:
 
 If street2 (or any other field) has no value, PHP is outputting the XML node
 as street2 /, which is producing a JS error when I try to call:
 
 script type=text/javascript..
 
 street2 = x[i].getElementsByTagName(street2)[0].childNodes[0].nodeValue;
 
.../script   (Because the requested node has no
 .nodeValue, I'm assuming???)
 
 
 
 Question:
 
 Can I tell PHP to output the XML node as street2/street2 instead of
 street2 / so that JS sees that the object has a value, but the value is 
 (blank)?

street2foo/street2 is syntax that means a street2 element with one 
child node: text node foo.

street2/street2 and street2 / are different syntax that mean the same 
thing: a street2 element with no child nodes.

Your JS property lookup fails because the street2 element has no child nodes. 
Rather than changing your XML serialization to have some sort of opaque 
meaning, why not do one of the following in your JS?

   1. Test to see if the element in question has any child nodes before 
attempting to access the first one:

   if (x[i].getElementsByTagName(street2)[0].childNodes.length  0) ...

   2. Use the textContent and innerText properties to get the text of 
all/any child nodes.

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



Re: [PHP] Malformed UTF-8 Data in JSON [SOLVED]

2010-07-15 Thread Benjamin Hawkes-Lewis
On 15 Jul 2010, at 04:12, Dave M G wrote:
 Yes, stripslashes() was the problem. I've removed it and the code works.
 
 However, it seems that when I send JSON data from a Javascript file, 
 stripslashes() is necessary. That's why I had it there. I'm not entirely sure 
 what's going on there, so obviously more experimentation is needed.

Presumably, thanks to your PHP settings, you need stripslashes() on all $_GET, 
$_POST, and $_COOKIE input.

http://www.php.net/manual/en/info.configuration.php#ini.magic-quotes-gpc

This does not apply to input from other sources.

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



Re: [PHP] urgent CSS question

2009-05-22 Thread Benjamin Hawkes-Lewis

On 22/5/09 12:49, PJ wrote:

Sorry, but no one suggested a mailing list for CSS and the W3 Schools
Forum has problems.


Actually, I did:

http://www.css-discuss.org/


Why do I get completely different formatting with two identical classes?
I want to change part of the formatting on just one page on the site
using the exact same class with some changes so I don't modify other
pages. I copied div#frame to div#frame1 and changed the class on the
page to id=frame1. But now the page no longer displays the formatting
as with id=frame - e.g.p  produces 16px font-size instead of 12px.


This description is confusing. Can you please link to a minimal test 
case showing the problem you're talking about, so that we can view your 
code and ideally probe it with DOM inspectors like Firebug?


http://webkit.org/quality/reduction.html

may help you produce one.

In general, I'd suggest creating page-specific style variations by 
sticking a class on the body (e.g. body class=article ) and using 
that as a hook to modify the styling of the class whose formatting you 
want to be different.


.thing {
font-weight: bold;
}

.article .thing {
font-style: italic;
}

for example.

--
Benjamin Hawkers-Lewis

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



Re: [PHP] urgent CSS question

2009-05-22 Thread Benjamin Hawkes-Lewis

On 22/5/09 13:02, Michael A. Peters wrote:

If I recall - it is illegal to end a css class name is a number.


Those are actually id names not class names, but it's not illegal in 
either case.


HTML id attributes must follow this:

http://www.w3.org/TR/html401/types.html#type-id

XML id attributes must follow this:

http://www.w3.org/TR/REC-xml/#NT-Name

The class attribute is a CDATA list:

http://www.w3.org/TR/html401/types.html#type-cdata

Pretty much the only thing illegal in a classname is whitespace.

You may be thinking of the restriction that HTML/XML id attributes may 
not /begin/ with a number.


--
Benjamin Hawkes-Lewis

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



Re: [PHP] urgent CSS question

2009-05-22 Thread Benjamin Hawkes-Lewis

On 22/5/09 13:27, PJ wrote:

Ok, I have duplicate classes - #frame and #frame1.


Let's get our terminology straight:

ids are not classes; classes are not ids.

ids look like:

id=thing

and are selected like:

#thing

classes look like:

class=thing other-thing

and are selected like

.thing

An element may have zero or one IDs.

An element may have zero or more classes.

id is supposed to be unique within a given document.

The same classname may be used multiple times in the same document.

See:

http://css.maxdesign.com.au/selectutorial/advanced_idclass.htm


What I don't understand is why switching from #frame to #frame1 should
change formatting.


#frame targets an element with id=frame while frame1 targets an 
element with id=frame1. So I'm not sure what these have to do with one 
another.



The two classes are absolutely the same, the only
difference is the 1 in the name.


Which is to say they are utterly different, since they have different names.


I would logically assume that the
interpreter or whoever is operating this stuff would understand that the
page is using a different class, whether it is the same name as another
or not.


I'm sorry, I don't know what you mean.


If I create still another class and start to format the various
sections of that class, I will wind up with the identical class as
#frame1.


Again, I don't know what you mean.


So where is the logic here?


Without seeing some clear test case links that reproduces the problem 
for us, I really can't comment about that.



It seems to me that what I am trying to do is logically and intuitively clear

 and simple.

What you're trying to do really isn't clear to me. Being able to see the 
problem (and the underlying code) might help.


--
Benjamin Hawkes-Lewis

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



Re: [PHP] urgent CSS question

2009-05-22 Thread Benjamin Hawkes-Lewis

On 22/5/09 20:31, PJ wrote:

They may have different names, but does that change their functionality?


Potentially, yes!

A selector including #frame will no longer match if id is changed to 
frame1, and vice versa.



They are identical except for the 1 in the title of the id. So, if I
change the one id to the other in the same code, I don't understand why
the formatting would change?


These descriptions are still far too vague and ambiguous. Please link to 
two test cases:


1) Effectively showing frame1.

2) Effectively showing frame.

that illustrate the problem you're talking about.


Obviously, the parents and the children
have not changed unless there's some weird hanky-panky going on.


Without seeing test cases, nothing is obvious.

 Or do I have to make a new css file for every page

Only if you're doing it wrong. :)


And to follow the logic here, if I create a different id and in the
end it turns out to be identical to the original frame except for the
name, shouldn't it function the same.


That depends on:

1) The contents of your CSS file, which I can't see.
2) Whether you've made any errors when modifying your HTML, which I 
can't see either.


If you provided test cases, I could see these things and answer your 
questions.


Trying to describe the problem rather than /showing/ the problem is very 
inefficient.


--
Benjamin Hawkes-Lewis

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



Re: [PHP] table-less layouts; Ideas welcome

2009-05-21 Thread Benjamin Hawkes-Lewis

On 21/5/09 09:02, Jim Lucas wrote:

I have been toying with the idea of doing a table-less layouts
involving tabular data, calendars, etc...


[snip]


But, not knowing how the various types of accessibility applications
work, I am guessing that the layout to an application trying to read it
should work fairly well. Let me know if I am way off the mark with my
thoughts.


The responses suggesting that even W3C would let you use tables for 
data tables are too weak.


W3C recommend you use the best possible semantic (X)HTML for your 
structured content and, if you want to style it, suggest a skin or skins 
for that structure with CSS. This is why table is the wrong tool for 
grid layout and the /right/ tool for tabular data.


This isn't semantics for the sake of semantics. Table markup implies 
a series of relationships that user agents can use in two basic ways:


1) Render content appropriately to communicate tabular relationships. 
For example, text browsers and browser/user stylesheets in GUI browsers 
can arrange tables in rows and columns, stick borders between cells, 
embolden/color header cells and captions, repeat header rows after a 
page break when printing. GUI browsers can copy table markup to system 
clipboards such that you can paste the table into a word processor or 
spreadsheet as a table. Screen readers can read or braille the table 
caption or summary when the table receives focus, and render an 
individual data cell's headers when it receives content focus.


2) Provide navigational functionality. For example, popular screen 
readers use table markup to give users commands to list tables on a 
page, jump to the next table, move to the next row rather than the next 
cell, query a cell for its headers, read row-by-row, or read 
column-by-column. For example:


http://www.freedomscientific.com/Training/Surfs-Up/Tables.htm
http://www.freedomscientific.com/Training/Surfs-up/Table_Reading_Commands.htm

So replacing good data markup ( http://www.webaim.org/techniques/tables/ 
) with a tree of div elements involves a substantial loss of 
functionality, and accessibility.


If for some reason, you /must/ use generic div elements instead of 
real tabular markup, I strongly recommend you annotate them with 
WAI-ARIA attributes (grid and related roles). Supporting clients will 
expose similar structural information to assistive technology as you 
would get with (X)HTML tables. WAI-ARIA has poor support compared to 
bog-standard (X)HTML tables, but it should be supported by the some of 
the newest browsers and screen readers (e.g. Firefox 3, IE8, and JAWS 10).


Calendar markup is a very tricky one.

But I'd certainly take advantage of (X)HTML's dedicated markup for 
relationships ( tables, lists, headings, hyperlinks ) to help users 
navigate the calendar and to ensure a decent presentation (even without 
your CSS) is applied, rather than expect users to parse linearized div 
elements.


Some useful discussion at:

http://www.joedolson.com/articles/2006/10/describing-a-semantic-calendar/

http://diveintoaccessibility.org/day_19_using_real_table_headers.html

http://georgiatechcatea.wordpress.com/2007/01/16/accessible-calendars-for-blogs-and-websites/

--
Benjamin Hawkes-Lewis


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



Re: [PHP] Re: table-less layouts; Ideas welcome

2009-05-21 Thread Benjamin Hawkes-Lewis

On 21/5/09 18:48, Weston C wrote:

I almost just wish
we'd accepted the horse was out of the barn and tried to figure out an
easy way to signal distinctions between layout tables and semantic
tabular data, rather than trying to get the entire internet to
completely retool.


One year after HTML 4.0 recommended stylesheets over table layouts, WCAG 
1.0 (published in 1999) explained how /authors/ could distinguish 
between layout tables and data tables:


1) When writing a presentational table, stick to the elements table, 
tr, td. Do not use the headers, scope, axis, or summary 
attributes. Make sure layout tables make sense when linearized.


2) When writing a data table, add the elements th, thead, tbody, 
tfoot, caption, and col and the attributes headers, scope, 
axis, and summary wherever appropriate.


http://www.w3.org/TR/WCAG10/#gl-table-markup

No algorithm for guessing whether a table matching the first class (but 
which could have been authored before WCAG 1.0 or in ignorance of WCAG 
1.0) is a layout or data table has ever been specified, as far as I 
know. You are entirely correct that text browsers and screen readers do 
indeed use such algorithms, however. This is why it's more crucial to 
use data table markup for data tables than to avoid presentational table 
markup for grid layout.


Fast forward a decade, and authors are getting another tool in our 
toolbox, not a million miles away from your 'class=layout'. I don't 
think it's very well specified yet, but:


http://www.w3.org/TR/wai-aria/#presentation

--
Benjamin Hawkes-Lewis



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



Re: [PHP] CSS tables

2009-05-18 Thread Benjamin Hawkes-Lewis

On 18/5/09 08:03, Jim Lucas wrote:

all major browser vendors don't even support CSS1 or CSS2 completely/correctly 
yet.


I don't think any browser vendor intends to implement the original CSS2 
Recommendation; instead they are aiming for compliance with the CSS 2.1 
revision.


We do have /very/ nearly complete implementations of CSS 2.1 from all 
major browser vendors.


This was the state of play /before/ IE8 - already pretty good:

http://www.webdevout.net/browser-support-css

Now:

Opera: http://www.opera.com/docs/specs/presto211/#css
IE: http://msdn.microsoft.com/en-us/library/cc351024(VS.85).aspx
Safari: 
http://developer.apple.com/documentation/AppleApplications/Reference/SafariCSSRef/Articles/StandardCSSProperties.html

Firefox: https://developer.mozilla.org/en/CSS_Reference

There a couple missing pieces - for example, in the upcoming Firefox 
3.5, The :before and :after pseudo-elements have been updated to full 
CSS 2.1 support, adding support for the position, float, list-style-*, 
and some display properties.


https://developer.mozilla.org/en/Firefox_3.5_for_developers

But all in all, vendor support for CSS 2.1 is arguably now as good as or 
better than for HTML 4.01.


Also, the fact that CSS2.1 implementation is not complete has not 
dissuaded browser vendors from experimenting with implementations of 
CSS3 drafts (e.g. border-radius, text-overflow).


--
Benjamin Hawkes-Lewis

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



Re: [PHP] Re: CSS tables

2009-05-18 Thread Benjamin Hawkes-Lewis

On 18/5/09 14:20, Al wrote:

It appears this thread has neglected to mention the display property
values that emulate table elements, e.g., table-row, table-cell, etc.


It's mentioned them at least twice.


As in: div class=cell where *.cell{display:table-cell}. Thus, one
can make a complete table without once ever using table tags table,
td etc.

Personally, using the display table properties to avoid using table
tags has left me a bit puzzled.


The point of tabular values of display is:

1. Allow the specification of HTML table rendering in terms of CSS, 
whether for HTML or for arbitrary XML.


2. Allow publishers to differentiate between table cells from which user 
agents should extract data relationships from other markup for which a 
grid layout is suggested.


3. Allow users to reformat content to make it easy for them to read with 
their abilities and devices.


For example, from the table:

trthCountry/ththPopulation/th/tr
trtdFrance/tdtd65 million/td/tr
trtdUnited Kingdom/thtd61 million/td/tr

A user agent can extract the population of France.

--
Benjamin Hawkes-Lewis

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



Re: [PHP] CSS tables

2009-05-18 Thread Benjamin Hawkes-Lewis

On 18/5/09 21:35, PJ wrote:

I anyone knows where there is a real source of information about CSS,
how to use it with logical explanations of what is used how, I sure
would like to hear aboutit.


Did you try the sources I already linked you to?


Surely I must be wrong but there must be a logical explanation why such
simple things as adiv id=some_thing  will show the first of three
imgs as being part of the div tag and the rest not - but rather as
part ofbody.



If you put a box around the div tag, it includes the first image but not
the next two.
Putting 5 images of 98px width not only shows four in linewitht the
fifth is off by the margin-top height but also displays the images in a
reverse order. How do you explain that? And how do you get it to do what
you want?


Your description of these problems is far too vague to make any 
suggestions. Try linking to minimal test cases that _show_ your code and 
the problems it causes. But best address them to a dedicated CSS 
discussion list, rather than a list dedicated to PHP.


http://webkit.org/quality/reduction.html might help you produce such 
test cases.



And what about all the weird CSS configurations that are not documented
anywhere I could find in a reasonable time - where are the definitions
for form positioning and displaying?


Strictly, there are no conformance criteria for how CSS 2.1 properties 
apply to (X)HTML form widgets, so this is up to user agents. For 
discussions of the current state of affairs, please see:


   * http://www.w3.org/TR/CSS21/conform.html#conformance
   * http://www.w3.org/TR/css3-ui/
   * 
http://www.456bereastreet.com/archive/200701/styling_form_controls_with_css_revisited/

   * http://meyerweb.com/eric/thoughts/2007/05/15/formal-weirdness/

For practical advice on styling forms with CSS, please see (for example):

http://dev.opera.com/articles/view/34-styling-forms/


What do such definitions signify:
form div fieldset label.labelCheckbox, form div fieldset
label.labelRadio {...
and - form div input.inputText, form div input.inputPassword {...


This is elementary CSS syntax:

   * http://penguin.theopalgroup.com/cgi-bin/css3explainer/selectoracle.py
   * http://css.maxdesign.com.au/selectutorial/
   * http://www.w3.org/TR/CSS2/selector.html
   * http://www.w3.org/TR/css3-selectors/


I thought that form would be subservient to div or is it the opposite?


This question suggests you'd benefit from reading an introduction to CSS 
selectors such as the maxdesign link above.


Again, I hope that helps.
--
Benjamin Hawkes-Lewis


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



Re: [PHP] CSS tables

2009-05-17 Thread Benjamin Hawkes-Lewis
 be made to work in IE6 with a bit of JS? Compare 
http://developer.yahoo.com/yui/articles/gbs/ for one such statement of 
support.)
2. A description of your actual problem in using HTML for structured 
content and CSS for style.
3. A description of ways you've attempted to solve the problem without 
success.
4. Minimal test cases (HTML + CSS) demonstrating the best of your 
attempts and how they failed.


with a dedicated CSS mailing list like:

http://www.css-discuss.org/

filled with people who solve (or fail to solve) such layout problems on 
a daily basis.


As you mention, you've managed to do some pages with CSS - maybe you 
just need pointing in the right direction. :) It's worth raising your 
question even if you won't have time to apply the answer to this 
particular project.


Before consulting such a forum, I'd recommend reviewing a few 
introductory resources, such as:


http://css.maxdesign.com.au/floatutorial/

http://www.maxdesign.com.au/presentation/page_layouts/

and the CSS articles in:

http://www.opera.com/company/education/curriculum/

- just in case your problem is more basic than it appears.

Hope that helps.

--
Benjamin Hawkes-Lewis


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



Re: [PHP] CSS tables

2009-05-17 Thread Benjamin Hawkes-Lewis

On 17/5/09 22:43, Paul M Foster wrote:

*Except* in IE6, which is what probably most of the world is using.


Probably a lot rather than most.

http://www.upsdell.com/BrowserNews/stat.htm

---
Benjamin Hawkes-Lewis

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



Re: [PHP] How about a saveXHTML for the DOM?

2009-04-09 Thread Benjamin Hawkes-Lewis

On 9/4/09 04:55, Michael A. Peters wrote:

IE (still) does not properly support XHTML.
It will render an XHTML page sent with the text/html mime type - but
that's actually a standards violation.


Is it? What standard is it violating?

XHTML Documents which follow the guidelines set forth in Appendix C, 
HTML Compatibility Guidelines may be labeled with the Internet Media 
Type text/html [RFC2854], as they are compatible with most HTML browsers.


http://www.w3.org/TR/xhtml1/#media

Due to the long and distributed development of HTML, current practice 
on the Internet includes a wide variety of HTML variants. Implementors 
of text/html interpreters must be prepared to be bug-compatible with 
popular browsers in order to work with many HTML documents available the 
Internet. … [XHTML1] defines a profile of use of XHTML which is 
compatible with HTML 4.01 and which may also be labeled as text/html.


http://www.ietf.org/rfc/rfc2854.txt

(I'm not saying it's a good idea, mark you! http://hixie.ch/advocacy/xhtml )

--
Benjamin Hawkes-Lewis

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



Re: [PHP] Parsing HTML href-Attribute

2009-01-18 Thread Benjamin Hawkes-Lewis

On 16/1/09 23:41, Shawn McKenzie wrote:

Again, I say that it won't work on URLs with spaces, like my web
page.html.  When I get a minute I'll fix it.  I thought spaces in URLs
weren't valid markup, but it seems to validate.


Some small points of information:

An HTML4 validator will only check that a HREF value is CDATA, as 
required by the DTD:


http://www.w3.org/TR/REC-html40/struct/links.html#adef-href

http://www.w3.org/TR/REC-html40/sgml/dtd.html#URI

http://www.w3.org/TR/REC-html40/types.html#type-cdata

Plenty of things can be CDATA without being a valid URI:

http://gbiv.com/protocols/uri/rfc/rfc3986.html

Space characters (U+0020) that are not percent encoded are not valid in 
a URI:


http://gbiv.com/protocols/uri/rfc/rfc3986.html#collected-abnf

That's not to say that browsers haven't developed error handling for 
space characters (and other illegal characters) in HREF values.


The HTML5 draft proposes an algorithm for parsing and resolving HREF 
values that includes such error handling:


http://www.whatwg.org/specs/web-apps/current-work/#parsing-urls

http://www.whatwg.org/specs/web-apps/current-work/#resolving-urls

--
Benjamin Hawkes-Lewis

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



Re: [PHP] PHP, Smarty, and Text

2009-01-14 Thread Benjamin Hawkes-Lewis

On 14/1/09 07:56, Robert Cummings wrote:

Strip all tags except bold and italics. Then replaceb  withstrong
andi  withem  since the former tags are deprecated.


Actually, b and i have not been formally deprecated in any standard.

The closest thing to a prohibition on these elements is WCAG 1.0's 
Checkpoint 3.3 Use style sheets to control layout and presentation.



If semantic meaning is not intended byb  andi then replace
withspan class=bold  andspan class=italic  and create those
CSS styles.


em is for stress.

strong is for strong stress.

In the third case, where semantic meaning _is_ intended by bold or 
italic but that meaning is _not_ stress, it's best to use relevant 
specific elements (code, var, cite, q, kbd, samp, etc.?) or 
failing that class names that express meaning not just style ( 
http://www.w3.org/QA/Tips/goodclassnames ).


--
Benjamin Hawkes-Lewis

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



Re: [PHP] table mixing PHP, javascript, ajax and CSS

2008-12-28 Thread Benjamin Hawkes-Lewis

On 28/12/08 13:33, Alain Roger wrote:


i'm currently working on some project which needs in several pages, a table
to display query results...till now nothing special.
however, in order to not create several time the table and features i've
decided to create my own templates including PHP classes, CSS and
javascript.

this table class should have filter, colors schemes, multi selection and
header/paging header.


An appropriate set of classes (data types, field names, even/odd 
designators for zebra styling) plus CSS is everything you need for color 
schemes.


Can you elaborate on what you mean by multi selection and paging header?


I would like to know what are your suggestions, recommendations or tips to
have something easy to deploy and upgrade ?


I'd look into:

http://developer.yahoo.com/yui/datatable/

It includes filtering.

I usually write my own code for generating raw table markup - that could 
be used by as a progressive enhancement by YUI datatable - with a 
minimum of repetition.


http://www.webaim.org/techniques/tables/data.php has information about 
what constitutes good markup for data tables.



i was thinking to have a common (framework) base : a simple html file having
3 divs, each div receiving a particular php file (header, pagin, or the
table itself)
header, paging or table PHP files could be located in some folder being
different for each template... main changes in templates are usually for the
table it self (in terms of columns amount, of presented data record,...)

the user will have only to run a js function which will include the
frame.php file into his own webpage with the template given as parameter.


The use of JS as an include mechanism is largely pernicious. Couldn't 
they just use include()?


--
Benjamin Hawkes-Lewis

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



Re: [PHP] What does ?xml have to do with it?

2008-12-28 Thread Benjamin Hawkes-Lewis

On 28/12/08 16:47, Jim Lucas wrote:

short tags are enabled.  Disable them in your php.ini file and you will be good.


Alternately:

?php
echo '?xml version=1.0 encoding=UTF-8 ?';
?

--
Benjamin Hawkes-Lewis


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



Re: [PHP] Curl with asp pages....

2008-12-17 Thread Benjamin Hawkes-Lewis

Ashley Sheridan wrote:

There is a slight difference in how ASP handles multiple form fields
that share the same name (as well as SELECT MULTIPLE lists) such that
ASP does not need (and should not use) square brackets in field names
the way PHP does.

Andrew


I thought that square brackets were actually part of the HTML spec, not
PHP, so the fact that ASP.Net cannot use them is just another example of
M$ doing their own thing again...


Why did you think that?

I think you'll find square brackets are a PHPism and that PHP is 
actually a freakish oddball in not interpreting key=barkey=fookey=quux 
as $_GET['key'] = array( 'bar', 'foo', 'quux' );


Contrast:

* PERL CGI module: http://docstore.mik.ua/orelly/linux/cgi/ch05_02.htm

* Python urlparse library: 
http://docs.python.org/library/urlparse.html#urlparse.parse_qs


* Ruby on Rails: http://dev.rubyonrails.org/ticket/6645

IIRC there's nothing in the URI, HTML, or CGI specs that enforces how 
these should be interpreted.


--
Benjamin Hawkes-Lewis

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



Re: [PHP] IE8 and HTML5

2008-12-04 Thread Benjamin Hawkes-Lewis

Richard Heyes wrote:

From a recent IEBlog post:

http://blogs.msdn.com/ie/archive/2008/12/03/compatibility-view-improvements-to-come-in-ie8.aspx


...and our start on HTML5 support.


Does this mean canvas support? 


Not in IE8.

http://blogs.msdn.com/ie/archive/2008/11/19/ie8-what-s-after-beta-2.aspx#9129600

Everyone has their favorite unstandardized feature they'd love IE to 
support. (Personally I'd be delighted by -ms-border-radius and 
content:uri() support.)


Experimental support for Canvas and other unstandardized features might 
be a good thing; I know the spec editors would welcome implementor 
feedback. It would be a shame, however, if we were locked into a 
technically poor solution thanks to the most popular browser 
implementing an early version of the specification, websites beginning 
to rely on that behaviour, and subsequent versions of the specification 
being forced to mandate such behaviour. I haven't used Canvas much, but 
it seems to me there a lot of areas of Canvas where there's room for 
further evolution, e.g. proper text width calculations? an accessible 
Canvas example? what about 3D?



Is it as a direct result of Chrome
being released and MS realising (finally) they are going to have to
remain competitive?


Given Chrome's poor rate of take-up and tendency to canibalize the 
userbases of non-MS browsers, I somewhat doubt it.


http://blog.statcounter.com/2008/09/chrome-whos-losing/

Regardless of Chrome's technical merits, it seems to me that it's 
Firefox's growing userbase, tailed by the other popular browsers in some 
markets, that has long represented the market challenge to IE.


http://www.upsdell.com/BrowserNews/stat.htm

Could be I'm underestimating the effects of press hype about chrome on 
MS's strategy, but I think actually Microsoft's turn towards a stronger 
emphasis on standards support long preceded the release of Chrome. For 
example:


http://blogs.msdn.com/ie/archive/2008/03/03/microsoft-s-interoperability-principles-and-ie8.aspx

Given that IE8 was already in beta when Chrome was released, standard 
support in IE8 is mostly a product of decisions taken before that time.


--
Benjamin Hawkes-Lewis

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



Re: [PHP] Javascript mailing list

2008-08-30 Thread Benjamin Hawkes-Lewis

Richard Heyes wrote:

Can anyone recommend a good Javascript related mailing list?


http://lists.evolt.org/mailman/listinfo/javascript perhaps.

--
Benjamin Hawkes-Lewis


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



Re: [PHP] Re: Version Control Software

2008-08-07 Thread Benjamin Darwin
On Thu, Aug 7, 2008 at 10:02 AM, Colin Guthrie [EMAIL PROTECTED] wrote:

 Robert Cummings wrote:

 On Thu, 2008-08-07 at 09:43 +1000, Ross McKay wrote:

 On Wed, 6 Aug 2008 16:42:23 -0400, Benjamin Darwin wrote:

 [...]
 I'm wondering if anybody knows of a version control software program
 that
 may fit my needs.

 Basically, I'm looking for something that runs locally, not on the live
 site, that I can edit the files on the dev computer, and store old
 versions
 on the dev computer, and then just publish off of the local onto the
 live
 site whenever I need to. [...]

 A couple of very easy-to-use ones are Subversion and CVS. Both are very
 easy to use from a shell / command line, and both have nice GUIs
 available for both Windows and *nix. Many editors and IDEs will work
 with CVS directly, and some with Subversion.


 While I currently use CVS, I probably wouldn't choose it going forward
 since Subversion solves many of the problems it has... as does GIT if I
 recall. I'm still using CVS because it works for me and I haven't
 allocated the time yet to switch over.


 Yeah I agree here. I wouldn't use CVS on any new project.

 For me the choices are simple: Git or SVN. Which one would depend on the
 kind of project (binary data?) and the team size/independent working
 requirements.

 Col


Thanks everyone for the opinions. I'm looking into Subversion and GIT, and
hopfully installating one (or both) to test later today.

--Ben


[PHP] Version Control Software

2008-08-06 Thread Benjamin Darwin
After reading a topic on the list here about someone losing their website,
and having a minor mistake on my own that cost me a week's work on a file
(basically, tested the file, then uploaded to the live site and took the
daily backup off the live site.. only to find the file was messed up.. and
had to go to the weekly backup off cd to recover it, losing a week of
work)..

I'm wondering if anybody knows of a version control software program that
may fit my needs.

Basically, I'm looking for something that runs locally, not on the live
site, that I can edit the files on the dev computer, and store old versions
on the dev computer, and then just publish off of the local onto the live
site whenever I need to.

Anybody have any suggestons/ideas on how this should be done, and what
program is a good fit?

Thanks for any help,
Ben


Re: [PHP] anyone have HTML snippet example of HTTP method = put?

2008-08-02 Thread Benjamin Hawkes-Lewis

mike wrote:

I have this:

form method=PUT action=work.php
 File: input type=file /
 input type=submit value=Submit /
/form

Looking in my webserver logs, it changes that to a GET.

Ideas anyone? The receiver is PHP and I am pretty sure I know how to
handle it once it is properly PUT-ted.

(I run nginx for the server and have enabled PUT as a method, supposedly)

Maybe I need to do something different on the web form though?


I can appreciate why one might imagine otherwise, but XHTML 1.x forms 
only support GET and POST. GET and POST are the only allowed values for 
the method attribute.


If you were validating your markup ( http://validator.w3.org/ ) you'd 
have caught that error; if you'd read the HTML documentation for the 
FORM element you wouldn't have made it in the first place:


http://www.w3.org/TR/html401/interact/forms.html#h-17.3

There are no conformance criteria in the HTML specification for how user 
agents should handle your error; it appears the client you were testing 
with submitted the form with the GET method instead.


There are proposals to add PUT and DELETE to the supported methods in a 
future version of HTML.


Hard to be sure, but judging from your markup, you might well be using 
the wrong HTTP method anyway. The action attribute specifies where the 
URL the form submits to. In the case of a PUT method, the server is 
supposed to replace the resource represented by that URL with the entity 
dispatched in the request:


http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.6

So unless you're intending that, after submission, a GET request to 
work.php should return the uploaded file, you're using the wrong method.


I suspect you want the POST method, where the server may do basically 
anything with the dispatched entity, such as taking an uploaded file and 
making it available at an arbitrary URL (like images/495005.jpg):


http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.5

I note in passing that if you're intending to use that markup in 
production, you should really enclose the text File:  in a label 
element associated with the input element by having a for attribute 
matching an id attribute adding to the input. This will allow user 
agents to accurately associate the label with the file upload control, 
for example screen readers and voice browsers can speak or braille 
File:  when the focus enters the control. For a detailed explanation, see:


http://reference.sitepoint.com/html/label

http://www.w3.org/TR/WCAG20-TECHS/H44.html

http://green-beast.com/blog/?p=254

http://www.w3.org/TR/html401/interact/forms.html#h-17.9

Hope that helps.

--
Benjamin Hawkes-Lewis

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



Re: [PHP] remembering where the user is on the page??

2008-08-02 Thread Benjamin Hawkes-Lewis

brian wrote:
A better way to do that is to give some block element--a header, a div, 
etc.--an ID. That works exactly the same as a name=


It should work the same. But it doesn't in older user agents or with 
older assistive technology:


http://stevenclark.com.au/2008/07/11/named-anchors-and-skip-navigation/

I *suspect* that the a name= thing is 
deprecated, even.


Not in HTML:

http://www.w3.org/TR/REC-html40/struct/links.html#adef-name-A

It's deprecated in XHTML 1.0 (i.e. it's valid to use):

http://www.w3.org/TR/xhtml1/#h-4.10

It's removed in XHTML 1.1 (i.e. it's not valid to use):

http://www.w3.org/TR/xhtml11/changes.html#a_changes

Its removal from XHTML isn't particularly relevant to most web authors, 
as Trident (and hence both IE and older assistive technology that only 
supports IE) doesn't support XHTML except when served as text/html (i.e. 
tag soup), XHTML 1.0 has no advantages when served as tag soup, and 
XHTML 1.1 must not be served as text/html. ;)


--
Benjamin Hawkes-Lewis

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



Re: [PHP] Re: Returning response includes HTML form data

2008-08-02 Thread Benjamin Hawkes-Lewis

Edward Diener wrote:
Does not the script 'exit' when the PHP code reaches the ending

'?' tag ?


Not exactly. PHP processes the remainder of the file too, it just 
doesn't find any PHP code to execute therein. It does find some text to 
output, and it outputs it. That text happens to be a form.


--
Benjamin Hawkes-Lewis

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



Re: [PHP] Retrive a ID or Class value from a form input field

2008-06-09 Thread Benjamin Hawkes-Lewis

Joe Harman wrote:

I was just writing a form validation script... I know that there is
ton of them out there... and i know that there are some different
methods of doing it... but i want to assign class names to each field
like class=req:email... not sure if that is the right way to do it,
but i thought it would make thing neat and tidy


And these class names could be used on the server for … what? Hopefully, 
you're not relying on GET and POST requests from (intrinsically 
untrustworthy) clients to know what data type input should be, as that 
would be intrinsically insecure.


--
Benjamin Hawkes-Lewis




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



Re: [PHP] Newbie ' If Statement' Question

2008-03-14 Thread Benjamin Darwin
On Fri, Mar 14, 2008 at 7:56 PM, [EMAIL PROTECTED] 
[EMAIL PROTECTED] wrote:

 Hello Folks,

 I would like to be able to wrap a 'form' inside a php 'if statement' -  so
 that the form will appear if the 'if condition' is met.

 -  most likely I cannot have a ?php tag inside another one - and am sure
 I'm doing other things wrong also...
 - now I get the error - Parse error: syntax error, unexpected T_STRING
 in...

 Q:  What is the best way to accomplish this goal?


 ---

 ?php if ($emp_row-getField('testfield') !=) {
print form name=edit method=post action=emp_edit_result2.php
 input type=hidden name=Status value=Active/
 input type=hidden name=The_Date value=/
 input type=hidden name=-recid value=?php echo
 $emp_row-getRecordId(); ?
 input type=submit name=edit_submit value=Activate
 /form

 ;}else {print Non Print;} ?



 --
 Thanks - RevDave
 Cool7 @ hosting4days . com
 [db-lists]


Your first mistake I'm finding is the use of quotes. You started the print
with a , which means the print ends at name=, and it's expecting more PHP
code, rather than a HTML string. The first fix would be to either escape all
quotes in the HTML with a slash (\) before it, or to change your opening and
closing quotes on the print to a single quote (').
Second, yes, you cannot enclose PHP tags inside PHP tags.  To do this,
change that portion to end the print, attach the two portions with a period
(.) and start up with the php function, then a period, and back to the
print.

Here's a fix that should work. I haven't tested it though, so I may have
missed one or two quotes.

?php if ($emp_row-getField('testfield') !=) {
   print form name=\edit\ method=\post\
action=\emp_edit_result2.php\
input type=\hidden\ name=\Status\ value=\Active\/
input type=\hidden\ name=\The_Date\ value=\\/
input type=\hidden\ name=\-recid\ value=\$emp_row-getRecordId().\
input type=\submit\ name=\edit_submit\ value=\Activate\
/form

;}else {print Non Print;} ?


Fwd: [PHP] Using PHP to remove certain number of bytes from file

2007-12-30 Thread Benjamin Darwin
Maybe one of these days I'll remember to actually reply to the list the
first time.


-- Forwarded message --
From: Benjamin Darwin [EMAIL PROTECTED]
Date: Dec 30, 2007 2:12 PM
Subject: Re: [PHP] Using PHP to remove certain number of bytes from file
To: Scott Wilcox [EMAIL PROTECTED]


Try this:

$file_data = file_get_contents('filename', false, null, 230);
file_put_contents('filename', $file_data);

This should do exactly what you need, although you may want to see if either
one returns false (indicating an error) and stop the script.

  On Dec 30, 2007 12:20 PM, Scott Wilcox [EMAIL PROTECTED] wrote:

 Is it possible with PHP to remove a certain number of bytes from a file,
 purely within PHP?

 If so, does someone have an example of doing this, removing the first
 230 bytes from a file.

 Thanks,

 Scott.

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




-- 
Benjamin Darwin
[EMAIL PROTECTED]

Dream as if you'll live forever, live as if you'll die today. ~James Dean


Re: [PHP] Multiple File Downloads

2007-12-14 Thread Benjamin Darwin
Aww, we have to wait all the way to Monday? It's fun to sit back and
watch the conversations on here!

And I call third-ed on that... is that the right word?

--Ben

On Dec 14, 2007 4:40 PM, Daniel Brown [EMAIL PROTECTED] wrote:


 You, too, Rob.  And to all else, make that seconded by me.

Report back here Monday for another week of droning.


 --
 Daniel P. Brown
 [Phone Numbers Go Here!]
 [They're Hidden From View!]

 If at first you don't succeed, stick to what you know best so that you
 can make enough money to pay someone else to do it for you.

 --



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



-- 
Benjamin Darwin

President, Crew 99
(Insert Phone Number Here)
[EMAIL PROTECTED]

Dream as if you'll live forever, live as if you'll die today. ~James Dean

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



Re: [PHP] Uploading a file through PHP form

2007-12-13 Thread Benjamin
Try checking out this manual page:
http://us3.php.net/features.file-upload
It includes pretty much everything you'll need to know.

--Ben
On Dec 13, 2007 9:03 PM, Ron Piggott [EMAIL PROTECTED] wrote:

 How do you upload a file using PHP?  Also what is the web page which
 describes the procedure on php.net ?  Thanks, Ron

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




-- 
Benjamin
[EMAIL PROTECTED]

Dream as if you'll live forever, live as if you'll die today. ~James Dean


[PHP] Compile - libxml2

2007-11-12 Thread Benjamin Dupuis
I've opened a bug report on bug.php.net,
Compiling PHP in 5.2.2 is working with my libxml2, but not in 5.2.4 (and 5.2.5)

but developpers say me that's not a bug : I must use XML2_DIR instead of 
XML_DIR,

But when using configure, it say me : use libxml-dir for libxml2
using libxml2-dir is not working, in 5.2.2 and 5.2.4
using libxml-dir is working in 5.2.2 but no 5.2.4

libxml2-dir isn't an existing variable in the configuration script.


Best regards,


http://bugs.php.net/bug.php?id=43212

Description:

Compilation work with PHP 5.2.2 but not 5.2.4

In 5.2.2 :
checking libxml2 install dir...
checking for xml2-config path... (cached)
/opt/freeware/libxml2/libxml2/bin/xml2-config
checking whether libxml build works... (cached) yes

In 5.2.4 :
checking for xml2-config path...
configure: error: xml2-config not found. Please check your libxml2
installation.

My xml2-config is in /opt/freeware/libxml2/2.6.30/bin

Reproduce code:
---
[EMAIL PROTECTED] more .envcommun
LADATE=$(date +%Y%m%d%H%M)

PATH=/opt/freeware/gcc/gcc/bin:${PATH}
export PATH

ZLIB_VERSION=1.2.3
CURL_VERSION=7.17.1
MYSQL_VERSION=4.1.18
OPENSSL_VERSION=0.9.8g
OPENLDAP_VERSION=2.3.39
APACHE_VERSION=2.0.61
FREETYPE_VERSION=2.3.5
GD_VERSION=2.0.35
JPEG_VERSION=6b
PNG_VERSION=1.2.22
XML_VERSION=2.6.30
PHP_VERSION=5.2.2

ZLIB_DIR=/opt/freeware/zlib/${ZLIB_VERSION}
CURL_DIR=/opt/freeware/curl/${CURL_VERSION}
MYSQL_DIR=/ibp/uti/msq/${MYSQL_VERSION}
OPENSSL_DIR=/opt/freeware/openssl/${OPENSSL_VERSION}
OPENLDAP_DIR=/opt/freeware/openldap/${OPENLDAP_VERSION}
APACHE_DIR=/opt/freeware/apache/${APACHE_VERSION}
FREETYPE_DIR=/opt/freeware/freetype2/${FREETYPE_VERSION}
GD_DIR=/opt/freeware/gd/${GD_VERSION}
JPEG_DIR=/opt/freeware/jpeg/${JPEG_VERSION}
PNG_DIR=/opt/freeware/libpng/${PNG_VERSION}
XML_DIR=/opt/freeware/libxml2/${XML_VERSION}
PHP_DIR=/ibp/uti/php/${PHP_VERSION}
DATADIRECT_DIR=/ibp/uti/ddt/datadirect

#

cd php-${PHP_VERSION}

LDFLAGS=-L${FREETYPE_DIR}/lib
CPPFLAGS=-I${DATADIRECT_DIR}/include -I${FREETYPE_DIR}/include
CUSTOM_ODBC_LIBS=-L${DATADIRECT_DIR}/lib -lodbc -lodbcinst
PATH=/opt/freeware/freetype2/freetype2/bin:${PATH}
export LDFLAGS CPPFLAGS CUSTOM_ODBC_LIBS PATH

make clean
../configure \
--prefix=${PHP_DIR} \
--with-config-file-path=${PHP_DIR} \
--with-apxs2=${APACHE_DIR}/bin/apxs \
--enable-safe-mode \
--enable-mbstring=all \
--enable-mbstr-enc-trans \
--enable-mbregex \
--disable-ipv6 \
--enable-libgcc \
--with-openssl=shared,${OPENSSL_DIR} \
--with-openssl-dir=${OPENSSL_DIR} \
--with-zlib=shared,${ZLIB_DIR} \
--with-zlib-dir=${ZLIB_DIR} \
--with-ldap=shared,${OPENLDAP_DIR} \
--with-libxml-dir=${XML2_DIR} \
--with-custom-odbc=${DATADIRECT_DIR} \
--enable-simplexml \
--enable-bcmath \
--enable-calendar=shared \
--enable-ctype \
--enable-tokenizer \
--enable-session \
--with-ldap=${OPENLDAP_DIR} \
--with-curl=${CURL_DIR} \
--with-mysql=${MYSQL_DIR} \
--with-mysqli=${MYSQL_DIR}/bin/mysql_config \
--enable-ftp \
--with-jpeg-dir=${JPEG_DIR} \
--with-png-dir=${PNG_DIR} \
--with-gd=shared \
--enable-gd-native-ttf \
--with-freetype-dir=${FREETYPE_DIR}

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



Re: [PHP] Re: Compile - libxml2

2007-11-12 Thread Benjamin Dupuis
DOH ! :/

Thanks !
But why php5.2.2 doesn't cry ?!! (and XML working)

Best regards

- Message d'origine -
De: Rob Richards [EMAIL PROTECTED]
Date: Mon, 12 Nov 2007 07:32:26 -0500
Sujet: [PHP] Re: Compile - libxml2
À: Benjamin Dupuis [EMAIL PROTECTED]
Cc: PHP-General php-general@lists.php.net

Hi Benjamin,

You really need to read the response more carefully.


Benjamin Dupuis wrote:
 I've opened a bug report on bug.php.net,
 Compiling PHP in 5.2.2 is working with my libxml2, but not in 5.2.4 (and 
 5.2.5)
 
 but developpers say me that's not a bug : I must use XML2_DIR instead of 
 XML_DIR,
 
 But when using configure, it say me : use libxml-dir for libxml2
 using libxml2-dir is not working, in 5.2.2 and 5.2.4
 using libxml-dir is working in 5.2.2 but no 5.2.4
 
 libxml2-dir isn't an existing variable in the configuration script.

 XML_DIR=/opt/freeware/libxml2/${XML_VERSION}

That's what's defined.

 --with-libxml-dir=${XML2_DIR} \

That's what your using.

Where is XML2_DIR coming from? Your path only shows XML_DIR being defined.

Rob

-- 
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



[PHP] Disable all caching

2006-10-10 Thread Benjamin Adams

I have a php (ver 4.x) script that is being cached.
I have placed:
META HTTP-EQUIV=CACHE-CONTROL CONTENT=NO-CACHE
but the page is still being cached.  I'm not sure if its apache or  
the php.  How can I disable all caching?

is there something I can set in php.ini?

(Mac OS X Server)

Thanks

Ben

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



[PHP] parse text file

2006-07-23 Thread Benjamin Adams
how would I read a file one line at a time:

?php
if($lines  $alllines){ 
$newline .= $lines;
}
?

something like that, I'm cofused on if I use fread, something  which
will do one line at a time?

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



Re: [PHP] parse text file

2006-07-23 Thread Benjamin Adams
Thanks, fgets works great  didn't know the function before.

On Mon, 2006-07-24 at 01:56 +0530, Sameer N Ingole wrote:
 Joe Wollard wrote:
  Benjamin,
 
  Use the file() function, it will read a file then return each line as
  a new element in an array.
  http://php.net/file
 And if file is big (biiig) then you want
 http://php.net/fgets
 
 -- 
 Sameer N. Ingole
 http://weblogic.noroot.org/
 ---
 Better to light one candle than to curse the darkness.
 

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



[PHP] Delete an upload

2006-07-17 Thread Benjamin Adams

I created a form where users can upload.
I'm working on the section where admins can delete entries.
When I have a user delete an entery, I have it taking out of MySQL 
(working fine)

But how do I delete the file that was uploaded?
Thanks for any help


Ben

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



[PHP] Filter php page

2006-07-05 Thread Benjamin Adams
can I create a script that will search a php page for iframes.  And  
have it check the path of the iframe, If the iframe is listed as bad  
don't show. (list I make)


Trying to do something with virus like through an iframe.

I don't really know where to start looking for help.

--Ben

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



[PHP] odbc remote

2006-06-07 Thread Benjamin Adams

how do I do a remote connection for odbc?
Everything that I see is on the local machine.
Can you do an odbc to a remote database?


Benjamin Adams / Lord of the Root / Ambrosia Software, Inc. -- http:// 
www.AmbrosiaSW.com


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



[PHP] permissions

2006-04-21 Thread Benjamin Adams

I have a text file that is just being read by php
Can I change the permissions of it so www can not read it?
what username does php uses to read files?

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



[PHP] pause until page is loaded

2006-04-18 Thread Benjamin Adams

I created a script to redirect to a download auto.
but it redirects before the Whole page is loaded.
How do I pause until page is loaded?

Ben

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



Re: [PHP] pause until page is loaded

2006-04-18 Thread Benjamin Adams
I tried it but it still stops half way through the page and then  
continues.


On Apr 18, 2006, at 5:24 PM, Jay Blanchard wrote:


[snip]
I created a script to redirect to a download auto.
but it redirects before the Whole page is loaded.
How do I pause until page is loaded?
[/snip]

Page loading is client-side, but you can delay the redirect using
sleep().



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



[PHP] parse a Makefile

2006-04-03 Thread Benjamin D Adams
I'm trying to parse a Makefile, (FreeBSD Ports)
I plan on dumping the Makefile vars to a MySQL Database.

Would I parse the make file like a ini file?
Or would I have to use something different?

Maybe someone knows a tool that can do this for me?

Thanks
Ben

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



Re: [PHP] XML-RPC or SOAP

2006-03-31 Thread Benjamin Adams
I want to take a mysql database that I have and turn it into a wsdl  
page where I can make a client program connect to.

I have read how to do it in Tomcat.
but looking for help in using PHP.

On Mar 30, 2006, at 9:45 PM, Anthony Ettinger wrote:


what about WSDL?

On 3/30/06, Russell Jones [EMAIL PROTECTED] wrote:


I would go with XML-RPC. I currently use XML-RPC to run LinkSleeve  
- a
link-spam detection tool. In my opinion, I have found XML-RPC to  
be easier
to use and understand. If at any point in your product you will be  
dealing
with customers / vendors who will be beginners with both XML-RPC  
and SOAP,

I
would say the learning curve for XML-RPC is much lower. I do feel,
however,
that SOAP is potentially a more robust solution.

Anyway, just my 2 cents and, good luck.



On 3/30/06, Philip Hallstrom [EMAIL PROTECTED] wrote:



I am at the beginning of creating a web service. As I am not very

familar
with both SOAP and XML-RPC it would not make much difference in  
which

one I

learn.

Which one would you guys recommend for a web app that has to be

transformed

into a white lable solution.


I just did one using SOAP.  Seems to work just fine.  Just be  
sure to

get

the WSDL generator from here:

http://www.schlossnagle.org/~george/php/WSDL_Gen.tgz

We did it using PHP5's soap extension.

good luck!

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








--
Anthony Ettinger
Signature: http://chovy.dyndns.org/hcard.html


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



[PHP] preg_match

2006-03-31 Thread Benjamin D Adams
I'm trying to check a string for ../
?php
if(preg_match(/..//i, $string)){
echo string has ../;
}
?

Can't get it to work can anyone help?

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



[PHP] Random value from ini file

2006-03-28 Thread Benjamin Adams

I have an ini file that has:
1 = words;
2 = words1;
3 = words3;

I want to pull a rand value and print it out
I'm trying to use parse_ini_file but its not working any help would  
be great.

Thanks

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



[PHP] Make all emails links

2006-03-08 Thread Benjamin Adams

I'm pulling data from a database;
When the data is pulled emails look like
[EMAIL PROTECTED]

Is there a way to just make all email address in the text that it  
pulls so,

bla bla bla okjsokdf [EMAIL PROTECTED] ksnow noduowe...

Make the email in the text be a mailto link automatically?

Thanks
-Ben

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



[PHP] Detect where someone comes from

2006-03-06 Thread Benjamin Adams
I was wondering if there was a way I can see where people are linking  
to me from.  Can I find this in php?

--Ben

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



Re: [PHP] Detect where someone comes from

2006-03-06 Thread Benjamin Adams

I have banners on other websites.
I'm trying to detect who is clicking on what banners.
I can have the company that has the banners throw a ? 
bannercompany='companyname'

and do a query on that but I would like to do it just by auto detecting
Ben

On Mar 6, 2006, at 11:21 AM, [EMAIL PROTECTED]  
[EMAIL PROTECTED] wrote:



[snip]
I was wondering if there was a way I can see where people are linking
to me from.  Can I find this in php?
[/snip]

HTTP_REFERRER is good to see where people are coming from, if it is  
set.
Are you wanting to see if people have links to your site? If so,  
you're

going to need a spider.



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



Re: [PHP] Detect where someone comes from

2006-03-06 Thread Benjamin Adams

Currently I have
an ini file that has the list of banner websites
I can make it count
problem is:
$_SERVER['REFERER'] will give me the full link
http://www.domain.com/dir/location/file.php
where I just want the
http://www.domain.com/
Ben

On Mar 6, 2006, at 11:39 AM, Benjamin Adams wrote:


I have banners on other websites.
I'm trying to detect who is clicking on what banners.
I can have the company that has the banners throw a ? 
bannercompany='companyname'
and do a query on that but I would like to do it just by auto  
detecting

Ben

On Mar 6, 2006, at 11:21 AM, [EMAIL PROTECTED]  
[EMAIL PROTECTED] wrote:



[snip]
I was wondering if there was a way I can see where people are linking
to me from.  Can I find this in php?
[/snip]

HTTP_REFERRER is good to see where people are coming from, if it  
is set.
Are you wanting to see if people have links to your site? If so,  
you're

going to need a spider.



--
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] Detect where someone comes from

2006-03-06 Thread Benjamin Adams

Got it Thanks!!
Ben

On Mar 6, 2006, at 12:13 PM, Stut wrote:


Benjamin Adams wrote:


Currently I have
an ini file that has the list of banner websites
I can make it count
problem is:
$_SERVER['REFERER'] will give me the full link
http://www.domain.com/dir/location/file.php
where I just want the
http://www.domain.com/


Look at http://php.net/parse_url

-Stut



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



[PHP] preg_replace problem

2006-03-01 Thread Benjamin Adams

$file = dog.txt;
$today = date(Ymd);

function incDate($new, $date){
//$date = settype('int');
return $new.($date++);
}

$getOldValue = parse_ini_file($file, 1);
$newValue = $getOldValue[$today] + 1;
$oldDate = $today .  = . $newValue;
$newDate = preg_replace('/(\d+\s\=\s)(\d+)/ie', 'incDate($1,$2)',  
$oldDate);

file_put_contents($file, $newDate . \n);

This works with one file but with multi lines I'm having trouble:
if the file has:
20060301 = 34
20060302 = 3
the file after script will be:
20060302 = 4

I want it to preserve the previous lines
so output should be:
20060301 = 34
20060302 = 4

Help would be great, thanks
Ben

[PHP] subtract dates

2006-03-01 Thread Benjamin Adams
I'm trying subtract to dates the user enters in and get the days  
between.

Dates are stored as
date('mdY')
is there a built in function to subtract to dates is this format?

Thanks

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



[PHP] working with ini files

2006-02-28 Thread Benjamin Adams
I have created my own ini file. I can read the values into an array  
fine. but What I want to do is change a value in the ini file. Example


file.ini
dog = 3
cat = 4
fish = 7

altered file.ini
dog = 3
cat = 5
fish = 7

how can I do this, I tried using ini_set but its not working.
help would be great, Thanks!!
Ben

[PHP] auto download

2006-02-22 Thread Benjamin Adams

I have three links. The code already auto selects one.
I'm trying to take that one link and automaticly start the download.
I tryed with header('location:$link');
but it tells me Warning: Cannot modify header information
what would I use to start downloading?
one of the link is another page so I need it to pop up in a new window.

Thanks for any help

Re: [PHP] auto download

2006-02-22 Thread Benjamin Adams

I have it working with javascript but the if statements are not working:
?php
$num_download = rand(0,100);
echo $num_download;
if($num_downlaod = 50){
?
script type=text/javascript
   window.open('?=$conf[$links]['link1']?');
   /script
?php
}else if(($num_download  50)  ($num_download = 75)  ($conf 
[$links]['link2'] != '')){

?
script type=text/javascript
   window.open('?=$conf[$links]['link2']?');
   /script
?php
}else if(($num_download  75)  ($num_download = 100)  ($conf 
[$links]['link3'] != '')){

?
script type=text/javascript
   window.open('?=$conf[$links]['link3']?');
   /script
?php
}else{
?
script type=text/javascript
   window.open('?=$conf[$links]['link1']?');
   /script
?php
}
?

Only the first if runs and is true all the time.
What is wrong with the code?

On Feb 22, 2006, at 12:41 PM, John Nichel wrote:


Benjamin Adams wrote:

I have three links. The code already auto selects one.
I'm trying to take that one link and automaticly start the download.
I tryed with header('location:$link');
but it tells me Warning: Cannot modify header information
what would I use to start downloading?
one of the link is another page so I need it to pop up in a new  
window.

Thanks for any help


http://us2.php.net/header

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

--
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



[PHP] Working with a config file

2006-02-20 Thread Benjamin Adams

I'm trying to parse a config file, example of the config is:
[fred]
id=8782
section=s1
years=4
download1=mirror1

[frank]
id=8372
section=s3
years=4
download1=mirror12
download2=mirror2
.
.
.

I want to parse this so I can only call frank or freds data and move  
id, section, years, etc to varaibles.

Can someone give me some help
Thanks
Ben

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



[PHP] Having resource variables over several scripts

2005-10-10 Thread Benjamin Mack

Hey,

I am trying to have e.g. a file opened over several scripts. When 
opening a file with fopen I receive a variable of the type resource 
(like Resource ID #3), but when I try to save this variable in the 
SESSION and try to use it on another page, I get a null variable.


Because I need to have the same and exact resource (not opened every 
time I load a new page) and since it is apparently not possible to store 
it in a session, I wanted to ask if somebody had the same issue once, 
and maybe there is some help out there.
Could I somehow serialize the resource, then give it to another page via 
GET or POST?


I would really appreciate if somebody has some hints...

Thanks,
benni.
-SDG-

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



Re: [PHP] Having resource variables over several scripts

2005-10-10 Thread Benjamin Mack

Hey,

actually, the key problem is that:
I installed this ssh2 extension and want to connect to e.g. a server, 
and then, maybe on the next page, enter a command that will be executed 
on that server and so on. I can't connect to a server everytime (or: i 
COULD but I don't want to) because it takes a whole lot of time to do this.

  http://www.php.net/manual/en/function.ssh2-connect.php
the connection I receive there is a resource.

Maybe I'll find a way with not exiting a script...

--
greetings,
benni.
-SDG-


Jeffrey Santos wrote:

I was under the impression he was using the resource to get information then
trying to pass that information... rereading it makes it seem otherwise, so
sorry for the false information :-P  I've never actually tried passing
resources themselves among scripts so TG is most likely correct.  As far as
not exiting the script, that wouldn't seem very efficient and you might be
better off just reaccessing the resources as needed.

- Jeff
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Monday, October 10, 2005 1:10 PM

To: php-general@lists.php.net
Subject: RE: [PHP] Having resource variables over several scripts

Ok, first let me disclaim that there are definitely a lot of people a lot
smarter than me out there who may have figured this one out already, but as
far as I know, resources like open file handles, database connection
handles, objects, etc..  but especially anything that returns a resource
number are not going to be carried over from one script execution to
another.

If I recall properly, lets say script1.php opens a file, that's resource #1,
then it opens a database connection, that's resource #2, etc..

Now let's say script2.php opens a database connection first, that's resource
#1 for that script, then opens another database connection, that's resource
#2, now it opens a file, that's resource #3..   


So the 'resource' number isn't tied to a certain type of handle (file, db
connection, etc), it's based on the order of resources allocated.

That's only semi-related to what you're talking about, but thought it was
worth mentioning.

But I believe all of these resources are freed up as soon as the script
finishes executing thereby necessitating re-opening files, db connections,
recreating objects, (maybe objects can be serialized, I forget) when the
next script is executed.  No carry-over possible.


The solution?  Don't exit the script.  Unfortunately in an web environment
you can't really keep a php script executing unless you create a php based
server that your scripts connect to (doesn't have to be php based really..
just any server that listens and can keep files open for as long as they're
needed).

Or maybe try to consolidate your file operations, in this case, so you can
do it all in one pass.  Don't open a file, read one little thing, close
it...  re-open it.. read something else... close it..  user makes changes..
opens file again.. writes changes.. closes it.  read once and write
once..See if you can streamline it somehow.

Just some thoughts off the top of my head.  Again, maybe someone else has a
better answer, but I can't see how you'd avoid opening and closing each time
unless you had a back-end server type program running.

-TG



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



[PHP] phpeclipse ide question

2005-01-18 Thread Benjamin Edwards
After the discussion about editors I have installed phpeclipse. It seems to 
work well and looks great.  However I am having slight problem.  

Whenever I save a file it seems to try to launch a browser, anyway it comes up 
with a message saying something like 'unable to launch external browser.  
Please set up your external browser in browser preferences.  It also launches 
an internal browser which is blank and if I type a URL in I get nothing.  

I have found a place to set up browsers and have both firefox and mozilla setup 
(I think) but am not sure wether I have set this up correctly (seems I have 
not).  So my questions are.

1) where exactly and how do I set up an external browser to launch when I save 
a .PHP file.

2) How can I get the internal browser working, do I need to set up some stuff.

3) How do I turn off the auto launch when I save a .PHP file and if I do this 
how do I manually launch it in the internal/external browser.

In fact launching the .PHP file from eclipse is of limited use as most of my 
pages require URL parameters.  So another question is

4)   Is there a way to set up testing URL (with ?/ parameters) for a .PHP file 
and is it possible to set up such a thing that calls a post  to the file.  

I know having a browser open and switching between eclipse is a totally good 
work around but this would be great.

Ben


__
This email and any files transmitted with it are confidential. It is for the 
intended recipient only. If you have received the email in error please notify 
the author by replying to this email. If you are not the intended recipient, 
you must not disclose, distribute, copy, print, or rely on this email. Any 
views expressed by an individual within this email which do not constitute or 
record professional advice relating to the RNLI, do not necessarily reflect the 
views of the organisation.

Registered Charity Number 209603

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



[PHP] Re: phpeclipse ide question

2005-01-18 Thread Benjamin Edwards
 David Robley [EMAIL PROTECTED] 01/18/05 01:38pm 
On Wed, 19 Jan 2005 00:08, Benjamin Edwards wrote:

 After the discussion about editors I have installed phpeclipse. It seems
 to work well and looks great.  However I am having slight problem.
...
 I know having a browser open and switching between eclipse is a totally
 good work around but this would be great.

 I suspect you may find the answers here:

 http://www.phpeclipse.de/tiki-forums.php 


I wish;)  Looked there last night and posted a question - no joy, thats why I 
am trying here.

Ben
-- 
David Robley

2400 Baud makes you want to get out and push!!

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


__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__


__
This email and any files transmitted with it are confidential. It is for the 
intended recipient only. If you have received the email in error please notify 
the author by replying to this email. If you are not the intended recipient, 
you must not disclose, distribute, copy, print, or rely on this email. Any 
views expressed by an individual within this email which do not constitute or 
record professional advice relating to the RNLI, do not necessarily reflect the 
views of the organisation.

Registered Charity Number 209603

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



Re: [PHP] php editor

2005-01-17 Thread Benjamin Edwards
Or you could get phpeclipse for free which is a php IDE.  It all depends on 
weather you are a web designer or a php developer.  If you are both you will 
still want an IDE (Integrated Development Enviroment) and Probably a debugger 
(see my previous email about phped).  If you can aford to throw your money 
around why dont you get Zend Studio and Dreamwever, or I can send you my paypal 
details...  

 David Green [EMAIL PROTECTED] 01/14/05 01:53pm 
I've been using Dreamweaver (currently MX) since I started writing PHP 
and I would defintiely recommend it if you can get hold of it.

You can download a trial from
http://www.macromedia.com/cfusion/tdrc/index.cfm?product=dreamweaver 



William Stokes wrote:

Hello,

I'm quite new with writing php code. I was considering of using some kind of
php editor program to help with the syntax. Know any goog ones?

Thanks
-Will

  


-- 
--
David Green
Information Centre, Central Science Laboratory
Sand Hutton, York, YO41 1LZ

Phone:  +44 (0)1904 462388 (GTN: 5129 2388)
Fax:+44 (0)1904 462111
E-Mail: [EMAIL PROTECTED] 
--
CSL email disclaimer: http://www.csl.gov.uk/email.htm 

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


__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__


__
This email and any files transmitted with it are confidential. It is for the 
intended recipient only. If you have received the email in error please notify 
the author by replying to this email. If you are not the intended recipient, 
you must not disclose, distribute, copy, print, or rely on this email. Any 
views expressed by an individual within this email which do not constitute or 
record professional advice relating to the RNLI, do not necessarily reflect the 
views of the organisation.

Registered Charity Number 209603

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



[PHP] PHPED PHP IDE (wasRe: [PHP] php editor)

2005-01-17 Thread Benjamin Edwards
Whats the story with this.  It seems too good to be true. A fully featured 
IDE/Debugger released under some sort of free software licence. The site you 
link to seems indicate that is is free software, it has a sourceforge.net logo 
at the botton.  However nuspere are selling it for £299.  what is the story?

Ben

 eoghan [EMAIL PROTECTED] 01/14/05 11:03am 

 Since I do Java, Python etc. on OSX/windows/Linux, I'm using Eclipse 
 with the PHPEclipse (PHPEclipse.de), I'm just starting PHP, but I'm 
 pretty happy with it so far. One thing I am wondering about is the 
 situation which Debugging in PHP4 / PHP5. Is there a Debugger for PHP?


http://dd.cron.ru/dbg/downloads.php 

eoghan

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


__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__


__
This email and any files transmitted with it are confidential. It is for the 
intended recipient only. If you have received the email in error please notify 
the author by replying to this email. If you are not the intended recipient, 
you must not disclose, distribute, copy, print, or rely on this email. Any 
views expressed by an individual within this email which do not constitute or 
record professional advice relating to the RNLI, do not necessarily reflect the 
views of the organisation.

Registered Charity Number 209603

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



Re: [PHP] Finding first/last occurrence of a substring

2005-01-17 Thread Benjamin Edwards
You need to use regular expresions, I think there is a regex_replace frunction 
(or something like that).

http://etext.lib.virginia.edu/helpsheets/regex.html is a fairly good 
introduction to regular expresions - learn to love them ;)

 Vikram Vaswani [EMAIL PROTECTED] 01/17/05 03:27pm 
Hi
I have a string like this:

Just when you begin to think the wagon of Vietnam-grounded movies is grinding 
to a slow halt, you're hit squarely in the face with another one. However, 
while other movies depict the gory and glory of war and its effects, this 
centres on the psychology of troopers before they're led to battle.

I need to know the index position of every occurrence of the pattern the in 
the string above, and replace it with something else. Specifically, I need the 
position of the last, first and third occurrences of the.
 
I'm totally lost as to how to do this. Could someone help me out?
 
TIA,
 
Kam
 


-
Do you Yahoo!?
 Yahoo! Mail - You care about security. So do we.

__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__


__
This email and any files transmitted with it are confidential. It is for the 
intended recipient only. If you have received the email in error please notify 
the author by replying to this email. If you are not the intended recipient, 
you must not disclose, distribute, copy, print, or rely on this email. Any 
views expressed by an individual within this email which do not constitute or 
record professional advice relating to the RNLI, do not necessarily reflect the 
views of the organisation.

Registered Charity Number 209603

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



[PHP] 2 dimensional array processing

2005-01-11 Thread Benjamin Edwards
If I create the following 2 dimensional associative array:-

$insert[tab2][fields1] = value1;
$insert[tab1][fields2] = value2;
$insert[tab2][fields5] = value3;
$insert[tab1][fields7] = value4;

how do I do 2 levels of nested loop with the first level looping through the 
first level of the array and the second nesting through the second.  something 
like:-

foreach( $insert as $table = $fields ) {
  foreatch( $fields as $field = $value ) {
echo update $table set $field = $value;
  }
}

Regards,
Ben







Re: [PHP] 2 dimensional array processing

2005-01-11 Thread Benjamin Edwards
Ok - looking at what you did I cant see any diference apart from turning a 
serious updated into a single update. This is usefull if I want to do an update 
but I actualy want an insert (the update was just used for this example).

I actualy want to do an insert so i'me thinking the following would work:-

foreach  ($insert as $table = $fields) {
foreach($fields as $field = $value) {
$columns[] = $field;
$values[] = '.$value.';
}

echo 
insert into $table ( .implode( ', ', $columns ).
 values ( .implode( ', ', $values ). ) ;
unset($columns);
unset($values);
}

Ben

 Brent Baisley [EMAIL PROTECTED] 01/11/05 03:02pm 
You've created a 2x2 array, not a 1x4, which might be confusing you:
tab2 [fields1] [fields5]
tab1 [fields2] [fields7]

You almost have it, you just need to set your loop up to handle 
unlimited field/value pairs in your array.

One option is to structure your loop like this:
foreach  ($insert as $table = $fields) {
foreach($fields as $field = $value) {
$fieldValuePairs[] = $field = $value;
}
$fieldValueStr = implode(',', $fieldValuePairs);
echo update $table set $fieldValueStr;
unset($fieldValuePairs);
}

On Jan 11, 2005, at 6:22 AM, Benjamin Edwards wrote:

 If I create the following 2 dimensional associative array:-

 $insert[tab2][fields1] = value1;
 $insert[tab1][fields2] = value2;
 $insert[tab2][fields5] = value3;
 $insert[tab1][fields7] = value4;

 how do I do 2 levels of nested loop with the first level looping 
 through the first level of the array and the second nesting through 
 the second.  something like:-

 foreach( $insert as $table = $fields ) {
   foreatch( $fields as $field = $value ) {
 echo update $table set $field = $value;
   }
 }

 Regards,
 Ben






-- 
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search  Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577

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


__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__


__
This email and any files transmitted with it are confidential. It is for the 
intended recipient only. If you have received the email in error please notify 
the author by replying to this email. If you are not the intended recipient, 
you must not disclose, distribute, copy, print, or rely on this email. Any 
views expressed by an individual within this email which do not constitute or 
record professional advice relating to the RNLI, do not necessarily reflect the 
views of the organisation.

Registered Charity Number 209603

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



Re: [PHP] client information

2005-01-11 Thread Benjamin Edwards
A couple of things that mey help.  I think phpinfo() will display all the 
system varables.  These varables come from the web server so your web server 
documentation may help.  Another thing that may work is implode ( ',' $_SERVER 
) which should give you a (, comma) seperated list of $_SERVER (Not sure uf 
this works for assosiated arrays) and you can also see if the varable is there.

Ben

 Bruno Santos [EMAIL PROTECTED] 01/11/05 03:43pm 
Hello all.

I have a problem that i hope to solve with php. i know that, using 
$_SERVER['xxx'] is possible to find some information about the client 
who is accessing the script.
what i need to know if its possible to find out more information about 
the client, like in linux the DISPLAY variable of the client ?
if i make a system call, i get the server information and thats not what 
i want ?
if not with php, is possible to do it with javascript ?

thanx in advance

Bruno Santos

-- 
Say no to Software patents
www.nosoftwarepatents.com 

--

[EMAIL PROTECTED] 

--

Divisão de Informática
[EMAIL PROTECTED] 
Tel: +272 000 155
Fax: +272 000 257

--

Hospital Amato Lusitano
[EMAIL PROTECTED] 
Tel: 272 000 272
Fax: 272 000 257

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


__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__


__
This email and any files transmitted with it are confidential. It is for the 
intended recipient only. If you have received the email in error please notify 
the author by replying to this email. If you are not the intended recipient, 
you must not disclose, distribute, copy, print, or rely on this email. Any 
views expressed by an individual within this email which do not constitute or 
record professional advice relating to the RNLI, do not necessarily reflect the 
views of the organisation.

Registered Charity Number 209603

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



[PHP] unpacking $_POST when example[1], example[2] in form.

2005-01-10 Thread Benjamin Edwards
If I have a form with elements like

input type=text name=example[1]
input type=text name=example[2]

If example was not an array it would be accessed using

$_POST[example]

But how do I access the varable if it is an array like above.

Ben





[PHP] $_REQUEST

2005-01-10 Thread Benjamin Edwards
Trying to get my head around relationship between/use of  $_GET, $_POST and  
$_REQUEST.

It seems to me that  $_REQUEST is most useful as if it is used in place of 
$_POST/$_GET it would be possible to change posting method without changing the 
code. 

I am kind of assuming that $_REQUEST is and aggregate of $_POST, $_GET and 
$_FILES.  Is this correct or are there differences.

Ben








[PHP] Static variable reflection

2004-10-09 Thread Benjamin Dischinger
I have been using and experimenting with PHP 5's reflection API and
have ran into a wall.  I am trying to access static variables through
reflection but it seems as though they cannot be set.  The following
is some code that reproduces the problem.  Thanks to anyone that has
insight into my problem.

class ReflectionTest {
public static $x=5;
}

$refl = new ReflectionClass('ReflectionTest');
$prop = $refl-getProperty('x');
//$prop-getValue(NULL); not valid!  need object
$obj = $refl-newInstance();
echo $prop-getValue($obj);

$prop-setValue($obj,8);//Won't work!  Static variables can't be set!
echo $prop-getValue($obj); 

Output:
5
Fatal error: Uncaught exception 'ReflectionException' with message
'Cannot access non-public member' in C:\Program
Files\eclipse\workspace\PHPFlux\test.php:13 Stack trace: #0 {main}
thrown in C:\Program Files\eclipse\workspace\PHPFlux\test.php on line
13

Thank you,

Ben Dischinger

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



[PHP] PHP modules

2004-09-10 Thread Benjamin Bostow
I have heard of php modules and to the sound of it it allows me to 
create php functions that I don't have to have include files to have 
access to those functions. I have been searching for any information on 
this and have not had any success. I am basically trying to write an 
API that others can use in php that will interface with my software. I 
would like to make it so that they don't have to worry about adding 
include files and having all of the structures set up for that. If 
anyone can provide information on building custom functions and calls 
into PHP it would be helpful.

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


[PHP] php fam problems

2004-08-06 Thread Benjamin Adler
hi!

I'm trying to use the fam module from cli-php5 with the example code from 
http://de2.php.net/manual/en/ref.fam.php. It works, but when I copy a
big file into an observed folder, I get a FAMCreated for the file, and
then, while the copying is still in progress, multiple FAMChanged.

I want to watch a folder and process the files that are either new or
changed. Currently, I would end up processing a new or changed file n times,
with n depending on the file's size. I'd like to get ONE FAMCreated for a
new file AFTER it was completely created and ONE FAMChanged for a file
AFTER a process is done changing it. Is that possible?

Also, when I watch i.e. /mnt, FAM doesn't notify me of events in /mnt's
subdirectories, the monitoring seems to be non-recursive. Can I change
this, or will I have to fam_monitor_directory each directory separately?

thanks for your help!
Ben Adler

P.S: if possible, please CC me, I'm not on the list.

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



[PHP] list to array help

2004-03-29 Thread Benjamin Jeeves
Hi all,

I have a search where I search inside a document and count how many times I 
found a given word. 

My problem is that I have a list e.g. $list_path this is a string of where the 
file is location on the server what I need help on this getting this list 
into array format of /somepath/doc1.doc would be $array[0] then /somepath/
doc2.doc would be $array[1] and so on. Then I can use array_count_values for 
how many times in appears.

If I my going off can someone point me in the right way?


Thank You

Ben

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



[PHP] Re: list to array help

2004-03-29 Thread Benjamin Jeeves
Justin Patrin wrote:

 Benjamin Jeeves wrote:
 
 Hi all,
 
 I have a search where I search inside a document and count how many times
 I found a given word.
 
 My problem is that I have a list e.g. $list_path this is a string of
 where the file is location on the server what I need help on this getting
 this list into array format of /somepath/doc1.doc would be $array[0] then
 /somepath/ doc2.doc would be $array[1] and so on. Then I can use
 array_count_values for how many times in appears.
 
 If I my going off can someone point me in the right way?
 
 
 Thank You
 
 Ben
 
 What format is $list_path in? How is it a string-list? If there is a
 delimiter (; or , for example) you can us explode.
 
 $array_path = explode(';', $list_path);
 
I think the list is in scalar list e.g. if I print it as print
($list_path[0] I get
/home/user/index.php
/home/user1/index.php
/home/user2/index.php
/home/user3/index.php
and so on.

The only delimiter I can think of would to be explode on / and then
rebuild all the path from the array. But was hoping for a butter way as not
sure how to count all the values then?

Thank you

Ben

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



Re: [PHP] How to make sure a redirect works

2004-03-17 Thread Benjamin
Henry Grech-Cini wrote:
 1) Do not redirect if the page is visited as the result of a POST
Why is that?  I do it all the time and it seems to work fine.  I have 
read through all the emails for this thread and didn't find anything 
mentioned.  Am I doing something wrong?

Benjamin

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


[PHP] reading a pdf file into an array

2004-03-17 Thread Benjamin Jeeves
Hi All

Was hoping some one might be able to point me down the right road I would like to be 
able to read the context of a pdf file into an array then search that array for a word 
is this possible with php. e.g can I read a pdf file into an array ?

Thank you

Ben


[PHP] Trouble with ftp_get function

2004-03-11 Thread Benjamin
I'm sorry if this has already been asked before...

I am trying to make a small ftp app using this line to download files:

if( !ftp_get( $conn_id , C:\thefile.txt , $HTTP_GET_VARS['file'] , 
FTP_BINARY ) ) $error = true;

I know I have a connection, and $HTTP_GET_VARS['file'] is the path of 
the file I want to download.

I always get this error:
ftp_get(): Error opening C:/thefile.txt in /main.php on line 97
I have searched all over trying numerous different scripts to try and 
figure out what is wrong.  Does anybody have any ideas?

thanks,

Benjamin

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


[PHP] deleting array elements

2004-03-09 Thread Benjamin Jeeves
Hi All 

I have two array one with a list of items in it. Then a second array with a list of 
items in it what I want to be able to do is compare array1 to array2 and if a match is 
found in both arrays delete that match from array1 and then so now? Any help would be 
good.

so array1 = (1,2,3,4,5)
array2 = (1,3,5)

then print array1 and the output be 2,4

Thank you


[PHP] chunk_split();

2004-01-28 Thread Benjamin Trépanier
Title: chunk_split();




Hi,

I am using the chunk_split(); function to separe a long long text on differents pages.
At this time, I can split the string into x sections of 2000 characters. 

Now I need to show only the first 2000 . 
when user click on page #2, its reloading and show the next 2000 characters... If he click the page 4 button, its going to the 6000th caracters and it show his next 2000.. etc...

How can I split this text on many pages without loosing any characters?? Maybe the chunk_split function is not the good one...

Thanks 

Ben







[PHP] PHP uninstall/reinstall

2003-10-12 Thread Benjamin Howarth
Hi all, am a newbie to PHP so please spell your answers to my questions out
in words of one syllable or less...

I recently had PHP 4.2.1 installed on Windows 98 SE, then it suddenly
stopped working for some reason  - I don't know why or how, but I kept
getting SErver 500 errors. Having tried to remove all traces of PHP from the
Windows OS and tried to install the latest version (4.3.3), both with the
ZIP manual installation and the EXE self-install program, I still get
problems. Can anyone please please help, cause I really need PHP on my PC to
finish development of my local dramatics society's website and the
intermediary between me and the Society will puncture my jugular if I can't
get it working within the next week.

Ben Howarth

P.S. Am running PWS/IIS 3

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



[PHP] How to debug XSLT Errors?

2003-03-28 Thread Benjamin Walling
I'm trying to use the xslt_* functions, but I can't get any decent error
messages out of them.  I've used the XML and XSL I'm passing it in IE, and
it gets processed and transformed correctly.  The only error I get is:

Warning: Sablotron error on line 1: XML parser error 4: not well-formed
(invalid token) in C:\Websites\iStatus\test.php on line 16

In the log, I get:

Sablotron Message on line none, level log: Parsing
'http://localhost/Simple.xsl'...

So, I have an error on line 'none'?  Can someone show me which line that is?
My XML and XSL is processed correctly by IE, so what gives here?  How can I
get it to tell me what it is having a problem with?  Without a line number
or some context, there is no way I'll ever debug this!

Using the following code:

 $xh = xslt_create();
 xslt_set_log($xh, true);
 xslt_set_log($xh, getcwd() . '\sablot.log');
 $args = array('/_xml' = $xml);
 $html = xslt_process($xh, 'arg:/_xml', http://localhost/Simple.xsl;, NULL,
$args);
 xslt_free($xh);
 echo $html;



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



Re: [PHP] How to debug XSLT Errors?

2003-03-28 Thread Benjamin Walling
I've got sabcmd and it is giving the same message.  I've got about 3 hours
experience with XSL, so if this file is bad, let me know.  Also, do you have
a recommendation for an xsl/xml validator?  This XSL file works for me in IE
if I return my XML to the browser along with the tag ?xml-stylesheet
type=text/xsl href=Simple.xsl?.  The problem with returning the XML is
that there is more information in the XML than I want the user to have.  I
want the transform done on the server so the user does not get the full XML.

  ?xml version=1.0 encoding=ISO-8859-1 ?

 html xsl:version=1.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform;
xmlns=http://www.w3.org/TR/xhtml1/strict;
 HEAD
LINK REL=stylesheet HREF=DisplayFormat.css TYPE=text/css /
 /HEAD
 BODY CLASS=Status
 H3 CLASS=StatusActive Police Calls/H3
 TABLE CLASS=Status
 TR
  TH CLASS=Status
   Incident
  /TH
  TH CLASS=Status
   Call Time
  /TH
  TH CLASS=Status
   Address
  /TH
  TH CLASS=Status
   Building
  /TH
  TH CLASS=Status
   Apt
  /TH
  TH CLASS=Status
   Nature
  /TH
 /TR
 xsl:for-each select=root/row
  TR
  TD CLASS=Status
  xsl:value-of select=Field_InNum /
  /TD
  TD CLASS=Status
  xsl:value-of select=Field_CallTime /
  /TD
  TD CLASS=Status
  xsl:value-of select=Field_Address /
  /TD
  TD CLASS=Status
  xsl:value-of select=Field_Building /
  /TD
  TD CLASS=Status
  xsl:value-of select=Field_Apt /
  /TD
  TD CLASS=Status
  xsl:value-of select=Field_Nature /
  /TD
  /TR
 /xsl:for-each
  /TABLE
  /BODY
  /html




Ray Hunter [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Try using the command line sablot sabcmd to parse the xsl file and see
 if you can get any info on the well-formness of the file.  If you dont
 have the command line version I suggest downloading an application that
 does xsl verification.

 You could also send post the file so that we can review the xsl code.

 --
 Ray

 On Fri, 2003-03-28 at 10:22, Benjamin Walling wrote:
  I'm trying to use the xslt_* functions, but I can't get any decent error
  messages out of them.  I've used the XML and XSL I'm passing it in IE,
and
  it gets processed and transformed correctly.  The only error I get is:
 
  Warning: Sablotron error on line 1: XML parser error 4: not well-formed
  (invalid token) in C:\Websites\iStatus\test.php on line 16
 
  In the log, I get:
 
  Sablotron Message on line none, level log: Parsing
  'http://localhost/Simple.xsl'...
 
  So, I have an error on line 'none'?  Can someone show me which line that
is?
  My XML and XSL is processed correctly by IE, so what gives here?  How
can I
  get it to tell me what it is having a problem with?  Without a line
number
  or some context, there is no way I'll ever debug this!
 
  Using the following code:
 
   $xh = xslt_create();
   xslt_set_log($xh, true);
   xslt_set_log($xh, getcwd() . '\sablot.log');
   $args = array('/_xml' = $xml);
   $html = xslt_process($xh, 'arg:/_xml', http://localhost/Simple.xsl;,
NULL,
  $args);
   xslt_free($xh);
   echo $html;
 
 




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



[PHP] Line Number function?

2003-02-01 Thread Benjamin Smith
PHP keeps track of what line# is being executed, so that when there's an 
error (say in pg_exec() ) it reports what line the error occured on. 

This appears to happen even during runtime (not just during compilation). 

For example: 
-
?
$dbname=mydb; 
$dbuser=myuser; 
$dbpass=mypw; 

$conn=pg_connect(dbname=$dbname, user=$dbuser, password=$dbpass); 
$cmd=go and ask the mice; 
$result=pg_exec($conn, $cmd); 
?
--

This would result in a pg_exec error ~ line 7. PHP tracks this, even though 
the error is during runtime, not during the precompile. 

Is there a function where I can access this information? Something like 
get_line(); or something? 

This would be REALLY HANDY for debugging large projects... 

-Ben 

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




[PHP] Turn off PHP for certain directories?

2003-02-01 Thread Benjamin Smith
Is it possible (using an apache directive, perhaps?) to turn off php parsing 
for certain directories within a site? (but not others?) 

I picture something like (in httpd.conf) 

directory /home/www/somesite.com/codearchive
 AllowOverride All
 Options FollowSymLinks
 NoParsePHP
/directory

Can this be done? How? Perhaps as a php_value entry in the VirtualHost 
directive? 

Thanks,

-Ben 

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




Re: [PHP] how can I use an external 'template' file and still use PHP variables?

2003-01-10 Thread Benjamin Niemann
I think this should make it:

ob_start();
include(/pathto/customer_email.php);
$message = ob_get_contents();
ob_end_clean();

- Original Message -
From: Daevid Vincent [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, January 10, 2003 10:48 AM
Subject: [PHP] how can I use an external 'template' file and still use PHP
variables?


 I've posted this a few weeks ago with no response. I want to use an
 external
 email template as it were, so that the sales guys can edit it as they
 like and simply shuffle the variables around that they need
 $username and $password (either with or without the ?php ? tags).

 I don't want them mucking around in my code and potentially screwing it
 up. Not to mention having a huge 'email' text in between those
 HTMLMESSAGE markers is ugly as hell and ends up making the color-coding
 in HomeSite all kinds of whack at the end of it.

 I tried to use:

 $message = HTMLMESSAGE
   include(/pathto/customer_email.php);
 HTMLMESSAGE;

 But $message has the literal string
 ''include(/pathto/customer_email.php);'' instead of including the
 file. Grr.. (wouldn't it make sense that an include() should be parsed
 FIRST with the contents put in place basically? This seems like a 'bug'
 not a feature.

 I also tried:

 $filename = /pathto/customer_email.php;
 $fd = fopen ($filename, r);
 $message = fread ($fd, filesize ($filename));
 fclose ($fd);

 But all the $username, etc. are treated as literals and if I use
 ?=$username? in the customer_email.php the field is blank (like it's
 being parsed but doesn't have a value for it or something), instead of
 being converted to their actual PHP values. I also tried to put the
 global keyword in the customer_email.php file at the top.

 Ideally I would like to set things up so we have varoius form letter
 emails and I can switch them around based upon say a special order
 code, where the $user/$pw is always the same (depending on the database
 user of course), but the email content is different formats.

 Is there no way to accomplish this? Am I not being clear on what it is
 I'm trying to accomplish?

 My final thought is to use some regex to search for ?=$username? in
 $message after it's all been read in, and replace it with the variable
 $username or make up my own tag codes like [!username!] or something
 like that. This seems like such a hack, when PHP should be able to do
 this natively somehow.

 Surely somebody out there has had to do this type of thing?




 --
 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] EOF: how to generate one in a string

2003-01-08 Thread Benjamin Niemann

- Original Message -
From: Jean-Christian Imbeault [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, January 08, 2003 9:52 AM
Subject: [PHP] EOF: how to generate one in a string


 I am trying to use a command line program in Linux using this form:

 $result = `/path/prog $arg`;

 But this doesn't work as the program is expecting and EOF that never
comes.

 If I use the program on the command line when I am finished entering all
 the data I need to hit return and then CTRL-D to give an EOF.

 How can I simulate this using the backticks?
If $arg is, what you would enter in the command line, you need to pass it to
prog's stdin. You could use
`echo $arg | /path/prog` for example. If $arg is more that just a single
line w/o special characters, you should probably use popen for more control
(is it popen in php?...)



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




  1   2   >