Re: [PHP] php.ini

2013-10-09 Thread Simon Schick
Hi, Jim

I suggest to read this page of the tutorial. It seems, that it solves the
questions, you posted here:
http://www.php.net/manual/en/configuration.file.per-user.php

Please be aware, that the ini-file is not re-read on every request, but
after a defined time.
Neither are all settings changeable in those per-user ini-files.

Read also the other pages in this chapter, they're good to keep in mind ;)

If you're now calling the script from a webserver, you called by requesting
a page on a subdomain or a top-level-domain, doesn't matter.

Bye,
Simon


On Tue, Oct 8, 2013 at 4:48 PM, Jim Giner jim.gi...@albanyhandball.comwrote:

 Can someone give me an understanding of how the .ini settings are located
 and combined?  I am under the impression that there is a full settings .ini
 file somewhere up high in my host's server tree and that any settings I
 create in .ini files in each of my domain folders are appended/updated
 against the 'main' ini settings to give me a 'current' group of php.ini
 settings.

 What I'm looking to find out is does an ini setting established in a test
 subdomain of my site affect those ini settings outside of my test subdomain?

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




[PHP] Which function returns a correct ISO8601 date?

2013-09-07 Thread Simon Schick
Hi, all

Some days ago, I needed a date, formatted as date(c) ...

To be a bit more object-oriented, I worked with an instance of
DateTime. My first thought was: As the documenting for date() defines
'c' as ISO8601, I can take the constant provided in the DateTime
object ... right? ... and that was wrong.

Here's a code-example:

date(c);
// 2013-09-07T12:40:25+00:00

date(DateTime::ISO8601);
// 2013-09-07T12:40:25+

- Take special care to the notation of the timezone.

The method date(c) actually formats a date, fitting to the format
defined in the constant DateTime::ATOM.

Are both formats (with and without colon) valid for ISO8601, or is the
documentation for the method date() wrong?

Bye,
Simon

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



Re: [PHP] Re: Which function returns a correct ISO8601 date?

2013-09-07 Thread Simon Schick
Hi, Alessandro

Would it be worth noting somewhere, that these two implementations of
ISO8601 differ? Because I needed the DateTime::ATOM way to save the
timezone ... Even so the other one was also about ISO 8601 ...

My system is working towards a search-engine called ElasticSearch.
This one makes use of a Java method to format a date. This one is
defined here:
http://joda-time.sourceforge.net/api-release/org/joda/time/format/ISODateTimeFormat.html#dateOptionalTimeParser%28%29

The definition for a time-offset is defined like this:
offset= 'Z' | (('+' | '-') HH [':' mm [':' ss [('.' | ',') SSS]]])

Is there a format, you know of, that makes this difference (colon or
not) bullet-prove?
Bye,
Simon


On Sat, Sep 7, 2013 at 5:29 PM, Alessandro Pellizzari a...@amiran.it wrote:
 On Sat, 07 Sep 2013 14:47:00 +0200, Simon Schick wrote:

 The method date(c) actually formats a date, fitting to the format
 defined in the constant DateTime::ATOM.

 Are both formats (with and without colon) valid for ISO8601, or is the
 documentation for the method date() wrong?

 Yes:

 http://en.wikipedia.org/wiki/ISO_8601#Time_zone_designators

 Bye.



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


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



Re: [PHP] How to delete 3 months old records in my database?

2013-08-02 Thread Simon Schick
On Fri, Aug 2, 2013 at 2:02 PM, Karl-Arne Gjersøyen karlar...@gmail.com wrote:

 2013/8/2 Dušan Novaković ndu...@gmail.com

  $query = DELECT FROM `__table_name__` WHERE `__date__` BETWEEN NOW() -
  INTERVAL 3 MONTH AND NOW()
 

 This delete everything from now and 3months backwards. I want to store 3
 months from now and delete OLDER than 3 months old records.

 Karl

Hi, Karl

You're right, but restructuring, to get it the way you want, isn't be
that hard, is it? :)

$query = DELETE FROM `__table_name__` WHERE `__date__`  NOW() -
INTERVAL 3 MONTH

@Dusan,
Btw: What is DELECT? I assume it should've been DELETE, right?

Bye
Simon

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



Re: [PHP] Holding datetimes in a DB.

2013-03-01 Thread Simon Schick
Hi, Richard

I, too, tought about switching to UTC times in my database. The only reason
for me was to get prepared for globalisation.

A good article about this consideration is written at PHP Gangsta (sorry,
German only):
http://www.phpgangsta.de/die-lieben-zeitzonen

The reason, why I did not switch to UTC, was the reason, that most of the
pages I host have visitors mostly from Germany.

If you have visitors from different countries, you first have to find out
which time-zone they're in, which can be quite messy. Just watch this video
about timezones (I added a jump-node that get's you directly to the
interesting stuff):
http://www.youtube.com/watch?feature=player_detailpagev=84aWtseb2-4#t=230s

But basically that doesn't matter that much, since you - anyways - don't
get a time from the client, so you're stuck in this problem either way ...

Each example, I can come up with, does apply to UTC saved timestamps as
well as to non-UTC based timestamps.

One consideration, if you only have to operate in one timezone, like I do,
is stuff like cron-jobs.
Since I only have Germany as main-visitor-source, I can safely configure
the server to Europe/Berlin and pull out stuff like birthday-information at
midnight.

Please do also keep in mind here, that there are not only
full-hour-timezones :)
http://en.wikipedia.org/wiki/List_of_UTC_time_offsets

But  I can't come up with a problem that you wouldn't have with a local
timezone instead of UTC ...

Bye
Simon

On Fri, Mar 1, 2013 at 11:49 AM, Richard Quadling rquadl...@gmail.comwrote:

 Hi.

 My heads trying to remember something I may or may not have known to start
 with.

 If I hold datetimes in a DB in UTC and can represent a date to a user
 based upon a user preference Timezone (not an offset, but a real
 timezone : Europe/Berlin, etc.) am I missing anything?

 Richard.
 --
 Richard Quadling
 Twitter : @RQuadling
 EE : http://e-e.com/M_248814.html
 Zend : http://bit.ly/9O8vFY

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




Re: [PHP] templeting

2012-09-04 Thread Simon Schick
On Tue, Sep 4, 2012 at 8:16 AM, Louis Huppenbauer
louis.huppenba...@gmail.com wrote:

 I'm mostly working with twig, a symfony2 framework component.
 I especially like it's template inheritance and the (in my opinion) very
 clear syntax.

 http://twig.sensiolabs.org/

Hi, all

I most like to use template-engines that does not allow to write
direct PHP code in the template.
This restricts you to split the logic from the displaying code.

Template-engines I know of:
* Smarty
* Twig
* FLUID
* OPT (Open Power Template)

If you want a bigger list, visit wikipedia:
http://de.wikipedia.org/wiki/Template-Engine#Template-Engines_f.C3.BCr_PHP
http://en.wikipedia.org/wiki/Template_engine_%28web%29#Comparison

What I used most is Twig. For the next project (if it has no
template-engine build in in the system I choose) I'll give OPT a try.
It looks promising ;)

Bye
Simon

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



[PHP] Separate apc-caches for each fpm-pool

2012-08-28 Thread Simon Schick
Hi, all

Not to get the bugfix https://bugs.php.net/bug.php?id=57825 too much
off-topic, I write this question in the mailinglist here:

Taking the case I have two fpm-pools on different sockets - the first
pool is responsible for www.example1.com and the second one for
www.example2.com.

If www.example1.com has 4 workers, they're all using the same
apc-cache. That's absolutely as expected. But also the workers of
www.example2.com are using this cache. In my opinion it would be nice
if the pools would have a separate cache.

I now found a solution for this: Just use more than one fpm-master
that is controlling the pools. (http://groups.drupal.org/node/198168)

Is this the way to go, or do you know of another way?
Should this be added to the APC- or fpm-documentation or is it enough
that you can find f.e. it using Google, if you need it?

Bye
Simon

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



[PHP] Re: [PHP-DEV] Separate apc-caches for each fpm-pool

2012-08-28 Thread Simon Schick
Sorry, I first posted it with the wrong subject ([PHP-DEV] instead of [PHP])
http://news.php.net/php.general/318898

On Mon, Aug 20, 2012 at 11:44 AM, Simon Schick simonsimc...@gmail.com wrote:
 Hi, all

 Not to get the bugfix https://bugs.php.net/bug.php?id=57825 too much
 off-topic, I write this question in the mailinglist here:

 Taking the case I have two fpm-pools on different sockets - the first
 pool is responsible for www.example1.com and the second one for
 www.example2.com.

 If www.example1.com has 4 workers, they're all using the same
 apc-cache. That's absolutely as expected. But also the workers of
 www.example2.com are using this cache. In my opinion it would be nice
 if the pools would have a separate cache.

 I now found a solution for this: Just use more than one fpm-master
 that is controlling the pools. (http://groups.drupal.org/node/198168)

 Is this the way to go, or do you know of another way?
 Should this be added to the APC- or fpm-documentation or is it enough
 that you can find f.e. it using Google, if you need it?

 Bye
 Simon

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



[PHP] Who is responsible for NFD or NFC formated UTF8 text? PHP, my application or the system-administrator?

2012-08-28 Thread Simon Schick
Hi, all

Yesterday I ran into a big issue I didn't know about before:

There are many ways in UTF8 to save the same character. This applies
to all characters that can be combined of other characters. An example
for that is the German umlaut ö. In theory it can be saved simply as ö
or it can be saved as o followed by ¨.
I raised a question on stackoverflow on that and got tons of helpful
information.
http://stackoverflow.com/questions/12147410/different-utf-8-signature-for-same-diacritics-umlauts-2-binary-ways-to-write

If you don't know what NFD, NFC and those are, take the time and read
this article http://www.unicode.org/reports/tr15/ or at least take a
view at the figures 3-6.

As you read, I moved a page from a MacOSX Server to a Linux Server.
During this movement the filenames got converted from NFD to NFC.

Now my question is:
Is this a common issue?
What can I do to prevent it in the future?
Who's responsible of taking care of that?
I myself, Wordpress, the system I use, or I as the
system-administrator moving the website?

For example I don't know if Windows f.e. converts every filename to
NFC, but MacOSX (using HFS+) forces filenames to be NFD compliant.

Bye
Simon

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



Re: [PHP] OT (maybe not): Drupal vs WordPress

2012-08-20 Thread Simon Schick
Hi, all

+1 for that Joomla sucks ... worked with it for a while and just got
more and more disappointed of the way they write stuff. Just look at
how complicate it is to write an extension ...

Just a bit off-toppic (since you're talking about WP vs Drupal), but I
use Wordpress for small blogs and pages where I know that people don't
have that much experience with creating webpages and so on and need
very simple systems,
and TYPO3 for more complex pages (multiple domains, multi language,
complex submenus) because the system has it's own
configuration-language (TypoScript) that this let you do so many
things, way faster than writing it down in PHP. Another good bonus is
that you can decide to hide each single checkbox, inputfield or even
selections in a selectbox in the backend for an average person
administrating the web-content.

But because of the own configuration-language the learning-curve of
TYPO3 is (in my opinion) the highest of all CMS-systems for
developers.

One thing I also really like at the TYPO3-philolsophy: If someone
finds a security-issue he should immediately get in contact with the
developers (of the extension and the TYPO3 security team) and discuss
the issue with them. They decide how critical the bug is and will do a
hard work to get the fix as soon as possible. If it is a very critical
issue (someone could gain admin-access by something) they will send
out an email that there will be a bugfix coming out at next-coming day
at 9 o'clock GMT and everyone is advised to update his TYPO3-core or
the extension. This is something I really like! To be prepared for
some critical fix and knowing that (in a perfect case) no-one should
have heard about that issue before who wants to hack my website :)

Don't know if there's some similar security-policy in other
communities than this :)

Bye
Simon

On Sun, Aug 19, 2012 at 11:39 PM, Michael Shadle mike...@gmail.com wrote:

 If you are going to use something like joomla, use Drupal. Why bother.
 Drupal is trending up and is used by large companies and governments. Joomla
 is hokey. Yes this is going to spawn a religious debate. But joomla sucks.
 Sorry folks.

 --
 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] [PHP-DEV] Separate apc-caches for each fpm-pool

2012-08-20 Thread Simon Schick
Hi, all

Not to get the bugfix https://bugs.php.net/bug.php?id=57825 too much
off-topic, I write this question in the mailinglist here:

Taking the case I have two fpm-pools on different sockets - the first
pool is responsible for www.example1.com and the second one for
www.example2.com.

If www.example1.com has 4 workers, they're all using the same
apc-cache. That's absolutely as expected. But also the workers of
www.example2.com are using this cache. In my opinion it would be nice
if the pools would have a separate cache.

I now found a solution for this: Just use more than one fpm-master
that is controlling the pools. (http://groups.drupal.org/node/198168)

Is this the way to go, or do you know of another way?
Should this be added to the APC- or fpm-documentation or is it enough
that you can find f.e. it using Google, if you need it?

Bye
Simon

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



Re: [PHP] Crash course

2012-08-20 Thread Simon Schick
Hi, Lester

Just try to connect to your mysqlserver using a simple php script first.

Example for MySqli:
http://www.php.net/manual/en/mysqli.construct.php#example-1625

Example for MySql:
http://www.php.net/manual/en/function.mysql-connect.php#refsect1-function.mysql-connect-examples

If you still use MySql and not MySqli to connect to your MySql-Server:
Please keep in mind, that this extension is about to die out.

I just know of mysqli and mysql that you can chosse in the
Joomla-Installation process ...
PHP itself does also have PDO. There you have to check first if the
pdo-driver for mysql is installed:
http://www.php.net/manual/en/mysqli.quickstart.prepared-statements.php
And then try to connect to your server:
http://de2.php.net/manual/en/pdo.construct.php#refsect1-pdo.construct-examples

If you're using MySqli, please try a prepared-statement as well.
http://www.php.net/manual/en/mysqli.quickstart.prepared-statements.php
I got access to a server where the administrator had mixed it up that
hard, that mysqli as PHP-extension was installed and worked quite well
excepted by the prepared-statement :D

Bye
Simon

On Mon, Aug 20, 2012 at 12:51 PM, Lester Caine les...@lsces.co.uk wrote:

 OK - MySQL is not an area I've had to bother with, but I'm trying to sort
 out a tranche of websites that 11 messed up the DNS on last week and we
 have take over support for. All the databases have backed up and been
 restored ... although after Firebird's backup and restore system having to
 dump the database as raw SQL ... that took a LONG time :(

 Anyway I've installed the mysqli driver and that seems to be working and
 I've run 'test connection' in mysql workbench with what I think are the same
 settings in the  joomla without a problem, but the website just gives
 Database connection error (2): Could not connect to MySQL. I can browse
 the data in workbench, and changing user admin enables and disables that,
 but nothing seems to sort the php connection.

 Can anybody think of something that I have missed in this or point me to a
 suitable 'newbie' guide to debugging mysql connections so I can get all
 these sites back on line again ... If it was Firebird I'd just have mirrored
 of one of my other machines and been working as the security stuff is
 managed in the database, by mysql seems to have layers of security that I'm
 missing somewhere ;)

 --
 Lester Caine - G8HFL
 -
 Contact - http://lsces.co.uk/wiki/?page=contact
 L.S.Caine Electronic Services - http://lsces.co.uk
 EnquirySolve - http://enquirysolve.com/
 Model Engineers Digital Workshop - http://medw.co.uk
 Rainbow Digital Media - http://rainbowdigitalmedia.co.uk


 --
 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] Crash course

2012-08-20 Thread Simon Schick
Hi, Lester

I know how you feel ... I didn't want to disable E_STRICT either, but
as most of those errors come from the Joomla-Core or some extensions,
I don't have the nerves to fix code that's not mine and the developer
just says aaa ... those E_STRICTs ... why do you even care 

Therefore I gave up because the developer won't fix those and I don't
want to support my own fork of those extensions.

Bye
Simon

On Mon, Aug 20, 2012 at 1:40 PM, Lester Caine les...@lsces.co.uk wrote:
 Simon Schick wrote:

 Just try to connect to your mysqlserver using a simple php script first.


 Actually my next step was to try phpMyAdmin ;)

 Having created a new user with the correct rights it just worked out of the
 box. I was simply trying to use 'root' just to get going, but it seems that
 is blocked somewhere and will only work internally. That is I could not log
 into phpMyAdmin using 'root' ...

 joomla is using mysqli but as yet is obviously not strict compliant as
 http://gc.lsces.org.uk/ will demonstrate ... that is if I've not found where
 to patch joomla since I don't want to switch E_STRICT off just for that. If
 I do anything with joomla it will be replacing mysql, but to be honest I'll
 probably just move most of the sites to something *I* can work with :) I've
 already sorted the E_STRICT problem with my own stuff. I just need to get
 them running for now!


 --
 Lester Caine - G8HFL
 -
 Contact - http://lsces.co.uk/wiki/?page=contact
 L.S.Caine Electronic Services - http://lsces.co.uk
 EnquirySolve - http://enquirysolve.com/
 Model Engineers Digital Workshop - http://medw.co.uk
 Rainbow Digital Media - http://rainbowdigitalmedia.co.uk



 --
 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] [PHP-DEV] SQLite - Unwanted values using group-by

2012-07-10 Thread Simon Schick
On Sun, Jul 8, 2012 at 12:33 AM, Matijn Woudt tijn...@gmail.com wrote:

 Both of the results are valid outcomes. I think you don't understand
 the GROUP BY clause well enough. The parameters in the SELECT clause,
 should be either
 1) an aggregate function (like the max function you're using)
 2) one of the parameters in the GROUP BY clause.
 If not one of the above, it will return 'random' values for r.month
 and r.year. (probably the first it finds, which might differ in your
 test cases)

 - Matijn

Hi, Matijn

But I think you get what I mean, when I say that max() should only
point to one row, in this case the one with the latest date ;)
How is it possible to, for sure, get the data of this rows?

Btw: Here's someone talking about that ... Out of reading this, it
should work as expected.
http://stackoverflow.com/questions/1752556/is-it-safe-to-include-extra-columns-in-the-select-list-of-a-sqlite-group-by-quer#answers

Bye
Simon

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



[PHP] [PHP-DEV] SQLite - Unwanted values using group-by

2012-07-07 Thread Simon Schick
Hi, All

May you have an idea ...

Here's the full code-example:
http://viper-7.com/M5mldG

I have the following SQL command:

SELECT max(r.month+r.year*100), r.year, r.month
FROM base b LEFT JOIN remote r ON b.id = r.remote_id
GROUP BY r.remote_id

Now I expect that the first column in the results should look like a
combination of the second and third one .. so f.e. this:
array(3) { [max(r.month+r.year*100)]= string(6) 201201 [year]=
string(4) 2012 [month]= string(2) 01 }

But instead I get this result:
array(3) { [max(r.month+r.year*100)]= string(6) 201201 [year]=
string(4) 2011 [month]= string(2) 12 }

I tested it on Windows7 (PHP 5.4.4, SQLiteLib v3.7.7.1), where I get the
result as shown above ... and I've also tested it on a fresh installation
on LinuxArch (PHP 5.4.4 and SQLiteLib v3.7.13) - where it works as
expected! A college of mine has tested it on OSX (PHP 5.3.7 and SQLiteLib
v3.7.13) and he gets the same result as I on the windows version.
Someone of you have an idea?
Maybe had the same problem before ... what could it be?

I thought it might a problem of the SQLite-lib but both, the LinuxArch and
the OSX system, have the same SQLite version - and both, the windows and
the LinuxArch version, have the same PHP-version.

Even if the example just uses PDO, I've also tested this using the native
SQLite3 lib and I got at least the same result on Windows. Haven't tested
the other systems with the native SQLite3 lib.

Bye
Simon


Re: [PHP] reload page without use header

2012-06-17 Thread Simon Schick
Hi, Farzan

Redirecting is something you can do in a way the user doesn't see anything
(I call them server-side redirects) and in a way the user get's informed
that the url has changed (I call them client-side redirects).

What I mean with server-side (mostly called internal redirects) is if the
user requests a page, you can do stuff with mod_rewrite (in Apache) or some
equal webserver-module to call another file than requested. The user will
not get any notice about that.

Client-side redirects can be done using the HTTP-header (see
list-of-http-statushttp://en.wikipedia.org/wiki/List_of_HTTP_status_codes#3xx_Redirection),
JavaScript (please think also about a non-js solution) and by using a HTML-Meta
tag http://en.wikipedia.org/wiki/Meta_refresh.
In my opinion the best way to do a redirect, where the user gets noticed
about, is the HTTP-header. This can be set f.e by your webserver or by a
php-script.

Example for PHP-script:

header( HTTP/1.1 301 Moved Permanently );
header( Location: http://www.new-url.com; );

As far as I know, this is the only way to let other services (f.e. a
search-engine) know that this page has been moved permanently (or
temporarily) to another url.
That's the reason why I use the header-command (incl. setting the
HTTP-Status explicitly). If you don't set the HTTP-header, it will be added
(by PHP or your webserver). In my case, I use PHP 5.4 and nginx 1.2.1, the
header-code 302 is added if I don't set it.

May there are more ways to set redirects, but this are the one I know of.

Bye
Simon

On Sun, Jun 17, 2012 at 10:06 AM, Farzan Dalaee farzan.dal...@gmail.comwrote:

 hi guys
 is there any way to reload page without using header('location
 :index.php'); and javascript?
 Best Regards


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




Re: [PHP] Searching IDE.

2012-06-13 Thread Simon Schick
Hi,

There was a discussion about that on Google+ ...

IDEs mentioned there:

__Free
* Eclipse PDT (5x)
* Aptana - based on Eclipse but not using PDT for PHP (2x)
* Netbeans (12x)
* VIM (6x)
* KDevelop (1x)
* gedit (3x)

__NonFree
* Sublime Text 2 (6x) - USD $59
* PhpStorm (7x) - €94 personal, €189 commercial
* Komodo (2x) - $382
* Zend Studio - also based on Eclipse (1x) - €299

Just by a rough view over the comments, not really reading any of those :)

My personal opinion:
* Eclipse PDT
** not used since 2008
** was way to slow, specially the file-search
** missed some good PHP code support ... code-completion for classes and
it's functions was quite limited at that time

* Netbeans
** not used since 2009
** seemed as the best free IDE for PHP to me

* Zend Studio
** not used since 2008
** seemed to be Eclipse PDT with some extensions ..

* PhpStorm
** Costs a bit of money but it's really worth it.
** intelligent code-completion
** view class-structure as UML
** helper for refactoring
** supports changelists and has it's own stash
** just faster than Netbeans and Eclipse ..

That's how I used this programs. Netbeans, Eclipse PDT and PhpStorm have
way more features but this is what I used the time I tested them.

I personally would use PhpStorm if you have money - else Netbeans.

Bye
Simon

On Wed, Jun 13, 2012 at 11:54 AM, Lester Caine les...@lsces.co.uk wrote:

 David Arroyo wrote:

 I am searching an IDE for php and web development, my options are
 Aptana or Eclipse+PDT.
 What is your opinion?


 I'm using Eclipse with PHPEclipse but PDT is probably just as good
 nowadays. PHPEclipse needs a few updates to handle some of the 'new
 features' in PHP.

 The advantage of Eclipse is that ALL of my development work is done in the
 one IDE, so I can play with C/C++, Python, javascript and even occasionally
 Java without having to switch. It also runs transparently on both Linux and
 Windows platforms which I have to support ...

 Need to fire up the java side again and have a look at fixing PHPEclipse ;)

 --
 Lester Caine - G8HFL
 -
 Contact - 
 http://lsces.co.uk/wiki/?page=**contacthttp://lsces.co.uk/wiki/?page=contact
 L.S.Caine Electronic Services - http://lsces.co.uk
 EnquirySolve - http://enquirysolve.com/
 Model Engineers Digital Workshop - http://medw.co.uk//
 Firebird - 
 http://www.firebirdsql.org/**index.phphttp://www.firebirdsql.org/index.php


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




Re: [PHP] Which workstation????

2012-06-11 Thread Simon Schick
Hi, All

There was an interesting talk on the PHP Conference Spring 2012:
Concepts of Success: Choose Your Framework
http://phpconference.com/2012spring/keynotes#session-3

If somebody has been there, please write some notes ... I personally
haven't had the time to join but am quite interested, what the developer of
the frameworks say about their own systems in comparison to others. Pro and
(more interesting) Contra arguments.

The only stuff I found is in german and quite limited:
http://it-republik.de/php/artikel/FLOW3-Zend-Symfony-Auf-der-Suche-nach-dem-besten-Framework-4826.html

Bye
Simon

On Tue, Jun 5, 2012 at 2:22 PM, Simon Schick simonsimc...@googlemail.comwrote:

 Hi, Farzan

 I do not really get your point of confusion ...

 What you've posted here are tools/frameworks that do not to the same stuff
 at all, yes you could even use all without missing something ...

 cakephp
 .. is a full-stack PHP-Framework. Yes, I have to say that there's quite a
 bunch of full-stack frameworks in PHP you could choose and I myself would
 recommend one by knowing how much experience you have in PHP :)

 smarty
 .. is a template-engine for PHP. If you want to use smarty, twig, php
 itself or another library as template-engine is up to you. Using a
 template-engine for some programmers I know just feel like a better
 separation between the view and the controler/model (search for
 ModelViewControler if you don't know what I mean here).

 netbeans
 .. is an IDE where you can develop with. I prefer to use PhpStorm, others
 use EclipsePDT, Notepad++ or even the basic editor of windows. This is just
 about syntax-highlight, code-completion and other things helping you to
 develop your code.

 Hope that helps :)

 Bye
 Simon


 On Tue, Jun 5, 2012 at 2:10 PM, Farzan Dalaee farzan.dal...@gmail.comwrote:

 hi guys
 i really confuse by choosing the best work station for php ( cakephp ,
 smarty , net bean , ... ) , please give me some advisdes.
 and please tell why which one is better,
 tnx
 best regards farzan





Re: [PHP] Which workstation????

2012-06-05 Thread Simon Schick
Hi, Farzan

I do not really get your point of confusion ...

What you've posted here are tools/frameworks that do not to the same stuff
at all, yes you could even use all without missing something ...

cakephp
.. is a full-stack PHP-Framework. Yes, I have to say that there's quite a
bunch of full-stack frameworks in PHP you could choose and I myself would
recommend one by knowing how much experience you have in PHP :)

smarty
.. is a template-engine for PHP. If you want to use smarty, twig, php
itself or another library as template-engine is up to you. Using a
template-engine for some programmers I know just feel like a better
separation between the view and the controler/model (search for
ModelViewControler if you don't know what I mean here).

netbeans
.. is an IDE where you can develop with. I prefer to use PhpStorm, others
use EclipsePDT, Notepad++ or even the basic editor of windows. This is just
about syntax-highlight, code-completion and other things helping you to
develop your code.

Hope that helps :)

Bye
Simon

On Tue, Jun 5, 2012 at 2:10 PM, Farzan Dalaee farzan.dal...@gmail.comwrote:

 hi guys
 i really confuse by choosing the best work station for php ( cakephp ,
 smarty , net bean , ... ) , please give me some advisdes.
 and please tell why which one is better,
 tnx
 best regards farzan


Re: [PHP] requesting comments on rajmvServiceLog (access + error logging through PHP and JS to MySQL)

2012-05-21 Thread Simon Schick
Hi, Rene

I took a quick look over your code ...

I kind-of like the idea having all logging at one place, but the code is a
bit too messy if you ask me :)
If you would have put it on github and I would fork it - the first thing
I'd do is trying to get rid of the hm-lib and rewriting all in a bit more
object-oriented style, but that's just personal taste ;)
Specially the function rajmvServiceLog_graphs_raphael_calculateData() with
a code of ca. 280 lines is quite long ...
Additionally I think that setting an error-handler who's just returning
false is not a good way. Why not disable error-handling or write code that
produces no errors?

I think it would be good to mention that you're using the library adodb (
http://adodb.sourceforge.net/) and sitewide_rv (is it that?
http://mediabeez.ws/) or am I guessing wrong?

You're talking about a sql-file ... has my anti-virus-program removed
something here?

Please don't see that as destructive critic, but as hints what I would do
if I get to do with this code.

Bye
Simon

On Mon, May 21, 2012 at 12:46 PM, rene7705 rene7...@gmail.com wrote:

 Hi.

 I wasn't happy with the fact that Google Analytics doesn't record many
 of the hits on my sites, so I decided to roll my own analytics
 software, and opensource it.
 It's now in a state where I can request early comments.
 You can view a demo at http://mediabeez.ws/stats (under construction,
 may fail at times) (browser compatibility may be an issue, I built it
 with chrome, should work in firefox too, but won't (ever) in IE.)
 If you click on the graph while the details for a given day are
 visible, you will see the errors for that day in a DIV below the
 graph.

 Normally you'd hide the error details and $hits for anyone's who's not
 registred as a developer, of course. I've turned it on for all at the
 moment, so you can comment on that feature and review my results array
 $hits.

 I've opted, for simplicity of design, to store all settings I thought
 could be remotely interesting in a mysql db (see attached sql init
 file) (which is filled from PHP every time a page is delivered, and
 again from JS when the page has initialized fully, or does a HTML5
 History API location.href change), and then use PHP to retrieve all
 rows for a given datetime-range, and do the totals calculations in a
 php loop.
 I'm only keeping 1 row from the db in memory at any given time, but
 I'm building up a large deep array with the totals information in the
 php loop that goes over the rows.
 I'm wondering if this is a good approach, though. Maybe I should let
 the totals be calculated by the mysql server instead.

 I was thinking to let the totals calculations stay in php, and be
 executed from a cron job every hour. Only for the current month would
 you need to re-calculate every hour.
 I haven't figured out yet how to for instance only re-calculate the
 last hour, store results per hour, and then calculate the day and
 month totals from that hourly cache data when needed.
 I don't have a clue about how big companies do their totals
 calculations (for sites that get way more hits than mine, which is
 something i'd like to be able to support with my own analytics code),
 and would like to know how big companies do this.

 I've included the relevant draft code as attachment files to this
 mail, for your review. Please let me know if I have forgotten to
 include relevant code..

 As always, thanks for your time,
  Rene

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



Re: [PHP] [missing] images .htaccess

2012-05-21 Thread Simon Schick
Hi, Muad

I guess that you have a cms (would be nice to name it if it's not a
custom one) that handles all requests coming into the system. Think
now of How you know if the requested uri is a missing-image and write
it down as mod_rewrite rule.
Is this the only line you have in your .htaccess-script? What does the
cms with the request if the file is available? Does the cms here just
works like a proxy or is it doing some other magic? May it checks some
permissions first before it ships the file?

If you want to ungo passing requests for images to the cms, I'd do it like this:
It checkes if the request is pointing to a directory where only images
(or downloadable files) are located and lets apache do the rest to
provide the file. Or check for file-endings ...

RewriteRule \.(gif|jpg|jpeg|png)$ - [L]

You can then guess that all files ending with .jpeg, .jpg, .gif, .png
or similar are pictures, bypass the cms and let apache ship the file
or apaches 404-page if not available.
But this has nothing to do with PHP itself but is an apache-configuration.
Here's a beginner guide where I copied the line above:
http://www.workingwith.me.uk/articles/scripting/mod_rewrite

Bye
Simon

On Mon, May 21, 2012 at 5:55 PM, muad shibani muad.shib...@gmail.com wrote:

 Hi there

 how I can ignore [missing]  images and other files completely in .htaccess
  from being processed by the index.php file



 RewriteRule .* index.php [L]

 the CMS itself gives 404 error page for unknown request

 thanks in advance

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



Re: [PHP] IDE

2012-05-07 Thread Simon Schick
On Mon, May 7, 2012 at 3:10 AM, Ethan Rosenberg eth...@earthlink.net wrote:


 ===
 Simon -

 Thanks.


 I don't think you're talking about auto-form-fill and stuff like
 that, are you?


 No, I am not.

 Please send me your xdebug-config file.

 Thanks

 Ethan



Hi, Ethan

I forgot to mention that the whole configuration of my test-webserver
is on github ;) There are my configuration-files for apache, mysql,
nginx, php, solr and so on.
But I have to say that my environment is a bit special as I am
developing on a windows-machine and this configuration is running on a
virtual linux machine. Don't hesitate to ask things about the
configuration :)
https://github.com/SimonSimCity/webserver-configuration
For each program I have an init.sh script which will install the
program exactly the way I use it.
Feel free to fork it and add your stuff.

If you're just looking for the xdebug-configuration:
https://github.com/SimonSimCity/webserver-configuration/blob/master/php/conf/conf.d/xdebug.ini
You might have to change it to use it on a windows-environment ... at
least you'd have to move it into your php.ini file instead of an
separate configuration-file as it is on Linux.

As I am the only one developing on this machine, I've configured
xdebug in that way, that anyone can open a xdebug-debug-session. This
is done by enabling xdebug.remote_connect_back. Please do not use this
on your live-server, but set an ip-limit using xdebug.remote_host!

Please read this part of the xdebug-configuration to get a better
understanding on how to set up a working environment (specially the
part Starting The Debugger):
http://xdebug.org/docs/remote

The only problem I can report so far is, that I can't debug
command-line scripts ... If someone else reading that post has an
answer, I'd be glad to hear it.

Bye
Simon

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



Re: [PHP] IDE

2012-05-06 Thread Simon Schick
On Mon, May 7, 2012 at 12:33 AM, Ethan Rosenberg eth...@earthlink.net wrote:

 Dear List -

 Is there any IDE which will let me step thru my code AND give the
 opportunity to enter data; eg, when a form should be displayed allow me to
 enter data into the form and then proceed?  I realize the forms are either
 HTML and/or Javascript, but there must be a work-around.  I is exceedingly
 tedious to use echo print var_dump print_r.

 Thanks.

 Ethan



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


Hi, Ethan

The only thing I can come up with, that would really help you, since
you're just working with var_dump and print_r, is a php-debugger.

The common debugger for php are Zend Debugger and xdebug.

Nearly every IDE can be connected to them and if you set it up
correctly you can browse through your side (using your favourite
browser) and activate the debugger just by setting a cookie. For
several browsers there are plugins that set the cookie by clicking an
icon.
I'm talking about nearly every IDE because I saw a screenshot of
someone debugging a php-script using xdebug and vi :)

Just the first two links I found on google ...
* http://xdebug.org/docs/install
* 
http://www.thierryb.net/pdtwiki/index.php?title=Using_PDT_:_Installation_:_Installing_the_Zend_Debugger

Is that what you need?

I'm personally using PhpStorm and a VM with Debian, PHP 5.3 and xdebug
to debug my scripts and am perfectly fine with that. I can send you my
whole xdebug-config if you want :)

The stuff with javascript sounds like something automated to me ...
But I don't think you're talking about auto-form-fill and stuff like
that, are you?

Bye
Simon

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



Re: [PHP] function

2012-05-04 Thread Simon Schick
On Fri, May 4, 2012 at 4:29 AM, Dan Joseph dmjos...@gmail.com wrote:

 Are these inside classes or anything?  If they're just functions, they
 should work fine together, example of 2 working functions together:

 ?php

 hellotwo();

 function helloone()
 {
        echo hi 1;
 }

 function hellotwo()
 {
        helloone();
 }

 ?

 This results in hi 1 being echoed to the screen.

 --
 -Dan Joseph

 http://www.danjoseph.me

Hi, Ron

Another hint:
Maybe the other function (you want to call inside your first function)
is not defined at that time but in a file that's included later on ...

Bye
Simon

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



Re: [PHP] Best PHP Template System

2012-04-26 Thread Simon Schick
On Thu, Apr 26, 2012 at 12:07 AM, Yared Hufkens y4...@yahoo.de wrote:

 Why use an external engine which slows your scripts down to do something
 which can easily be done by PHP itself? PHP is imho the best template engine
 for PHP.
 With PHP 5.4, it became even easier because ?=$do-somestuff()? can be
 used without short_open_tag enabled.
 However, you always schould divide UI and backend.


Hi,

If you like to write an xml-template by having purely xml, you could
also use OPT (Open Power Template).

You can f.e. add a attribute to a tag by decision by writing this code:

div
opt:attribute name=class value=highlight opt:if=$highlightDiv/
Content
/div

Feels a bit cleaner to me than writing

div ?php if ($highlightDiv) : ?class=highlight?php endif; ?
Content
/div

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



Re: [PHP] Should I check imput for bad chars in this case?

2012-04-26 Thread Simon Schick
On Thu, Apr 26, 2012 at 2:15 PM, mirrys.net mirrys@gmail.com wrote:
 Hi all,

 this is more question than real problem (I hope :)). I include this
 script into my pages to log IPs of visitors (they are saved info txt
 file and send to e-mail later):

 function getIPadress()
 {
    if (isset($_SERVER[HTTP_CLIENT_IP]))
    {
        return $_SERVER[HTTP_CLIENT_IP];
    }
    elseif (isset($_SERVER[HTTP_X_FORWARDED_FOR]))
    {
        return $_SERVER[HTTP_X_FORWARDED_FOR];
    }
    elseif (isset($_SERVER[HTTP_X_FORWARDED]))
    {
        return $_SERVER[HTTP_X_FORWARDED];
    }
    elseif (isset($_SERVER[HTTP_FORWARDED_FOR]))
    {
        return $_SERVER[HTTP_FORWARDED_FOR];
    }
    elseif (isset($_SERVER[HTTP_FORWARDED]))
    {
        return $_SERVER[HTTP_FORWARDED];
    }
    else
    {
        return $_SERVER[REMOTE_ADDR];
    }
 }

 // save log to txt
 $fh = fopen($fileWithLog, 'a+') or die(Oups  . $fileWithLog . !);
 $IPAdress = getIPadress();
 fwrite($fh, date('j.n.Y G:i:s') . $IPAdress .  ( .
 gethostbyaddr($IPAdress) . )\n);
 fclose($fh);

 ...can this be some possible security risk (XSS or so..), becose I
 does not check chars in IP adress and host name mainly. It is probably
 crazy, but on the other side I think it isn't imposibble to use some
 bad strings in host name.

 Would you recommend use $IPAdress = htmlspecialchars(getIPadress());
 or something like? Or is it nonsense?

 Thx and excuse me, if this question is too stupid :(. Br, Mir R.

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


Hi, mirrys

Why not use the function filter_input()? This would be at least show
if the value is a valid ip-address.

function getIPadress() {
$params = array(
HTTP_CLIENT_IP,
HTTP_X_FORWARDED_FOR,
HTTP_X_FORWARDED,
HTTP_FORWARDED_FOR,
HTTP_FORWARDED,
REMOTE_ADDR
);

foreach($params as $param) {
if ($val = filter_input(INPUT_SERVER, $param, 
FILTER_VALIDATE_IP))
return $val;
}

return false;
}

This way you could even specify I don't want ip's out of a private
range and stuff like that ...
http://www.php.net/manual/en/filter.filters.validate.php
http://www.php.net/manual/en/function.filter-input.php

If no valid ip-address is found you'll get false here ... depends -
may you want to give 127.0.0.1 back then ;)

Bye
Simon

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



Re: [PHP] Should I check imput for bad chars in this case?

2012-04-26 Thread Simon Schick
On Thu, Apr 26, 2012 at 3:59 PM, mirrys.net mirrys@gmail.com wrote:
 Thank you for your help Marco  Simon. No doubt, your code is much
 cleaner and better.

 One more question, without any filter or something could be my
 original code somehow compromised (mean some security bug)? Or rather
 was a major problem in the possibility of a script crash?


Hi, Mirrys

I personally can not see a security-hole at the first view ...
Stuff in the global server-variable should only be set by the
webserver and therefore it should be kind-of save (depending on the
quality of the configuration of the webserver ;))

That was also the main reason why I would do a validation-check for this.
Talking about a script-crash ... I don't know ... I just found this
line in a comment for the function gethostbyaddress()

 If you use gethostbyaddr() with a bad IP address then it will send an error 
 message to the error log.

Bye
Simon

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



Re: [PHP] PHP: a fractal of bad design

2012-04-12 Thread Simon Schick
2012/4/12 Daevid Vincent dae...@daevid.com:
 http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/

 Can't say he doesn't have some good points, but he sure goes about it in a
 dickish way.

Hi, Daevid

I think this discussion is incomplete without mentioning the feedback
from Anthony Ferrara:
http://blog.ircmaxell.com/2012/04/php-sucks-but-i-like-it.html

Bye
Simon

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



Re: [PHP] Could apc_fetch return a pointer to data in shared memory ?

2012-04-02 Thread Simon Schick
2012/4/1 Simon slg...@gmail.com

 Another thing that's possible in .NET is the Singleton design pattern.
 (Application variables are an implementation of this pattern)

 This makes it possible to instantiate a static class so that a single
 instance of the object is available to all threads (ie requests) across
 your application.

 So for example the code below creates a single instance of an object for
 the entire server. Any code calling new App();  gets a pointer to the
 shared object.

 If PHP could do this, it would be *awesome* and I wouldn't need
 application
 variables since this is a superior solution.

 Can / could PHP do anything like this ?

 public class App
 {
   private static App instance;
   private App() {}
   public static App Instance
   {
      get
      {
         if (instance == null)
         {
            instance = new App();
         }
         return instance;
      }
   }
 }


 Creates an inste

Hi, Simon

Sorry for this out-of-context post - but just to answer to Simon's question:

One way of implementing Singleton in PHP is written down in the php-manual:
http://www.php.net/manual/en/language.oop5.patterns.php
I personally would also declare __clone() and __wakeup() as private,
but that's something personal :)

If you have many places where you'd like to use the Singleton-pattern
you may now think of having one class where you define the pattern
itself and extending other classes from that ... But that does not
seem the good way to me because this classes are not related at all,
in case of content.
Other frameworks are using interfaces but they have to write the code
for the implementation over and over again.

Here's where traids make the most sense to me:
http://stackoverflow.com/questions/7104957/building-a-singleton-trait-with-php-5-4

Bye
Simon

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



Re: [PHP] Watch out for automatic type casting

2012-03-29 Thread Simon Schick
Hi, Arno

I don't know if this is written somewhere in the php-manual, but I
really like this table:
http://en.wikipedia.org/wiki/Order_of_operations#Programming_languages

I do not really understand why this has some special stuff to do with
typecasting ... This is just an order like the operators + and * in
math.
If you'd ask me, this is exactly what I would expect to happen.

Bye
Simon

2012/3/29 Arno Kuhl a...@dotcontent.net:
 I found automatic typecasting can be a bit of a gotcha.



 $sText = this.is.a.test.text;

 if ( $pos = strpos($sText, test) !== FALSE) {

                echo  substr($sText, 0, $pos)..substr($sText, $pos,
 strlen(test))..substr($sText, $pos+strlen(test));

 }



 The code seems logical enough, and the expected result would be:

 this.is.a.test.text



 In fact it ends up being:

 this.is.a.test.text



 The reason is $pos is typecast as TRUE, not int 10, presumably because it's
 in the same scope as the boolean test.

 Then when $pos is later used as an int it's converted from TRUE to 1.



 You have to bracket the $pos setting to move it into its own scope to
 prevent it being typecast:

 if ( ($pos = strpos($sText, test)) !== FALSE) {



 No doubt it's mentioned somewhere in the php manual, I just never came
 across it.

 Just thought I'd highlight one of the gotchas of auto typecasting for any
 other simpletons like me.



 Cheers

 Arno


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



Re: [PHP] Watch out for automatic type casting

2012-03-29 Thread Simon Schick
Hi, Arno

FYI: I found a page in the php-manual that's exactly for that:
http://www.php.net/manual/en/language.operators.precedence.php

p.s. some of them were also new to me  Thanks for getting me to read it.

Bye
Simon

2012/3/29 Simon Schick simonsimc...@googlemail.com:
 Hi, Arno

 I don't know if this is written somewhere in the php-manual, but I
 really like this table:
 http://en.wikipedia.org/wiki/Order_of_operations#Programming_languages

 I do not really understand why this has some special stuff to do with
 typecasting ... This is just an order like the operators + and * in
 math.
 If you'd ask me, this is exactly what I would expect to happen.

 Bye
 Simon

 2012/3/29 Arno Kuhl a...@dotcontent.net:
 I found automatic typecasting can be a bit of a gotcha.



 $sText = this.is.a.test.text;

 if ( $pos = strpos($sText, test) !== FALSE) {

                echo  substr($sText, 0, $pos)..substr($sText, $pos,
 strlen(test))..substr($sText, $pos+strlen(test));

 }



 The code seems logical enough, and the expected result would be:

 this.is.a.test.text



 In fact it ends up being:

 this.is.a.test.text



 The reason is $pos is typecast as TRUE, not int 10, presumably because it's
 in the same scope as the boolean test.

 Then when $pos is later used as an int it's converted from TRUE to 1.



 You have to bracket the $pos setting to move it into its own scope to
 prevent it being typecast:

 if ( ($pos = strpos($sText, test)) !== FALSE) {



 No doubt it's mentioned somewhere in the php manual, I just never came
 across it.

 Just thought I'd highlight one of the gotchas of auto typecasting for any
 other simpletons like me.



 Cheers

 Arno


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



Re: [PHP] including PHP code from another server..

2012-03-26 Thread Simon Schick
Hi, Rene

I just want to say the same ... whatever you're trying to do here - it
will end up in a major security-isse that (I think) you won't fix that
soon as someone has hacked your server.

That sounds like you don't wanna pay 10$ per month for a good
multiple-domain-hosting solution.
If you're searching for something cheap for multi-domains, take a look
at providers like DreamHost or something similar.

Bye
Simon

2012/3/26 Stuart Dallas stu...@3ft9.com:
 REMOVE THAT SCRIPT FROM YOUR SERVER RIGHT NOW!

 See follow-up email direct to you for the reason!

 On 26 Mar 2012, at 14:53, rene7705 wrote:

 Hi.

 My last thread got derailed into a javascript and even photoshop
 discussion, and while I can't blame myself for that really, this time I
 would like to bring a pure PHP issue to your scrutiny.

 I run several sites now, on the same shared hoster, but with such a setup
 that I cannot let PHP require() or include() code from a central place
 located on another domain name on the same shared hosting account, not the
 normal way at least.
 $_SERVER['DOCUMENT_ROOT'] is a completely different path for each of the
 domains on the same hosting account, and obviously you can't access one
 domain's directory from another domain.

 Hoster support's reply is A) I dont know code, B) You can't include code
 from one domain on another and C) use multiple copies, 1 for each domain

 But that directory (my opensourced /code in the zip on
 http://mediabeez.wsbtw), takes a while to update to my hoster, many
 files.
 Plus, as I add more domains that use the same code base, my overhead and
 waiting time increases lineary at a steep incline.

 So.. Since all of this code is my own, and tested and trusted, I can just
 eval(file_get_contents('
 http://sitewithwantedcode.com/code/get_php.php?file=/code/sitewide_rv/autorun.php'))
 hehe
 And get_php.php takes care of the nested includes by massaging what it
 retrieves. Or so is my thinking.

 The problem I'm facing, and for which I'm asking your most scrutinous
 feedback, is:
 How would you transform _nested_ require(_once) and include(_once)? I
 haven't figured out yet how to transform a relative path include/require.
 What about for instance a require_once($fileIwantNow)?
 I do both in my /code tree atm.

 For my own purposes, I could massage my own PHP in /code/libraries_rv and
 /code/sitewide_rv manually, but I'd also like to be able to include a
 single copy of the 3rd party free libs that I use in
 /code/libraries(/adodb-5.10 for instance). And god knows how they might
 include and require.

 Plus, I'd like to turn this into another free how-to blog entry on
 http://mediabeez.ws, plus accompanying code, so I think I might find some
 free tips here again.

 Greetings,
 from spring sun soaked amsterdam.nl,
 Rene


 --
 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] foreach weirdness

2012-03-25 Thread Simon Schick
2012/3/25 Arno Kuhl a...@dotcontent.net:

 will not only give the wrong result, it will corrupt the array for *any* 
 further use of that array. I still think it’s a bug according to the 
 definition of foreach in the php manual. Maybe php needs to do an implicit 
 unset at the closing brace of the foreach where was an assign $value by 
 reference, to remove the reference to the last element (or whatever element 
 it was pointing to if there was a break) so that it doesn't corrupt the 
 array, because any assign to $value after the foreach loop is completed will 
 corrupt the array (confirmed by testing). The average user (like me) wouldn't 
 think twice about reusing $value after ending the foreach loop, not realising 
 that without an unset the array will be corrupted.


Hi, Arno

Requesting that will at least require a major-release (f.e. PHP 6.0)
... but I would rather request to add a notice or warning to the
documentation of references to remind stuff like that.
http://www.php.net/manual/en/language.references.php
I think this is stuff more people will stumble over ...

Bye
Simon

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



Re: [PHP] foreach weirdness

2012-03-23 Thread Simon Schick
2012/3/23 Robert Cummings rob...@interjinn.com

 On 12-03-23 11:16 AM, Arno Kuhl wrote:


 it still does not produce the correct result:
 0 1 3 6 10 15 21
 0 1 3 6 10 15 15


 This looks like a bug... the last row should be the same. What version of
 PHP are you using? Have you checked the online bug reports?



Hi, Robert

Does not seem like a bug to me ...
http://schlueters.de/blog/archives/141-References-and-foreach.html

What you should do to get the expected result:
Unset the variable after you don't need this reference any longer.

Bye
Simon

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



Re: [PHP] Bug zlib.output_compression not normal work in IIS7.5

2012-03-21 Thread Simon Schick
2012/3/19 小鱼虾 i...@xiaoyu.org

 How I do fix it ?


 https://bugs.php.net/bug.php?id=61434


Hi,

I got a rough overview of the conversation in the bug-tracker ...

You were always talking about a tool you used to test the
gzip-compression ... but why not test it natively?
Using Firefox (with the extension Firebug) or Safari / Chrome for
example you can easily view the respond-header from the server and get
more info out of that.
Just press F12, click on the network-tab, select your request and
search in the response-header for Content-Encoding: ...

I would write my own small php-test-script where you just output some
text. Then you're sure that not other code is doing something strange.

Another possible problem: Is the extension zlib enabled at all? The
documentation says that it's disabled by default ...
http://www.php.net/manual/en/zlib.installation.php

Bye
Simon

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



Re: [PHP] Have little enough hair as it is ...

2012-03-12 Thread Simon Schick
2012/3/12 Lester Caine les...@lsces.co.uk:
 More irritating is
 'Notice: Array to string conversion' which are coming up all over the place.
 I can understand what the problem is ... but trying to remove the notices is
 more challenging ...

 $secondsGap[] = array($gap[0] * 60, $gap[1] * 60);
 if( isset($secondsGap[1]) ) {
        $gapName = $secondsGap[0].to.$secondsGap[1];
 } else {
        $gapName = $secondsGap[0];
 }
 $secondsGap[] is two numbers, which are used to create the name string, so
 what is the 'official' way of making this work without generating warnings?


Hi, Lester

I suggest that all done with this variable before is not of interest ...
Assuming this, I'd say the following:

 $secondsGap[] = array($gap[0] * 60, $gap[1] * 60);
Implicit initializing of an array that has the following structure:
array( array(int, int) );

 if( isset($secondsGap[1]) ) {
Trying to get the second element .. which will never happen if you
haven't added an element before the snipped you pasted here.

$gapName = $secondsGap[0].to.$secondsGap[1];
 } else {
$gapName = $secondsGap[0];
 }
[some-code]

I'm quite unsure what you want to do here. If you'd update the first
line as following it would always trigger the first condition:
$secondsGap = array($gap[0] * 60, $gap[1] * 60);

Bye
Simon

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



Re: [PHP] Have little enough hair as it is ...

2012-03-11 Thread Simon Schick
2012/3/11 Lester Caine les...@lsces.co.uk:
 ( Been down London over night ;) ) ... and was not awake enough to change
 email address ...


 http://piwik.medw.org.uk/phpinfo.php has http://piwik.medw.org.uk/ working
 fine...

 http://piwik.rainbowdigitalmedia.org.uk/phpinfo.php is just giving seg
 faults on http://piwik.rainbowdigitalmedia.org.uk/ but
 http://rainbowdigitalmedia.org.uk/ is working perfectly.

 The piwik analytics is based on Zend, and I've not been able to get it
 working on either of the two new machines, while all of my other stuff is
 working fine. I started with Apache2.4.1 and PHP5.4.0 and moved back to
 what
 should be the same versions as the working machines but without success.


 Simon Schick wrote:

 Can you give us some more information?

 I've been working on this for some days and tried various combinations of
 Apache and PHP, but my starting point was Ap2.4.1 with PHP5.4.0 and I've now
 worked my way back through versions to what should be the same as setup as
 is working on piwik.medw.org.uk but I have yet to get piwik to run on either
 new machine!

 How is php called in your apache-configuration? (f)cgi, module or somehow
 else?
 You said that the configuration should be the same ... can you
 double-check that? Reload the services etc ...

 Always used module and I see no reason to change
 I've enabled and disable just about everything, and the installer tells me
 the set-up is fine.

 What about the logs? There must be more info in there ...

 THAT is what is pissing me off. ZEND does not seem to log anything usable
 and I have yet to establish the best way of debugging it. The rest of my
 stuff simply worked, gave the expected new nagging and allowed me to track
 and tidy them. EVERY configuration of ZEND based piwik just gives ...
 [notice] child pid 10345 exit signal Segmentation fault (11)
 With eaccelerator switched on and tracking, I can see files being cached,
 but have yet to work out what the next file would be, and to be honest, I'm
 not convinced it runs the same way every time, but that is probably just the
 order of parallel paths being run?

 --
 Lester Caine - G8HFL
 -
 Contact - http://lsces.co.uk/wiki/?page=contact
 L.S.Caine Electronic Services - http://lsces.co.uk
 EnquirySolve - http://enquirysolve.com/
 Model Engineers Digital Workshop - http://medw.co.uk//
 Firebird - http://www.firebirdsql.org/index.php

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


Hi, Lester

You're talking about some kind of installer ... What exactly is it?
And what exactly do you mean with ZEND does not seem to log ...?
Apache, PHP or something that's controlling both?
And the more interesting question as you're only talking about ZEND
... in which log-file have you found the notice? I guess it's the
log-file of Apache ...
I guess you have already tried to set Apache and PHP to the lowest
possible error-level ...

I searched up the inet and came across totally different solutions ...

Things that I found you can try:
* Replace the index.php ... Some people reported that this error was
caused by an endless-loop in their php-script
* Disable all php-modules that are not really needed (f.e. APC or eAccelerator)
* Disable all superfluous apache-modules (you should have done that
anyways, but let's try to put it to a minimum)

Here's also one tutorial how to get more information out of the
apache-process. Haven't tried that and can therefore just give the
hint to test it once.
http://stackoverflow.com/questions/7745578/notice-child-pid-3580-exit-signal-segmentation-fault-11-in-apache-error-l

Hope you can get some more details ...

Bye
Simon

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



Re: [PHP] file url access funniness

2012-03-10 Thread Simon Schick
Hi, TR Shaw

I would next try curl as php-extension.
If that is working well, and you need it definitely with file() I'd use
Wireshark to check which request is sent to the remote machine.

Bye
Simon

2012/3/10 TR Shaw ts...@oitc.com

 This is weird.  This statement fails:

$tlds = file(http://www.surbl.org/tld/three-level-tlds;,
 FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);

 Warning: file(http://www.surbl.org/tld/three-level-tlds): failed to open
 stream: HTTP request failed! HTTP/1.0 502 Bad Gateway

 also tried the final location and it fails with:

 Warning: file(http://george.surbl.org/two-level-tlds): failed to open
 stream: HTTP request failed!

 But a browser and the following work:

$response = shell_exec(curl -s -S -L
 http://data.iana.org/TLD/tlds-alpha-by-domain.txt -o
 tlds-alpha-by-domain.txt);

 Any ideas?  I'd rather not use curl if possible.

 TIA,

 Tom




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




Re: [PHP] Have little enough hair as it is ...

2012-03-10 Thread Simon Schick
Hi, Lester

Can you give us some more information?

How is php called in your apache-configuration? (f)cgi, module or somehow else?
You said that the configuration should be the same ... can you
double-check that? Reload the services etc ...

What about the logs? There must be more info in there ...

Bye
Simon

2012/3/10 Lester Caine les...@lsces.co.uk:
 OK this has got to be some configuration problem!
 I've two machines running fine Apache 2.2.15/PHP5.3.8 and two not with what
 should be identical Apache/PHP setups.
 All SUSE machines but 11.3, 11.4 and 12.1 with 11.3 and 11.4 machine running
 fine ...

 http://piwik.medw.org.uk/phpinfo.php has http://piwik.medw.org.uk/ working
 fine...

 http://piwik.rainbowdigitalmedia.org.uk/phpinfo.php is just giving seg
 faults on http://piwik.rainbowdigitalmedia.org.uk/ but
 http://rainbowdigitalmedia.org.uk/ is working perfectly.

 The piwik analytics is based on Zend, and I've not been able to get it
 working on either of the two new machines, while all of my other stuff is
 working fine. I started with Apache2.4.1 and PHP5.4.0 and moved back to what
 should be the same versions as the working machines but without success.

 ANYBODY got any ideas?
 What should I be doing next to try and track down where the seg fault is
 coming from?

 --
 Lester Caine - G8HFL
 -
 Contact - http://lsces.co.uk/wiki/?page=contact
 L.S.Caine Electronic Services - http://lsces.co.uk
 EnquirySolve - http://enquirysolve.com/
 Model Engineers Digital Workshop - http://medw.co.uk//
 Firebird - http://www.firebirdsql.org/index.php

 --
 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] Function mktime() documentation question

2012-03-07 Thread Simon Schick
Hi, All

To bring a work-around into this discussion I myself would not see it
as a good way to do it like that - even if the documentation provides
some information around that.
Here's what I have done in all new projects I worked with time-calculation:

@Tedd: Lets pick up your first example and work with the
DateTime-Object instead:

$date = new DateTime($year . '-' . $current_month . '-1');
$date-add( new DateInterval( 'P1M' ) ); // Add a period of 1 month to
the date-instance (haven't tried that with the 30th of Jan ... would
be kind-of interesting)

$days_in_current_month = $date-format('j'); // Get the date of the month

As this does not solve the problem (as we still should update the
documentation or the code if it does not match) it's not a solution,
but a suggestion to coding-style at all.
It seems a bit cleaner to me as you don't have to worry about the 13th
month, time-zones or other things that can be difficult to calculate
yourself.

Bye
Simon

2012/3/8 shiplu shiplu@gmail.com:
 To get the number of days for a specific month, I use:

 // $current_month is the month under question

 $next_month = $current_month + 1;

 I use this

 $next_month = $current_month + 1;
 $next_month_1    = mktime(0, 0, 0,     $next_month, 1, date(Y) );
 $current_month_1= mktime(0, 0, 0, $current_month, 1, date(Y) );
 $mdays = ($current_month_1 - $next_month_1)/(3600*24);

 It's much more easier if you use DateTime and DateInterval class



 --
 Shiplu.Mokadd.im
 ImgSign.com | A dynamic signature machine
 Innovation distinguishes between follower and leader

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



Re: [PHP] SESSION var and Objects problem

2012-03-02 Thread Simon Schick
Hi, Jim

To avoid this kind of problem it would also help to provide an
autoloader-function as PHP then tries to load the class-definition by this
autoloader ;)
Using that you'd bind yourself to have a pretty good system for php-classes
and you'd avoid having problems like that.

I'd in fact have never thought about a solution like that - but that may
comes from the fact that I always use auto-loader-scripts ;)

One additional info:
I had some problems putting an instance of *SimpleXmlElement *into the
session ... The only valuable info I found was this error:
*Fatal error: Exception thrown without a stack frame in Unknown on line 0*

Here's the solution and description why:
http://stackoverflow.com/questions/4624223/object-in-session-fatal-error-exception-thrown-without-a-stack-frame-in-unknow#answer-4624256

Bye
Simon

2012/3/2 Jim Giner jim.gi...@albanyhandball.com

 Stuart Dallas stu...@3ft9.com wrote in message
 news:7eeba658-c7f6-4449-87bd-aac71b41e...@3ft9.com...

 Make sure the class is declared before you call session_start.
 *

 You Da Man!!

 I see now why it makes a difference.  The session tries to bring back the
 data but doesn't know how to handle the objects in the session vars since
 the objects haven't been defined.  Never would of thought of that!

 Thank you for being there!  :)



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




Re: [PHP] How do I enable more useful PHP error logging?

2012-02-29 Thread Simon Schick
Hi, Daevid

What you could do to have it quick is to install the plugin xdebug.

Here you can (as described in the documentation linked here) enable to get
some extra information for a E_* message from php.
http://xdebug.org/docs/stack_trace

I would not do that on a live-system where you have 30k v/s without
changing the default configuration as there are several options that would
dramatically slow down the system.
But if you're configuring this properly I think you'll get the best
information without changing the php-code itself.

Bye
Simon

2012/2/29 Tommy Pham tommy...@gmail.com

 On Tue, Feb 28, 2012 at 3:14 PM, Daevid Vincent dae...@daevid.com wrote:
  My question is, is there a way to enable some PHP configuration that
 would
  output more verbose information, such as a backtrace or the URL
 attempted?
 

 Have you looked at log4php? [1] It's a log4j (Java based) logging
 facility port to PHP.  IIRC for log4j, you can do various logging from
 FINEST, FINER, FINE, INFO, WARNING, ERROR (?), SEVERE levels within
 the application.  You can adjust levels as needed at run time.  You
 may want to have a wrapper that will do back trace and record the
 requested URL.  The log4* facility does rolling file logging, DB,
 e-mail, syslog, etc.  (I've used the log4j and log4net before.)  Very
 handy and flexible, IMO.

 HTH,
 Tommy


 [1] http://logging.apache.org/

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




Re: [PHP] Website preview script

2012-02-29 Thread Simon Schick
Hi, Nibin

I wonder what you'd call a website preview ...
Do you mean a screenshot or the HTML-response from the server, specially
prepared (sounds like you want to create a proxy ;))?

Bye
Simon

2012/2/29 Nibin V M nibi...@gmail.com

 No..what I am trying to write a website preview plugin attached to a
 control panel.. :)

 since I am a newbie, I don't know how to achieve this without modifying
 hosts file ( I am basically a linux sys admin ) :)

 @Martin -  I will check it. Since I am a beginner ( of course, just started
 to learn PHP today ) I need to start from scratch. If yo could provide some
 sample code, it will be great :)

 thanks for your input guys..

 On Thu, Mar 1, 2012 at 12:11 AM, Ashley Sheridan
 a...@ashleysheridan.co.ukwrote:

  **
  On Wed, 2012-02-29 at 19:29 +0100, Matijn Woudt wrote:
 
  On Wed, Feb 29, 2012 at 7:07 PM, Nibin V M nibi...@gmail.com wrote:
   Hello,
  
   I am very new to PHP coding. I am trying to achieve a task via PHP,
   regarding which I have been googling around for a few days and now
 come up
   with emtpy hands!
  
   Ok, what I need to write is a website preview script. That is I need
 to
   display a website hosted on serverA and pointing elsewhere, from
 ServerA (
   via curl possibly ).
  
   For example: I have configured techsware.in and google.com on ServerA
 ( of
   course google.com pointing to their IP ). I need to display the
 contents of
   google.com on my server , if I call http://techsware.in/google.phpwhich
   has some curl coding in it! Note, what I have is the domain name (
   google.com ) and the IP on which it is hosted on serverA to achieve
 this.
   Any way to achieve this?
  
   I can achieve this if I put my IP google.com in /etc/hosts file (
 its
   Linux ). But I need to run this script for normal users as well, which
   won't have super user privileges and thus unable to edit /etc/hosts
 file.
   So I want to specify somewhere in the PHP script that, google.compoints to
   my IP. I can do this with this little script.
  
 
  How about just doing a str_replace[1]?
 
  - Matijn
 
  [1]http://www.php.net/str_replace
 
 
  Why can't you use an iframe, or are you trying to offer this other
  websites content as if it were on your own site? If so, I would first
 check
  to see if you're actually allowed to do that, as that will bring up
 quite a
  few copyright issues otherwise, which can be very expensive.
 
--
  Thanks,
  Ash
  http://www.ashleysheridan.co.uk
 
 
 


 --
 Regards

 Nibin.

 http://TechsWare.in



Re: [PHP] Website preview script

2012-02-29 Thread Simon Schick
Hi, Ashley

The question is what this function does ;)
I think it really takes a screenshot of the server - whatever is shown
there right now. But how to get a browser running there in full-screen?

I came around that post for a couple of weeks ago and thought it could be
useful for someone here:
http://www.phpgangsta.de/screenshots-von-webseiten-erstellen-mit-php

Bye
Simon

2012/2/29 Ashley Sheridan a...@ashleysheridan.co.uk

 **
 On Wed, 2012-02-29 at 19:54 +0100, Simon Schick wrote:


 Hi, Nibin

 I wonder what you'd call a website preview ...
 Do you mean a screenshot or the HTML-response from the server, specially
 prepared (sounds like you want to create a proxy ;))?

 Bye
 Simon

 2012/2/29 Nibin V M nibi...@gmail.com

  No..what I am trying to write a website preview plugin attached to a
  control panel.. :)
 
  since I am a newbie, I don't know how to achieve this without modifying
  hosts file ( I am basically a linux sys admin ) :)
 
  @Martin -  I will check it. Since I am a beginner ( of course, just started
  to learn PHP today ) I need to start from scratch. If yo could provide some
  sample code, it will be great :)
 
  thanks for your input guys..
 
  On Thu, Mar 1, 2012 at 12:11 AM, Ashley Sheridan
  a...@ashleysheridan.co.ukwrote:
 
   **
   On Wed, 2012-02-29 at 19:29 +0100, Matijn Woudt wrote:
  
   On Wed, Feb 29, 2012 at 7:07 PM, Nibin V M nibi...@gmail.com wrote:
Hello,
   
I am very new to PHP coding. I am trying to achieve a task via PHP,
regarding which I have been googling around for a few days and now
  come up
with emtpy hands!
   
Ok, what I need to write is a website preview script. That is I need
  to
display a website hosted on serverA and pointing elsewhere, from
  ServerA (
via curl possibly ).
   
For example: I have configured techsware.in and google.com on ServerA
  ( of
course google.com pointing to their IP ). I need to display the
  contents of
google.com on my server , if I call 
http://techsware.in/google.phpwhich
has some curl coding in it! Note, what I have is the domain name (
google.com ) and the IP on which it is hosted on serverA to achieve
  this.
Any way to achieve this?
   
I can achieve this if I put my IP google.com
  in /etc/hosts file (
  its
Linux ). But I need to run this script for normal users as well, which
won't have super user privileges and thus unable to edit /etc/hosts
  file.
So I want to specify somewhere in the PHP script that, google.compoints 
to
my IP. I can do this with this little script.
   
  
   How about just doing a str_replace[1]?
  
   - Matijn
  
   [1]http://www.php.net/str_replace

  
  
   Why can't you use an iframe, or are you trying to offer this other
   websites content as if it were on your own site? If so, I would first
  check
   to see if you're actually allowed to do that, as that will bring up
  quite a
   few copyright issues otherwise, which can be very expensive.
  
 --
   Thanks,
   Ash
   http://www.ashleysheridan.co.uk
  
  
  
 
 
  --
  Regards
 
  Nibin.
 
  http://TechsWare.in
 


 It does sound more like a proxy than a preview script.

 What about using something like this:
 http://uk3.php.net/manual/en/function.imagegrabscreen.php

 I've never used it, but on first appearances it looks like it should
 produce the preview you require.


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





Re: [PHP] SimpleXML and the Single String (SOLVED)

2012-02-21 Thread Simon Schick
Hi, Jay

If you're not using the variable *$xmlCompany* somewhere else I'd try to
skip the array and just do it with this single line:
*$arrayLead[0]-Company = (string)
$xml-SignonRq-SignonTransport-CustId-SPName;*

The result should not differ from what you have now.

Bye
Simon

2012/2/21 Jay Blanchard jay.blanch...@sigmaphinothing.org

 Howdy,

 My PHP chops are a little rough around the edges so I know that I am
 missing something. I am working with SimpleXML to retrieve values from an
 XML file like this -

 $xmlCompany = $xml-SignonRq-SignonTransport-CustId-SPName;

 If I echo $xmlCompany I get the proper information.

 If I use $xmlCompany as an array value though, I get this object -

 $arrayLead[0]-Company = $xmlCompany; // what I did
 [Company] = SimpleXMLElement Object // what I got
(
[0] = Dadgummit
)
 I tried casting AND THEN AS I TYPED THIS I figured it out...

 $xmlCompany = array((string)
 $xml-SignonRq-SignonTransport-CustId-SPName); // becomes an array
 $arrayLead[0]-Company = $xmlCompany[0]; // gets the right bit of the array

 and the result is

  [Company] = Dadgummit
 Thanks for bearing with me!







Re: [PHP] pathinfo or other

2012-02-17 Thread Simon Schick
Hi, All

I do not remember where I found the list of variables that are provided if
you load PHP using Apache, nginx, IIS ...
Fact is that there's a list of variables in the CGI 1.1 definition that
should be given to a cgi script:
http://tools.ietf.org/html/rfc3875#section-4
PATH_INFO is on the list and therewith should at least be given to every
cgi-script.

As not all web-server are fully compatible to the definition or do not
support cgi 1.1 there are quite much posts where you find work-arounds for
misconfiguration web-servers.
I know about nginx that you have to add a special configuration to get the
path_info - but the example provided at the developers-page sometimes
returns a wrong value. See:
http://stackoverflow.com/questions/8265941/empty-value-to-path-info-in-nginx-returns-junk-value/

Maybe there are also some other known issues around this PATH_INFO ...
Here's a request for a portable way to receive the path-info even if it's
not provided by the web-server:
http://stackoverflow.com/questions/1884041/portable-and-safe-way-to-get-path-info

I've always tried to use something like mod_rewrite and manage all incoming
requests in an own dispatcher. That helped me a lot getting around this
problems.

Hope that this gives you more detailed information in what you need.

Bye
Simon

2012/2/17 Donovan Brooke li...@euca.us

 Elbert F wrote:

 SCRIPT_NAME is a server side path, try REQUEST_URI. This includes the
 query
 string but it's easy to remove.

 Elbert
 http://swiftlet.org



 Hi, I thought I should say that server side SCRIPT_NAME seems to be fine
 for me in this case. Thanks for the input.


 Donovan




 --
 D Brooke

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




Re: [PHP] pathinfo or other

2012-02-17 Thread Simon Schick
Hi,

Just to also add the discussion why mod_rewrite or PATH_INFO :)
http://stackoverflow.com/questions/1565292/mod-rewrite-or-path-info-for-clean-urls

Bye
Simon

2012/2/17 Simon Schick simonsimc...@googlemail.com

 Hi, All

 I do not remember where I found the list of variables that are provided if
 you load PHP using Apache, nginx, IIS ...
 Fact is that there's a list of variables in the CGI 1.1 definition that
 should be given to a cgi script:
 http://tools.ietf.org/html/rfc3875#section-4
 PATH_INFO is on the list and therewith should at least be given to every
 cgi-script.

 As not all web-server are fully compatible to the definition or do not
 support cgi 1.1 there are quite much posts where you find work-arounds for
 misconfiguration web-servers.
 I know about nginx that you have to add a special configuration to get the
 path_info - but the example provided at the developers-page sometimes
 returns a wrong value. See:
 http://stackoverflow.com/questions/8265941/empty-value-to-path-info-in-nginx-returns-junk-value/

 Maybe there are also some other known issues around this PATH_INFO ...
 Here's a request for a portable way to receive the path-info even if it's
 not provided by the web-server:
 http://stackoverflow.com/questions/1884041/portable-and-safe-way-to-get-path-info

 I've always tried to use something like mod_rewrite and manage all
 incoming requests in an own dispatcher. That helped me a lot getting around
 this problems.

 Hope that this gives you more detailed information in what you need.

 Bye
 Simon


 2012/2/17 Donovan Brooke li...@euca.us

 Elbert F wrote:

 SCRIPT_NAME is a server side path, try REQUEST_URI. This includes the
 query
 string but it's easy to remove.

 Elbert
 http://swiftlet.org



 Hi, I thought I should say that server side SCRIPT_NAME seems to be fine
 for me in this case. Thanks for the input.


 Donovan




 --
 D Brooke

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





Re: [PHP] basic captcha

2012-02-17 Thread Simon Schick
Hei, Ashley

The php bugtracker himself uses just simple math.
Others are made by clicking on the man's name in the picture (3 shaddows of
people with names in there) ...

But I myself dislike the visitor having extra-work. Therefore I'll stick to
the honey-pot the referer check and so on.
One check I think is quite effective is something google does for
discovering spam-mail:
Discover which language this mail is written in. If it does not seem to be
a lanuage at all its most likely spam ;) But I think that's not possible
for not-so-big websites ..

Anyways: most likely it's just about filtering the 99% spam and get all
user-mails through. Nothing is more annoying as when you (as user) get the
feedback *Go away! You're a bot.* ;)

Bye
Simon

2012/2/17 Ashley Sheridan a...@ashleysheridan.co.uk



 Simon Schick simonsimc...@googlemail.com wrote:

 Hi, all
 
 When you ask for a captcha, I'd first ask what do you want to use it
 for.
 If you read the first lines of Wikipedia it has been developed to
 differ
 between a real user and a bot.
 
 If you'd now say that you want to use it to protect spam in a formula
 I'd
 give you the same explanation that you can find here in german (in a
 bit
 more text): http://www.1ngo.de/web/captcha-spam.html
 The author of this link says that captchas are not efficient enough and
 give a new unnecessary barrier to all users. He also declaims that bots
 nowadays are better than ever and can even read captchas that many
 humans
 are not able to read.
 For this reason he provides a list of extra stuff that you can use to
 protect your formula against spam instead of a picture that's text
 should
 be written in an input-field.
 
 One of those is the honey-pot. You simply create an additional field
 (f.e. *
 email2*) hide it for most visitors (using *css*) and ignore the comment
 if
 there's text in here. As most of the bots cannot read css they'll fill
 a
 valid email-address in here :) But then you also have to think about
 users
 that have css disabled f.e. *ScreenReader*. Another disadvantage of
 this
 issue is that you can use an auto-field-fill mechanism provided by the
 browser who could fill this field ... But both cases should not be that
 difficult. For the screenreder you can change the label for the field
 to
 look like *Do not paste your email in here. Just leave it empty.* Just
 to
 have the word email again in here ;)
 
 Another good thing is to think about how fast this form can be
 submitted
 when the user enters the formula for the first time. Also think about
 the
 second time, when the user as entered some wrong values and you have to
 show him a message.
 If you have a formula that contains more than 5 fields it's quite
 unusual
 that the user can submit that below 2 sec after receiving the response.
 You
 could even add a feature by using javascript that the user cannot
 submit
 this form or his request will be delayed for a view seconds (one or
 two).
 
 If you want to know more about that, out there are plenty of plugins
 for
 different systems where you can see what other possibilities you have.
 One
 extension i like is the one from TYPO3. They have quite a bunch of such
 things and you can give each of the checks a value. If the sum of the
 values of the failing tests reaches a configured level, this
 form-submission will be rejected.
 http://typo3.org/extensions/repository/view/wt_spamshield/current/
 
 Wordpress: http://antispambee.de/
 
 Bye
 Simon
 
 2012/2/17 Savetheinternet savetheinter...@tinyboard.org
 
  On Fri, Feb 17, 2012 at 3:40 PM, Donovan Brooke li...@euca.us
 wrote:
   Hello,
  
   Does anyone know of a basic (open source or freeware) form captcha
 system
   for PHP?
  
   TIA,
   Donovan
  
  
  
  
   --
   D Brooke
  
 
  Hi,
 
  There are plenty of free PHP captcha scripts out there. Just google
  captcha PHP. Securimage (phpcaptcha.org) looks relatively okay.
 
  Thanks,
  Michael
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 

 I would avoid making a user type in something they see in a picture, as
 you've just succeeded in pissing off a bunch of blind people.

 Also, avoid relying on javascript. It can be turned off, disabled, blocked
 and sometimes isn't available at all, such as with some speech/Braille
 browsers.

 One popular route is to ask a question that only a human could answer. I
 use this method on the contact page of my site. I just ask a question such
 as

 Multiply the number of heads a person has by the number of legs on 2 dogs.

 It's easy for a human, but requires context, something a bot can't do
 effectively.
 Thanks,
 Ash
 http://ashleysheridan.co.uk



Re: [PHP] basic captcha

2012-02-16 Thread Simon Schick
Hi, all

When you ask for a captcha, I'd first ask what do you want to use it for.
If you read the first lines of Wikipedia it has been developed to differ
between a real user and a bot.

If you'd now say that you want to use it to protect spam in a formula I'd
give you the same explanation that you can find here in german (in a bit
more text): http://www.1ngo.de/web/captcha-spam.html
The author of this link says that captchas are not efficient enough and
give a new unnecessary barrier to all users. He also declaims that bots
nowadays are better than ever and can even read captchas that many humans
are not able to read.
For this reason he provides a list of extra stuff that you can use to
protect your formula against spam instead of a picture that's text should
be written in an input-field.

One of those is the honey-pot. You simply create an additional field (f.e. *
email2*) hide it for most visitors (using *css*) and ignore the comment if
there's text in here. As most of the bots cannot read css they'll fill a
valid email-address in here :) But then you also have to think about users
that have css disabled f.e. *ScreenReader*. Another disadvantage of this
issue is that you can use an auto-field-fill mechanism provided by the
browser who could fill this field ... But both cases should not be that
difficult. For the screenreder you can change the label for the field to
look like *Do not paste your email in here. Just leave it empty.* Just to
have the word email again in here ;)

Another good thing is to think about how fast this form can be submitted
when the user enters the formula for the first time. Also think about the
second time, when the user as entered some wrong values and you have to
show him a message.
If you have a formula that contains more than 5 fields it's quite unusual
that the user can submit that below 2 sec after receiving the response. You
could even add a feature by using javascript that the user cannot submit
this form or his request will be delayed for a view seconds (one or two).

If you want to know more about that, out there are plenty of plugins for
different systems where you can see what other possibilities you have. One
extension i like is the one from TYPO3. They have quite a bunch of such
things and you can give each of the checks a value. If the sum of the
values of the failing tests reaches a configured level, this
form-submission will be rejected.
http://typo3.org/extensions/repository/view/wt_spamshield/current/

Wordpress: http://antispambee.de/

Bye
Simon

2012/2/17 Savetheinternet savetheinter...@tinyboard.org

 On Fri, Feb 17, 2012 at 3:40 PM, Donovan Brooke li...@euca.us wrote:
  Hello,
 
  Does anyone know of a basic (open source or freeware) form captcha system
  for PHP?
 
  TIA,
  Donovan
 
 
 
 
  --
  D Brooke
 

 Hi,

 There are plenty of free PHP captcha scripts out there. Just google
 captcha PHP. Securimage (phpcaptcha.org) looks relatively okay.

 Thanks,
 Michael

 --
 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-13 Thread Simon Schick
Hi, Paul

I personally pretty much like the idea of auto-loaders, but that's a
personal point of view.
If you have always develop with scripts having autoloaders you'll hate to
write a *require_once* command at the beginning of all files. And what
would a dependency-injection-container be without an autoloader ;)
http://www.slideshare.net/fabpot/dependency-injection-with-php-53

If you write your code in OOP you should always have unique class-names. If
you follow this and use a good naming-convention both ways should be
usable. I prefer to use autoloaders, you maybe not and that makes code so
personalized ;) *like-it*

Bye
Simon

2012/2/13 Benjamin Hawkes-Lewis bhawkesle...@googlemail.com

 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] Swiftlet is quite possibly the smallest MVC framework you'll ever use.

2012-02-13 Thread Simon Schick
Hi, Elbert

I personally would remove the set_error_handler completely. This is a
configuration that the administrator has to handle himself. In a
development-env they want to see all errors, warnings etc, yes - even a
strict_notice. But in a production-env they dont want to show anything to
the user - just show a general error if something really heavy happened.
You can put that in the index.php but I'd wrap it in comments or remove it.

In my opinion it's a good idea to move the autoloader into the index.php.
Then you can even call your app class using the autoloader ;)

I'm just curious what exactly you want to try with the plugins ... Should
they simply be extensions or also possibilities to extend other plugins? I
also wrote my own framework 3 years ago and was more about making things
way more complex than they could be just to think about maximum flexibility
..

I pretty much also like the no-config part.
http://en.wikipedia.org/wiki/Convention_over_configuration


Bye
Simon

2012/2/12 Elbert F i...@elbertf.com

 Hi Simon,

 I think you're right that I may be abusing the constructor a bit. I'm
 going to follow your suggestion and split it up into smaller functions. I'm
 also thinking of moving the set_error_handler and spl_autoload_register
 functions to index.php where Swiftlet is bootstrapped so they can be
 changed.

 You make another good point about the model; it's never supposed to access
 the controller or view. I updated the code to reflect this. It should work
 like your second 
 flowcharthttp://betterexplained.com/wp-content/uploads/rails/mvc-rails.png(perhaps
  with the added concept of plugins, which can hook into anything).

 Symfony's routing is nice, many smaller frameworks take a similar approach
 (e.g. Sinatra http://www.sinatrarb.com/ and ToroPHPhttp://toroweb.org/).
 However, I like the fact that Swiftlet requires no configuration. Just drop
 in your class and it works. The file structure and classes already do a
 good job describing themselves.

 Excellent feedback, thanks!

 Elbert



 On Sun, Feb 12, 2012 at 10:53 PM, Simon Schick 
 simonsimc...@googlemail.com wrote:

 Hi, Elbert

 I've looked through the code and found it quite tiny :) I like that.

 Until now I found some things that I'd like to discuss with you:

 In the class App you're doing all the stuff (routing, calling the
 constructor aso) in the constructor. Would it not be better to have
 separate functions for that? I like the way I learned from using Java: The
 constructor is only for initializing the variables you need to execute the
 other functions of this class.
 Of course you can have a function that then calls all those small
 functions and maybe directly return the output.

 I dislike the way you treat with the model .. currently it gets the
 controller, the view and the app itself. If you ask me the model only needs
 some configuration. I cannot come up with an idea where you'd need more
 than a connection-string and some additional settings. The model has
 several methods to gather the data that has been requested and gives it
 back. If you'd ask me, there's no need for interaction with the app,
 controller or view.

 I'd like to see an option for the router like the one I've seen in
 symfony2 ... that was quite nice .. There you can define a regexp that
 should match the called url, some variables that should be extracted from
 that and some default-variables. It's quite hard to explain in the short
 term, but take a look at their documentation:
 http://symfony.com/doc/current/book/routing.html

 I'd like you to create a small workflow what your framework is doing in
 which order. Your framework to me looks like this image:
 http://imageshack.us/f/52/mvcoriginal.png/ But I'd rethink if this
 structure would give you more flexibility:
 http://betterexplained.com/wp-content/uploads/rails/mvc-rails.png

 I hope you got some input here you can work with. I'd like to hear your
 feedback.

 Bye
 Simon


 2012/2/12 Elbert F i...@elbertf.com

 I'm looking for constructive feedback on Swiftlet, a tiny MVC framework
 that leverages the OO capabilities of PHP 5.3. It's intentionally
 featureless and should familiar to those experienced with MVC. Any
 comments
 on architecture, code and documentation quality are very welcome.

 Source code and documentation: http://swiftlet.org






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

2012-02-12 Thread Simon Schick
Hi, Elbert

I've looked through the code and found it quite tiny. I like that.

Until now I found some things that I'd like to discuss with you:

In the class App you're doing all the stuff (routing, calling the
constructor aso) in the constructor. Would it not be better to have
separate functions for that? I like the way I learned from using Java: The
constructor is only for initializing the variables you need to execute the
other functions of this class.
Of course you can have a function that then calls all those small functions
and maybe directly return the output.

I dislike the way you treat with the model .. currently it gets the
controller, the view and the app itself. If you ask me the model only needs
some configuration. I cannot come up with an idea where you'd need more
than a connection-string and some additional settings. The model has
several methods to gather the data that has been requested and gives it
back. If you'd ask me, there's no need for interaction with the app,
controller or view.

I'd like to see an option for the router like the one I've seen in symfony2
... that was quite nice .. There you can define a regexp that should match
the called url, some variables that should be extracted from that and some
default-variables. It's quite hard to explain in the short term, but take a
look at their documentation:
http://symfony.com/doc/current/book/routing.html

I'd like you to create a small workflow what your framework is doing in
which order. Your framework to me looks like this image:
http://imageshack.us/f/52/mvcoriginal.png/ But I'd rethink if this
structure would give you more flexibility:
http://betterexplained.com/wp-content/uploads/rails/mvc-rails.png

I hope you got some input here you can work with. I'd like to hear your
feedback.

Bye
Simon


2012/2/12 Elbert F i...@elbertf.com

 I'm looking for constructive feedback on Swiftlet, a tiny MVC framework
 that leverages the OO capabilities of PHP 5.3. It's intentionally
 featureless and should familiar to those experienced with MVC. Any comments
 on architecture, code and documentation quality are very welcome.

 Source code and documentation: http://swiftlet.org