[PHP] After a PHP script timeout, Apache logs the error but may not cleanly exit the script

2013-10-06 Thread Meta Seller Admin
Hi. I'm wondering if anyone can help with this.

We're using PHP and Apache, hosted on a dedicated server running
Debian Linux. The specific versions in each case are mostly
immaterial, as this problem has been around since Debian 6, and is
still present in Debian 7; in the meantime we've been using the latest
versions of all packages.

We're having problems with PHP script timeouts, which although rare,
are behaving erratically and causing severe problems when they do
occur.

The timeouts are always recorded in the Apache log, and sometimes the
script and everything else may execute/terminate correctly, but often,
various failures may be observed, such as:

* timeouts not registered back to PHP - the script may not terminate
as expected (the function registered with register_shutdown_function()
- see code example below - may not be called);

* after a timeout, Apache may run in the background indefinitely,
using up CPU resources in one core;

* Apache may fail altogether - no further requests serviced - Apache
must be restarted.

The exact cause of the fault has not been found. It is reproducible on
all servers we deploy to.

Example PHP script:

//...
function _on_shutdown()
{
if (connection_status()  CONNECTION_TIMEOUT)
{
echo 'ERROR: TIMEOUT!';
//Do something else...
}
exit;
}
register_shutdown_function('_on_shutdown');
//...more code here...
//(various potentially long running scripts which may timeout)


The above was also posted here:
http://serverfault.com/questions/542045/after-a-php-script-timeout-apache-logs-the-error-but-may-not-cleanly-exit-the-s

Ric.

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



RE: [PHP] Can't connect to MySQL via PHP

2013-01-13 Thread admin


 -Original Message-
 From: tamouse mailing lists [mailto:tamouse.li...@gmail.com]
 Sent: Saturday, January 12, 2013 7:55 PM
 To: admin
 Cc: a...@ashleysheridan.co.uk; Rick Dwyer; php-general@lists.php.net
 Subject: Re: [PHP] Can't connect to MySQL via PHP
 
 On Sat, Jan 12, 2013 at 4:49 PM, admin ad...@buskirkgraphics.com
 wrote:
  As much as the php list would like to force people from using mysql,
 I guess you should not have invented it, if you don't want people to
 still use it.
 
 It's not this php list. It's the php developers. mysql* functions are
 set to be removed in a release coming soon.
 
 Time marches on. mysql* functions were written first, then the mysqli*
 functions were written. mysql* is old, out of date, and not begin
 supported.
 
 Should not have written it? Maybe? But maybe no libraries should have
 been written, nothing should move forward, better ways should not have
 been found.
 
 Maybe you want to do your computing using pebbles, too.



So let me understand how this works.
Someone ask for help, no matter what version they are using or function that is 
currently in place.
We slam them.
Call them an idiot.

Not that they ask a question about a function in the CURRENT version. Yes the 
documentation does fully express the function is depreciated, but let's deal 
with the now.
So let's NOT answer the question? (Hello, welcome to MICROSOFT)
I am very glad 90% of other languages that have list don't have the same 
approach.
They would gladly give you the answer, but then go on to express how they may 
suggest this (with example) because it is (safer, easier, ect...).

Every time I see someone give a simple answer in an approach to help them 
learn, in comes the marching band of ignorance and they are toting the banner 
of epic fail.
This is a list to help people understand php and grow the community and 
knowledge base of its inner workings. 
If you want to answer at question please at least use SOMETHING that is 
conducive to educating them.


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



RE: [PHP] Can't connect to MySQL via PHP

2013-01-13 Thread admin
 

 

From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] 
Sent: Sunday, January 13, 2013 8:52 AM
To: admin
Cc: 'tamouse mailing lists'; 'Rick Dwyer'; php-general@lists.php.net
Subject: RE: [PHP] Can't connect to MySQL via PHP

 

On Sun, 2013-01-13 at 11:37 -0800, admin wrote: 

 
 
 -Original Message-
 From: tamouse mailing lists [mailto:tamouse.li...@gmail.com]
 Sent: Saturday, January 12, 2013 7:55 PM
 To: admin
 Cc: a...@ashleysheridan.co.uk; Rick Dwyer; php-general@lists.php.net
 Subject: Re: [PHP] Can't connect to MySQL via PHP
 
 On Sat, Jan 12, 2013 at 4:49 PM, admin ad...@buskirkgraphics.com
 wrote:
  As much as the php list would like to force people from using mysql,
 I guess you should not have invented it, if you don't want people to
 still use it.
 
 It's not this php list. It's the php developers. mysql* functions are
 set to be removed in a release coming soon.
 
 Time marches on. mysql* functions were written first, then the mysqli*
 functions were written. mysql* is old, out of date, and not begin
 supported.
 
 Should not have written it? Maybe? But maybe no libraries should have
 been written, nothing should move forward, better ways should not have
 been found.
 
 Maybe you want to do your computing using pebbles, too.
 
 
 
So let me understand how this works.
Someone ask for help, no matter what version they are using or function that is 
currently in place.
We slam them.
Call them an idiot.
 
Not that they ask a question about a function in the CURRENT version. Yes the 
documentation does fully express the function is depreciated, but let's deal 
with the now.
So let's NOT answer the question? (Hello, welcome to MICROSOFT)
I am very glad 90% of other languages that have list don't have the same 
approach.
They would gladly give you the answer, but then go on to express how they may 
suggest this (with example) because it is (safer, easier, ect...).
 
Every time I see someone give a simple answer in an approach to help them 
learn, in comes the marching band of ignorance and they are toting the banner 
of epic fail.
This is a list to help people understand php and grow the community and 
knowledge base of its inner workings. 
If you want to answer at question please at least use SOMETHING that is 
conducive to educating them.
 


At no point was I slamming someone for using the old functions, in-fact I was 
trying to make a joke of that and point out that the msqli functions would be 
better, unless you really do believe that kittens will kill programmers...

The thing is most of us expect the person asking the question here to have done 
at least a little bit of research into the problem, even if that only extends 
to I'll Google some of these keywords in the error. That should at least have 
produced the same advice about those old deprecated functions, but I wanted to 
reiterate it a bit just to be sure. It can't hurt to know something like that.

The fact is, what you considered a simple answer was bad advice, and would have 
just taught more people that those old functions are fine, when in-fact they 
are not. I think it's very important to make people aware of security concerns, 
especially if they're a beginner with the language.


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



Ash,

  I am not trying to single you out and i hope that is not how you 
have taken this conversation.

While i agree with you on the security of mysql and BTW (Kittens are monsters).

The question clearly showed they have NO experience in db connectors.  

I felt to over complicate the problem by pushing them into another function was 
not the best approach.

Yes they should understand the security risk and i take the reasonability for 
not fully explaining the ramifications for using such a function.

 

If you knew my staff you would know I am the last person to think old ways is 
any approach i will accept.

I will end the conversation with an apology to person asking the question, 
because i should have went into more detail and to anyone this conversation has 
mislead into thinking i think that function is anything BUT outmode.

 



RE: [PHP] Can't connect to MySQL via PHP

2013-01-13 Thread admin


 -Original Message-
 From: Jim Giner [mailto:jim.gi...@albanyhandball.com]
 Sent: Sunday, January 13, 2013 9:13 AM
 To: php-general@lists.php.net
 Subject: Re: [PHP] Can't connect to MySQL via PHP
 
 Regardless of the choice of interface to mysql, regardless of the
 completely harmless but educational tips from Ash, and very
 deliberately ignoring the un-helpful and extraneous comments of others,
 I'm wondering how the OP is doing with getting his mysql access
 working.
   Haven't heard from him lately.
 
 Rick?
 
 --
 PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
 http://www.php.net/unsub.php

Jim,
I understand it was a credentials issue and all is working fine now.
I hope they did take the advice from ash and change the function for
security reasons.



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



RE: [PHP] PHP programming a members only access site

2013-01-13 Thread admin


 -Original Message-
 From: Stephen [mailto:stephe...@rogers.com]
 Sent: Sunday, January 13, 2013 9:06 AM
 To: php-general@lists.php.net
 Subject: [PHP] PHP programming a members only access site
 
 Can anyone point me to good tutorials/documentation on the subject?
 
 I want to add this functionality to one of my sites.
 
 I know there are existing solutions for this, but the ones I have found
 are complex, turnkey and don't really facilitate learning.
 
 I consider myself strong in php programming and using MySQL.
 
 But I have never used sessions or cookies, and want to learn and do it
 properly.
 
 And I am interested in the security of logins and credentials. Things
 like detecting sharing of credentials and the appropriate action to
 take. Also what logs to keep and how to audit them.
 
 And, of course, having sample code for functions like creating a new
 account, sending the confirmation email, handling the response. Dealing
 with forgotten passwords. I don't want to re-invent the wheel, but I
 don't want to have to dissect the code for, say, phpBB to see how it is
 done there, either.
 
 Thanks in advance for suggestions!
 
 --
 Stephen
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


Stephen,
Chris Shiflett wrote an amazing book on this subject Essential PHP
Security he examines specific attacks and the techniques used to protect
against them.


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



RE: [PHP] Can't connect to MySQL via PHP

2013-01-12 Thread admin


 -Original Message-
 From: Rick Dwyer [mailto:rpdw...@earthlink.net]
 Sent: Saturday, January 12, 2013 8:26 AM
 To: php-general@lists.php.net
 Subject: [PHP] Can't connect to MySQL via PHP
 
 Hello all.
 
 I used the code below successfully to connect to a MySQL db on one
 hosting provider.  I've moved the code to a new hosting provider with
 new values and it returns:
 
 Access denied for user 'user'@'db.hostprovider.net' (using password:
 YES)
 
 Even though I can copy and paste these three values (host, user and
 pass) and paste into Navicat to make a connection.  So the credentials
 are correct, but they are not authenticating when used in PHP.  I've
 tried making host localhost and 127.0.0.1. both with the same
 result.
 
 Can someone tell me what I am doing wrong here?
 
 Appreciate it.
 
 Thanks,
 --Rick
 
 
 
 $db_name = mydb;
 $vc_host= db.hostprovider.net;
 $vc_user= user;
 $vc_pass= pass;
 
 $connection = @mysql_connect($vc_host, $vc_user, $vc_pass); $db =
 mysql_select_db($db_name, $connection);
 
 echo mysql_error();
 
 
 
 
 --
 PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
 http://www.php.net/unsub.php


Try this for me

---

$db = mysql_connect($vc_host, $vc_user, $vc_pass); 
mysql_select_db($db_name, $db);

if (!$db) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($db);





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



RE: [PHP] Can't connect to MySQL via PHP

2013-01-12 Thread admin
 

 

From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] 
Sent: Saturday, January 12, 2013 10:03 AM
To: admin
Cc: 'Rick Dwyer'; php-general@lists.php.net
Subject: RE: [PHP] Can't connect to MySQL via PHP

 

On Sat, 2013-01-12 at 12:56 -0800, admin wrote: 

 
 
 -Original Message-
 From: Rick Dwyer [mailto:rpdw...@earthlink.net]
 Sent: Saturday, January 12, 2013 8:26 AM
 To: php-general@lists.php.net
 Subject: [PHP] Can't connect to MySQL via PHP
 
 Hello all.
 
 I used the code below successfully to connect to a MySQL db on one
 hosting provider.  I've moved the code to a new hosting provider with
 new values and it returns:
 
 Access denied for user 'user'@'db.hostprovider.net' (using password:
 YES)
 
 Even though I can copy and paste these three values (host, user and
 pass) and paste into Navicat to make a connection.  So the credentials
 are correct, but they are not authenticating when used in PHP.  I've
 tried making host localhost and 127.0.0.1. both with the same
 result.
 
 Can someone tell me what I am doing wrong here?
 
 Appreciate it.
 
 Thanks,
 --Rick
 
 
 
 $db_name = mydb;
 $vc_host= db.hostprovider.net;
 $vc_user= user;
 $vc_pass= pass;
 
 $connection = @mysql_connect($vc_host, $vc_user, $vc_pass); $db =
 mysql_select_db($db_name, $connection);
 
 echo mysql_error();
 
 
 
 
 --
 PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
 http://www.php.net/unsub.php
 
 
Try this for me
 
---
 
$db = mysql_connect($vc_host, $vc_user, $vc_pass); 
mysql_select_db($db_name, $db);
 
if (!$db) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($db);
 
 
 
 
 


Please at least use mysqli_* functions. Every time someone recommends we use 
mysql_* functions, a kitten kills a programmer.


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



 

Ash,

  The question was asked about mysql functions. 

As much as the php list would like to force people from using mysql, I guess 
you should not have invented it, if you don't want people to still use it.

 

Shoots a small fluffy kitten with big blue eyes... Waste a cap save a gui

 

 

 



RE: [PHP] PDO question

2012-11-29 Thread admin
 -Original Message-
 From: Jim Lucas [mailto:li...@cmsws.com]
 Sent: Wednesday, November 28, 2012 9:23 PM
 To: ad...@buskirkgraphics.com
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] PDO question
 
 On 11/28/2012 12:58 PM, ad...@buskirkgraphics.com wrote:
 
  Guys,
  I am not quiet sure what is happening but every time i try to connect
  to a remote host it refers back to localhost.
 
  $pdo = new PDO('mysql:host=171.16.23.44;dbname=test',
  'user','password');
 
  ERROR: Access denied for user 'user'@'localhost' (using password:
 YES)
  in /var/www/html/text.php
 
  Any clue as to WHY it keeps referring back to localhost when i
 clearly
  set the host parameter to another server.
  I checked the /etc/hosts records to see if there was a referral for
  that domain back to it's self there is NOT.
 
 
 There is a warning on the following page that talks about a possible
 issue with connections.  Might give it a look.
 
 http://www.php.net/manual/en/ref.pdo-mysql.connection.php
 
 --
 Jim Lucas
 
 http://www.cmsws.com/
 http://www.cmsws.com/examples/


Thank you issue resolved for some reason it was passing the credentials with 
the fully qualified domain name and NOT the IP and the permission failed to 
match.
Not sure why it is suddenly passing the fully qualified domain name now but as 
long and this works I really don’t care thanks.

 







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



Re: [PHP] PDO mysql Connection issue

2012-11-28 Thread Admin

 On Wednesday, November 28, 2012 at 4:50 PM, ad...@buskirkgraphics.com wrote:
 I am having a PDO mysql connection issue I cant explain.
 
 On server server1.mydomain.com (http://server1.mydomain.com)
 I have a test script
 ?php
 $pdo = new PDO('mysql:host=171.16.23.44;dbname=test', 'user','password');
 ?
 171.16.23.44 is by an A record called server2.mydoamin.com 
 (http://server2.mydoamin.com) they are 2 different
 servers.
 This script returns an error:
 ERROR: Access denied for user 'user'@'server1.mydomain.com 
 (http://server1.mydomain.com)' (using password:
 YES)
 
 I find this ODD because that is not the server i am connecting TO but FROM.
 Why would the PDO connection be referring back to its own localhost instead 
 of
 the intended domain.
 I have tried this by fully qualified domain name, same thing.
 I have ensured the route does exist on the connecting server.
 I have ensured there is no local reference to the domain name/IP back to its
 self.
 
 I log into 171.16.23.44 and there is NO record of the failed attempt.
 I validate the user has remote access rights.
 I validate there is not a firewall rule blocking the host/port/you name it.
 I telnet from the server to the destination via port 3306 it connects.
 
 BTW (171.16.23.44) IS FAKE I AM USING THE IP AS AN EXAMPLE HERE.
 
 Any clue as to WHY the host parameter is not setting or is it setting and
 something else is wrong?
 
 
 Have you tried running FLUSH HOSTS on the MySQL server?
 
 Also, i would try to disable DNS within MYSQL by starting with 
 --skip-name-resolve 
 (http://dev.mysql.com/doc/refman/5.0/en/server-options.html#option_mysqld_skip-name-resolve);
 
 -- 
 Mike Mackintosh
 PHP 5.3 ZCE
 
I have tried the options listed same results. 
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Table help needed

2012-10-20 Thread admin
 -Original Message-
 From: tamouse mailing lists [mailto:tamouse.li...@gmail.com]
 Sent: Saturday, October 20, 2012 1:53 AM
 To: admin
 Cc: Chris Payne; php-general@lists.php.net
 Subject: Re: [PHP] Table help needed
 
 On Fri, Oct 19, 2012 at 6:09 PM, admin ad...@buskirkgraphics.com
 wrote:
  -Original Message-
  From: Chris Payne [mailto:oxygene...@gmail.com]
  Sent: Friday, October 19, 2012 7:01 PM
  To: php-general@lists.php.net
  Subject: [PHP] Table help needed
 
  Hi everyone,
 
  So i'm stuck, and I admit it.  I have to (QUICKLY) display
  information from a database, easy.  But the formatting they want is
  in a HTML table, 3 columns at a time and unlimited rows - how can I
  display 3 columns across at a time?  Please help, it's a last minute
 thing !!!
 
  Chris
 
 
  $query = SELECT * TABLE;
  $result = mysql_query($query);
  If(mysql_num_rows($result) = 1)
  {
  Echo table;
  While($row = mysql_fetch_assoc($result))
  {
  Echo
 
 TRTD.$row[field1]./TDTD.$row[field2]./TDTD.$row[fiel
  d3].
  /TD/TR
  }
  Echo /table;
  }
 
 Surprised no one else has jumped on the Don't use mysql anymore thing
 here.
 
 Quick and dirty PDO implementation: https://gist.github.com/3922192


Chris,
Let me first apologize for a couple syntax errors I had in the real 
quick explanation.
I answered your question in relationship to your knowledge of the subject based 
on the question it's self.

I want to apologize for the comments that followed my reply, seems some people 
can't make constructive comments
if their life depended on it. While the more complex version in PDO is the 
preferred method to obtain objects 
from mysql. This does require you to have the basic fundamentals of object 
oriented programming skills, 
which I am guessing at this point you do not have based on how the question was 
phrased.

There are many people in the list who will gladly point you in the direction to 
learning aids and tutorials to get you started.

Good Luck :)


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



RE: [PHP] Table help needed

2012-10-19 Thread admin


 -Original Message-
 From: Chris Payne [mailto:oxygene...@gmail.com]
 Sent: Friday, October 19, 2012 7:01 PM
 To: php-general@lists.php.net
 Subject: [PHP] Table help needed
 
 Hi everyone,
 
 So i'm stuck, and I admit it.  I have to (QUICKLY) display information
 from a database, easy.  But the formatting they want is in a HTML
 table, 3 columns at a time and unlimited rows - how can I display 3
 columns across at a time?  Please help, it's a last minute thing !!!
 
 Chris


$query = SELECT * TABLE;
$result = mysql_query($query);
If(mysql_num_rows($result) = 1)
{
Echo table;
While($row = mysql_fetch_assoc($result))
{
Echo
TRTD.$row[field1]./TDTD.$row[field2]./TDTD.$row[field3].
/TD/TR
}
Echo /table;
}








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



RE: [PHP] Differences

2012-10-03 Thread admin
 Hi everyone, I have been playing around with some code the list helped me
with a while back and I'm not grasping the concept between return and echo
and the PHP manual doesn't answer this, unless I'm missing something. There
is an  example at the very bottom of PHP's return manual, but it's
confusing.

 So now I'm left wondering why return will only give me the first result in
an array, but echo will give me all the results of the array. Using stuart's
example he had sent me a while back I've messed around with it and modified
it  to better understand it:
 
 function filename($prefix)
{
  $matches = glob('images/property_pics/'.$prefix.'*');
  foreach($matches as $filename){
  return $filename;
 }
}

echo completeImageFilename($row['MLS_No']);

With the above code I only get the first image of each picture name, but
when I change return to echo, it groups and displays all the pics that have
the same picture name.
--
David M.



The first loop and return is all you will get.
Put the information into an array and return the array once the array is
built.


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



RE: [PHP] Differences

2012-10-03 Thread admin
function filename($prefix)
{
$array_to_return = array();
  $matches = glob('images/property_pics/'.$prefix.'*');
  foreach($matches as $filename){
  $array_to_return[] = $filename;
 }
return $array_to_return;
}


If this better explains it.
The first return will stop the process you need to put the information into
an array and then return the array outside of the foreach loop.



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



RE: [PHP] Problem with PHP in Moodle LMS

2012-09-27 Thread admin
 Has anyone ever heard of a problem with the Moodle LMS when trying to edit
an activity (quiz, resource) in which there is a timeout after only a few
seconds and a message saying something to the effect of  that the system is
sorry but there was a time out, please retry. When I look in the URL I see
the following after my domain name:
 
 .../course/modeit.php
 
 Is this purely a Moodle thing, or something someone can help me with.
(I've already searched the Moodle site for information about this error, but
can't see anything related to version 2.2.3, which I am 
 using.) Any help would be appreciated. I thought I might want to up the
timout figure in the php5.ini file in the root directory of my shared Linux
hosting with Godaddy, but I don't think that's really the  problem.
 Regards,

 Gary

Gary,
Yes Moodle has a configuration issue. I would switch it to Debug
mode and check the error logs it will tell you exactly what is going wrong.



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



RE: [PHP] Joining a team, where no wiki or docs are available

2012-09-24 Thread admin
 -Original Message-
 Hi,
 
 i'm going to join a mid-size company with a few PHP-driven projects written 
 in procedural PHP, million years old.

 At the moment, they don't have a wiki or any documentation about their 
 projects. For me, the first challenge in probation period is to understand 
 how their code works.
 *
 Considering that there is no wiki or docs, How can I see the Big Picture?* 
 i'm sure this is a common problem for programmers everywhere.
 
 What approach do you use in a similar situation?
 Is there a systematic approach for this?
 Is there reverse-engineering technique to understand the design of code?
 
 Please share your experience and thoughts.

 -Thanks in advance,
 Behzad


Behzad,
I would start by mapping their databases structure. Get an 
understanding of the data behind the application.
Normally this gives you a better insight into their thought process, providing 
they use one.

Now for each page I would map out any functions, statements or includes to a 
diagram and documenting explanations for everything.
Because their concept of what the application does may not be the actual 
functionality.

This will allow you to see pitfalls, bad coding, and areas of improvement. This 
will also allow you do explain to them what the application really does.
Think documentum







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



[PHP] Images can execute php script?

2012-09-23 Thread admin
Today I seen a hack into php that has rocked me to my foundation.
I seen a picture uploaded onto a server using php and when php displayed the
image, phpinfo() was executed and displayed.

Does this problem exist in PHP 5.2.17 +?
How do you stop it?

Sorry, I have never known of this before today.


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



RE: [PHP] Images can execute php script?

2012-09-23 Thread admin
 Jpgs can hold other data rather than image data
 One thing to try is to run strip_tags($image) to remove any php code

http://stackoverflow.com/questions/3499173/my-php-site-was-hacked-by-codes-u
ploaded-as-image
 http://josephkeeler.com/2009/04/php-upload-security-the-1x1-jpeg-hack/
 
 Bastien



I understand the principle behind
include('pages/' . $_GET['page'] . '.php');
http://www.mysite.com/index.php?page=../upload/image.jpg?cmd=somecode%00

Which I find ridiculous if anyone did that.
I am not sure how he was calling the image to be sure. I watched him upload
the image and then
Do what looked like a normal echo UPLOADED_IMAGES.$_FILE[name]; You seen
phpinfo() called but it was not in the script rather in the image.

He opened the test.jpg in a text editor and sure enough there was ?php
phpinfo(); ? in the code of the jpeg.

This bothers me because I am not sure what all he did. He was proving PHP is
not a safe language in front of a rather large group or people in the
meeting.
I could only look on in disbelief that it just happened in front of me.

Everything inside of me wants to say he was doing something outside of what
I consider normal circumstances.
My question is this:
If someone uploads a image through a form or whatever and they have embedded
a code in can that code inside the image be executed by viewing the file?

$image = 'uploaded.jpg';
Echo IMG SRC='.$image.';

Read this:
http://php.webtutor.pl/en/2011/05/13/php-code-injection-a-simple-virus-writt
en-in-php-and-carried-in-a-jpeg-image/
That was written a couple months ago.



 


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



[PHP] PHP Threading on Windows

2012-09-13 Thread admin
It has been suggested:
That because php does not support PCNTL threading on Windows that
multiple services of php are an alternative.

I am interested in this theory, if anyone is currently working on a project
that (forks) processes off to another instance or service of PHP on windows
please let me know.
In some of my latest development I have some rather large processes that
consume the single instance of PHP, threading these off would be ideal.

Example:   
$tmpsrv=win32_query =win32_create_service(array(
'params' = __FILE__. install,
'service' = 'Name_of_the_service',
'display' = 'Name of service to be displayed in the service list'
));

Any windows php developers have ideas, comments on this suggestion?


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



[PHP] another Array question

2012-09-10 Thread admin
Hello everyone,

I have a very long array. I want to pull all the data from the array
from a certain position to a certain position.
$myarray = array('0'='me', '1'='you','2'='her','3'='him','4'='them',
'5'='us');
Yes I know the array above it small it's an example, mine has over 150
positions.

$foundyou = array_search('you', $myarray);
$foundthem = array_search('them', $myarray);

Now I want to take all the array positions from $foundyou to $foundthem and
put their values into a variable;
For the life of me I can't remember how I did it.

I DO NOT want to foreach over the array positions that would be
counterproductive.




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



RE: [PHP] another Array question

2012-09-10 Thread admin
Length was my problem the whole time.
Thank you very much.

Resolved 


-Original Message-
From: Jim Lucas [mailto:li...@cmsws.com] 
Sent: Tuesday, September 11, 2012 1:02 AM
To: admin
Cc: php-general@lists.php.net
Subject: Re: [PHP] another Array question

On 9/10/2012 9:41 PM, admin wrote:
 Hello everyone,

   I have a very long array. I want to pull all the data from the array

 from a certain position to a certain position.
 $myarray = array('0'='me', 
 '1'='you','2'='her','3'='him','4'='them',
 '5'='us');
 Yes I know the array above it small it's an example, mine has over 150 
 positions.

 $foundyou = array_search('you', $myarray); $foundthem = 
 array_search('them', $myarray);

 Now I want to take all the array positions from $foundyou to 
 $foundthem and put their values into a variable; For the life of me I 
 can't remember how I did it.

 I DO NOT want to foreach over the array positions that would be 
 counterproductive.


Well, depends on exactly what you mean by and put their values into a
variable.  Do you mean concatenate all the values into one single flat
variable.  Or do you mean to make a subset array of the values between your
two points you found?


First, check out array_slice.
Second, look at join


?php

$myarray = array(
   '0'='me',
   '1'='you',
   '2'='her',
   '3'='him',
   '4'='them',
   '5'='us',
);

$s_pos = array_search('you', $myarray);
$f_pos = array_search('them', $myarray);

# Calculate the length, it is needed by array_slice() $length = ($f_pos -
$s_pos);

$subset_array = array_slice($myarray, $s_pos, $length);

print_r($subset_array);

$all_values = join(', ', $subset_array);

echo $all_values;

?

Obviously, you need to add in some error checking.  But that should get you
started.

--
Jim


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



RE: [PHP] PHP to XLS Security Alert issue

2012-08-29 Thread admin
-Original Message-
From: Matijn Woudt [mailto:tijn...@gmail.com] 
Sent: Tuesday, August 28, 2012 3:55 PM
To: admin
Cc: php-general@lists.php.net
Subject: Re: [PHP] PHP to XLS Security Alert issue

 I believe that's normal, and that it does that with any document downloaded 
 from the web.
 I'm not sure if there's a workaround, but you should not ask that here but on 
 a Microsoft Office forum/list, or just ask the question to Microsoft 
 themselves.

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


Matijn,
I understand YOU believe this is normal. 
I am sorry you feel that way because the construction of the document is 
exactly where the problem was resolved, and that is in PHP.
So asking in the PHP-List was the exact the place to post a question of 
document construction using PHP. Yes understanding the document verification 
methods of Microsoft helps but it is up to the DEVELOPER to put the correct 
headers and content strings to make the document valid and that is what I was 
asked. 

Q: I am exporting to a XLS file and the file does export, but when I open the 
file Microsoft is giving a Excel Security Notice. I am sure there is something 
in the header that is missing or causing this problem?


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



[PHP] PHP to XLS Security Alert issue

2012-08-28 Thread admin
I am exporting to a XLS file and the file does export, but when I open the
file Microsoft is giving a Excel Security Notice.

I am sure there is something in the header that is missing or causing this
problem.

 

header(Pragma: public);

header(Expires: 0);

header(Cache-Control: must-revalidate, post-check=0, pre-check=0);

header(Content-Type: application/force-download);

header(Content-Type: application/octet-stream);

header(Content-Type: application/download);

header(Content-Disposition: attachment;filename=list.xls);

header(Content-Transfer-Encoding: binary );

 

I use pack() to write the labels, Numbers, data. If that could be the
culprit.

  echo pack(s, 0x203, 14, $Row, $Col, 0x0);

  echo pack(d, $Value);

 

I am running 5.2 on PHP and opening the document with 2010 Office on
Windows.

 

 

 



[PHP] Dynamic Content thoughts

2012-08-23 Thread admin
Hello everyone,

In my quest to build bigger and better dynamic content, I am
putting forth a concept to see what you all think.

Many times I come across customers who want drop down menus dynamically
built from database tables.

 

Old way Example:

Echo 'SELECT ID=personneloption value='0'--Please  Select--/option';

$query = SELECT * FROM personnel ORDER BY last_name;

$result = mysql_query($query);

If(mysql_num_rows($result) = 1)

{

While($row = mysql_fetch_assoc($result))

{

Echo option value='.$row['ID'].'.$row['first_name'].
.$row['last_name']./option;

}

}

Echo '/select';

*

 

I am purposing a Method for this that has some flexibility.

 

Initialize Object:  $yourobject = new yourclass();

Call method: // The call design is just so you have a better understanding
of my concept

$dropdown = $yourobject- dropmenu('personnell','ID',array(0 =
'first_name', 1 = 'last_name'), 'last_name'); 

 

Function dropmenu($table,$fieldforvalue,$fieldstodisplay,$fieldorder)  //
Yes you could add some WHERE filters as well 

{

$arraytoreturn = array();

If(strlen($table) = 3){   

if(is_array($fieldstodisplay)){

$count = 0;

foreach($fieldstodisplay as $key=$values){

if(strlen($values) =3){

If($count == 0){

$fields = $values;

}else{

$fields . = ,.$values;

}  

$count++;

}


}

}else{

If(strlen(($fieldstodisplay) = 1){

$fields = $fieldstodisplay;

$fieldstodisplay = array(0
=$fieldstodisplay);

}else{

Return $arraytoreturn; // Return nothing
because no field was selected.

}

}

}else{

Return $arraytoreturn; // Return nothing because no table was selected.

}  

If(strlen($fieldorder) = 3) {

$orderfilter =  ORDER BY .$fieldorder. ;  

}else{

$orderfilter = ;

}

$query = SELECT .$fields. FROM .$table. .$orderfilter. ;

$result = mysql_query($query);

If(mysql_num_rows($result) = 1)

{

$arraytoreturn[] = option value=0--Please Select--/option;

While($row = mysql_fetch_assoc($result))

{

$display_fields   = ;

Foreach($fieldstodisplay as $key=$values){

$display_fields  .= $row[$values]. ;  

}  

If(strlen($fieldforvalue = 3){

$arraytoreturn[] = option
value='.$row[$fieldforvalue].'.$display_fields  ./option;

}else{

$arraytoreturn[] = option.$display_fields  ./option;

}

}

Return $arraytoreturn;

}else{

Return $arraytoreturn; // Nothing to return.

}

}

 

Now I can call the drop downs driven by database tables dynamically and It
saves me a TON of time.

Echo 'SELECT ID=personnel';

Foreach($dropdown as $key=$values){

Echo $values;

}

Echo '/select';

 

 

Richard L. Buskirk

Some of the world's greatest feats were accomplished by people not smart
enough to know they were impossible

 



RE: [PHP] Dynamic Content thoughts

2012-08-23 Thread admin
-Original Message-
From: Matijn Woudt [mailto:tijn...@gmail.com] 
Sent: Thursday, August 23, 2012 4:39 PM
To: admin
Cc: php-general@lists.php.net
Subject: Re: [PHP] Dynamic Content thoughts

On Thu, Aug 23, 2012 at 9:51 PM, admin ad...@buskirkgraphics.com wrote:
 Hello everyone,

 In my quest to build bigger and better dynamic 
 content, I am putting forth a concept to see what you all think.

 Many times I come across customers who want drop down menus 
 dynamically built from database tables.



 Old way Example:



 *



 I am purposing a Method for this that has some flexibility.



 Initialize Object:  $yourobject = new yourclass();

 Call method: // The call design is just so you have a better 
 understanding of my concept

 $dropdown = $yourobject- dropmenu('personnell','ID',array(0 = 
 'first_name', 1 = 'last_name'), 'last_name');



 Function dropmenu($table,$fieldforvalue,$fieldstodisplay,$fieldorder)  
 //
snip



 Now I can call the drop downs driven by database tables dynamically 
 and It saves me a TON of time.

 Echo 'SELECT ID=personnel';

 Foreach($dropdown as $key=$values){

 Echo $values;

 }

 Echo '/select';



Hi Richard,


First of all, I don't really see the problem with the first code, as it's not 
that many LOC. OTOH comparing it to the enormous amount of lines needed for 
your function it seems a bit overkill. If you combine $query = .. and 
mysql_query($query), to a single line (which I prefer), then you only have 4 
lines of code in your first example. ( I only count lines that do something, 
not the brackets etc). Your function has about 40.
If you still want this function, I would change a few things.
1) Do all the echo stuff inside your function, or, only return the data and 
print the option html stuff outside of your function.
You're now mixing both which seems wrong.
2) Use SQL as input, and if you wish to make it easy for yourself, write a 
seperate function that writes SQL queries for you (or just use a lib for it, 
there are probably plenty).
3) Use mysqli, mysql is deprecated.
4) Use mysqli_real_escape_string to sanitize your input before using it on the 
database.

Hope this helps you,

- Matijn

--
Thank you Matijn,
For coding style, I think we can agree on the fact each person has a 
different style and reasoning's for their own style.
My style on SQL statements was passed down to me from some very successful 
developers who felt the reason for creating a 
SQL statement in such a manor was to assist in informatics and Debugging.

While you're not getting the point in the Method being in the class and called 
when needed. It cuts coding size and time down by extremes when you have 
multiple drop downs that may or may not repeat on different views. 

Matijn was very correct on the combination of HTML and PHP in a Method and I do 
agree, many feel this is a giant no no. Many could simply pass the array to the 
view and create the drop down from there. The wonderful part of the method is 
that it has the flexibility to meet many coding styles and a vast range of 
abilities.

I do however feel the Mysql_real_escape_string to be un-necessary for the 
developer, being the end-user(GUI between the keyboard and Chair) will not be 
passing these fields to the Database. But escape away if you feel safer doing 
this with-in your own version of the method. 

As for the MYSQL VS MYSQLI in MOST benchmarks, I find the MYSQL extension to be 
slightly faster. 
Yes MYSQLI functions are more Object-oriented in some designs I feel MYSQL out 
performs MYSQLI in large database setups for a personal preference.
Again you may change the Design of the method to meets your needs MYSQL or 
MYSQLI doesn’t really take away from the concept.







--
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 admin
-Original Message-
From: Lester Caine [mailto:les...@lsces.co.uk] 
Sent: Monday, August 20, 2012 6:52 AM
To: php-general@lists.php.net
Subject: [PHP] Crash course

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


First of all, I HIGHLY doubt that 1and1 AKA Cisco messed up the DNS. I would
be very careful blaming them and publically announcing it.
Secondly if you tested mysql connection with Workbench then the error you
describe is configuration error in Joomla, common sense would dictate so.
http://www.inmotionhosting.com/support/edu/joomla-25/database/troubleshootin
g-database-errors


This list is for PHP 








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



[PHP] get_browser error

2012-08-03 Thread admin
Anyone using

Get_browser() notice that IE 9 is reporting as IE 7?

 

I am aware  of compatibility mode in IE 9 but that should not change the
version information sent  will it?

 



RE: [PHP] What do you call the end-user?

2012-07-19 Thread admin


-Original Message-
From: Tedd Sperling [mailto:t...@sperling.com] 
Sent: Thursday, July 19, 2012 1:27 PM
To: php-general@lists.php.net General
Subject: [PHP] What do you call the end-user?

Hi gang:

I can't wait for tomorrow -- so here's my off-topic post today.

First question:

What do you call the people who ultimately use your code?

I call them the end-user, but others have stated other terms, such as
customer or user.

Second question:

Are you concerned with their (whomever) experience in using your code? 

This question transcends your code working correctly, accurately, and
securely -- no need to comment on those aspects. But rather more
specifically do you consider how easily your whomever can use your work
efforts?

As you may have guessed - I just attended a UX conference and they provide
an interesting perspective on UX. I was wondering how php developers
typically address the subject.

Cheers,

tedd


t...@sperling.com
http://sperling.com


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


I call them the GUI between the Chair and the Key board (behind the
scenes)!
To their face/documented I call them the End-user I do however break this
down into tier level access users depending on access desires.

From straw dog to functioning portal the (easy, flow, and navigation) is
always designed for the most novice of users is HIGH priority.
This area gets a little hairy with different levels of knowledge are
concerns. Some want a point to point (Walk Trough scenario) and others want
more complex features as options. 

Reports, in my mind the most complex portion of any development because of
the mash of conceptual ideas of what the end product should look like. These
areas are rarely novice compliant, because of the sheer complexity of
filtering options desired. I stick to a Canned Report approach when
dealing with novice end-users.

My goal in life has been to develop the ultimate portal that thinks for you
and less dependent on your interactions. I am close to finishing a learning
module that learns from your interactions and navigates according to your
past history. But that is for another time 


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



RE: [PHP] What do you call the end-user?

2012-07-19 Thread admin

-Original Message-
From: Paul M Foster [mailto:pa...@quillandmouse.com] 
Sent: Thursday, July 19, 2012 6:31 PM
To: php-general@lists.php.net
Subject: Re: [PHP] What do you call the end-user?

On Thu, Jul 19, 2012 at 01:26:50PM -0400, Tedd Sperling wrote:

 Hi gang:
 
 I can't wait for tomorrow -- so here's my off-topic post today.
 
 First question:
 
 What do you call the people who ultimately use your code?
 
 I call them the end-user, but others have stated other terms, such 
 as customer or user.

User, because I'm writing the code for *my* customer. The person actually
exposed to my code may or may not be a customer of anyone. They may simply
be an internet surfer at my customer's site.

 
 Second question:
 
 Are you concerned with their (whomever) experience in using your 
 code?
 
 This question transcends your code working correctly, accurately, and 
 securely -- no need to comment on those aspects. But rather more 
 specifically do you consider how easily your whomever can use your 
 work efforts?
 
 As you may have guessed - I just attended a UX conference and they 
 provide an interesting perspective on UX. I was wondering how php 
 developers typically address the subject.

I'm interested in user experience to a limited extent. My interest stops
when a user wants the code to wipe their nose for them. Can we make the
website automatically update our accounting system and then write a check
for the cost of goods to the vendor? Sure. How much money do you have?
(Their accounting system is some inscrutable pile of Windows COM objects,
like SAP, behind a firewall. And they don't even know which vendor to write
the check to. I guess mental telepathy is a part of the PHP libraries not
installed on my development system.) Or when someone sends the form on the
website for an appointment request, can you make a reminder pop up on all
the desktops in the office? No, I can't. Here's an idea: assign someone to
check the email for appointment requests throughout the day, and contact the
customer to confirm, based on you actually *looking* at your appointment
calendar. Sheesh. Apparently, computers (not mine) are capable of
performing magic tricks.

I think my screens should be fairly self-explanatory, if possible. But I'm
averse to making them idiot-proof. If you're an idiot, get someone else to
operate your computer for you. You shouldn't be using one. But there may be
times when a computer screen or set of screens will absolutely require some
training, rather than someone completely unfamiliar with the workings of the
office just sitting down and being able to guess how to operate the system.
You didn't learn to drive by just sitting in a car and guessing how it is
done. Don't expect a web-based application to be operable simply by
guessing, necessarily.

By the way, I'm quite happy to write documentation for systems.
Unfortunately, more than half the people who read anything can't actually
*apply* what they read to whatever system they're working with.
Supposedly they can read. But somehow they still need someone to explain it
to them, no matter how good the docs are.

Paul

--
Paul M. Foster
http://noferblatz.com
http://quillandmouse.com

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

---



LOL Paul,
You are so very spot on, I have a current customer who would like
the website to just load when he logs in. I wish I had not agreed to writing
him a startup script to load the interface for him because NOW he wants it
to auto login for him. They use a random key generator as a portion on their
login authentication. So let's see: The system sends you a report every hour
on the hour. You no longer have to navigate to the interface. It auto logs
into the system for you.

I pander to these kind of people like there is no tomorrow when they are the
ones who sign the check, because anything outside of scope cost BIG TIME. :)
I have gone so far to create training aids that are system mimics to explain
to them what they are doing wrong and what the next step is. I use to write
SCO compliant learning systems and let me tell you there is NO such thing as
idiot proof.



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



RE: [PHP] Entry point of an MVC framework

2012-07-12 Thread admin
-Original Message-
From: Timmy Sjöstedt [mailto:m...@iostream.se] 
Sent: Thursday, July 12, 2012 6:01 PM
To: php-general@lists.php.net
Subject: Re: [PHP] Entry point of an MVC framework



On 07/12/2012 11:44 PM, Daevid Vincent wrote:
 -Original Message-
 From: Simon Dániel [mailto:simondan...@gmail.com]
 Sent: Thursday, July 12, 2012 1:21 PM
 Subject: [PHP] Entry point of an MVC framework

 I have started to develop a simple MVC framework.

 Yeah! Just what PHP needs, another MVC framework

 NOT.

 Why are you re-inventing the wheel?

 Personally I *hate* frameworks with a passion, but if you're going to 
 use one, then why not just build with one that is already out there 
 and well supported. http://www.phpframeworks.com/ to start with.



I would say this is a perfectly sane idea if one wants to learn how things
actually work.

Most frameworks, however, are very bloated because they have to support and
implement many things, as they are general purpose frameworks used by
everybody and their dogs.

If you only want what you need, and you know how to do it, rolling your own
system is no problem.

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

-

Timmy,
Thank GOD someone said it. 99.999% of every MVC framework you can
download is crammed to the hilt with BLOAT. I also agree that
knowing/understanding a MVC framework is vital and sometimes the only way to
learn is to recreate the madness you see in front of you.
I like many people have created my OWN MVC framework customized to my
madness and NO BLOAT!!

I do suggest if you're starting out in MVC frameworks. You have a better
understand of .htaccess and or web.conf for better control and flexibility.



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



RE: [PHP] slicing and dicing strings

2012-06-28 Thread admin
-Original Message-
From: Geoff Shang [mailto:ge...@quitelikely.com] 
Sent: Thursday, June 28, 2012 5:12 AM
To: php-general@lists.php.net
Subject: Re: [PHP] slicing and dicing strings

On Wed, 27 Jun 2012, tamouse mailing lists wrote:

 RTFM with no hint of where to look is a problem. But the dictum of 
 Read here in the manual will surely be the best thing. You will then 
 know where to look for future questions.

Personally, I've got better things to do with my time than spend it
committing the syntax and semantics of every single PHP function to memory.
I nearly always have the php.net front page with its function search open in
a browser whenever I'm writing something more than a few lines.  The
function search seriously rocks.  Even if I can't remember which string
function I want, I can search for *any* string function and I'll get the
list of all of them, along with a quick summary to help me find the one I
want.

Geoff.


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

Geoff,
The function you are looking for is SUBSTR();
I understand you have the manual open and you think you can find the answer
pretty quickly.
Please understand that knowing a little, to advanced features of all
functions will help you significantly.
It will cut down on research time and you have a better understanding of
what function will better fit 
the situation at hand. While some people will never fully remember all
syntax of every function it never hurt 
anyone in attempting to understand a majority of PHP functionality.

:)
 


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



RE: [PHP] slicing and dicing strings

2012-06-27 Thread admin
Read

http://php.net/manual/en/function.substr.php


-Original Message-
From: Kirk Bailey [mailto:kbai...@howlermonkey.net] 
Sent: Wednesday, June 27, 2012 6:15 PM
To: php-general@lists.php.net
Subject: [PHP] slicing and dicing strings

ok, it slices and dices, but how?
in python, to print all but the last char in string FOO, we say print
FOO[:-1] But this seems to bark like a basset hound in php. Whyfore?

Now tihs tyro is seeking sage words to help me understand this.
RTFM is not sage words; if you don't want to help me please don't waste the
bandwidth.

Would anyone care to help me understand this without dedicating 4 precious
and in over demand/under supply hours to RTFM?

--
end

Very Truly yours,
  - Kirk Bailey,
Largo Florida

kniht
   +-+
   | BOX |
   +-+
think


--
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] Variable representation

2012-06-21 Thread admin


-Original Message-
From: Ron Piggott [mailto:ron.pigg...@actsministries.org] 
Sent: Thursday, June 21, 2012 3:47 AM
To: php-general@lists.php.net
Subject: [PHP] Variable representation


I am trying to represent the variable: 
$row['Bible_knowledge_phrase_solver_game_question_topics_1'] 
Where the # 1 is replaced by a variable --- $i

The following code executes without an error, but “Hello world” doesn’t show on 
the screen.

?php

$row['Bible_knowledge_phrase_solver_game_question_topics_1'] = hello world;

$i = 1;

echo ${row['Bible_knowledge_phrase_solver_game_question_topics_$i']};

?

What needs to change?  Ron

Ron Piggott



www.TheVerseOfTheDay.info 



You can do this

echo $row['Bible_knowledge_phrase_solver_game_question_topics_'.$i];

I would not suggest a variable name that long.



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



RE: [PHP] help with preg_match

2012-06-03 Thread admin


-Original Message-
From: Chris Purves [mailto:ch...@northfolk.ca] 
Sent: Sunday, June 03, 2012 8:26 PM
To: php-general General
Subject: [PHP] help with preg_match

Hello,

I am trying to use preg_match to match something from an html file. 
Within the html file is some text that looks like:

spanSomething, something end/span

I know that the text ends 'end', but I don't know what the Something,
something is.  I am using preg_match as follows:

preg_match('/[^]*end/',$curl_response,$matches);

I want to match 'end' and everything before it that is not ''.

The problem appears to be with the ''.  I have tried escaping (\), but it
didn't make a difference.  The php script hangs when it tries to run this
function.


--
Chris Purves

There's a time to think, and a time to act. And this, gentlemen, is no time
to think. - Sheriff Bud B. Boomer

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

You could try this

preg_match_all('/(span[^]**)(.*)(/span[^]*)/is',$curl_response,$matc
hes);
print_r($matches);



Rick


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



RE: [PHP] Re: Function size

2012-05-30 Thread admin


-Original Message-
From: Paul M Foster [mailto:pa...@quillandmouse.com] 
Sent: Wednesday, May 30, 2012 10:54 AM
To: php-general@lists.php.net
Subject: Re: [PHP] Re: Function size

On Wed, May 30, 2012 at 04:31:12PM +0200, Sebastian Krebs wrote:


[snip]

 
 If the functions were named properly you don't have to follow every 
 execution path to the deepest deep. Or do you reading PHPs C-source, 
 just because a wild substr() appeared? When you see a method
loadFromFile()
 and the IDE tells you, that it expects a $filename as parameter, why 
 should you jump there just to make sure, that the method loads 
 something from a file by the filename given as first parameter?

Here's why, and I've seen this happen a *lot*. The function may be properly
named, but have side effects. Or the guy who named the function
*thought* it was properly named, but was wrong. For example, he may have
named the function loadFromFile(), and the function does in fact do that.
What the name doesn't tell you is that it then erases the file from which it
pulled. Oops! No, you're correct, the function is *not* properly named in
that case. But the guy who wrote it thought it was.
And before I look at the internals of the function, I don't know whether
it's properly named or not. Worse, the side effects may not show up until
later, and then with disasterous results. Imagine assuming everything's
okay, patching your code into the system, and finding out that it's been
hacking up the customer's filesystem for the last three weeks. All because
you didn't check to see what that other function was
*actually* doing.

Rule: NEVER assume you know what a function is doing by looking at its name.
ALWAYS satisfy yourself that you know what a function is doing by
*looking* at what it's doing.

Paul

--
Paul M. Foster
http://noferblatz.com
http://quillandmouse.com

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

---

That is WHY you put Function Definitions / Relations 


Rick.







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



RE: [PHP] What is The best way/tool for debuging PHP?

2012-05-26 Thread admin
-Original Message-
From: LEOPARD Corporation [mailto:leopardonline@gmail.com] 
Sent: Saturday, May 26, 2012 12:02 PM
To: php-general@lists.php.net
Subject: Re: [PHP] What is The best way/tool for debuging PHP?

Thanks for your reply.

Dev-PHP is an IDE, and I don't need such tool because I'm using Eclipse, and
I'm very comfortable with.

what I really want to know is:
what is the best pure debugging tool which its function is to debug PHP
scripts and applications only.

Thanks in advance!



On Sat, May 26, 2012 at 6:03 PM, saeed ahmed
mycomputerbo...@gmail.comwrote:

 Dev-php
 from
 http://devphp.sourceforge.net/

 2012/5/26, LEOPARD Corporation leopardonline@gmail.com:
  Hello,
 
  I'm new to this list, and this is the first time ever I send a 
  message to you.
 
  I'm learning PHP since a couple of months, and I really wanna be a 
  good
 PHP
  programer, and I know that I should work hard for that.
 
  Now, I just wanted to know what is the best way or tool for debuging
PHP.
 
  I have googled for this many many times, and found a lot of these 
  stuff, but I didn't figure out which one is really the best.
 
  in fact, I don't care whether it's an easy way or hard way, all what 
  I
 want
  is to know what is the best and preferred way or tool.
 
  Wish you all the best!
 


Yes many IDE's are used when debugging php because they can simulate the
environment needed for php.

Not to promote them but VSPHP is an amazing product, as a standalone or
integrated into Visual Studio 2010. I have enjoyed 
using this product for the last couple years. I am a HUGE Visual Studio
advocate, when VSPHP came along I exclusively use VS and 
notepad to develop applications in. Is this the BEST product? No clue!!

BUT:
I can develop and Debug in different versions of PHP. I can
integrate with any database, and I will (Toot the horn about) the ability to
use global variables instant insert.
Saves me time, headaches and I can search an entire project for every
instance of variable and no need to open each page. I like the color markup
and the debug options of stepping trough a segment of 
code for a real time analysis. To me it is the BEST tool on the market. I am
a .NET PHP developer who switched over from 15+ years of Linux/Unix systems.


Rick


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



RE: [PHP]How to handle E_ERROR,E_PARSE with a user defined function

2012-05-22 Thread admin
-Original Message-
From: Yuchen Wang [mailto:phob...@gmail.com] 
Sent: Tuesday, May 22, 2012 10:19 PM
To: php-general Maillist
Subject: [PHP]How to handle E_ERROR,E_PARSE with a user defined function

Hi all,

How to handle E_ERROR,E_PARSE with a user defined function ?

-- 
*Yuchen Wang*






I suggest you try 
http://www.php.net/set_error_handler



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



RE: [PHP] w.r.t. mail() function

2012-05-22 Thread admin
-Original Message-
From: Ashwani Kesharwani [mailto:ashwani.kesharw...@gmail.com] 
Sent: Wednesday, May 23, 2012 12:13 AM
To: php-general@lists.php.net
Subject: [PHP] w.r.t. mail() function

Hi ,

I have a query w.r.t. mail() function in php.

I have hosted my site and i have created an email account as well.

when i am sending mail to different recipient from my php script using above
function it is getting delivered to respective recipients as expected.

However if I want to see those mail in the sent folder of my email account ,
i can not see those mails there.

How can I achieve this.

Any suggestions.

Regards
Ashwani

-


You can change the settings of sendmail
http://www.devshed.com/c/a/Administration/Getting-Started-with-Sendmail/12/

OR
You can log text or database each email.
$query = INSERT INTO mail_log (`subject`,`to`,`from`,`message`,`mail_date`)
values ('.mysql_real_escape_string( $subject ).',
'.mysql_real_escape_string( $to ).', '.mysql_real_escape_string( $from
).', '.mysql_real_escape_string( $message ).', '.date(Y-m-d H:i:s).')
;









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



[PHP] Time out issue

2012-05-12 Thread admin
I am running Windows 2008 R2, IIS 7

I am running into an issue where no matter what I set the script  time out
to be the server is 

Giving me a 500 error  after like 60 seconds when the process exceeds the
configured activity timeout.

 

Here is the example script

?

set_time_limit(120);

sleep(100);

Echo PASSED THE TIME OUT;

?

 

I fully understand this may not be a PHP error but if anyone has ran into
this issue with a windows server and 

can explain in detail how I can adjust the timeout, I would be very
grateful. 

Everything I have read online points to a fcgiext.ini file that does not
exist on my server.

 

Anyone know how to help ?



RE: [PHP] Time out issue

2012-05-12 Thread admin


-Original Message-
From: Matijn Woudt [mailto:tijn...@gmail.com] 
Sent: Saturday, May 12, 2012 3:54 PM
To: admin
Cc: php-general@lists.php.net
Subject: Re: [PHP] Time out issue

On Sat, May 12, 2012 at 9:42 PM, admin ad...@buskirkgraphics.com wrote:
 I am running Windows 2008 R2, IIS 7

 I am running into an issue where no matter what I set the script  time 
 out to be the server is

 Giving me a 500 error  after like 60 seconds when the process exceeds 
 the configured activity timeout.



 Here is the example script

 ?

 set_time_limit(120);

 sleep(100);

 Echo PASSED THE TIME OUT;

 ?



 I fully understand this may not be a PHP error but if anyone has ran 
 into this issue with a windows server and

 can explain in detail how I can adjust the timeout, I would be very 
 grateful.

 Everything I have read online points to a fcgiext.ini file that does 
 not exist on my server.



 Anyone know how to help ?


Didn't use windows server in about 10 years (Go linux ;)), but did you try this?

http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/44ebc761-ac76-4b44-8894-551c9315af6c.mspx

- Matijn

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


I had to get Microsoft on the phone to resolve this issue with IIS and FAST-CGI 
seems you can adjust the 
Request Timeout and Activity Timeout within the IIS manager and for some reason 
no documentation leads you to this point.

Sorry to bother issue resolved.










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



RE: [PHP] Best practice question regarding set_include_path()

2012-05-10 Thread admin


-Original Message-
From: Al [mailto:n...@ridersite.org] 
Sent: Thursday, May 10, 2012 11:44 AM
To: php-general@lists.php.net
Subject: [PHP] Best practice question regarding set_include_path()

For my applications, I've been using includes and other file addressing by
using the doc root as the base dir.   e.g.
require_once $_SERVER['DOCUMENT_ROOT'] .
'/miniRegDB/includes/miniRegDBconfig.php';

Recently, I ran into a problem with a new installation on a shared host
where the doc root was assigned in an unusual manner. I rather not require
setting a custom base dir [instead of $_SERVER['DOCUMENT_ROOT']'] for my
applications.

So, I was wondering if it would be good practice to use the
set_include_path() and add the base dir for my applications.  I've used this
for dealing with Pear function files on shared servers and had no problems.

Need some guidance regarding this subject.

Thanks 

--

I use define to set the application path
define('BASE_PATH','C:\\inetpub\\vhosts\\yourwebsite.com\\httpdocs\\');

Example:
require_once (BASE_PATH. '/miniRegDB/includes/miniRegDBconfig.php');


works great for JQuery paths

script
$(document).ready(function() {
$('#dareport').html('img src=?php echo BASE_URL;?images/loading.gif
/');
});
/script

To me it is much better than set_include_path() but works in the same
premise



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



RE: [PHP] I need a good access and error log..

2012-05-07 Thread admin
-Original Message-
From: rene7705 [mailto:rene7...@gmail.com] 
Sent: Monday, May 07, 2012 3:00 AM
To: php-general
Subject: [PHP] I need a good access and error log..

Hi.

I've been using Google Analytics, and I'm sure I'm using the analytics code
correctly, but when I checked my dev server's apache access logs (dozens of
hits per day) against what Google Analytics reports (zip, zero, nada), I
realized I needed something different. BTW, I'm not the only one to report
this problem
(https://www.google.nl/search?aq=fsourceid=chromeie=UTF-8q=google+analyti
cs+lower+number)

I thought of rolling something of my own, a PHP-MySQL based
access+error log, add a viewer for it (http://dygraphs.com/ perhaps),
and spend the next month perfecting it..
But before I start coding, I thought it would be better to ask you all what
you use to see who's visiting your sites and when.
Oh, I need something that will work on shared hosting (php+mysql).

Thanks for your input.

(and purists; I couldn't think of a better place to post this, as this is a
large community of web developers who use the same language as I do. I may
even end up writing an opensourced php logging facility for
you)

--


I have seen and dealt with this for a few companies.
I have setup PHP scripting, JavaScript, Perl scripting you name it I have
tried it.
I have NEVER came up with the same number Google Analytics comes up with.
Sporadic behavior from Analytics not tied to a unique browser, OS or time.
Almost like random addition values are just added to the total for no
reason.

I like Google, but the numbers are not real!
When I can track each and every visit, site navigation and the numbers do
not match.
I asked Google for click by click information IP, Time and any other
information they could give me.
I never got that list to this day. Probably because it would allow me to
argue traffic that simply didn’t happen!

Suggestions when logging traffic, Avoid JavaScript that relies on the client
side to tell you information. Bad Idea!
Use php, perl or any server side language.
When logging information remember that apache/.NET process web request and
generally the best place to log.
It you log at the process you do not need to have scripting in each landing
page.
Log light information, never request overwhelming amounts of information for
each request you may cause horrid loading results.

PHP example (Just a simple example, there are many ways to do it)
Index.php
?php
$query = INSERT INTO click_log (`ip`,`action_time`) VALUES
('.$_SERVER['REMOTE_ADDR'].','.date(y-m-d H:i:s).') ;
$result = mysql_query($query);
?

I HIGHLY recommend you have a full understand of httaccess or web.config
before you attempt logging from them.
 

Rick









   


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



RE: [PHP] code deployment through php

2012-05-01 Thread admin

-Original Message-
From: Stuart Dallas [mailto:stu...@3ft9.com] 
Sent: Tuesday, May 01, 2012 8:19 AM
To: rene7705
Cc: Camilo Sperberg; php-general
Subject: Re: [PHP] code deployment through php

On 1 May 2012, at 10:19, rene7705 wrote:

 On Tue, May 1, 2012 at 11:11 AM, Camilo Sperberg unrea...@gmail.com
wrote:
 
 If I understood the problem correctly, you want to keep a single copy 
 of your code on every machine you work, including the final server.
 
 
 Well, I want to work on 1 copy of my common code on my windows 
 machine, then sync those changes to all my sites (hosted on the win 
 dev box) to see if it messes up the other sites, then FTP those 
 changes to my hosting account, and run the sync script there as well.
 
 
 Have you read about SVN ? You can set up a cronjob to execute it 
 automatically if you want, there are clients for Windows, Zend 
 Studio, etc etc.
 
 
 I've read about some source control systems, I've tried them out, but 
 I'd rather go for this simpler approach tbh.
 I already do regular backups that are timestamped, it's enough for me 
 right now I think.

If you really think rolling your own deployment system is simpler than using
source control then I don't think you've understood all of the advantages of
source control. I know it can look complicated, but it's really not, and it
will make it far easier to keep track of what you're doing and what changes
are deployed where than the system you described. I strongly recommend you
reconsider.

-Stuart

--
Stuart Dallas
3ft9 Ltd
http://3ft9.com/




Stuart,
If I may add to your post
 
Version control for different environments (Development and Production) is
SO key with SVN.
SVN has logging and other key features. 

Many, and when I say many that is an understatement, Many companies enforce
SVN for their protection.

Ever had a script not fully transfer, and only partial code remains?
With SVN you can roll it back and Whala! You have the original source back.

For one of my roles as Project Manager, I love Tortoise SVN. I have changed
the scripting a bit to send me emails with descriptions of changes as they
happen with attached files.
This way I can actually filter my emails to find the exact person who made
the bad change, what they had, and what they did instead of searching the
logs.

Since my developers can only push to the Development Servers I can fix
issues before they become a Production Issue.
No more, Developers having access to the server directly. They make their
changes and commit their changes up, I review and can schedule changes to be
committed to Production Servers.
To setup a new Developer I simply check out the SVN library for them and
they are up to speed day one.

The setup is very easy, Yes the controls are a tiny bit confusing at FIRST. 
But if you want success, then SVN is a SMART decision for any project.




Richard Buskirk














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



RE: [PHP] Insert group by

2012-04-27 Thread admin
$sql='select count(*) as count, searchkeywords 
from searchkeywords 
group by searchkeywords 
having searchkeywords LIKE searchkeywords
order by count desc'


Ir this does not work for you explore the HAVING CLAUSE





-Original Message-
From: Rick Dwyer [mailto:rpdw...@earthlink.net] 
Sent: Thursday, April 26, 2012 8:23 PM
To: PHP-General
Subject: [PHP] Insert group by

Hello all.

This is more of a MySQL question, but I'm hoping it can be answered here.
On one of my pages, I issue a SQL command to group data as such:

$sql='select count(*) as count, searchkeywords from searchkeywords group by
searchkeywords order by count desc'

Works well... but I would like it to groups plurals with singular words as
well.  So hats are grouped with hat.

Since I'm doing a group by column name, I don't know that this can be
done.

Any help is appreciated.

Thanks,
 
 --Rick



--
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] Array_diff problems

2012-04-27 Thread admin


-Original Message-
From: Rick Dwyer [mailto:rpdw...@earthlink.net] 
Sent: Friday, April 27, 2012 3:37 PM
To: PHP-General
Subject: [PHP] Array_diff problems

Hello all.

I have two arrays and when compared against each other via array_diff, I do
not get any output:

$myarray1 = Array (
[0] = Array ( [id] = 1 [Funding_Type] = Federal [Amount] = 10
[Frequency_Description] = Total [Other_Funding] = ) [1] = Array ( [id] =
2 [Funding_Type] = Trust [Amount] = 20 [Frequency_Description] = Per Year
[Other_Funding] = ) [2] = Array ( [id] = 3 [Funding_Type] = Other
Funding [Amount] = 30 [Frequency_Description] = Other [Other_Funding] =
some )) 

$myarray2 = Array
(
[0] = Array ( [id] = 1 [Funding_Type] = Federal [Amount] = 10
[Frequency_Description] = Total [Other_Funding] = ) [1] = Array ( [id] =
2 [Funding_Type] = Trust [Amount] = 20 [Frequency_Description] = Per Year
[Other_Funding] = ) [2] = Array ( [id] = 3 [Funding_Type] = Other
Funding [Amount] = 50 [Frequency_Description] = Other [Other_Funding] =
none )) 

$arraydifferences = (array_diff($myarray1,$myarray2));

I need $arraydifferences to record the differences between the two.

Any help is appreciated.

Thanks,
 
 --Rick



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



I suggest you read Multidimensional array_diff for Nested Arrays and your
format is not correct on the array that you gave an example of.

http://www.php.net/manual/en/function.array-diff.php#98680





 


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



RE: [PHP] Blocking URL hacking attemps

2012-04-22 Thread admin
-Original Message-
From: sono...@fannullone.us [mailto:sono...@fannullone.us] 
Sent: Sunday, April 22, 2012 12:55 PM
To: PHP General
Subject: [PHP] Blocking URL hacking attemps

I'm using a script called BlackHole that uses PHP and a hidden
directory to catch bad bots and block them by their IP address from the site
[http://perishablepress.com/blackhole-bad-bots/].  It's working very well,
but I'd like to expand on the idea.

When looking at our access logs, I see someone adding code to our
URL's in hopes to, apparently, hack into our site.  If our URL is like this:

http://www.example.com/pages/bolts.php

they are adding to it like this:

http://www.example.com/pages/bolts.php/wp-content/themes/functions/thumb.php
.cache/external_e19f4bb51bc2262e07d23b79b916c12c.php
or
http://www.example.com/pages/bolts.php/cart.php
or
http://www.example.com/pages/bolts.php/wp-content/themes/functions/thumb.php
timthumb.php
or
http://www.example.com/pages/bolts.php/bratislava/stare-mesto

Is there a way that I can trap the extra info in the URL's and
pass it to the BlackHole script to ban these attempts as well?  I'm thinking
I'll need to compare the entered URL with $_SERVER[PHP_SELF] and if
there's extra info, like another *.php, after the page name, then ban the
IP.  I realize that's a rather simplistic explanation and there may be a
better way to accomplish this.

If anyone has any examples they can share, I'd really appreciate.

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




Marc,
First I would suggest you look at htaccess or web.config depending
on your flavor of OS. 
Examine the URL patterns and rewrite the URL appending to the string. This
will allow you a little more control.
I completely disagree on the blocking IP concept and this can lead to
network latency and other issues, redirecting traffic is more efficient.

I think the scare factor of products like black hole are really just that. 
Bots are not always a bad thing, when your server becomes more popular
people are interested in content so controlling the bots is key. 
IP addresses can be spoofed and if you have an auto block this could be your
undoing in the long run.



Rick..






 


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



RE: [PHP] Sorting Help

2012-04-11 Thread admin
-Original Message-
From: Floyd Resler [mailto:fres...@adex-intl.com] 
Sent: Wednesday, April 11, 2012 11:26 AM
To: PHP
Subject: [PHP] Sorting Help

I need to sort the following array:
{
[Smith, Bob]=array(137.5,125.5),
[Jones, Robert]=array(132.7,128.2)
}

The array needs to be sorted by the first number (i.e. 137.5) and then the
second in descending order.  I looked at array_multisort but couldn't figure
out how to make work for my needs.

Thanks!
Floyd


Do me a favor and copy a print_r of your array because this I can't figure
out what you're are doing with that.






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



RE: [PHP] Sorting Help

2012-04-11 Thread admin


-Original Message-
From: Floyd Resler [mailto:fres...@adex-intl.com] 
Sent: Wednesday, April 11, 2012 11:26 AM
To: PHP
Subject: [PHP] Sorting Help

I need to sort the following array:
{
[Smith, Bob]=array(137.5,125.5),
[Jones, Robert]=array(132.7,128.2)
}

The array needs to be sorted by the first number (i.e. 137.5) and then the
second in descending order.  I looked at array_multisort but couldn't figure
out how to make work for my needs.

Thanks!
Floyd



Here is what I did to your array

$test = array(Smith, Bob=array(137.5,125.5),Jones
Robert=array(132.7,128.2));
asort($test);
print_r('pre');
print_r($test);






-- 
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 admin
Tedd,
This area was always a little grey to me. 
I have used -1 to obtain the previous months for some time now.
0 always indicated the beginning index of the current month but the
explanation never seemed to fit the bill.


Having worked extensively in time manipulation in many of the development
projects I have come up with a rule of thumb.


$this_month = date('Y-m-d 00:00:00',mktime(0,0,0,date('m'),1,date('Y')));
$previous_month = date('Y-m-d
00:00:00',mktime(0,0,0,date('m')-1,1,date('Y')));
$next_month = date('Y-m-d 00:00:00',mktime(0,0,0,date('m')+1,1,date('Y')));

To get the days of any given month or just about anything you need to just
use the strtotime
$days_in_month = date('j',strtotime($this_month));






-Original Message-
From: Tedd Sperling [mailto:tedd.sperl...@gmail.com] 
Sent: Wednesday, March 07, 2012 3:04 PM
To: PHP-General List
Subject: [PHP] Function mktime() documentation question

Hi gang:

I am using the getdate(mktime()) functions to get month data (i.e., name of
month, first weekday, last day, number of days).

To get the number of days for a specific month, I use:

// $current_month is the month under question

$next_month = $current_month + 1;   
$what_date = getdate(mktime(0, 0, 0, $next_month, 0, $year));
$days_in_current_month = $what_date['mday'];

That works for me!

However, if you read the documentation, namely:

http://php.net/manual/en/function.mktime.php

It states:

--- quote

day

The number of the day relative to the end of the previous month. Values 1 to
28, 29, 30 or 31 (depending upon the month) reference the normal days in the
relevant month. Values less than 1 (including negative values) reference the
days in the previous month, so 0 is the last day of the previous month, -1
is the day before that, etc. Values greater than the number of days in the
relevant month reference the appropriate day in the following month(s).
--- un-quote

From my code, the number of days in a month can be found by using 0 as the
first index of the next month -- not the last day of the previous month.

As such, I would re-write the relevant portion of the paragraph to be:

day

The number of the day relative to the end of the previous month. Values 1 to
28, 29, 30 or 31 (depending upon the month) reference the normal days in the
relevant month. Values less than 0 reference the days in the previous month.
For example, -1 is the day before the first day of the relevant month. The
value 0 is the zero index of the next month, which is also equal to the last
day of the relevant month. Values greater than zero are the number of days
in the relevant month reference the appropriate day in the following
month(s).

What say you?

Cheers,

tedd

_
tedd.sperl...@gmail.com
http://sperling.com






--
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] syntax question

2012-02-07 Thread admin
I have been struggling with this issue for an hour and honestly I am not
sure why.

I consider myself to be pretty savvy with MySQL but I am running into an
syntax error that is just flat out eluding me.

 

$query = SELECT `table2`.`name` from `table1` ,`table2` WHERE
`table2`.`user_id`=`table1`.`seller_id` AND IF(`table2`.`name`='juice','No
Juice for YOU', `table2`.`name`=`table2`.`name`) LIMIT 1;

This query works!!

 

But If I try to add a GROUP BY to the query, complete failure.

$query = SELECT `table2`.`name`  FROM `table1` ,`table2` WHERE
`table2`.`user_id`=`table1`.`seller_id` AND IF(`table2`.`name`='juice','No
Juice for YOU', `table2`.`name`=`table2`.`name`) GROUP BY `table1`.`ID`
LIMIT 1;

 

The main goal here is to get only 1 return but MySQL is returning the same
row 2 times.

Before I beat my head in anymore I will toss this out to you guys and beat
myself up later for not drinking enough coffee or something .

 

 

 

 



RE: [PHP] syntax question

2012-02-07 Thread admin

 -Original Message-
 From: Louis Huppenbauer [mailto:louis.huppenba...@gmail.com]
 Sent: Tuesday, February 07, 2012 9:24 AM
 To: ad...@buskirkgraphics.com
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] syntax question
 
 Generally... Wouldn't grouping by an id (which is normally unique) have
 no
 real benefit... Except some strange behaviour?
 
 Just to clarify: Why aren't you sticking to the LIMIT 1?
 
 2012/2/7 ad...@buskirkgraphics.com
 
  I have been struggling with this issue for an hour and honestly I am
 not
  sure why.
 
  I consider myself to be pretty savvy with MySQL but I am running into
 an
  syntax error that is just flat out eluding me.
 
 
 
  $query = SELECT `table2`.`name` from `table1` ,`table2` WHERE
  `table2`.`user_id`=`table1`.`seller_id` AND
 IF(`table2`.`name`='juice','No
  Juice for YOU', `table2`.`name`=`table2`.`name`) LIMIT 1;
 
  This query works!!
 
 
 
  But If I try to add a GROUP BY to the query, complete failure.
 
  $query = SELECT `table2`.`name`  FROM `table1` ,`table2` WHERE
  `table2`.`user_id`=`table1`.`seller_id` AND
 IF(`table2`.`name`='juice','No
  Juice for YOU', `table2`.`name`=`table2`.`name`) GROUP BY
 `table1`.`ID`
  LIMIT 1;
 
 
 
  The main goal here is to get only 1 return but MySQL is returning the
 same
  row 2 times.
 
  Before I beat my head in anymore I will toss this out to you guys and
 beat
  myself up later for not drinking enough coffee or something .
 
 



There is no real reason to have a LIMIT It was just yet another attempt to 
limit the results during the testing.
After reading my post back I see an error in the IF statement but not the 
resolution to the issue.

The IF should read
IF(`table2`.`name`='juice',`table2`.`name`=`table1`.`code`, 
`table2`.`name`=`table1`.`ref`)




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



RE: [PHP] syntax question

2012-02-07 Thread admin

 -Original Message-
 From: ma...@behnke.biz [mailto:ma...@behnke.biz]
 Sent: Tuesday, February 07, 2012 10:47 AM
 To: php-general@lists.php.net; ad...@buskirkgraphics.com
 Subject: Re: [PHP] syntax question
 
 
 
 ad...@buskirkgraphics.com hat am 7. Februar 2012 um 15:11 geschrieben:
 
  I have been struggling with this issue for an hour and honestly I am
 not
  sure why.
 
  I consider myself to be pretty savvy with MySQL but I am running into
 an
  syntax error that is just flat out eluding me.
 
 
 
  $query = SELECT `table2`.`name` from `table1` ,`table2` WHERE
  `table2`.`user_id`=`table1`.`seller_id` AND
 IF(`table2`.`name`='juice','No
  Juice for YOU', `table2`.`name`=`table2`.`name`) LIMIT 1;
 
  This query works!!
 
 
 
  But If I try to add a GROUP BY to the query, complete failure.
 
  $query = SELECT `table2`.`name`  FROM `table1` ,`table2` WHERE
  `table2`.`user_id`=`table1`.`seller_id` AND
 IF(`table2`.`name`='juice','No
  Juice for YOU', `table2`.`name`=`table2`.`name`) GROUP BY
 `table1`.`ID`
  LIMIT 1;
 
 
 This is a nice query but I am not sure if I understand what you want to
 do?
 Maybe we could start with your error message and a table structure :-)
 That
 would be handy.
 
 You wanna get all users that have at least on sell? But only once?
 
 Maybe something like that?
 
 SELECT table2.name
 FROM
   table2,
   (SELECT seller_id FROM table1 GROUP BY seller_id) as table1
 WHERE
   table2.user_id = table1.seller_id
   AND IF(table2.name = 'juice','No Juice for YOU', table2.name =
 table2.name)
 ;
 
 
 
 
 Marco Behnke
 Dipl. Informatiker (FH), SAE Audio Engineer Diploma
 Zend Certified Engineer PHP 5.3
 
 Tel.: 0174 / 9722336
 e-Mail: ma...@behnke.biz
 
 Softwaretechnik Behnke
 Heinrich-Heine-Str. 7D
 21218 Seevetal
 
 http://www.behnke.biz



Marco,
Thank you but the whole issue stemed from the 2nd table in the FROM.
I just did an inner join using the If statement and it resolved the whole issue.
Maybe it was just a coffee thing because 2 cups later I seen it very clearly :)

Thanks so much.
 



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



RE: [PHP] What's Your Favorite Design Pattern?

2012-02-07 Thread admin
 -Original Message-
 From: Mike Mackintosh [mailto:mike.mackint...@angrystatic.com]
 Sent: Tuesday, February 07, 2012 1:57 PM
 To: PHP General List
 Subject: [PHP] What's Your Favorite Design Pattern?
 
 I was curious to see what everyones favorite design patterns were, if
 you use any, and why/when have you used it?
 
 Choices include slots and signals (observer), singleton, mvc, hmvc,
 factory, commander etc..
 
 Thanks,
 
 --
 Mike Mackintosh
 PHP, the drug of choice - www.highonphp.com
 
 


MVC because it allows the most flexibility and I use it every day.


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



RE: [PHP] free space

2012-01-31 Thread admin

 -Original Message-
 From: Sean Greenslade [mailto:zootboys...@gmail.com]
 Sent: Tuesday, January 31, 2012 2:50 PM
 To: saeed ahmed
 Cc: PHP General
 Subject: Re: [PHP] free space
 
 On Tue, Jan 31, 2012 at 1:59 PM, saeed ahmed
 mycomputerbo...@gmail.comwrote:
 
  is there any free server where one can practice php(myadmin) - sql
 without
  installing on personal computer?
 
 
 Not that I know of. There may be some, but I wouldn't bother. You can
 find
 Virtualbox server images pre-made from sites such as this:
 
 http://virtualboxes.org/images/ubuntu/
 
 #5 has apache, mysql and php installed (a LAMP package). You can use
 Virtualbox to run the server virtually, without having to install
 everything on your dev computer. Similar packages for Xen and VMWare
 are
 available, just go googling.
 
 --
 --Zootboy
 
 Sent from my PC.



I might suggest you read about the security issues when using phpmyadmin and 
understand how to secure it as well. I would never use the script personally 
because of the limitations and the measures you have to put in place to secure 
it are exhausting and limited by hosting providers .
I would always work locally to ensure stability and ensuring that bad sql 
statements do not take down your service. 

Just my thoughts about phpmyadmin


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



RE: [PHP] differences in between these env. variables

2012-01-27 Thread admin

 -Original Message-
 From: Tedd Sperling [mailto:tedd.sperl...@gmail.com]
 Sent: Friday, January 27, 2012 12:09 PM
 To: php-general. List
 Subject: Re: [PHP] differences in between these env. variables
 
 On Jan 11, 2012, at 9:24 PM, tamouse mailing lists wrote:
 
  Is there ever a case where SCRIPT_NAME does not equal PHP_SELF?
 
 Was this every answered? I would like to know.
 
 Cheers,
 
 tedd
 
 
 _
 t...@sperling.com
 http://sperling.com
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


Ted I show on the 11 Jan there was 2 answers.

I'll extend your example. We now have a RewriteRule in apache like this:

RewriteRule ^files/?$ /directory/file.php [L,QSA]

Which will rewrite /files/... -- /directory/file.php

REQUEST_URI now contains how it was called by the browser,
'/files/something.php'
SCRIPT_NAME returns path to script (/directory/file.php), set by the SAPI
(apache, ..).
PHP_SELF returns also the path to script (/directory/file.php), but set by
PHP self.
I don't have any ORIG_PATH_INFO on my Ubuntu box, so be careful about this
one.

Recommended: Depends on which you need. I prefer PHP_SELF over SCRIPT_NAME,
but that's more personal choice.
Matijn




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



RE: Re: [PHP] Question about date calculations

2011-12-30 Thread admin

 -Original Message-
 From: Eric Lommatsch [mailto:er...@pivotaldata.com] On Behalf Of Eric
 Lommatsch
 Sent: Friday, December 30, 2011 12:31 PM
 To: Fatih P.; ad...@buskirkgraphics.com
 Cc: 'Frank Arensmeier'; 'Eric Lommatsch'; php-general@lists.php.net
 Subject: RE: Re: [PHP] Question about date calculations
 
 
 Actually for what I need this is exactly what i was looking for.  I am
 converting an asp page that was calculating this difference using VBA
 functions and I was trying to duplicate things as they were in that
 page.
 
 
 
 
 Thank you
 
 
 
 
 Eric H. Lommatsch
 Programmer
 Pivotal Data Incorporated
 2087 South Grant Street
 Denver, CO 80210
 Tel 303-777-8939 Ext 23
 Fax 888-282-9927
 
 
 
 
 www.pivotaldata.com
 
 
 
 
 er...@pivotaldata.com
 
 
 
 
 
 -Original message-
 From: Fatih P. fatihpirist...@gmail.com
 Sent: Thu 29-12-2011 16:16
 To: ad...@buskirkgraphics.com;
 CC: 'Frank Arensmeier' farensme...@gmail.com; 'Eric Lommatsch'
 er...@pivotaldata.net; php-general@lists.php.net;
 Subject: Re: [PHP] Question about date calculations
 
 
 
 On 12/30/2011 12:19 AM, ad...@buskirkgraphics.com wrote:
 -Original Message- From: Fatih P. [
 mailto:fatihpirist...@gmail.com ] Sent: Thursday, December 29, 2011
 5:10 PM To: Frank Arensmeier Cc: Eric Lommatsch; php-
 gene...@lists.php.net Subject: Re: [PHP] Question about date
 calculations On Thu, Dec 29, 2011 at 11:40 PM, Frank Arensmeier
 farensme...@gmail.com wrote:
 
 29 dec 2011 kl. 22.22 skrev Eric Lommatsch:
 
 So far in looking at the functions that are available at
 http://www.php.net/manual/en/ref.datetime.php I have not been able
 
 to
 
 figure
 
 out how to do what I need to do. Below is a snippet showing
 
 approximately
 
 what I am trying to do.
 
 On the same page you are referring, there are plenty of examples on
 
 how to
 
 calculate the difference between two dates. Choose one and see if it
 
 fits
 
 your bill. Or is there any particular reason why you're writing your
 
 own
 
 function? http://www.php.net/manual/en/ref.datetime.php#78981 /frank --
 PHP General Mailing List ( http://www.php.net/ ) To unsubscribe, visit:
 http://www.php.net/unsub.php
 
 since you have everything in database tables why not to do this
 calculation on database side which would be much appropriate place ? /*
 columns date_start = '2011-02-08'; date_end = ' 2011-03-04'; */ select
 DATEDIFF(date_end, date_start);
 http://dev.mysql.com/doc/refman/5.5/en/date-and-time -
 functions.html#function_datediff
 
 I looked at this answer and see the date is from an array of a database
 and not 2 fields with in the table. While the DATEDIFF() is very useful
 in queries this will not help you unless both fields are in the table.
 Try this example $dteStartDate[$intCnt] = new DateTime($row[10]);
 $dteEndDate[$intCnt] =new DateTime($row[11]); $interval =
 $dteStartDate[$intCnt]-diff($dteEndDate[$intCnt]); echo $interval-
 format('%R%a days');
 
 well then look deeper in the question:
 
 I have a page I am trying to create where I am comparing the values of
 two
 MySQL date fields with the current date. One of the MySQL Date fields
 is a class start date, the other is the class end date.
 
 all needs to do is modify his query.


Thank you Eric,

Date conversion is a popular issue when converting the language from
one to the next. 
I prefer to manage any date filtering outside of MySQL because sometimes the
fields are not clean or formatted correctly, and the DATEDIFF() of MySQL
just fails.
This failure can be devastating when dealing with a MySQL replication setup.
I gauge the MySQL process against the PHP process and determine which is
faster and which do I have more effective controls in.
I have found I have better flexibility and control of date filtering in PHP.

But squirrels will be squirrels...


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



RE: [PHP] Question about date calculations

2011-12-29 Thread admin

 -Original Message-
 From: Fatih P. [mailto:fatihpirist...@gmail.com]
 Sent: Thursday, December 29, 2011 5:10 PM
 To: Frank Arensmeier
 Cc: Eric Lommatsch; php-general@lists.php.net
 Subject: Re: [PHP] Question about date calculations
 
 On Thu, Dec 29, 2011 at 11:40 PM, Frank Arensmeier
 farensme...@gmail.comwrote:
 
  29 dec 2011 kl. 22.22 skrev Eric Lommatsch:
 
   So far in looking at the functions that are available at
   http://www.php.net/manual/en/ref.datetime.php I have not been able
 to
  figure
   out how to do what I need to do.  Below is a snippet showing
  approximately
   what I am trying to do.
 
  On the same page you are referring, there are plenty of examples on
 how to
  calculate the difference between two dates. Choose one and see if it
 fits
  your bill. Or is there any particular reason why you're writing your
 own
  function?
 
  http://www.php.net/manual/en/ref.datetime.php#78981
 
  /frank
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 since you have everything in database tables why not to do this
 calculation
 on database side which would be much appropriate place ?
 
 /* columns
 date_start = '2011-02-08';
 date_end = ' 2011-03-04';
 */
 
 select DATEDIFF(date_end, date_start);
 
 http://dev.mysql.com/doc/refman/5.5/en/date-and-time-
 functions.html#function_datediff


I looked at this answer and see the date is from an array of a database and not 
2 fields with in the table.
While the DATEDIFF() is very useful in queries this will not help you unless 
both fields are in the table.

Try this example

$dteStartDate[$intCnt] = new DateTime($row[10]);
$dteEndDate[$intCnt] =new DateTime($row[11]);
$interval = $dteStartDate[$intCnt]-diff($dteEndDate[$intCnt]);
echo $interval-format('%R%a days');


 






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



RE: [PHP] Preferred Syntax

2011-12-14 Thread admin
 -Original Message-
 From: Tamara Temple [mailto:tamouse.li...@tamaratemple.com]
 Sent: Wednesday, December 14, 2011 1:40 PM
 To: Tedd Sperling
 Cc: Rick Dwyer; PHP-General
 Subject: Re: [PHP] Preferred Syntax
 
 Tedd Sperling tedd.sperl...@gmail.com wrote:
  On Dec 14, 2011, at 7:59 AM, Rick Dwyer wrote:
 
   Hello all.
  
   Can someone tell me which of the following is preferred and why?
  
   echo a style='text-align:left;size:14;font-weight:bold'
 href='/mypage.php/$page_id'$page_name/abr;
  
   echo a style='text-align:left;size:14;font-weight:bold'
 href='/mypage.php/.$page_id.'.$page_name./abr;
  
   When I come across the above code in line 1, I have been changing
 it to what you see in line 2 for no other reason than it delineates out
 better in BBEdit.  Is this just a preference choice or is one method
 better than the other?
  
   --Rick
 
  Neither.
 
  My advice, take all the style elements out of the anchor tag.
 
  echo(a href='/mypage.php/$page_id'$page_name/a);
 
  Even the 'br' can be (perhaps should be) handled by css.
 
 I think you may have missed the question. The OP was asking whether:
 
   text $var text
 
 or
 
   text .$var. text
 
 was preferrable.
 
 For me, I tend to use the first unless the second makes things clearer
 where they need to be. Syntax hilighing can easily be one of those
 times.
 
 
 --

The key thing to remember here is that this is a preference and not a
performance thing.






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



RE: [PHP] Preferred Syntax

2011-12-14 Thread admin
 -Original Message-
 From: Adam Richardson [mailto:simples...@gmail.com]
 Sent: Wednesday, December 14, 2011 2:19 PM
 To: Rick Dwyer
 Cc: PHP-General
 Subject: Re: [PHP] Preferred Syntax
 
 On Wed, Dec 14, 2011 at 7:59 AM, Rick Dwyer rpdw...@earthlink.net
 wrote:
 
  Hello all.
 
  Can someone tell me which of the following is preferred and why?
 
   echo a style='text-align:left;size:**14;font-weight:bold'
  href='/mypage.php/$page_id'$**page_name/abr;
 
   echo a style='text-align:left;size:**14;font-weight:bold'
  href='/mypage.php/.$page_id.**'.$page_name./abr;
 
  When I come across the above code in line 1, I have been changing it
 to
  what you see in line 2 for no other reason than it delineates out
 better in
  BBEdit.  Is this just a preference choice or is one method better
 than the
  other?
 
 
 I prefer sending arguments to the echo language construct (note, if you
 send more than one argument, you can't use parentheses.) I perceive
 this
 usage to be a clean presentation of the code's intent, easy to use in
 most
 IDE's, and it's very fast relative to the other options:
 
 echo a style='text-align:left;size:**14;font-weight:bold'
 href='/mypage.php/$page_id'$**page_name/abr;
 
 echo a style='text-align:left;size:**14;font-weight:bold'
 href='/mypage.php/.$page_id.**'.$page_name./abr;
 
 echo a style='text-align:left;size:**14;font-weight:bold'
 href='/mypage.php/, $page_id, ', $**page_name, /abr;
 
 And, for longer lines, I'll often break it up into separate lines by
 argument like below:
 
 echo
 a style='text-align:left;size:**14;font-weight:bold'
 href='/mypage.php/,
 $page_id,
 ',
 $**page_name,
 /abr;
 
 That all said, I don't change code that uses another convention, as I
 think
 it's most beneficial to stay with the established conventions in any
 codebase (unless you're establishing a new convention and refactoring
 the
 entire code base.) This is just my general preference, and I don't
 believe
 there is consensus as to the most appropriate.
 
 Adam
 
 --
 Nephtali:  A simple, flexible, fast, and security-focused PHP framework
 http://nephtaliproject.com



Adam,
You are very correct, the last discussions and testing of theories
caused my head to hurt!!! 
Neither side gained ground in testing or discussion.
Having said that to me it is a preference only and not a performance
enhancing or degrading factor in syntax.





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



RE: [PHP] Problem with date

2011-12-07 Thread admin

 -Original Message-
 From: Jack [mailto:jacklistm...@gmail.com]
 Sent: Wednesday, December 07, 2011 1:49 PM
 To: PHP
 Subject: [PHP] Problem with date
 
 Hello All,
 
 
 
 I have a problem where Dates are coming out as 12.31.1969 19:00:00
 which of
 course we didn't have PC's in 1969
 
 I'm not able to see where the date is getting screwed up, any ideas??
 
 
 
 //
 ###
 #
 #
 
 function ShowFeed_RSS($XmlRoot) {
 
   $title = GetFirstChildContentByPath($XmlRoot, channel/title);
 
   $link = GetFirstChildContentByPath($XmlRoot, channel/link);
 
   $desc = GetFirstChildContentByPath($XmlRoot, channel/description);
 
 # Next 2 lines display the title of the feed, and feed description
 
 
 #  echo font face=arial color=blue size =2ba
 href=\$link\$title/a/b\n;
 
 #  echo $desc;
 
   $nodelist = GetChildrenByPathAndName($XmlRoot, channel, item);
 
   if (!$nodelist) return 0;
 
   foreach ($nodelist as $nl) {
 
 $title   = GetFirstChildContentByName($nl, title);
 
 $link= GetFirstChildContentByName($nl, link);
 
 $desc= GetFirstChildContentByName($nl, description);
 
 $creator = GetFirstChildContentByName($nl, author);
 
 
 
 #if (!$creator) $creator = GetFirstChildContentByName($nl,
 dc:creator);
 
 
 
 #   echo JACK . $nl . br;
 
 #$pubdate = GetFirstChildContentByName($nl, pubDate);
 
 if (!isset($pubdate)) $pubdate = GetFirstChildContentByName($nl,
 dc:date);
 
 #if (!$pubdate) $pubdate = GetFirstChildContentByName($nl,
 dc:date);
 
 if (isset($pubdate)) $pubdate = strtotime($pubdate);
 
 if (isset($pubdate)) $pubdate = strftime(%m.%d.%Y %H:%M:%S,
 $pubdate);
 
 $out = $creator;
 
 
 
 if ( ($creator != )  ($pubdate != ) ) $out .=  @ ;
 
 
 $out .= $pubdate;
 
 echo a class=\rss-link\ href=\$link\b$title/b/a;
 
 echo font size=1 color=\black\$outbr;
 
 echo font size=2$descbrbr;
 
 #   echo font size=1 class=rss-linkThis is not green/font;
 
 
 
 }
 
 #  this line is after each rss feed group
 
 #  echo hr\n;
 
 
 
 }
 
 
 
 
 
 
 
 Thanks!
 
 Jack
 
 



Suggestion only.
if (isset($pubdate)) $pubdate = strtotime($pubdate);

if (isset($pubdate)) $pubdate = strftime(%m.%d.%Y %H:%M:%S, $pubdate);

could be 

if (isset($pubdate)) $pubdate = mktime(m d Y
H:i:s,strtotime($pubdate));
Reducing the code

I also changed this to MKtime from strftime because The %e modifier is not
supported in the Windows implementation of this function. To achieve this
value, the %#d modifier can be used instead. The example below  illustrates
how to write a cross platform compatible function. 

Please read on the MKTIME function
http://php.net/manual/en/function.mktime.php
















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



Re: [PHP] Help with redeclare error

2011-10-27 Thread UltraMega Admin

On 10/27/2011 5:33 PM, Daniel Brown wrote:

On Thu, Oct 27, 2011 at 20:06, Jason Pruimli...@pruimphotography.com  wrote:

Most likely you have in included in 2 files... Look into it from that angle... 
It only needs to be included in 1 file to work throughout all the files.

 Prune is spot-on.  That error generally happens when you include a
file that has already been included, which contains function
definitions.  Look at the code in the files the error mentions, on the
lines it specifies, and - most likely - you'll see an include.
Changing them to include_once instead will resolve the issue, as PHP
will just skip the order if it's already been done within the
execution of the code.



A function with that name already exists in PHP as of 5.3.0. You'll have 
to rename it or something.


http://us2.php.net/manual/en/function.date-diff.php

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



[PHP] newline and return issues in string

2011-10-11 Thread admin
I have come across an issue with my string that I would like to find a
faster way to resolve.

It seems there are new lines and returns at different positions of the
string. 

 

First I exploded on the new line explode(“\n”, $ string)

This gave me a nice array but when I try to implode I get the new lines
again.

There is not a consistent position and there seems to be some hidden returns
in the array as well.

 

Is there a way, or has someone written a filter that would allow me to
remove all the newlines and returns from the array or string.

Understand I have resolved this issue but I think I have to be going about
this the hard way because it is just too complex .

 

FYI

$filter = array(\r\n, \n, \r);

str_replace($filter,’’,$string) ß this is useless in this situation I have
tried and it does not change the string at all.

Understand the newlines and returns do not display in the string as
literals. Meaning you do not see /n or /r it is hidden.

 

 



RE: [PHP] newline and return issues in string

2011-10-11 Thread admin
 -Original Message-
 From: Bastien Koert [mailto:phps...@gmail.com]
 Sent: Tuesday, October 11, 2011 8:53 AM
 To: ad...@buskirkgraphics.com
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] newline and return issues in string
 
 On Tue, Oct 11, 2011 at 7:58 AM,  ad...@buskirkgraphics.com wrote:
  I have come across an issue with my string that I would like to find
 a
  faster way to resolve.
 
  It seems there are new lines and returns at different positions of
 the
  string.
 
 
 
  First I exploded on the new line explode(“\n”, $ string)
 
  This gave me a nice array but when I try to implode I get the new
 lines
  again.
 
  There is not a consistent position and there seems to be some hidden
 returns
  in the array as well.
 
 
 
  Is there a way, or has someone written a filter that would allow me
 to
  remove all the newlines and returns from the array or string.
 
  Understand I have resolved this issue but I think I have to be going
 about
  this the hard way because it is just too complex .
 
 
 
  FYI
 
  $filter = array(\r\n, \n, \r);
 
  str_replace($filter,’’,$string) ß this is useless in this situation I
 have
  tried and it does not change the string at all.
 
  Understand the newlines and returns do not display in the string as
  literals. Meaning you do not see /n or /r it is hidden.
 
 
 
 
 
 
 
 What about using nl2br() and then stripping out all the BR tags?
 
 --
 
 Bastien
 
 Cat, the other other white meat

I tried that but same issue



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



RE: [PHP] newline and return issues in string

2011-10-11 Thread admin
 -Original Message-
 From: Richard Quadling [mailto:rquadl...@gmail.com]
 Sent: Tuesday, October 11, 2011 9:44 AM
 To: ad...@buskirkgraphics.com
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] newline and return issues in string
 
 On 11 October 2011 12:58,  ad...@buskirkgraphics.com wrote:
  I have come across an issue with my string that I would like to find
 a
  faster way to resolve.
 
  It seems there are new lines and returns at different positions of
 the
  string.
 
 
 
  First I exploded on the new line explode(“\n”, $ string)
 
  This gave me a nice array but when I try to implode I get the new
 lines
  again.
 
  There is not a consistent position and there seems to be some hidden
 returns
  in the array as well.
 
 
 
  Is there a way, or has someone written a filter that would allow me
 to
  remove all the newlines and returns from the array or string.
 
  Understand I have resolved this issue but I think I have to be going
 about
  this the hard way because it is just too complex .
 
 
 
  FYI
 
  $filter = array(\r\n, \n, \r);
 
  str_replace($filter,’’,$string) ß this is useless in this situation I
 have
  tried and it does not change the string at all.
 
 You don't want to remove them. You want to replace them with a
 constant.
 
 $lines = explode(PHP_EOL, str_replace($filter, PHP_EOL, $string));
 
 for example.
 
 
 
 
 
 --
 Richard Quadling
 Twitter : EE : Zend : PHPDoc
 @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea



Richard I am not sure I understand what that is doing it made things 300% worse.



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



RE: [PHP] Re: newline and return issues in string

2011-10-11 Thread admin


Richard L. Buskirk
Senior Software Engineer/Systems Administrator

You can’t grow your business with systems that are on life support...


 -Original Message-
 From: Al [mailto:n...@ridersite.org]
 Sent: Tuesday, October 11, 2011 10:17 AM
 To: php-general@lists.php.net
 Subject: [PHP] Re: newline and return issues in string
 
 
 
 On 10/11/2011 7:58 AM, ad...@buskirkgraphics.com wrote:
  I have come across an issue with my string that I would like to find
 a
  faster way to resolve.
 
  It seems there are new lines and returns at different positions of
 the
  string.
 
 
 
  First I exploded on the new line explode(“\n”, $ string)
 
  This gave me a nice array but when I try to implode I get the new
 lines
  again.
 
  There is not a consistent position and there seems to be some hidden
 returns
  in the array as well.
 
 
 
  Is there a way, or has someone written a filter that would allow me
 to
  remove all the newlines and returns from the array or string.
 
  Understand I have resolved this issue but I think I have to be going
 about
  this the hard way because it is just too complex .
 
 
 
  FYI
 
  $filter = array(\r\n, \n, \r);
 
  str_replace($filter,’’,$string) ß this is useless in this situation I
 have
  tried and it does not change the string at all.
 
  Understand the newlines and returns do not display in the string as
  literals. Meaning you do not see /n or /r it is hidden.
 
 
 
 
 
 
 
 Try this:
 
 $strippedStr= preg_replace(%(\n|\r)%, #, $string);
 
 The # will let your see what's happening. Change it to simply . for
 the
 final version.
 
 
 
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




PERFECT  Thank you so much for that


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



RE: [PHP] Code should be selv-maintaining!

2011-08-29 Thread admin

 -Original Message-
 From: Rico Secada [mailto:coolz...@it.dk]
 Sent: Monday, August 29, 2011 3:42 PM
 To: php-general@lists.php.net
 Subject: [PHP] Code should be selv-maintaining!
 
 Dont get me wrong, I love programming! But what an absolute pain in the
 ass it is when you re-use old code only to discover something less
 well
 made.
 
 You all know about this right?
 
 You go into your homemade library of code to re-use some piece that you
 already are using 12 other places in production. Now, last time you
 worked on the code you thought it was almost perfect. While working on
 the code this time you find an undiscovered bug or some part of the
 code that looks like you where on drugs when you made it.
 
 Of course we develop experience and more skills all the time, and as a
 good programmer we never stop doing that, but what a pain it is when
 the above happens and you have to patch the code being used those 12
 other places too, and each place maybe has a slightly different usage,
 so minor changes affect other stuff. And this goes on while your head
 is spinning around trying to stay focused on the very task at hand that
 originated the need for a quick re-usage of old code in the first
 place.
 
 Why the hell can't code be self-maintaining!? :))
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


In a framework this is not a problem, and easy to update. Development as a
whole, is a living document ever growing and expanding it abilities.
If taking advantage of the new ability is a long upgrade process then the
design is stagnate . This is called the longevity of a design and is why
many developers No longer use what is called as flat text programming.
Thinking object oriented programming in frameworks is the only way I do
business.


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



RE: [PHP] Struggling with MySQL query

2011-08-09 Thread admin

 -Original Message-
 From: David Green [mailto:simp...@gmail.com]
 Sent: Tuesday, August 09, 2011 10:14 AM
 To: php-general@lists.php.net
 Subject: [PHP] Struggling with MySQL query
 
 Hi
 
 I have a simple from which uses the post method to get to my page
 script
 results.php
 
 in results.php I have
 
 $find=$_POST[find]; //this works perfectly, echo $find gives me the
 search
 term as entered
 
 I then connect to mysql and select the db successfully.
 
 After that, I have the following:
 
 $find = strtoupper($find);
 $find = strip_tags($find);
 $find = trim($find);
 
 $data = mysql_query(SELECT * FROM news_items WHERE upper('headline')
 LIKE
 '%$find%');
 
 while($result = mysql_fetch_array($data)) { //etc
 
 I get no error messages, but no results to work with either.  It
 returns a
 no results message that I put in further on in the script.  A casual
 look
 at the db shows that I should be getting results.  I'm pretty sure that
 the
 problem is in the query, but for the life of me I can't see the
 problem.
 
 Kind regards
 David


Suggestion:

$query = SELECT * FROM news_items WHERE UPPER(headline) LIKE
'%.mysql_real_escape_string($find).%' ;
$result = mysql_query($query);

//Check your syntax display any errors.
Echo mysql_error();
Echo mysql_errno();

If(mysql_num_rows($result)= 1) {
While($row = mysql_fetch_assoc($result))
{   
print_r($row);
}
}else{
Echo 'nothing to show';
}









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



RE: [PHP] control structure

2011-08-04 Thread admin
 -Original Message-
 From: Chris Stinemetz [mailto:chrisstinem...@gmail.com]
 Sent: Thursday, August 04, 2011 11:34 PM
 To: PHP General
 Subject: [PHP] control structure
 
 I have a php script with a simple condition. If it is not satisfied I
 want to exit the script otherwise I want to continue. I am having
 difficulties getting it to work. The script is just exiting..
 
 Please excuse my indention. Gmail tends to distort it.
 
 Thank you,
 
 Chris
 
 This is what i have so far:
 
 if (!session_id())
   {
   session_start();
   }
 if($_SESSION['signed_in'] == false | $_SESSION['user_level'] != 1
 || $_SESSION['user_level'] != 2  )
   {
   //the user is not an admin
   echo 'Sorry, you do not have sufficient rights to access this
 page.br/
 You must be a technician or an engineer to create a store
 visit.';
 
 exit;
   }
   else {
   continue;
 
 
 
 If I get it to continue I want to execute the rest of the script, but
 It will only exit. Current user has user_level of 1 so that is not an
 issue.
 
 Rest of script:
 
 $market = isset($_GET['market']) ? $_GET['market'] :
 $_SESSION['market'];
 $type = isset($_GET['type']) ? $_GET['type'] : $_SESSION['type'];
 $store = isset($_GET['store']) ? $_GET['store'] :
 $_SESSION['store'];
 
 $type = str_replace('-', ' ', $type);
 
 if($_SESSION['type'] != $type)
 {
 $_SESSION['type'] = $type;
 $store = '';
   }
 
 if($_SESSION['market'] != $market)
 {
 $type = '';
 $store = '';
 }
 
 $_SESSION['market'] = $market;
 $_SESSION['type'] = $type;
 $_SESSION['store'] = $store;
 
 $market_name = array();
 $market_prefix = array();
 $type_name = array();
 $market_prefix = array();
 $store_name = array();
 
 
 $query = SELECT * FROM marketcode  ;
 $result = mysql_query($query) or die(report($query,__LINE__
 ,__FILE__)); //(Something went wrong);
 
   while($row = mysql_fetch_array($result))
 {
 $market_name[] = $row['market_name'];
 $market_prefix[] = $row['market_prefix'];
 }
 
 $query = SELECT store_type FROM store_type WHERE market_prefix =
 '$market'  ;
 $result = mysql_query($query) or die(report($query,__LINE__
 ,__FILE__));
 
   while($row = mysql_fetch_array($result))
 {
 $type_name[] = $row['store_type'];
 }
 
 $type_name = array_unique($type_name);
 sort($type_name);
 
 if($type == '')
 {
 $type = $type_name[0];
 $_SESSION['type'] = $type;
 }
 
 $query = SELECT store_name FROM store_list WHERE store_type =
 '$type' AND market_prefix = '$market'   ;
 $result = mysql_query($query) or die(report($query,__LINE__
 ,__FILE__));
 
 while($row = mysql_fetch_array($result))
 {
 $store_name[] = $row['store_name'];
 }
  //   include ('includes/closedb.php');
// close dB
 sort($store_name);
  }
 ?
 
 div id=myspan
 form action=index.php method=post
 table
 tr
 th class=marketMarket/th
 th class=typeStore Type/th
 th class=storeStore Name/th
 /tr
 tr
 td
 select name=market
 onchange=javascript:get(this.parentNode);
   option value=Choose.../option
 ?php
 foreach($market_prefix as $key = $value)
 {
 $selected = '';
 if($value == $market)
 {
 $selected = 'selected';
 }
 //echo(option value=$value $selected
 $value : $market_name[$key]);
   echo 'option
value=',
 htmlspecialchars($value), ' ',
 $selected, '', htmlspecialchars($value.' : '.$market_name[$key]),
 '/option';
 }
 ?
 /select
 /td
 td
 select name=type
 onchange=javascript:get(this.parentNode);
   option value=Choose.../option
 ?php
 foreach($type_name as $value)
 {
 $selected = '';
 if($value == $type)
 {
 $selected = 'selected';
 }
 $v = str_replace(' ', '-', $value);
 //echo(option value=$v $selected
 $value

RE: [PHP] Syntax Question

2011-08-03 Thread admin
 -Original Message-
 From: Gates, Jeff [mailto:gat...@si.edu]
 Sent: Wednesday, August 03, 2011 10:23 AM
 To: php-general@lists.php.net
 Subject: [PHP] Syntax Question
 
 I, too, am a super newbie. I have a beginning knowledge of being able
 to
 read php and understand its syntax but I can¹t write it. This is a
 bit
 complicated but here¹s my problem:
 
 I want to create a variable in PHP that I can use to link to an image
 in our
 museum's image website. We have done it with ColdFusion here but I need
 the
 same thing for PHP because I¹m building a site using a php-based CMS
 called
 Omeka.
 
 In ColdFusion the variable is written:
 cfset tmpImageDirectory = getToken(artwork.accessionNumber, 1, .)
 
 Basically, it¹s saying find the image on our server by looking for its
 accession number within the year directory. Since the first part of the
 accession number is the year we got the artwork this variable is saying
 look
 for the accession number in the year directory by first looking at the
 first
 part of that accession number (the year), look in that year directory
 and
 then use the entire accession number to find the image within that
 directory.  An example of an accession number is 2011.15. That¹s saying
 that
 artwork was the 15th artwork brought into our collection in 2011. On
 our
 image server it will be found in a directory called 2011. (Am I making
 sense?)
 
 Then the Coldfusion call is:
 
 a
 href=http://ids.si.edu/ids/dynamic?container.fullpageid=http://americ
 anart
 .si.edu/images/#tmpImageDirectory#/#artwork.accessionNumber#_1a.jpg
 (the
 1a.jpg is simply the size image we want to call).
 
 I need to be able to do the same thing with PHP but have no idea how.
 
 More information: within my site I¹m housing the accession number in a
 mySQL
 database. I¹ve gotten a bit of help on this already (but not enough,
 that¹s
 why I¹m turning to you).
 
 I was told I need to create two variables [('Dublin Core','Identifier')
 is
 the name of the field that houses the accession number):
 
 $accessionNumber =  item('Dublin Core','Identifier');
 $tmpImageDirectory = strtok($accessionNumber,.);
 
 And then create a third variable to create a url variable
 
 $url =
 http://ids.si.edu/ids/dynamic?container.fullpageid=http://americanart
 .si.e
 du/images/
 http://ids.si.edu/ids/dynamic?container.fullpageid=http://americanart
 .si.e
 du/images/$tmpImageDirectory/$artwork.accessionNumber_1a.jpg  +
 $tmpImageDirectory + / + $accessionNumber + _1ajpg;
 
 That's as far as I've gotten. I don't know how to put all of these
 together
 using proper PHP syntax. Can someone help me with this? Thanks.
 
 Best, Jeff
 
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




$url =
http://ids.si.edu/ids/dynamic?container.fullpageid=http://americanart.si.e
du/images/
http://ids.si.edu/ids/dynamic?container.fullpageid=http://americanart.si.e
du/images/. $tmpImageDirectory ./. $artwork .accessionNumber_1a.jpg .
$tmpImageDirectory ./. $accessionNumber ._1ajpg;

I am not sure I agree with the way you are setting the $url it looks like
you have mashed and a url hyperlink partially into 1.
Like you are trying to set the $url as a image with a link are you trying to
set a link or an image as the $url?

If you are trying to set a image as the $url do this.

$url = image
src=http://ids.si.edu/ids/dynamic?container.fullpageid=http://americanart.s
i.edu/images/. $tmpImageDirectory ./. $accessionNumber ._1ajpg ALT='';

Sorry if this is not correct for what you are trying to do. I just do not
understand the intent.















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



RE: [PHP] Re: testing

2011-08-02 Thread admin
 -Original Message-
 From: Jim Giner [mailto:jim.gi...@albanyhandball.com]
 Sent: Tuesday, August 02, 2011 5:25 PM
 To: php-general@lists.php.net
 Subject: [PHP] Re: testing
 
 
 Jim Giner jim.gi...@albanyhandball.com wrote in message
 news:6d.60.30104.5b968...@pb1.pair.com...
  Don't seem to be getting any feeds thru the newsgroup mirror(?).
 
 Ok - this showed up in my OE newsgroup, but OE still shows 36 more
 messages
 in php.general that I haven't/can't seem to retrieve.  Is something
 wrong
 with the list-to-newgroup interface?
 
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


I was thinking the same thing I have none myself.


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



RE: [PHP] How to sum monetary variables

2011-07-18 Thread admin
 -Original Message-
 From: Martín Marqués [mailto:martin.marq...@gmail.com]
 Sent: Monday, July 18, 2011 6:01 PM
 To: PHP General
 Subject: [PHP] How to sum monetary variables
 
 I'm building a table (which is a report that has to be printed) with a
 bunch of items (up to 300 in some cases) that have unitary price
 (stored in a numeric(9,2) field), how many there are, and the total
 price for each item. At the end of the table there is a total of all
 the items.
 
 The app is running on PHP and PostgreSQL is the backend.
 
 The question is, how do I get the total of everything?
 
 Running it on PHP gives one value, doing a sum() on the backend gives
 another, and I'm starting to notice that even using python as a
 calculator gives me errors (big ones). Right now I'm doing the maths
 by hand to find out who has the biggest error, or if any is 100%
 accurate.
 
 Any ideas?
 
 --
 Martín Marqués
 select 'martin.marques' || '@' || 'gmail.com'
 DBA, Programador, Administrador
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



Can you show us some examples of what you have tried please.

Richard L. Buskirk


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



RE: [PHP] Constants in strings

2011-07-06 Thread admin
 -Original Message-
 From: Dave Wilson [mailto:dai_bac...@hotmail.com]
 Sent: Wednesday, July 06, 2011 10:11 AM
 To: php-general@lists.php.net
 Subject: Re: [PHP] Constants in strings
 
 On Wed, 06 Jul 2011 12:56:21 +0100, Stuart Dallas wrote:
  My guess is that the preceding $ causes PHP to interpret the next
 token
  {XYZ} as a variable or a constant, but without that preceding $ it
 has
  no way to know you're trying to use a constant. As Curtis points out,
  the only way to insert a constant into a string is through
  concatenation.
 
  -Stuart
 
 OK. I should have made myself clearer - I was making an observation
 with
 regards to constant parsing in strings rather than looking for advice.
 My
 bad.
 
 My third example showed that {${XYZ}} would echo the value of the
 variable called the value of XYZ:
 ?php
 define ('XYZ','ABC');
 
 $ABC=huh!;
 
 echo {${XYZ}}\n;
 ?
 Output - huh!
 
 We could easily re-write the 'echo' line above to be:
 echo {${constant('XYZ'}}\n;
 
 But my example shows that PHP *is* accessing the value of a constant
 without any jiggery-pokery or hacks (e.g. http://www.php.net/manual/en/
 language.types.string.php#91628) as it is retrieving the value of ABC
 from the XYZ constant and then looking for a variable of that name.
 
 I admit that I'm no C coder but it may be possible (note, the word
 may)
 that a change of code within the PHP source tree will allow us to use
 something like echo {{XYZ}} to access the constant value.
 
 Cheers
 
 Dave
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



define('DIR_JAVA', '/js/');

When you need to use the JavaScript directory you can do this.
script src=?php echo DIR_JAVA . 'jquery-1.5.1.js';?/script

There is no true need for the curly brackets to echo out the value of the 
constant.











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



RE: [PHP] Constants in strings

2011-07-06 Thread admin
 -Original Message-
 From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk]
 Sent: Wednesday, July 06, 2011 10:49 AM
 To: ad...@buskirkgraphics.com; 'Dave Wilson'; php-general@lists.php.net
 Subject: RE: [PHP] Constants in strings
 
 
 
 
 define('DIR_JAVA', '/js/');
 
 When you need to use the JavaScript directory you can do this.
 script src=?php echo DIR_JAVA . 'jquery-1.5.1.js';?/script
 
 There is no true need for the curly brackets to echo out the value of
 the constant.
 
 
 Except for when you're using heredoc, much like in the OPs first
 post...
 
 Thanks,
 Ash
 http://www.ashleysheridan.co.uk
 --
 Sent from my Android phone with K-9 Mail. Please excuse my brevity.


Ash,
I have a few questions.
I use constants in my OOP and I never use the heredoc syntax. Now I am fearing 
that I have not taken advantage of something.
My understanding of heredoc syntax as of 5.3 is just a string quoting right?
Is there an advantage of using the heredoc syntax over single quoted or double 
quoted?

Examples:

Echo 'your constant for the javascript path is '.DIR_JAVA;

Echo EOT
Your constant for the JavaScript path is {{DIR_JAVA}}
EOT; 

I fully understand the syntax but I do not understand the advantages of using 
either.
Is it just a writing style, or is there an advantage to the way it processes, 
speed or something?





 


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



[PHP] Top Posting

2011-07-05 Thread admin
Since this is the 3rd time I have been chewed out for top posting.

Anyone know how to make Outlook changes its reply position.

 

I am using outlook  2007 and I do not find an option for this.

I have to scroll down to the bottom of the email and it considers that to be
an adjustment to the original email , plus I have to manually write my
signature block.

 

Assuming this is what they mean about top posting!!!

 

Richard L. Buskirk

 



RE: [PHP] Re: Top Posting

2011-07-05 Thread admin
 -Original Message-
 From: Jim Giner [mailto:jim.gi...@albanyhandball.com]
 Sent: Tuesday, July 05, 2011 1:53 PM
 To: php-general@lists.php.net
 Subject: Re: [PHP] Re: Top Posting
 
 
 Ashley Sheridan a...@ashleysheridan.co.uk wrote in message
 news:21e916f2-2a1f-4982-bc4d-9a574da92...@email.android.com...
 I've seen fake messages do that before as a way of harvesting good live
 email addresses, so I regard all such messages spam now.
 
 oh, well...
 
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

I have made a few changes in Outlook to make this a little easier. Since
this is the only time I would ever bottom post. 
I will manually do it, I am sorry but Outlook should have an option for
this 
I was not complaining about bottom posting I just thought maybe someone knew
a setting to make it happen in outlook.

:) Happy FRY Casey Anthony Day!



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



RE: [PHP] Re: Parent Limits?

2011-07-01 Thread admin
Brian,
I totally get what you are saying.
I just may have not translated my thoughts to you very well and I am very
sorry for that.
I tested the design on a few of my servers.
I had issues on my windows Servers and did not have issues on my RHEL
servers

There is an actual term for this practice it is called Linkal Gymnastics

I have read many articles on this issue, in trying to explain the path
issues using ../ .
Many complain of performance issues in windows as well as Linux.


I want to propose something and you tell me if it makes sense.
Load the path to the file, not from the current location.
It is just bad practice, and if you ever change the location of the file you
have major problems.
You're not guessing at the location backwards and running into performance
issues.


Instead of loading the file in reverse 
require_once(../../../../ini.inc.php); -- this path could be wrong.
try
require_once(C:/intepub/vhost/yourdoamin.com/httpdocs/www/ini.inc.php);--
unless you move it the direct path is always right.

You can create constants as I said before making your life easier.
define('BASE_PATH','C:\\inetpub\\vhosts\\yourdoamin.com\\httpdocs\\');

simply calling
require_once(BASE_PATH.www/ini.inc.php);

I cannot tell you why there are performance issue, but there are and it
seems to be more directory path issues than php.
They did write a paper on this issue at Texas U under Computer Science
Recursive Backtracking

I hope this helps


Richard L. Buskirk

-Original Message-
From: Brian Smither [mailto:bhsmit...@gmail.com] 
Sent: Thursday, June 30, 2011 2:30 PM
To: php-general@lists.php.net
Subject: [PHP] Re: Parent Limits?

With all kind respect to Richard Buskirk and Daniel Brown (thank you for
responding), their replies did not actually answer my question. 

My question is: What module or php.ini setting would render inoperative a
directory traversal of X parents?

My original post follows.

The following works (three parents):
include(../../../includes/ini.inc.php);
require_once(../../../includes/ini.inc.php);

The following works (four parents):
include(../../../../includes/ini.inc.php);

The following does not work (four parents):
require_once(../../../../includes/ini.inc.php);

That is, require_once() with four parents has been reported to have been
disabled for security purposes. But apparently, not disabled is include()
with four parents.

The device or setting which is causing the problem is not known to me. It
may be just the four parents (and include() is getting the data from this
file elsewhere) or it may be the combination.

It has been reported this is not a limit within open_basedir. So, what is
it? What module or php.ini setting would have this effect?

Thank you.



-- 
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] I want to use POST when redirect via PHP Header function.

2011-06-30 Thread admin
I could be wrong on this but,
I am pretty sure you can use GET variables but not POST in a header
redirect.

Example 
header('Location:http://www.yourmom.com/?large=inchargehasorbit=yes');





Richard L. Buskirk

-Original Message-
From: Md Ashickur Rahman Noor [mailto:ashickur.n...@gmail.com] 
Sent: Thursday, June 30, 2011 2:36 AM
To: Ashley Sheridan
Cc: php-general@lists.php.net
Subject: Re: [PHP] I want to use POST when redirect via PHP Header function.

For passing value to other page.
--
Dedicated Linux Forum in
Bangladeshhttp://forums.linuxdesh.com/member.php?action=registerreferrer=3
%20
Follow Me Twiter https://twitter.com/#%21/AshickunNoor
Thank you
Md Ashickur Rahman




On Thu, Jun 30, 2011 at 12:34 PM, Ashley Sheridan
a...@ashleysheridan.co.ukwrote:



 Md Ashickur Rahman Noor ashickur.n...@gmail.com wrote:

 I want to use POST when redirect via PHP Header function. Is it
 possible?
 --
 Dedicated Linux Forum in
 Bangladesh
 http://forums.linuxdesh.com/member.php?action=registerreferrer=3%20
 Follow Me Twiter https://twitter.com/#%21/AshickunNoor
 Thank you
 Md Ashickur Rahman

 Erm, a bit vague. Use POST for *what* during the redirect?

 Thanks,
 Ash
 http://www.ashleysheridan.co.uk
 --
 Sent from my Android phone with K-9 Mail. Please excuse my brevity.



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



RE: [PHP] caching problem

2011-06-28 Thread admin
If the issue is a caching proxy or browser caching I suggest you look into 
controlling the page caching header.

You can expire the header.

// calc an offset of 24 hours
 $offset = 3600 * 24;
 // calc the string in GMT not localtime and add the offset
 $expire = Expires:  . gmdate(D, d M Y H:i:s, time() + $offset) .  GMT;
 //output the HTTP header
 Header($expire);

Just a thought.

Richard L. Buskirk


-Original Message-
From: Stuart Dallas [mailto:stu...@3ft9.com] 
Sent: Tuesday, June 28, 2011 7:53 AM
To: Fatih P.
Cc: php-general@lists.php.net
Subject: Re: [PHP] caching problem

On Tuesday, 28 June 2011 at 06:57, Fatih P. wrote:
 On Tue, Jun 28, 2011 at 7:40 AM, Nilesh Govindarajan
 cont...@nileshgr.com (mailto:cont...@nileshgr.com)wrote:
 
  On 06/28/2011 10:56 AM, Fatih P. wrote:
   Hi guys,
   
   the code files are being cached. and modifications in methods are skipped
   and not executed. is there any parameter that i can pass it from ini
  file?
   this has been so annoying for me. restarting apache, windows, etc does
  not
   even help. im running apache 2.2.19, php ts 5.3.6 on windows 2003 r2
   any ideas how to avoid this situation? thanks
   
   Fatih
  
  It seems you have a wrongly configured opcode cache runnning about which
  you're not aware of.
  
  --
  Regards,
  Nilesh Govindarajan
  @nileshgr on twitter/identica
 basically using default configuration, have not changed anything except the
 path for extensions in php.ini.
 and there is nothing installed/configured to cache anything.

Since restarting Apache does not help, the problem is obviously outside the web 
server. There are two possibilities I can think of...

* Browser caching

* Proxy caching

See if clearing your browser cache helps. If not then you probably have a proxy 
between you and the server that's caching the content.

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/


-- 
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] caching problem

2011-06-28 Thread admin
Faith,

I actually did read from the beginning of the message.

That does not make sense.
PHP files are cached intentionally, the system does not Cache PHP on its own.
Sounds to me like you have an issue re-declaring an object or calling the right 
script/path/class/method something.


I have never heard of PHP being cached unless it was intentionally cached it. 
Thank god for security reason!
HTML output?? Sure all the time helps the browser load the content faster.

I have a real issue with who ever told you that PHP is being cached, because if 
that was the case there is SERIOUS security hole in your PHP.
I am doubting that.

I have cached PHP, it can be done. 

Are you using APC(Alternative PHP Cache)???

I would not suggest it with complex scripting using classes and methods they 
are the whole reason NOT to cache.


That’s just my opinion.

Richard L. Buskirk

-Original Message-
From: Stuart Dallas [mailto:stu...@3ft9.com] 
Sent: Tuesday, June 28, 2011 9:18 AM
To: Fatih P.
Cc: PHP General
Subject: Re: [PHP] caching problem

On Tue, Jun 28, 2011 at 1:51 PM, Fatih P. fatihpirist...@gmail.com wrote:



 On Tue, Jun 28, 2011 at 1:52 PM, Stuart Dallas stu...@3ft9.com wrote:

 On Tuesday, 28 June 2011 at 06:57, Fatih P. wrote:
  On Tue, Jun 28, 2011 at 7:40 AM, Nilesh Govindarajan
  cont...@nileshgr.com (mailto:cont...@nileshgr.com)wrote:
 
   On 06/28/2011 10:56 AM, Fatih P. wrote:
Hi guys,
   
the code files are being cached. and modifications in methods are
 skipped
and not executed. is there any parameter that i can pass it from ini
   file?
this has been so annoying for me. restarting apache, windows, etc
 does
   not
even help. im running apache 2.2.19, php ts 5.3.6 on windows 2003 r2
any ideas how to avoid this situation? thanks
   
Fatih
  
   It seems you have a wrongly configured opcode cache runnning about
 which
   you're not aware of.
  
   --
   Regards,
   Nilesh Govindarajan
   @nileshgr on twitter/identica
  basically using default configuration, have not changed anything except
 the
  path for extensions in php.ini.
  and there is nothing installed/configured to cache anything.

 Since restarting Apache does not help, the problem is obviously outside
 the web server. There are two possibilities I can think of...

 * Browser caching

 * Proxy caching

 See if clearing your browser cache helps. If not then you probably have a
 proxy between you and the server that's caching the content.

 -Stuart

 --
 Stuart Dallas
 3ft9 Ltd
 http://3ft9.com/


 This is not proxy or browser caching. browser does not receive php code. it
 gets output of php code.


Well thanks, cos I only started doing this whole webby programmy developy
technobabble thing yesterday and I'm still learning the basics!*

How do you know that modifications in methods are skipped and not
executed? By looking at the output shown in your browser? The output that
could be cached by proxies and/or your browser?

Or are you running them on the command line, in which case some sort of
opcode cache is probably the culprit, or you're not running the code you
think you are.

-Stuart

*sarcasm!

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/


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



RE: [PHP] caching problem

2011-06-28 Thread admin
Fatih,
I am sorry spell check auto corrected your name, I was not changing 
your name on purpose.
It was not my intension to piss you off. 

I understand your frustration, trust me. 
I am running 5.3.6 on Windows Server 2008 R2 IIS, I am running massive class 
based methods in my own framework.
I am trying to help you narrow down the issue. I never blame PHP first because 
in my trouble shooting steps, I never get to PHP before I find the issue.

Segmentation Faults: that prevent the php script from completing locking up 
resources and causing a nightmare chain of events. It dumps the process at the 
fail point can look like it is a PHP thing but it is not. This can explain 
sometimes it works and sometimes it does not.

This can be caused by a host of reasons:
Buffer Overflow,
Attempting to access memory the program does not own. (This also points to 
Storage Violations)
Using uninitialized pointers,
Dereferencing Null pointers

Again suggestions please do not take offense.


Richard L. Buskirk


-Original Message-
From: Fatih P. [mailto:fatihpirist...@gmail.com] 
Sent: Tuesday, June 28, 2011 12:13 PM
To: Stuart Dallas
Cc: ad...@buskirkgraphics.com; PHP General
Subject: Re: [PHP] caching problem

On Tue, Jun 28, 2011 at 5:30 PM, Stuart Dallas stu...@3ft9.com wrote:

 On Tue, Jun 28, 2011 at 4:23 PM, Fatih P. fatihpirist...@gmail.comwrote:

 On Tue, Jun 28, 2011 at 5:12 PM, ad...@buskirkgraphics.com wrote:

  Faith,
 
  I actually did read from the beginning of the message.
 
  That does not make sense.
  PHP files are cached intentionally, the system does not Cache PHP on its
  own.
  Sounds to me like you have an issue re-declaring an object or calling
 the
  right script/path/class/method something.
 
 
  I have never heard of PHP being cached unless it was intentionally
 cached
  it. Thank god for security reason!
  HTML output?? Sure all the time helps the browser load the content
 faster.
 
  I have a real issue with who ever told you that PHP is being cached,
  because if that was the case there is SERIOUS security hole in your PHP.
  I am doubting that.
 
  I have cached PHP, it can be done.
 
  Are you using APC(Alternative PHP Cache)???
 
  I would not suggest it with complex scripting using classes and methods
  they are the whole reason NOT to cache.
 
 
  That’s just my opinion.
 
  Richard L. Buskirk
 
 
 Well, seems you didn't read it carefully even to write my name correctly.
 if
 this is an issue with PHP then it is an
 issue with PHP. AsI said I am using pre-compiled binaries with default
 settings. also mentioned no caching is
 enabled to cache anything.  And NO i am not using APC either or something
 else!!!



 Fatih, please explain what you mean by the code files are being cached.
 and modifications in methods are skipped
 and not executed. How are you getting the modified files onto the server,
 and how are you running the scripts? Are you working directly on the server,
 or are you uploading the files to the server via FTP, SCP or some other
 mechanism?

 -Stuart

 --
 Stuart Dallas
 3ft9 Ltd
 http://3ft9.com/


OK, this is a development machine, everything is running on it. nothing is
being uploaded  through ftp, scp or something else.
all kind of content caching is disabled.

and what I mean by the code files are being cached is: after the
modifications, i do get the result which was produced before modification.
which shows
that the file is not being interpreted by php. how i get to this point that
I see errors after restarting the machine which were not there during coding
or when
i dump an object it doesn't show up anything other than previous content.

to recover this situation,  either I have to restart httpd which sometimes
does work or when it gets more problematic,
i have to crush httpd / php on start. and only having this problem on
windows machines.

sounds funny to most of you but it is happening


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



[PHP] Upgrade or Die?

2011-06-24 Thread admin
In shifting gears to a faster pace of development and release, Mozilla has
opted to abandon security support for Firefox 4 immediately upon the release
of version 5, which came out this week. 

This could be a risky move, since many users neglect to update their
browsers immediately for various reasons, despite the pop-up reminders
Firefox periodically displays.

I will never understand this mindset.

 

Full story : http://www.technewsworld.com/edpick/72739.html

 

 

 

Richard L. Buskirk

 



RE: [PHP] Upgrade or Die?

2011-06-24 Thread admin
The message for Netscape was very clear, the development community refused to 
write for it they had started a precedence that could not be forgotten.
I say communities will not forget this act and remove the browser from their 
systems rather than be forced into an update for security reasons.

Honestly, rarely do any of my customers use FF, and their reasons are justified 
in their mind, so I do not argue the point.

This is another reason for security personnel, to credit their policies in 
denying FF on their network the same as they did with Netscape.


   

Richard L. Buskirk
Senior Software Engineer/Systems Administrator

You can’t grow your business with systems that are on life support...

-Original Message-
From: Richard Quadling [mailto:rquadl...@gmail.com] 
Sent: Friday, June 24, 2011 5:38 PM
To: a...@ashleysheridan.co.uk
Cc: Andy McKenzie; php-general@lists.php.net
Subject: Re: [PHP] Upgrade or Die?

On 24 June 2011 19:39, Ashley Sheridan a...@ashleysheridan.co.uk wrote:
 On Fri, 2011-06-24 at 13:38 -0400, Andy McKenzie wrote:

 On Fri, Jun 24, 2011 at 1:30 PM,  ja...@nixsecurity.org wrote:
  Chrome. Enough said. Now, if we can only convince the rest of the world ...
 

 Ugh.  I can't stand Chrome.  Of course, I gave up on Firefox years ago
 and went back to Opera, so it doesn't bother me when Firefox does
 something weird like this...

 -Andy



 Meh, I'm still using 3.6 on my main computer and 3.5 on my laptop. Using
 Fx4 at work, and I have to say, I prefer 3.6. Fx4 is slower, prone to
 crashing and a bit of a memory hog. I really hope Mozilla doesn't go the
 way of Google and create loads of new versions dropping support for the
 older ones as it goes, even if the 'older' versions are barely that old
 at all.

That pattern of behaviour sounds exactly like Netscape all those years ago.



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

-- 
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] Call to undefined function

2011-06-23 Thread admin
I am running a scheduled task for the first time since switching from linux
to Windows IIS 

I am getting an error when the task runs.

Fatal error: Call to undefined function mysql_connect()

 

I ran php.exe -m to see that the MySQL Module is loaded.

I have no issues unless I am running a php file in the Scheduled task.

 

Any help would be appreciated

 

 

 

Richard L. Buskirk



RE: [PHP] Call to undefined function

2011-06-23 Thread admin
Okay,
I am just start apologizing for my own ignorance.
In the task scheduler I told the php.exe to use a older configuration file.
TOTALLY my fault, seems PHP.ini file I used for the web was not the one I
pointed the task manager at.

Resolved and I will crawl back under my rock and read more about the proper
Arguments for task manager next time before I post.

Thanks Shiplu, and Negin for all your help.

Richard L. Buskirk


-Original Message-
From: Shiplu Mokaddim [mailto:muquad...@gmail.com] 
Sent: Thursday, June 23, 2011 9:42 PM
To: ad...@buskirkgraphics.com
Cc: php-general@lists.php.net
Subject: Re: [PHP] Call to undefined function



Sent from a handheld device

On 24-Jun-2011, at 5:53 AM, ad...@buskirkgraphics.com wrote:

 I am running a scheduled task for the first time since switching from
linux
 to Windows IIS 
 
 I am getting an error when the task runs.
 
 Fatal error: Call to undefined function mysql_connect()
 
 
 I ran php.exe -m to see that the MySQL Module is loaded.
 
 I have no issues unless I am running a php file in the Scheduled task.
 
 
 
 Any help would be appreciated
 

Richard,
Create a sample scheduled task with a sample.php file. In that file call
phpinfo() and save that content. After finishing the task find the
configuration file (php.ini) location in your saved content. Just make sure
mysql is  activated there.
Good luck
 
 
 
 
 Richard L. Buskirk
 


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



RE: [PHP] 【N級、 S級、AAA級 財布、バッグ!】【ブランド館】

2011-06-20 Thread admin
I see that it is actually from rjck...@gmail.com
I am not bilingual in Japanese but this is what I can make out it is an
Advertisement.


(A/the N class, S class, AAA class purse, bag!  ) (A/the brand mansion)
Japanese highest level copy brand 激 cheap market ☆*.
http://www.special-price.biz/ ☆*.
Main operation merchandise: a/the bag, purse, wrist watch, belt, writer!

A foreign country brand-name goods safe shopping bag and purse etc. be a/the
good buy!
(New work arrival) ● ● ● (an ultra popular pawnshop)   Most new work
Vitton purse new article, new material arrival
① ★ GUCCI in 2011 new work bag voluminous arrival ultra popular ★
② ★ LOUIS VUITTON in 2011 new work bag voluminous arrival ultra popular ★
3 ★ Louis 2011 Vuitton new large fiscal the Dutch! !  !
(News) ★ ROLEX-ロレックス N class highest grade clock voluminous arrival
ultra popular ★

Manager: 'a brand 激 cheap market' Tsuchida Kenichi
I request it very much.
Friend who deals, for long sincere reception (^o^)
≡ ≡ ≡ ≡ ≡ ≡ ≡ ≡ ≡ ≡ ≡ ≡ ≡   The carriage free   ≡ ≡ ≡ ≡ ≡
≡ ≡ ≡ ≡ ≡ ≡ ≡ ≡ ≡ ≡ ≡







Richard L. Buskirk

-Original Message-
From: Sharl.Jimh.Tsin [mailto:amoiz.sh...@gmail.com]
Sent: Monday, June 20, 2011 11:28 PM
To: php-general@lists.php.net
Subject: Re: [PHP] 【N級、 S級、AAA級 財布、バッグ!】【ブランド館】

・EURー葦・ぢ年06月21日 11:21, ◆送料無料◆ブランド激安市場 wrote:
 【N級、 S級、AAA級 財布、バッグ!】【ブランド館】

 日本最大級コピーブランド激安市場 ☆*.http://www.special-price.biz/  ☆*.
 ■主要取扱商品: バッグ、財布、腕時計、ベルト、ライタ!
 ≡≡≡
 海外ブランド品安心ショッピング バッグや財布等がお買得!

 【新作入荷】●●●【超人気質屋】◆最新作 ヴィトン 財布新品、新素材入荷

 ① ★GUCCI 2011年新作バッグ大量入荷超人気 ★
 http://www.special-price.biz/


 ② ★LOUIS VUITTON 2011年新作バッグ大量入荷超人気 ★
 http://www.special-price.biz/


 ③ ★LOUIS VUITTON 2011年新作財布大量入荷 !!!
 http://www.special-price.biz/


 【News】★ROLEX -ロレックスN級最高等級時計大量入荷超人気 ★
 http://www.special-price.biz/


 ■宜しくお願い申し上げます。
 ≡≡≡
 ◆誠実な接待、長い間取引する友達(^o^)

 ■URL:http://www.special-price.biz/
 ■店長:『ブランド激安市場』 土田健一

 ≡◆送料無料◆
Advertisement?!

--
Best regards,
Sharl.Jimh.Tsin (From China *Obviously Taiwan INCLUDED*)

Using Gmail? Please read this important notice:
http://www.fsf.org/campaigns/jstrap/gmail?10073.



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



RE: [PHP] Parent Limits?

2011-06-20 Thread admin
Why not set a constants for a base path and then you do not have to do that?

define('BASE_PATH','C:\\inetpub\\vhosts\\yourwebsite.com\\httpdocs\\');
--windows format for path
define('DIR_INCLUDES', './includes');

require_once(BASE_PATH.DIR_INCLUDES.'ini.inc.php');



Richard L. Buskirk


-Original Message-
From: Brian Smither [mailto:bhsmit...@gmail.com] 
Sent: Tuesday, June 21, 2011 12:35 AM
To: php-general@lists.php.net
Subject: [PHP] Parent Limits?


The following works (three parents):
include(../../../includes/ini.inc.php);
require_once(../../../includes/ini.inc.php);

The following works (four parents):
include(../../../../includes/ini.inc.php);

The following does not work (four parents):
require_once(../../../../includes/ini.inc.php);

That is, require_once() with four parents has been reported to have been
disabled for security purposes. But apparently, not disabled is include()
with four parents.

The device or setting which is causing the problem is not known to me. It
may be just the four parents (and include() is getting the data from this
file elsewhere) or it may be the combination.

It has been reported this is not a limit within open_basedir. So, what is
it? What module or php.ini setting would have this effect?

Thank you.






-- 
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] Doctrine madness!

2011-06-17 Thread admin
While I do agree with your discloser of the bloat for all off the shelf
frameworks. 

I created my own framework and my development time drop drastically and not
by a few hours, in some cases days.

The complaint of time is always an issue, if you do not scope out a project
properly.
Timelines and IPR's (In Process Reviews) will keep the developers sane, and
the customer happy.

It tells the customer: I have given you expectation timelines on how long it
will take me to get to each point in development.
It also gives you an opportunity to find obstacles in development that can
be discussed or redirected with another option before the project begins.
Any added edge on the timelines, allows for extra creativity and pit falls.

The worst thing you can do?  Not take time to understand your development
process and coding practices.

To use someone else's framework is asking for trouble. 
Like most who download a framework, install it. They just setup the config
and start programming.

Bad, Bad, BAD 
If you took the time to flow through the framework, you might understand all
the things you never want to happen that can cause serious latency issues.
Then soon learn, you are better off just writing your own or developing a
coding practice that keeps your timelines consistent.

If you are using a database, PLEASE learn what is called Relational
modeling.
The fastest server in the world will not help a poorly designed database,
causing 78% of all latency in projects that are DB driven.


I never claimed to be the expert here, I just know what has made me very
successful.

Richard L. Buskirk

-Original Message-
From: Paul M Foster [mailto:pa...@quillandmouse.com] 
Sent: Friday, June 17, 2011 1:46 AM
To: php-general@lists.php.net
Subject: Re: [PHP] Doctrine madness!

On Thu, Jun 16, 2011 at 08:53:18PM -0400, Eric Butera wrote:

 On Thu, Jun 16, 2011 at 7:32 PM, Daevid Vincent dae...@daevid.com wrote:
 

[snip]

 
 I'm sorry but this is absolute rubbish.  I used to write my queries by
 hand, but over time you start to realize that perhaps, maybe writing
 out thousands of identical lines of code over hundreds of projects
 might not be an efficient usage of time.  If you have performant
 requirements, that is one thing and can easily be overcome with slight
 deviations on a case by case basis.  Most of the time, contrary to
 your position, things just need to work and be completed quickly.
 What is the more common question from clients: why is this so slow,
 or, client asks why is this not finished yet?

I generally side with Daevid on this, though my position isn't as
extreme. However, I have to take exception to the either/or question
from clients. As far as I'm concerned, clients need to learn that coding
takes as long as it takes. I'd much rather spend the extra time and
never have the customer ask why the code is so slow. The theoretical
alternative, having the customer satisfied with the delivery time, but
complain about latency, isn't what I'd consider acceptable.

Looking at some of the code that comprises most ORM and other frameworks
(but particularly ORM frameworks) the bloat is amazing.

Paul

-- 
Paul M. Foster
http://noferblatz.com
http://quillandmouse.com

-- 
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] Ftp upload

2011-06-14 Thread admin
Andre, I have checked the $_POST, and THE $_FILES.
I am pretty sure the actual path is not passed. Now you can find the path on 
the server in the tmp_name of the $_FILES array.

I have read a few DOM related issue concerning the PATH of the file uploaded in 
mulitpart/form-data.


Microsoft: Internet Explorer 7 and later. By default, Internet Explorer does 
not include folder or directory path information when uploading files to sites.

So this means the Clients Browser is passing the file name NOT the path.

I am sure if you dig around in JavaScript you may find a way to see the value 
of that attribute on submit or click.
I have never wanted to know the actual file path from the end user, nor has it 
ever been a request for me to do so.


You can however change the ini for upload_max_filesize and post_max_size inside 
of your php script at the top.

html
head
titleA file upload script/title
/head
?php
ini_set('upload_max_filesize', 800);
ini_set(post_max_size, 30M);

$file_dir = .;
$file_url = .;
if ( isset( $fupload ) ){
   print path: $fuploadbr\n;
   print name: $fupload_namebr\n;
   print size: $fupload_size bytesbr\n;
print type: $fupload_typep\n\n;
   if ( $fupload_type == image/gif ){
 copy ( $fupload, $file_dir/$fupload_name) or die (Couldn't copy);
 print img src=\$file_url/$fupload_name\p\n\n;
   }
}
?
body
form enctype=multipart/form-data action=?php print $PHP_SELF? 
method=POST
input type=hidden name=MAX_FILE_SIZE value=51200
input type=file name=fupload
input type=submit value=Send file!
/form
/body
/html



Richard L. Buskirk


-Original Message-
From: Andre Polykanine [mailto:an...@oire.org] 
Sent: Tuesday, June 14, 2011 7:38 AM
To: Php General
Subject: [PHP] Ftp upload

Hi everyone,
I would like to have a possibility to upload really large files to the
website.
As we all know, the post_max_size parameter is set to 8Mb by default.
However,  I  see  that  the  ftp_put() function has a local filepath
parameter.
And  the  question is: how can I retrieve the local filepath if a user
browses to the file from his/her PC?
Thanks!


  

-- 
With best regards from Ukraine,
Andre
Skype: Francophile
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion


-- 
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] Ftp upload

2011-06-14 Thread admin
Andre,
Anything over 7 MB to me should be done with FTP. 
You have a lot of issues with file corruption, length of upload, and bandwidth 
on each end.

But you have to remember, I am crazy in the head. I think that customer 
satisfaction is key!!!

Richard L. Buskirk


-Original Message-
From: Andre Polykanine [mailto:an...@oire.org] 
Sent: Tuesday, June 14, 2011 10:02 AM
To: ad...@buskirkgraphics.com
Cc: 'Php General'
Subject: Re: [PHP] Ftp upload

Hi Richard,

Thanks a lot!
So  can  I  let  them  upload, say, a 700 Mb file via POST or should I
consider connecting to FTP?


-- 
With best regards from Ukraine,
Andre
Skype: Francophile
My blog: http://oire.org/menelion (mostly in Russian)
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

 Original message 
From: ad...@buskirkgraphics.com ad...@buskirkgraphics.com
To: 'Andre Polykanine'
Date created: , 3:41:59 PM
Subject: [PHP] Ftp upload


  Andre, I have checked the $_POST, and THE $_FILES.
I am pretty sure the actual path is not passed. Now you can find the path on 
the server in the tmp_name of the $_FILES array.

I have read a few DOM related issue concerning the PATH of the file uploaded in 
mulitpart/form-data.


Microsoft: Internet Explorer 7 and later. By default, Internet Explorer does 
not include folder or directory path information when uploading files to sites.

So this means the Clients Browser is passing the file name NOT the path.

I am sure if you dig around in JavaScript you may find a way to see the value 
of that attribute on submit or click.
I have never wanted to know the actual file path from the end user, nor has it 
ever been a request for me to do so.


You can however change the ini for upload_max_filesize and post_max_size inside 
of your php script at the top.

html
head
titleA file upload script/title
/head
?php
ini_set('upload_max_filesize', 800);
ini_set(post_max_size, 30M);

$file_dir = .;
$file_url = .;
if ( isset( $fupload ) ){
   print path: $fuploadbr\n;
   print name: $fupload_namebr\n;
   print size: $fupload_size bytesbr\n;
print type: $fupload_typep\n\n;
   if ( $fupload_type == image/gif ){
 copy ( $fupload, $file_dir/$fupload_name) or die (Couldn't copy);
 print img src=\$file_url/$fupload_name\p\n\n;
   }
}
?
body
form enctype=multipart/form-data action=?php print $PHP_SELF? 
method=POST
input type=hidden name=MAX_FILE_SIZE value=51200
input type=file name=fupload
input type=submit value=Send file!
/form
/body
/html



Richard L. Buskirk


-Original Message-
From: Andre Polykanine [mailto:an...@oire.org] 
Sent: Tuesday, June 14, 2011 7:38 AM
To: Php General
Subject: [PHP] Ftp upload

Hi everyone,
I would like to have a possibility to upload really large files to the
website.
As we all know, the post_max_size parameter is set to 8Mb by default.
However,  I  see  that  the  ftp_put() function has a local filepath
parameter.
And  the  question is: how can I retrieve the local filepath if a user
browses to the file from his/her PC?
Thanks!


  

-- 
With best regards from Ukraine,
Andre
Skype: Francophile
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion


-- 
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] Convert a PDF to a PNG?

2011-06-14 Thread admin
Will they allow you to recompile PHP
http://www.php.net/manual/en/imagick.installation.php


Richard L. Buskirk


-Original Message-
From: Tamara Temple [mailto:tamouse.li...@gmail.com] 
Sent: Tuesday, June 14, 2011 6:18 PM
To: PHP-General List
Subject: Re: [PHP] Convert a PDF to a PNG?


On Jun 14, 2011, at 3:37 PM, Brian Dunning wrote:

 My server has GD but NOT ImageMagick. Can I convert a PDF doc to a  
 PNG? I have the PDFs stored as a files and I need to save an  
 identical PNG alongside each.

Could you install a copy of ImageMagick in a user/hosted directory?



-- 
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] Ftp upload

2011-06-14 Thread admin
LOL yeah.
Since I can buy a 2 terabyte external hard drive and caddy for less than
$300. At Best Buy.

Richard L. Buskirk...


-Original Message-
From: Marc Guay [mailto:marc.g...@gmail.com] 
Sent: Tuesday, June 14, 2011 8:25 PM
To: PHP General
Subject: Re: [PHP] Ftp upload

I bought a 1GB external hard drive for $1000.  Did I just choke on my lunch?

-- 
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] Can't use class 'DOMDocument

2011-06-09 Thread admin
http://www.php.net/manual/en/dom.requirements.php

They usually post the requirements or dependencies if there are any. 


Richard L. Buskirk


-Original Message-
From: Adam Tong [mailto:adam.to...@gmail.com] 
Sent: Wednesday, June 08, 2011 10:30 PM
To: ad...@buskirkgraphics.com
Cc: php-general@lists.php.net
Subject: Re: [PHP] Can't use class 'DOMDocument

Hi,

You're right. I just installed the package php-xml, and everything is
working properly now.

Is there anyway to know for each class or function which is the package
needed?

thank you

On Tue, Jun 7, 2011 at 3:48 AM,  ad...@buskirkgraphics.com wrote:
 Did you install the php-xml ?

 Richard L. Buskirk

 -Original Message-
 From: Adam Tong [mailto:adam.to...@gmail.com]
 Sent: Monday, June 06, 2011 9:49 PM
 To: php-general@lists.php.net
 Subject: [PHP] Can't use class 'DOMDocument

 Hi,

 When I try using DOMDocument I get the following error:
 Fatal error: Class 'DOMDocument' not found in ...

 I guess something has to be fixed in my php.ini?

 Here is my php version:
 # php -version
 PHP 5.3.6 (cli) (built: Mar 17 2011 20:58:15)
 Copyright (c) 1997-2011 The PHP Group
 Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies

 I also noticed when I click reply in gmail it does not reply to the
 list. Sorry for that inconvenience for poeple who tried to help me
 while the previous issue was already resolved.

 Thank you

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

2011-06-07 Thread admin
Dynamically changing displays can be done with JavaScript.

First thing I want you to think of is whether or not your 2nd and 3rd menus
require information from the first menu to display or sort.
According to what I see they do not.

If they do not :

We start off wrapping each of the second and 3rd menus in a DIV element and
turning them off to display. I am using 2 options pick which one is best for
you.
We can display them individually by ID or by the group of class. Now we
give an ID attribute to the first menu.

echo select ID='market' name='term'option value=''Choose
Market/option\n;

DIV ID=Menu2 class=other_menus style=display: none;  Put your 2nd menu
in here  /DIV
DIV ID=Menu3 class=other_menus style=display: none;  Put your 3nd menu
in here  /DIV

In this example I will utilize JQuery.js   IF you do not have it you can
download it from www.jquery.com .

Please do not use both function if you use a class use the class if you use
and ID base use the ID

script type=text/javascript src=jquery.js/script
script
$(document).ready(function(){

// this will display them by ID
$('#market').change(
Function() {
Val marketvalue = $(This).val();  // I am doing this because
what if they change the menu back to the default value of ''
If(marketvalue = 1)
{
$('#Menu2').show();
$('#Menu3').show();
}else{
$('#Menu2').hide();
$('#Menu3').hide();
}
}
);

// this will display them by the class
$('#market').change(
Function() {
Val marketvalue = $(This).val();  // I am doing this because
what if they change the menu back to the default value of ''
If(marketvalue = 1)
{
$('.other_menus').show();
}else{
$('.other_menus').hide();
}
}
);  
});
/script

This will display the menu items as soon as they pick from the first menu
NOT requiring a submit.
If you do require the value from the first menu to be passed to the select
statements for the other menus let me know I will explain how that is done,
it is a little more complex.


Richard L. Buskirk


-Original Message-
From: Chris Stinemetz [mailto:chrisstinem...@gmail.com] 
Sent: Tuesday, June 07, 2011 12:41 AM
To: php-general@lists.php.net
Subject: [PHP] php hide menu

I have three drop down menus in my form. How do I make it so the
second and third menus are only visible once the prior menu was
selected?

Below is the first two drop down menus.

Thanks in advance.

// Generating first menu using array.
$markets = array('MCI' = 'Kansas City',
  'STL' = 'ST. Louis',
  'ICT' = 'Wichita',
  'OMA' = 'Omaha',
  'LIN' = 'Lincoln');
echo select name='term'option value=''Choose Market/option\n;
foreach ($markets as $key = $market) {
echo option value='$key'$market/option\n;
}
echo /select;

// This will evaluate to TRUE so the text will be printed.
if (isset($markets)) {
echo This var is set so I will print.;
}



// Then, later, validating the menu
if (! array_key_exists($_POST['Market'], $choices)) {
echo You must select a market.;
}

$query=SELECT cell_sect FROM sector_list order by cell_sect;

$result = mysql_query ($query);
echo select name='cat'option value=''Choose Cell Sector/option;
// printing the list box select command

while($cellSect=mysql_fetch_array($result)){//Array or records stored
in $cellSect
echo option value=$cellSect[cell_sect]$cellSect[cell_sect]/option;
/* Option values are added by looping through the array */
}
echo /select;// Closing of list box

// This will evaluate to TRUE so the text will be printed.
if (isset($cellSect)) {
echo This var is set so I will print.;
}

-- 
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] Can't use class 'DOMDocument

2011-06-07 Thread admin
Did you install the php-xml ?

Richard L. Buskirk

-Original Message-
From: Adam Tong [mailto:adam.to...@gmail.com] 
Sent: Monday, June 06, 2011 9:49 PM
To: php-general@lists.php.net
Subject: [PHP] Can't use class 'DOMDocument

Hi,

When I try using DOMDocument I get the following error:
Fatal error: Class 'DOMDocument' not found in ...

I guess something has to be fixed in my php.ini?

Here is my php version:
# php -version
PHP 5.3.6 (cli) (built: Mar 17 2011 20:58:15)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies

I also noticed when I click reply in gmail it does not reply to the
list. Sorry for that inconvenience for poeple who tried to help me
while the previous issue was already resolved.

Thank you

-- 
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] What do you get for ...

2011-06-07 Thread admin
Microsoft Windows Version 5.1.2600

E:\php -r var_dump(realpath(null));
string(41) E:\

E:\

Richard L. Buskirk


-Original Message-
From: Richard Quadling [mailto:rquadl...@gmail.com] 
Sent: Tuesday, June 07, 2011 6:35 AM
To: PHP General list
Subject: [PHP] What do you get for ...

Hi.

What do you get for ...

php -r var_dump(realpath(null));

I'm wondering if the result should be a boolean false.

But I'm getting very different results for different versions of PHP
for Windows.

For PHP5+ (upto lastest 5.3.7-dev), the output is always the same as getcwd()

For PHP4, some very interesting differences ...

V4.0.0 : string(5) Z:\\/
V4.0.1 : string(5) z:\\/
V4.0.1pl1 : string(5) z:\\/
V4.0.2 : bool(false)
V4.0.3 : bool(false)
V4.0.4 : string(3) z:\
V4.0.4pl1 : string(3) z:\
V4.0.5 : string(3) z:\
V4.0.6 : string(3) z:\
V4.1.0 : string(3) z:\
V4.1.1 : string(3) z:\
V4.1.2 : string(3) z:\
V4.2.0 : string(98) D:\Personal
Files\Downloads\Software\Programming\PHP\Official
Releases\PHP4.x.x\PHP4.2.x\php-4.2.0
V4.2.1 : string(3) z:\
V4.2.2 : string(3) z:\
V4.2.3 : string(3) z:\
V4.2.3RC1 : string(3) z:\
V4.2.3RC2 : string(3) z:\
V4.3.0 : string(3) z:\
V4.3.0pre2 : string(102) D:\Personal
Files\Downloads\Software\Programming\PHP\Official
Releases\PHP4.x.x\PHP4.3.x\php-4.3.0pre2
V4.3.0RC1 : string(101) D:\Personal
Files\Downloads\Software\Programming\PHP\Official
Releases\PHP4.x.x\PHP4.3.x\php-4.3.0RC1
V4.3.0RC2 : string(101) D:\Personal
Files\Downloads\Software\Programming\PHP\Official
Releases\PHP4.x.x\PHP4.3.x\php-4.3.0RC2
V4.3.0RC3 : string(101) D:\Personal
Files\Downloads\Software\Programming\PHP\Official
Releases\PHP4.x.x\PHP4.3.x\php-4.3.0RC3
V4.3.0RC4 : string(3) z:\
V4.3.1 : string(3) z:\
V4.3.10 : string(3) z:\
V4.3.11 : string(3) z:\
V4.3.2 : string(3) z:\
V4.3.2RC1 : string(3) z:\
V4.3.2RC2 : string(3) z:\
V4.3.2RC3 : string(3) z:\
V4.3.3 : string(3) z:\
V4.3.3RC1 : string(3) z:\
V4.3.3RC2 : string(3) z:\
V4.3.3RC3 : string(3) z:\
V4.3.3RC4 : string(3) z:\
V4.3.4 : string(3) z:\
V4.3.4RC1 : string(3) z:\
V4.3.4RC2 : string(3) z:\
V4.3.4RC3 : string(3) z:\
V4.3.5 : string(3) z:\
V4.3.5RC1 : string(3) z:\
V4.3.5RC2 : string(3) z:\
V4.3.5RC3 : string(3) z:\
V4.3.5RC4 : string(3) z:\
V4.3.6 : string(3) z:\
V4.3.6RC1 : string(3) z:\
V4.3.6RC2 : string(3) z:\
V4.3.6RC3 : string(3) z:\
V4.3.7 : string(3) z:\
V4.3.7RC1 : string(3) z:\
V4.3.8 : string(3) z:\
V4.3.9 : string(3) z:\
V4.3.9RC1 : string(3) z:\
V4.4.0 : string(3) z:\
V4.4.1 : string(3) z:\
V4.4.2 : string(3) z:\
V4.4.3 : string(3) z:\
V4.4.4 : string(3) z:\
V4.4.5 : string(3) z:\
V4.4.6 : string(3) z:\
V4.4.7 : string(3) z:\
V4.4.8 : string(3) z:\
V4.4.9 : string(3) z:\

Z:\ is essentially the equivalent of __DIR__ in this example.

What output do you get on non Windows setups?

php -r var_dump(realpath(null));

If the current releases on other OS's all have output equivalent to
getcwd(), then I'll change the documentation to at least mention that
a null or empty path equates to the current working directory for V5+.

Richard.

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

-- 
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] Announcing New PHP Extension: System Detonation Library (was: phpsadness)

2011-06-04 Thread admin
LOL,
That is too funny. I took the wording System Detonation literally.
Did it take your server offline or did it just say that in CLI.



Richard L. Buskirk


-Original Message-
From: xucheng [mailto:helloworldje...@gmail.com] 
Sent: Saturday, June 04, 2011 2:55 AM
To: Daniel Brown
Cc: PHP General
Subject: Re: [PHP] Announcing New PHP Extension: System Detonation Library 
(was: phpsadness)

I create a script with : php -r ' detonate();' via the CLI ,
and get this :

PHP Fatal error:  This system will self-destruct in five four
three two one [CONNECTION TO HOST INTERRUPTED] in Command
line code on line 1

is this an expected result ?

2011/6/3 Daniel Brown danbr...@php.net:
First of all, a happy Friday to all here.  Hopefully some of you
 will be able to pass this on to your boss and get sent home early.

Second, as dreamed up in the previous thread, I've decided to take
 a few moments this morning to build and release a new PHP extension,
 which provides a single function: detonate().

Third, you can read about it and download it here:
 http://links.parasane.net/29nh

That's all, folks.

 --
 /Daniel P. Brown
 Network Infrastructure Manager
 http://www.php.net/

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





-- 
Just do it  follow your passion !

-- 
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] Found this and I thought of you.

2011-06-04 Thread admin
LOL, that’s awesome.
Cough.. Cake... cough can anyone guess the DB username LOL


Richard L. Buskirk

-Original Message-
From: Richard Quadling [mailto:rquadl...@gmail.com] 
Sent: Saturday, June 04, 2011 7:35 PM
To: PHP General list
Subject: [PHP] Found this and I thought of you.

http://www.exxcire.com/login.php

If nothing more than a good bad example.

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

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

2011-06-03 Thread admin
I am writing a filter as I reply, to delete any comments to this thread that
come to my mailbox
So I do not have to deal with manually deleting them as they come in.

Richard L. Buskirk


-Original Message-
From: Marc Guay [mailto:marc.g...@gmail.com] 
Sent: Friday, June 03, 2011 10:58 AM
To: php-general@lists.php.net
Subject: Re: [PHP] phpsadness

Unsubscribe! Unsubscribe! Unsubscribe!

Can I detonate() the future of this thread before it goes where it's
about to go?

-- 
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] https help

2011-05-30 Thread admin
Negin,
That is pretty vague. 
More details please




Richard L. Buskirk
Senior Software Engineer/Systems Administrator

You can't grow your business with systems that are on life support...


-Original Message-
From: Negin Nickparsa [mailto:nickpa...@gmail.com] 
Sent: Monday, May 30, 2011 4:04 PM
To: php-general@lists.php.net
Subject: [PHP] https help

hi all,
I want to write an application that can be logged to yahoo.com using https
protocol
Would  you please put me some suggestions and advices?

if ($_SERVER['SERVER_PORT'] != 443) {
header(Location: https://.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
}


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



[PHP] Unique multi dimensional arrays

2011-05-29 Thread admin
I have worked for some time on developing a method for this issue. The
problem has always been the flexibility of the method to work in any
situation.

I had initially thought this might be my solution.

Function multi_dim_unique($array='')

{

For ($a=0;$b=count($array);$a$b;$a++) {

For ($c=0,$d=count($array[$a]);$c$d;$c++) {

$tmp = $array[$a][$c];

   If (!isset
($record_array[$tmp])) {

$record_array[$tmp] = $c;

}

}

}

Foreach ($record_array as $key=$value) {

$array[$value][] = $key;

}

Return $array;

}

While this concept work perfect for multi dimensional arrays like.

$array = (0=array(0=12345,1=67890),1=array(0=12345,1=67890,2=1));

 

I find myself constantly needing to dig deeper and unique at other positions
of the array but still have the flexibility.

$array = array([0] =  array(['Company'] = array( [0] =  ABC,[1] =
CBS,[2] = NBC), [Owners] = array ( [0] = John,[1] = Mark,[2] = John));

 

In a desire to find the unique Owner names from the array above. The initial
method is not accommodating for this array and will return the entire array
as presented.

My new thoughts are to pass a parameter to the method for the position I
want unique.

 

$position = 'Owners';

multi_dim_unique($array,$postion);

 

Here lies the problem finding the position match no matter how many
dimensions there are.

My question is has anyone tackled this issue and may have some suggestions
as to how I may reconstruct the method to be a bit more accommodating to
situations like this. 

 

 

 

Richard L. Buskirk

 



RE: [PHP] Detecting HTTPS connections under Apache

2011-05-26 Thread admin
The %{HTTPS} variable is not an Apache core variable. A more-portable
solution is to check %{SERVER_PORT} for port 80 or port 443 -- or for not
port 80 or not port 443. 

Also, you're requiring an *exact* match on not /user or not /admin,
meaning that directory and file paths below these directories will not be
matched -- They will always be redirected by the second rule. 

In addition, the URL-path in the Request_URI variable always starts with a
slash, and a RewriteCond should not be used to test the URL-path unless the
RewriteRule cannot be used to do this. 

Finally, since the rules are already scoped to http and https by their
locations within the vHost containers, checking %{HTTPS} or %{SERVER_PORT}
is probably not even necessary. 

Most likely, correcting the second problem will fix your code, and the other
inefficiencies can be removed as well: 

VirtualHost *:80 
RewriteRule ^/((user|admin)(/.*)?)$ https://example.com/$1 [R=301,L]
/VirtualHost

VirtualHost _default_:443
RewriteCond $1 !^(user|admin)(/.*)?$
RewriteRule ^/(.*)$ http://example.com/$1 [R=301,L]
/VirtualHost

[added] Alternative format for second rule -- I'm not sure, but it might be
faster: 
VirtualHost _default_:443
RewriteRule !^/(user|admin)(/.*)?$ http://example.com%{REQUEST_URI}
[R=301,L]
/VirtualHost

Richard L. Buskirk

-Original Message-
From: Geoff Shang [mailto:ge...@quitelikely.com] 
Sent: Thursday, May 26, 2011 3:38 PM
To: php-general@lists.php.net
Subject: [PHP] Detecting HTTPS connections under Apache

Hi,

Apologies if this is covered somewhere but I've searched fairly 
extensively and not found anything.

I'm working on an application which has a function for redirecting to a 
given URL.  This is generally used for redirecting after a form has been 
submitted.

Right now it sends an HTTP URL in the redirection, which means it can't 
work under a secure connection.

I'd like to be able to use it over HTTPS but don't want to force people to 
do this.   So ideally I'd like to be able to detect the protocol in use 
and send the appropriate protocol in the Location header.

The problem is that, at least on the system I'm working on, I can't see 
any way of detecting the protocol.  _SERVER[SERVER_SIGNATURE] and 
_SERVER[SERVER_ADDR] both give the port as 80, even if I specify port 
443 in the URL.  I've seen references to _SERVER[HTTPS] or something 
similar but it's not in the output I get from either print_r ($_SERVER) 
or phpinfo ().

I'm running PHP Version 5.3.3-7+squeeze1 on Apache/2.2.16 (Debian).  The 
machine is an x86-64 VPS running Debian Squeeze.

I have full access to the VPS, so if something needs tweeking in Apache 
(or anything else) then I can do this.

Thanks in advance,
Geoff.


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



  1   2   3   >