[PHP] Re: How to download a multi-part file at the server side?

2013-11-02 Thread Ajay Garg
I just came across http://www.w3schools.com/php/php_file_upload.asp, and
tested it..
It works fine, when the file is uploaded via a form.


It does seem that the client-method might indeed play a role.
Here is my Java code for uploading the file ::


###
HttpClient httpclient = new DefaultHttpClient();

httpclient.getParams().setParameter(CoreProtocolPNames.PROTOCOL_VERSION,
HttpVersion.HTTP_1_1);

HttpPost httppost = new HttpPost(URL);
File file = new File(/path/to/png/file.png);

// Send the image-file data as a Multipart-data.
MultipartEntity mpEntity = new MultipartEntity();
ContentBody cbFile = new FileBody(file, image/png);
mpEntity.addPart(userfile, cbFile);

httppost.setEntity(mpEntity);

HttpResponse response = httpclient.execute(httppost);
###


Any ideas if making a change at the client (Java) OR/AND server (PHP) might
do the trick?


On Sat, Nov 2, 2013 at 6:06 PM, Ajay Garg ajaygargn...@gmail.com wrote:

 Hi all.

 I intend to implement a use-case, wherein the client uploads a file in
 multi-part format, and the server then stores the file in a mysql database
 (after downloading it at the server side).

 I have been unable to find any immediate answers through googling; I will
 be grateful if someone could start me in a direction to achieve the
 downloading at server via php requirement.

 (Don't think it should matter, but I use Java to upload a file in
 multi-part format).

 I will be grateful for some pointers.

 Thanks in advance


 Thanks and Regards,
 Ajay




-- 
Regards,
Ajay


Re: [PHP] Re: Sending PHP mail with Authentication

2013-09-29 Thread Paul M Foster
On Fri, Sep 27, 2013 at 12:06:30AM +0200, Maciek Sokolewicz wrote:

[snip]
 
 I'm sure I'm going to annoy people with this, but I would advise to
 never use PEAR. It's the biggest load of extremely badly coded PHP
 you'll ever find. Creating an SMTP client (with the purpose of just
 sending mail) is very easy to do yourself (and also a good challenge
 if you're not yet very skilled with PHP). Alternatively, you can
 indeed use a package such as PHPMailer; it's not perfect, and quite
 bloated for what you want probably, but it works rather well.
 

I have to agree on the code bloat. Unless your requirements are
extraordinary (which the OP's are), the native PHP mail() function is
generally quite adequate.

Never thought about creating a PHP email client. Interesting idea...

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] Re: Switch Statement

2013-09-28 Thread Jim Giner

On 9/28/2013 10:33 PM, Ethan Rosenberg wrote:

Dear List -

I have a working program.  I made one change in a switch statement, and
it does not work.  I'm probably missing something fundamental.

Here are some code SNIPPETS...  [please note that all my debug
statements are at the left margin]

Setup...

?php
 session_start();
 session_name(STORE);
 set_time_limit(2400);
 ini_set('display_errors', 'on');
 ini_set('display_startup_errors', 'on');
 error_reporting(-2);

 ini_set('error_reporting', 'E_ALL | E_STRICT');
 ini_set('html_errors', 'On');
 ini_set('log_errors', 'On');
 require '/home/ethan/P/wk.inc'; //password file
 $db = Store;
 $cxn =mysqli_connect($host,$user,$password,$db);
 if (!$cxn)
 {
 die('Connect Error (' . mysqli_connect_errno() . ') '
 . mysqli_connect_error());
 }// no error
 if($_REQUEST['welcome_already_seen']!= already_seen)
 show_welcome();

 //end setup
 function show_welcome() //this is the input screen
 {
 snip

 echo  input type='hidden' name='welcome_already_seen'
value='already_seen';
 echo  input type='hidden' name='next_step' value='step20' /;

 snip
 }


 //end input screen

 //Switch statement

echo 'before';
print_r($_POST); //post#1

 switch ( $_POST['next_step'] )
 {

 case 'step20':
 {
pint_r($_POST);//post#2
echo 'step20';
 if(!empty($_POST['Cust_Num']))
 good();
 if(empty($_POST['Cust_Num']))
 bad();
 break;
 } //end step20

 snip
 } //end switch



post#1

beforeArray
(
 [Cust_Num] = 123
 [Fname] =
 [Lname] =
 [Street] =
 [City] =
 [state] = NY
 [Zip] = 10952
 [PH1] =
 [PH2] =
 [PH3] =
 [Date] =
 [welcome_already_seen] = already_seen
 [next_step] = step20

)

Cust_Num state and Zip are as entered.

The switch statement is never entered, since post#2 is never displayed,
and neither good() or bad() functions are entered.


TIA

Ethan


Once again you are posting code that has no chance of running.  And 
since you are DISABLING error reporting with that -2 value you won't 
even know you have bad code.


Try again.  Post#2 will never display since you aren't printing it.

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



[PHP] Re: Switch Statement

2013-09-28 Thread Jim Giner

?php
 session_start();
 session_name(STORE);
 set_time_limit(2400);
 ini_set('display_errors', 'on');
 ini_set('display_startup_errors', 'on');
 error_reporting(-2);

 ini_set('error_reporting', 'E_ALL | E_STRICT');
 ini_set('html_errors', 'On');
 ini_set('log_errors', 'On');


Ethan,Ethan,Ethan - what is all this stuff you have at the top???  Do 
you know how any of this is supposed to be written?  You can not put 
Constants in quotes - they become just plain strings then, not Constants 
with the predefined values you (and the functions) are expecting.  For 
example, 'on' is NOT the same as the use of the word :  on.  And your 
error_reporting setting (which you are attempting to do TWICE) is 
actually causing your script to NOT show any errors, which is preventing 
you from seeing that your script dies at the misspelled print statement 
and never gets to the pair of if statements that should call your good 
and bad functions.


Hate to do this to you, but you've been attempting to pick up PHP for 
two years now almost and from this latest post you appear to not have 
learned anything.


And WHY would you EVER want to have a time limit of 2400 seconds???

And stop burying functions in the middle of your straight line code. 
It's ridiculous and makes reading your scripts a royal PIA.




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



Re: [PHP] Re: Switch Statement

2013-09-28 Thread Ethan Rosenberg

On 09/28/2013 11:59 PM, Jim Giner wrote:

?php
 session_start();
 session_name(STORE);
 set_time_limit(2400);
 ini_set('display_errors', 'on');
 ini_set('display_startup_errors', 'on');
 error_reporting(-2);

 ini_set('error_reporting', 'E_ALL | E_STRICT');
 ini_set('html_errors', 'On');
 ini_set('log_errors', 'On');


Ethan,Ethan,Ethan - what is all this stuff you have at the top???  Do
you know how any of this is supposed to be written?  You can not put
Constants in quotes - they become just plain strings then, not Constants
with the predefined values you (and the functions) are expecting.  For
example, 'on' is NOT the same as the use of the word :  on.  And your
error_reporting setting (which you are attempting to do TWICE) is
actually causing your script to NOT show any errors, which is preventing
you from seeing that your script dies at the misspelled print statement
and never gets to the pair of if statements that should call your good
and bad functions.

Hate to do this to you, but you've been attempting to pick up PHP for
two years now almost and from this latest post you appear to not have
learned anything.

And WHY would you EVER want to have a time limit of 2400 seconds???

And stop burying functions in the middle of your straight line code.
It's ridiculous and makes reading your scripts a royal PIA.


Jim -

Thanks.

Changed error_reporting to -1. No error messages. No change in output.

Ethan

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



Re: [PHP] Re: Switch Statement

2013-09-28 Thread Jim Giner

On 9/29/2013 1:29 AM, Ethan Rosenberg wrote:

On 09/28/2013 11:59 PM, Jim Giner wrote:

?php
 session_start();
 session_name(STORE);
 set_time_limit(2400);
 ini_set('display_errors', 'on');
 ini_set('display_startup_errors', 'on');
 error_reporting(-2);

 ini_set('error_reporting', 'E_ALL | E_STRICT');
 ini_set('html_errors', 'On');
 ini_set('log_errors', 'On');


Ethan,Ethan,Ethan - what is all this stuff you have at the top???  Do
you know how any of this is supposed to be written?  You can not put
Constants in quotes - they become just plain strings then, not Constants
with the predefined values you (and the functions) are expecting.  For
example, 'on' is NOT the same as the use of the word :  on.  And your
error_reporting setting (which you are attempting to do TWICE) is
actually causing your script to NOT show any errors, which is preventing
you from seeing that your script dies at the misspelled print statement
and never gets to the pair of if statements that should call your good
and bad functions.

Hate to do this to you, but you've been attempting to pick up PHP for
two years now almost and from this latest post you appear to not have
learned anything.

And WHY would you EVER want to have a time limit of 2400 seconds???

And stop burying functions in the middle of your straight line code.
It's ridiculous and makes reading your scripts a royal PIA.


Jim -

Thanks.

Changed error_reporting to -1. No error messages. No change in output.

Ethan

CORRECT ALL THE WRONG SHIT AND YOULL GET ERROR MESSAGES!!!

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



Re: [PHP] Re: Switch Statement

2013-09-28 Thread Jim Giner

On 9/29/2013 1:38 AM, Jim Giner wrote:

   session_start();
 session_name(STORE);
 set_time_limit(2400);
 ini_set('display_errors', 'on');
 ini_set('display_startup_errors', 'on');
 error_reporting(-2);

 ini_set('error_reporting', 'E_ALL | E_STRICT');
 ini_set('html_errors', 'On');
 ini_set('log_errors', 'On');

This is what you should have in place of all of the above:

session_start();
error_reporting(E_ALL | E_STRICT | E_NOTICE);	ini_set('display_errors', 
'1');

set_time_limit(2);// if you use more than 2 secs you have a problem




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



[PHP] Re: Sending PHP mail with Authentication

2013-09-26 Thread Maciek Sokolewicz

On 25-9-2013 22:11, dealTek wrote:

Hi All,

Semi newbie email question...

I have used the - mail() — Send mail php function to send email from a site.

now it seems the server is blocking this for safety because I should be using 
authentication

Q: mail() does not have authentication - correct?

Q: So I read from the link below that maybe I should use - PEAR Mail package 
 is this a good choice to send mail with authentication?

...any suggestions for basic sending email with authentication (setup info and 
links also) would be welcome


http://email.about.com/od/emailprogrammingtips/qt/PHP_Email_SMTP_Authentication.htm

--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-3]



I'm sure I'm going to annoy people with this, but I would advise to 
never use PEAR. It's the biggest load of extremely badly coded PHP 
you'll ever find. Creating an SMTP client (with the purpose of just 
sending mail) is very easy to do yourself (and also a good challenge if 
you're not yet very skilled with PHP). Alternatively, you can indeed use 
a package such as PHPMailer; it's not perfect, and quite bloated for 
what you want probably, but it works rather well.


- Tul

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



[PHP] Re: Apache

2013-09-23 Thread Tim Streater
On 23 Sep 2013 at 11:37, Domain nikha.org m...@nikha.org wrote: 

 The problem is the weak PHP upload mechanism! 

I'd have said the problem is weak metadata provision - overloading the filename 
for other purposes.

--
Cheers  --  Tim

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

[PHP] Re: Apache

2013-09-23 Thread Domain nikha . org
Tim Streater am Montag, 23. September 2013 - 12:56:
 On 23 Sep 2013 at 11:37, Domain nikha.org m...@nikha.org wrote: 
 
  The problem is the weak PHP upload mechanism! 
 
 I'd have said the problem is weak metadata provision - overloading the
filename for other purposes.
 
 --
 Cheers  --  Tim
 

You are right, but unfortunately filenames ARE metadata for Apache. 
Would be better, if they were not, and just identifiers...

Niklaus

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



[PHP] Re: Friday's Question

2013-09-22 Thread Jonesy
On Fri, 20 Sep 2013 12:51:49 -0400, Tedd Sperling wrote:

 Do you use a Mousepad?

Age: 70
Mousepad: No.  Been using trackballs since 1993...
(No room for a mousepad on _my_ desktop!)


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



[PHP] Re: php-general Digest 20 Sep 2013 17:33:26 -0000 Issue 8369

2013-09-20 Thread Bill Guion

On Sep 20, 2013, at 1:33 PM, php-general-digest-h...@lists.php.net wrote:

 Friday's Question
   322111 by: Tedd Sperling
 --
 
 From: Tedd Sperling t...@sperling.com
 Subject: Friday's Question
 Date: September 20, 2013 12:51:49 PM EDT
 To: php-general@lists.php.net
 
 
 Hi gang:
 
 Do you use a Mousepad?
 
 My reason for asking is that I've used a Mousepad ever since mice first came 
 out (back when they had one ball).
 
 Now that mice are optical (no balls), Mousepads are not really needed -- or 
 so I'll told by the college -- you see, they don't provide Mousepads for 
 their student's computers.
 
 As such, I wondered what's the percentage of programmers still using a 
 Mousepad?
 
 Secondly, are Mousepads used primarily by older programmers (like me) while 
 younger programmers don't use Mousepads, or what?
 
 So -- please respond with:
 
 Age: *
 Mousepad: Yes/No
 
 Thank you,
 
 tedd
 
 PS: * If you don't want to provide your actual age, then indicate your age by 
 stating young, middle-age, old-age, ancient, or whatever term 
 describes your age.
 
 Alternate -- I claim that you can tell a man's age by ten-times the number of 
 personal products he routinely uses, for example:
 
 Years Old - Personal Products
 10Toothpaste
 20Toothpaste, Deodorant
 30Toothpaste, Deodorant, Aftershave
 40Toothpaste, Deodorant, Aftershave, Minoxidil
 50Toothpaste, Deodorant, Aftershave, Minoxidil, Preparation-H
 60Toothpaste, Deodorant, Aftershave, Minoxidil, Preparation-H, Bag Bomb
 70Toothpaste, Deodorant, Aftershave, Minoxidil, Preparation-H, Bag Bomb, 
 Fixodent
 
 So, you could indicate age by stating Bag Bomb like me.
 
 ___
 tedd sperling
 t...@sperling.com


Age: 72 years, 7 days  toothpaste, deodorant, aftershave. Don't need the rest, 
yet.
Mousepad: Yes. I find it easier to clean the mousepad than to try to clean the 
keyboard tray/desktop/whatever.


 -= Bill =-
-- 

A day without sunshine is like a day in Seattle.



[PHP] Re: Friday's Question

2013-09-20 Thread Tim Streater
On 20 Sep 2013 at 17:51, Tedd Sperling t...@sperling.com wrote: 

 Age: Fast approaching doddering old fossil stage
 Mousepad: Yes. I use an Apple Mighty Mouse so that I can scroll my Excel 
 spreadsheet in two directions at once while moving the mouse pointer across 
 the screen. The optics works slightly better on the pad (covered in butterfly 
 pix) than it would on the pine desktop.


--
Cheers  --  Tim

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

[PHP] Re: Friday's Question

2013-09-20 Thread Tim Streater
On 20 Sep 2013 at 18:20, Jen Rasmussen j...@cetaceasound.com wrote: 

 -Original Message-
 From: Tedd Sperling [mailto:t...@sperling.com]

 70Toothpaste, Deodorant, Aftershave, Minoxidil, Preparation-H, Bag
 Bomb, Fixodent

 LOL. What in the heck is a Bag Bomb?

I have no idea what most of these items are except the toothpaste.

--
Cheers  --  Tim

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

[PHP] Re: assign database result to iinput text box

2013-09-18 Thread Maciek Sokolewicz

On 18-9-2013 7:33, iccsi wrote:

I have following html code to show my input text box and php to connect
server and select result from database server.
I would like to know how I can I use php to assign the value to my input
text.
Your help and information is great appreciated,

Regards,


Hi iccsi,

first, look at http://www.php.net/mysql_fetch_array the example should 
help you.


Once you have the value you're looking for in a variable, you simply 
assign insert it into the value property of your input element. Ie. you 
should have something like input type=text name=a id=b value=the 
variable containing your data


Also please note that the mysql extension is deprecated; you are advised 
to switch to either PDO_MySQL or mysqli instead.


- Tul

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



Re: [PHP] Re: assign database result to iinput text box

2013-09-18 Thread ITN Network
?php
$username = root;
$password = myPassword;
$hostname = localhost;

//connection to the database
$dbhandle = mysql_connect($hostname, $username, $password)  or die(Unable
to connect to MySQL);
echo Connected to MySQLbr;

//select a database to work with
$selected = mysql_select_db(iccsimd,$dbhandle)  or die(Could not select
aerver);

//execute the SQL query and return records
$result = mysql_fetch_assoc(mysql_query(SELECT invid, invdate, note,
amount FROM invheader));
?

INPUT type=text name=Mytxt id=MytextID value=?php echo
$result['note'];? /

Like Maciek mentioned, if this is a new project use PDO or MySQLi instead,
else use a PDO wrapper for MySQL functions.


On Wed, Sep 18, 2013 at 7:45 AM, Maciek Sokolewicz 
maciek.sokolew...@gmail.com wrote:

 On 18-9-2013 7:33, iccsi wrote:

 I have following html code to show my input text box and php to connect
 server and select result from database server.
 I would like to know how I can I use php to assign the value to my input
 text.
 Your help and information is great appreciated,

 Regards,


 Hi iccsi,

 first, look at 
 http://www.php.net/mysql_**fetch_arrayhttp://www.php.net/mysql_fetch_arraythe
  example should help you.

 Once you have the value you're looking for in a variable, you simply
 assign insert it into the value property of your input element. Ie. you
 should have something like input type=text name=a id=b value=the
 variable containing your data

 Also please note that the mysql extension is deprecated; you are advised
 to switch to either PDO_MySQL or mysqli instead.

 - Tul


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




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

2013-09-07 Thread Alessandro Pellizzari
On Sat, 07 Sep 2013 14:47:00 +0200, Simon Schick wrote:

 The method date(c) actually formats a date, fitting to the format
 defined in the constant DateTime::ATOM.
 
 Are both formats (with and without colon) valid for ISO8601, or is the
 documentation for the method date() wrong?

Yes:

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

Bye.



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



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

2013-09-07 Thread Simon Schick
Hi, Alessandro

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

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

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

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


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

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

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

 Yes:

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

 Bye.



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


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



[PHP] Re: PHP-5.5.2 +opcache segfaults with Piwik

2013-09-06 Thread Jan Ehrhardt
Grant in php.general (Thu, 5 Sep 2013 03:47:55 -0700):
 I've tried php-5.5.2 and 5.5.3 but both segfault with piwik unless the
 opcache is disabled.  Someone filed a piwik bug but was told it's a
 php bug:

 http://dev.piwik.org/trac/ticket/4093

 Is this a known issue?

Is there anything I can do?

Could you test if your problems are solved when you use the latest
opcache from github?
https://github.com/zendtech/ZendOptimizerPlus

Jan

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



[PHP] Re: PHP-5.5.2 +opcache segfaults with Piwik

2013-09-05 Thread Grant
 I've tried php-5.5.2 and 5.5.3 but both segfault with piwik unless the
 opcache is disabled.  Someone filed a piwik bug but was told it's a
 php bug:

 http://dev.piwik.org/trac/ticket/4093

 - Grant

 Is this a known issue?

 - Grant

Is there anything I can do?

- Grant

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



Re: [PHP] Re: refernces, arrays, and why does it take up so much memory?

2013-09-03 Thread Jim Giner

On 9/3/2013 1:09 AM, Daevid Vincent wrote:




-Original Message-
From: Jim Giner [mailto:jim.gi...@albanyhandball.com]
Sent: Monday, September 02, 2013 8:14 PM
To: php-general@lists.php.net
Subject: [PHP] Re: refernces, arrays, and why does it take up so much
memory?

On 9/2/2013 9:30 PM, Daevid Vincent wrote:

I'm confused on how a reference works I think.

I have a DB result set in an array I'm looping over. All I simply want

to

do

is make the array key the id of the result set row.

This is the basic gist of it:

 private function _normalize_result_set()
 {
foreach($this-tmp_results as $k = $v)
{
   $id = $v['id'];
   $new_tmp_results[$id] = $v; //2013-08-29 [dv]

using

a

reference here cuts the memory usage in half!
   unset($this-tmp_results[$k]);

   /*
   if ($i++ % 1000 == 0)
   {
 gc_enable(); // Enable Garbage Collector
 var_dump(gc_enabled()); // true
 var_dump(gc_collect_cycles()); // # of

elements

cleaned up
 gc_disable(); // Disable Garbage Collector
   }
   */
}
$this-tmp_results = $new_tmp_results;
//var_dump($this-tmp_results); exit;
unset($new_tmp_results);
 }

Without using the = reference, my data works great:
$new_tmp_results[$id] = $v;

array (size=79552)
6904 =
  array (size=4)
'id' = string '6904' (length=4)
'studio_id' = string '5' (length=1)
'genres' = string '34|' (length=3)
6905 =
  array (size=4)
'id' = string '6905' (length=4)
'studio_id' = string '5' (length=1)
'genres' = string '6|37|' (length=5)

However it takes a stupid amount of memory for some unknown reason.
MEMORY USED @START: 262,144 - @END: 42,729,472 = 42,467,328 BYTES
MEMORY PEAK USAGE: 216,530,944 BYTES

When using the reference the memory drastically goes down to what I'd

EXPECT

it to be (and actually the problem I'm trying to solve).
MEMORY USED @START: 262,144 - @END: 6,029,312 = 5,767,168 BYTES
MEMORY PEAK USAGE: 82,051,072 BYTES

However my array is all kinds of wrong:

array (size=79552)
6904 = 
  array (size=4)
'id' = string '86260' (length=5)
'studio_id' = string '210' (length=3)
'genres' = string '8|9|10|29|58|' (length=13)
6905 = 
  array (size=4)
'id' = string '86260' (length=5)
'studio_id' = string '210' (length=3)
'genres' = string '8|9|10|29|58|' (length=13)

Notice that they're all the same values, although the keys seem right. I
don't understand why that happens because
foreach($this-tmp_results as $k = $v)
Should be changing $v each iteration I'd think.

Honestly, I am baffled as to why those unsets() make no difference. All

I

can think is that the garbage collector doesn't run. But then I had also
tried to force gc() and that still made no difference. *sigh*

I had some other cockamamie idea where I'd use the same tmp_results

array

in

a tricky way to avoid a  second array. The concept being I'd add 1

million

to the ['id'] (which we want as the new array key), then unset the

existing

sequential key, then when all done, loop through and shift all the keys

by

1

million thereby they'd be the right index ID. So add one and unset one
immediately after. Clever right? 'cept it too made no difference on

memory.

Same thing is happening as above where the gc() isn't running or

something

is holding all that memory until the end. *sigh*

Then I tried a different way using array_combine() and noticed something
very disturbing.
http://www.php.net/manual/en/function.array-combine.php


 private function _normalize_result_set()
 {
if (!$this-tmp_results || count($this-tmp_results)  1)
return;

$D_start_mem_usage = memory_get_usage();
foreach($this-tmp_results as $k = $v)
{
   $id = $v['id'];
   $tmp_keys[] = $id;

   if ($v['genres'])
   {
  $g = explode('|', $v['genres']);
 $this-tmp_results[$k]['g'] = $g; //this

causes a

massive spike in memory usage
   }
}
//var_dump($tmp_keys, $this-tmp_results); exit;
echo \nMEMORY USED BEFORE array_combine:
.number_format(memory_get_usage() - $D_start_mem_usage). PEAK:
(.number_format(memory_get_peak_usage(true)).)br\n;
$this-tmp_results = array_combine($tmp_keys,
$this-tmp_results);
echo \nMEMORY USED FOR array_combine:
.number_format(memory_get_usage() - $D_start_mem_usage). PEAK:
(.number_format

Re: [PHP] Re: PHP-5.5.2 +opcache segfaults with Piwik

2013-09-03 Thread Daniel
Just so that you know, I've posted in the forum topic as well:
http://forum.piwik.org/read.php?2,105879
Regards,
Daniel Fenn






On Tue, Sep 3, 2013 at 12:42 AM, Lester Caine les...@lsces.co.uk wrote:
 Jan Ehrhardt wrote:

 Could you try to add a function_exists check to
 libs/upgradephp/upgrade.php?
 
 This at the function declaration of _json_encode:
 if (!function_exists('_json_encode')) { function _json_encode($var, ...
 
 And a extra } at the end.

 This patch, together with upgrading to the latest OPcache from github
 solved my segfaults and fatal errors.


 Jan  - could you post the solution on http://dev.piwik.org/trac/ticket/4093
 - better that you get the credit than one of us pinch it ;)


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

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


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



[PHP] Re: PHP-5.5.2 +opcache segfaults with Piwik

2013-09-02 Thread Jan Ehrhardt
Grant in php.general (Sun, 25 Aug 2013 02:31:29 -0700):
I've tried php-5.5.2 and 5.5.3 but both segfault with piwik unless the
opcache is disabled.  Someone filed a piwik bug but was told it's a
php bug:

http://dev.piwik.org/trac/ticket/4093

Could you try to add a function_exists check to
libs/upgradephp/upgrade.php?

This at the function declaration of _json_encode:
if (!function_exists('_json_encode')) { function _json_encode($var, ...

And a extra } at the end.

This seemed to correct this fatal error on my side:

[02-Sep-2013 10:35:40 Europe/Paris] PHP Fatal error:  Cannot redeclare
_json_encode() (previously declared in
/usr/local/lib/php/share/piwik/libs/upgradephp/upgrade.php:109) in
/usr/local/lib/php/share/piwik/libs/upgradephp/upgrade.php on line 109

I do not know what opcache has to do with it, although I suspect that
Piwik is calling itself a lot of times and that opcache is trailing
behind (or something like that).

Jan

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



[PHP] Re: PHP-5.5.2 +opcache segfaults with Piwik

2013-09-02 Thread Jan Ehrhardt
Jan Ehrhardt in php.general (Mon, 02 Sep 2013 10:57:14 +0200):
Could you try to add a function_exists check to
libs/upgradephp/upgrade.php?

This at the function declaration of _json_encode:
if (!function_exists('_json_encode')) { function _json_encode($var, ...

And a extra } at the end.

This patch, together with upgrading to the latest OPcache from github
solved my segfaults and fatal errors.

Jan

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



Re: [PHP] Re: PHP-5.5.2 +opcache segfaults with Piwik

2013-09-02 Thread Lester Caine

Jan Ehrhardt wrote:

Could you try to add a function_exists check to
libs/upgradephp/upgrade.php?

This at the function declaration of _json_encode:
if (!function_exists('_json_encode')) { function _json_encode($var, ...

And a extra } at the end.

This patch, together with upgrading to the latest OPcache from github
solved my segfaults and fatal errors.


Jan  - could you post the solution on http://dev.piwik.org/trac/ticket/4093 - 
better that you get the credit than one of us pinch it ;)


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

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



[PHP] Re: refernces, arrays, and why does it take up so much memory?

2013-09-02 Thread Jim Giner

On 9/2/2013 9:30 PM, Daevid Vincent wrote:

I'm confused on how a reference works I think.

I have a DB result set in an array I'm looping over. All I simply want to do
is make the array key the id of the result set row.

This is the basic gist of it:

private function _normalize_result_set()
{
   foreach($this-tmp_results as $k = $v)
   {
  $id = $v['id'];
  $new_tmp_results[$id] = $v; //2013-08-29 [dv] using a
reference here cuts the memory usage in half!
  unset($this-tmp_results[$k]);

  /*
  if ($i++ % 1000 == 0)
  {
gc_enable(); // Enable Garbage Collector
var_dump(gc_enabled()); // true
var_dump(gc_collect_cycles()); // # of elements
cleaned up
gc_disable(); // Disable Garbage Collector
  }
  */
   }
   $this-tmp_results = $new_tmp_results;
   //var_dump($this-tmp_results); exit;
   unset($new_tmp_results);
}

Without using the = reference, my data works great:
$new_tmp_results[$id] = $v;

array (size=79552)
   6904 =
 array (size=4)
   'id' = string '6904' (length=4)
   'studio_id' = string '5' (length=1)
   'genres' = string '34|' (length=3)
   6905 =
 array (size=4)
   'id' = string '6905' (length=4)
   'studio_id' = string '5' (length=1)
   'genres' = string '6|37|' (length=5)

However it takes a stupid amount of memory for some unknown reason.
MEMORY USED @START: 262,144 - @END: 42,729,472 = 42,467,328 BYTES
MEMORY PEAK USAGE: 216,530,944 BYTES

When using the reference the memory drastically goes down to what I'd EXPECT
it to be (and actually the problem I'm trying to solve).
MEMORY USED @START: 262,144 - @END: 6,029,312 = 5,767,168 BYTES
MEMORY PEAK USAGE: 82,051,072 BYTES

However my array is all kinds of wrong:

array (size=79552)
   6904 = 
 array (size=4)
   'id' = string '86260' (length=5)
   'studio_id' = string '210' (length=3)
   'genres' = string '8|9|10|29|58|' (length=13)
   6905 = 
 array (size=4)
   'id' = string '86260' (length=5)
   'studio_id' = string '210' (length=3)
   'genres' = string '8|9|10|29|58|' (length=13)

Notice that they're all the same values, although the keys seem right. I
don't understand why that happens because
foreach($this-tmp_results as $k = $v)
Should be changing $v each iteration I'd think.

Honestly, I am baffled as to why those unsets() make no difference. All I
can think is that the garbage collector doesn't run. But then I had also
tried to force gc() and that still made no difference. *sigh*

I had some other cockamamie idea where I'd use the same tmp_results array in
a tricky way to avoid a  second array. The concept being I'd add 1 million
to the ['id'] (which we want as the new array key), then unset the existing
sequential key, then when all done, loop through and shift all the keys by 1
million thereby they'd be the right index ID. So add one and unset one
immediately after. Clever right? 'cept it too made no difference on memory.
Same thing is happening as above where the gc() isn't running or something
is holding all that memory until the end. *sigh*

Then I tried a different way using array_combine() and noticed something
very disturbing.
http://www.php.net/manual/en/function.array-combine.php


private function _normalize_result_set()
{
   if (!$this-tmp_results || count($this-tmp_results)  1)
return;

   $D_start_mem_usage = memory_get_usage();
   foreach($this-tmp_results as $k = $v)
   {
  $id = $v['id'];
  $tmp_keys[] = $id;

  if ($v['genres'])
  {
 $g = explode('|', $v['genres']);
$this-tmp_results[$k]['g'] = $g; //this causes a
massive spike in memory usage
  }
   }
   //var_dump($tmp_keys, $this-tmp_results); exit;
   echo \nMEMORY USED BEFORE array_combine:
.number_format(memory_get_usage() - $D_start_mem_usage). PEAK:
(.number_format(memory_get_peak_usage(true)).)br\n;
   $this-tmp_results = array_combine($tmp_keys,
$this-tmp_results);
   echo \nMEMORY USED FOR array_combine:
.number_format(memory_get_usage() - $D_start_mem_usage). PEAK:
(.number_format(memory_get_peak_usage(true)).)br\n;
   var_dump($tmp_keys, $this-tmp_results); exit;
}

Just the simple act of adding that 'g' variable element to the array causes
a massive change in memory usage. WHAT THE F!?

MEMORY USED BEFORE array_combine: 105,315,264 PEAK: (224,395,264)
MEMORY USED FOR array_combine: 106,573,040 PEAK: (224,395,264)

And taking out the

RE: [PHP] Re: refernces, arrays, and why does it take up so much memory?

2013-09-02 Thread Daevid Vincent


 -Original Message-
 From: Jim Giner [mailto:jim.gi...@albanyhandball.com]
 Sent: Monday, September 02, 2013 8:14 PM
 To: php-general@lists.php.net
 Subject: [PHP] Re: refernces, arrays, and why does it take up so much
 memory?
 
 On 9/2/2013 9:30 PM, Daevid Vincent wrote:
  I'm confused on how a reference works I think.
 
  I have a DB result set in an array I'm looping over. All I simply want
to
 do
  is make the array key the id of the result set row.
 
  This is the basic gist of it:
 
  private function _normalize_result_set()
  {
 foreach($this-tmp_results as $k = $v)
 {
$id = $v['id'];
$new_tmp_results[$id] = $v; //2013-08-29 [dv]
using
 a
  reference here cuts the memory usage in half!
unset($this-tmp_results[$k]);
 
/*
if ($i++ % 1000 == 0)
{
  gc_enable(); // Enable Garbage Collector
  var_dump(gc_enabled()); // true
  var_dump(gc_collect_cycles()); // # of
 elements
  cleaned up
  gc_disable(); // Disable Garbage Collector
}
*/
 }
 $this-tmp_results = $new_tmp_results;
 //var_dump($this-tmp_results); exit;
 unset($new_tmp_results);
  }
 
  Without using the = reference, my data works great:
  $new_tmp_results[$id] = $v;
 
  array (size=79552)
 6904 =
   array (size=4)
 'id' = string '6904' (length=4)
 'studio_id' = string '5' (length=1)
 'genres' = string '34|' (length=3)
 6905 =
   array (size=4)
 'id' = string '6905' (length=4)
 'studio_id' = string '5' (length=1)
 'genres' = string '6|37|' (length=5)
 
  However it takes a stupid amount of memory for some unknown reason.
  MEMORY USED @START: 262,144 - @END: 42,729,472 = 42,467,328 BYTES
  MEMORY PEAK USAGE: 216,530,944 BYTES
 
  When using the reference the memory drastically goes down to what I'd
 EXPECT
  it to be (and actually the problem I'm trying to solve).
  MEMORY USED @START: 262,144 - @END: 6,029,312 = 5,767,168 BYTES
  MEMORY PEAK USAGE: 82,051,072 BYTES
 
  However my array is all kinds of wrong:
 
  array (size=79552)
 6904 = 
   array (size=4)
 'id' = string '86260' (length=5)
 'studio_id' = string '210' (length=3)
 'genres' = string '8|9|10|29|58|' (length=13)
 6905 = 
   array (size=4)
 'id' = string '86260' (length=5)
 'studio_id' = string '210' (length=3)
 'genres' = string '8|9|10|29|58|' (length=13)
 
  Notice that they're all the same values, although the keys seem right. I
  don't understand why that happens because
  foreach($this-tmp_results as $k = $v)
  Should be changing $v each iteration I'd think.
 
  Honestly, I am baffled as to why those unsets() make no difference. All
I
  can think is that the garbage collector doesn't run. But then I had also
  tried to force gc() and that still made no difference. *sigh*
 
  I had some other cockamamie idea where I'd use the same tmp_results
array
 in
  a tricky way to avoid a  second array. The concept being I'd add 1
million
  to the ['id'] (which we want as the new array key), then unset the
 existing
  sequential key, then when all done, loop through and shift all the keys
by
 1
  million thereby they'd be the right index ID. So add one and unset one
  immediately after. Clever right? 'cept it too made no difference on
 memory.
  Same thing is happening as above where the gc() isn't running or
something
  is holding all that memory until the end. *sigh*
 
  Then I tried a different way using array_combine() and noticed something
  very disturbing.
  http://www.php.net/manual/en/function.array-combine.php
 
 
  private function _normalize_result_set()
  {
 if (!$this-tmp_results || count($this-tmp_results)  1)
  return;
 
 $D_start_mem_usage = memory_get_usage();
 foreach($this-tmp_results as $k = $v)
 {
$id = $v['id'];
$tmp_keys[] = $id;
 
if ($v['genres'])
{
   $g = explode('|', $v['genres']);
  $this-tmp_results[$k]['g'] = $g; //this
 causes a
  massive spike in memory usage
}
 }
 //var_dump($tmp_keys, $this-tmp_results); exit;
 echo \nMEMORY USED BEFORE array_combine:
  .number_format(memory_get_usage() - $D_start_mem_usage). PEAK:
  (.number_format(memory_get_peak_usage(true)).)br\n;
 $this-tmp_results = array_combine($tmp_keys,
  $this-tmp_results);
 echo \nMEMORY USED

[PHP] Re: PHP-5.5.2 +opcache segfaults with Piwik

2013-09-01 Thread Grant
 I've tried php-5.5.2 and 5.5.3 but both segfault with piwik unless the
 opcache is disabled.  Someone filed a piwik bug but was told it's a
 php bug:

 http://dev.piwik.org/trac/ticket/4093

 - Grant

Is this a known issue?

- Grant

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



Re: [PHP] Re: PHP-5.5.2 +opcache segfaults with Piwik

2013-09-01 Thread Lester Caine

Grant wrote:

I've tried php-5.5.2 and 5.5.3 but both segfault with piwik unless the
opcache is disabled.  Someone filed a piwik bug but was told it's a
php bug:

http://dev.piwik.org/trac/ticket/4093



Is this a known issue?


I'm running my own port of piwik in production with eaccelerator on 5.4 but I've 
made the decision not to move any of the machines to 5.5 until all of the legacy 
5.2 machines have been brought up to 5.4. Not an answer, but explains perhaps 
why the problem is not being seen by others.


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



Re: [PHP] Re: PHP-5.5.2 +opcache segfaults with Piwik

2013-09-01 Thread Jan Ehrhardt
Lester Caine in php.general (Sun, 01 Sep 2013 12:59:18 +0100):
Grant wrote:
 I've tried php-5.5.2 and 5.5.3 but both segfault with piwik unless the
 opcache is disabled.  Someone filed a piwik bug but was told it's a
 php bug:
 
 http://dev.piwik.org/trac/ticket/4093

 Is this a known issue?

 (...) Not an answer, but explains perhaps  why the problem is not being
seen by others.

It is more likely that users do not notice it. I have Piwik running with
PHP 5.3 and php_opcache.dll (Centos 5) and it segfaults:

[Sun Sep 01 17:06:53.131410 2013] [core:notice] [pid 25411] AH00052:
child pid 25451 exit signal Segmentation fault (11)
[Sun Sep 01 17:08:18.561917 2013] [core:notice] [pid 25411] AH00052:
child pid 25453 exit signal Segmentation fault (11)
[Sun Sep 01 17:08:19.569714 2013] [core:notice] [pid 25411] AH00052:
child pid 25450 exit signal Segmentation fault (11)

However, nothing special is displaying on the page. You have to grep
your Apache error_log to know that it happens. How did you notice?

Jan

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



[PHP] Re: PHP-5.5.2 +opcache segfaults with Piwik

2013-09-01 Thread Jan Ehrhardt
Grant in php.general (Sun, 1 Sep 2013 02:13:54 -0700):
 I've tried php-5.5.2 and 5.5.3 but both segfault with piwik unless the
 opcache is disabled.  Someone filed a piwik bug but was told it's a
 php bug:

 http://dev.piwik.org/trac/ticket/4093

Is this a known issue?

I changed the PHP on my (dev) Centos5 server to PHP 5.5.3, pulled the
latest OPcache from Github and tried to get a segfault. That was clearly
visible when I tried to access the Goals tab in the dashboard of one of
my websites. The page never got further than 'Loading data...' and my
Apache log showed a segfault.

So, if it was no known issue it is confirmed now.

Jan

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



[PHP] RE: php seg faults on creation pdf

2013-08-28 Thread KAs Coenen
Hi, 

Some more info. I ran gdb on the core file (after reinstalling with debug mode):

# /usr/local/gdb/bin/gdb /usr/local/php5/bin/php-cgi 
/opt/apache/htdocs/wachtlijst/core
GNU gdb (GDB) 7.6
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type show copying
and show warranty for details.
This GDB was configured as i386-pc-solaris2.10.
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/...
Reading symbols from /usr/local/php5/bin/php-cgi...done.
[New LWP 1]
[Thread debugging using libthread_db enabled]
[New Thread 1 (LWP 1)]
Core was generated by `/usr/local/php5/bin/php-cgi 
/opt/apache/htdocs/wachtlijst/test.php'.
Program terminated with signal 11, Segmentation fault.
#0  0x0093baa4 in _object_and_properties_init (arg=error reading 
variable: Cannot access memory at address 0xffd8,
    arg@entry=error reading variable: Cannot access memory at address 0x8, 
class_type=error reading variable: Cannot access memory at address 
0xffd0,
    class_type@entry=error reading variable: Cannot access memory at address 
0x8, properties=error reading variable: Cannot access memory at address 
0xffc8,
    properties@entry=error reading variable: Cannot access memory at address 
0x8) at /export/home/coenenka/php-5.5.1/Zend/zend_API.c:1200
1200    Z_OBJVAL_P(arg) = class_type-create_object(class_type 
TSRMLS_CC);

Does anyone see anything in this? The dir /export/home/coenenka is not the 
install dir (but my home drive) and I have no clue why it is referencing to 
that dir (it is the location of the source). 

Greetings,

Kas



 From: kascoe...@hotmail.com
 To: php-general@lists.php.net
 Subject: php seg faults on creation pdf
 Date: Wed, 28 Aug 2013 10:00:29 +0200

 Hi,

 When surfing to a website that generates a pdf the apache server segfaults. 
 This made me run the script (that generates the pdf) with the php cli 
 command. The php also segfaults with the same error:

 # /usr/local/php5/bin/php-cgi test.php
 Segmentation Fault (core dumped)

 Pstack output:

 # pstack core
 core 'core' of 726: /usr/local/php5/bin/php-cgi test.php
  00960af5 _object_and_properties_init () + 111

 I attached the truss output to the mail. I am running this on a solaris 
 server:

 # uname -a
 SunOS zone-eu4 5.10 Generic_142910-17 i86pc i386 i86pc
 # cat /etc/release
 Oracle Solaris 10 9/10 s10x_u9wos_14a X86
  Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
 Assembled 11 August 2010

 pdflib module is 2.1.10. PDFlib lite is version 7.0.5. I tried to compile 
 everything in 64 bit. I suspect the problem is that somewhere a 32bit lib or 
 executable is being used instead of a 64bit.


 Can anyone help me out on this?

 Kind regards,

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



[PHP] Re: Permissions

2013-08-27 Thread David Robley
Ethan Rosenberg wrote:

 Dear List -
 
 Tried to run the program, that we have been discussing, and received a
 403 error.
 
 rosenberg:/var/www# ls -la StoreInventory.php
 -rwxrwxrw- 1 ethan ethan 4188 Aug 26 20:26 StoreInventory.php
 
 rosenberg:/var# ls -ld www
 drwxrwxrw- 37 ethan ethan 20480 Aug 26 20:26 www
 
 I had set the S bit [probably a nasty mistake] and I thought I was able
 to remove the bit. [it doesn't show above]
 
 How do I extricate myself from the hole into which I have planted myself?
 
 TIA
 
 Ethan

This is in no way a php question, as the same result will happen no matter 
what you ask apache to serve from that directory.

You have the directory permissions set to 776 not 777.
-- 
Cheers
David Robley

Steal this tagline and I'll tie-dye your cat!


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



Re: [PHP] Re: Permissions

2013-08-27 Thread Ashley Sheridan
On Tue, 2013-08-27 at 16:16 +0930, David Robley wrote:

 Ethan Rosenberg wrote:
 
  Dear List -
  
  Tried to run the program, that we have been discussing, and received a
  403 error.
  
  rosenberg:/var/www# ls -la StoreInventory.php
  -rwxrwxrw- 1 ethan ethan 4188 Aug 26 20:26 StoreInventory.php
  
  rosenberg:/var# ls -ld www
  drwxrwxrw- 37 ethan ethan 20480 Aug 26 20:26 www
  
  I had set the S bit [probably a nasty mistake] and I thought I was able
  to remove the bit. [it doesn't show above]
  
  How do I extricate myself from the hole into which I have planted myself?
  
  TIA
  
  Ethan
 
 This is in no way a php question, as the same result will happen no matter 
 what you ask apache to serve from that directory.
 
 You have the directory permissions set to 776 not 777.
 -- 
 Cheers
 David Robley
 
 Steal this tagline and I'll tie-dye your cat!
 
 


776 won't matter in the case of a directory, as the last bit is for the
eXecute permissions, which aren't applicable to a directory. What 

It's possible that this is an SELinux issue, which adds an extra layer
of permissions over files. To see what those permissions are, use the -Z
flag for ls. Also, check the SELinux logs (assuming that it's running
and it is causing a problem) to see if it brings up anything. It's
typically found on RedHat-based distros.

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




Re: [PHP] Re: Permissions

2013-08-27 Thread David Robley
Ashley Sheridan wrote:

 On Tue, 2013-08-27 at 16:16 +0930, David Robley wrote:
 
 Ethan Rosenberg wrote:
 
  Dear List -
  
  Tried to run the program, that we have been discussing, and received a
  403 error.
  
  rosenberg:/var/www# ls -la StoreInventory.php
  -rwxrwxrw- 1 ethan ethan 4188 Aug 26 20:26 StoreInventory.php
  
  rosenberg:/var# ls -ld www
  drwxrwxrw- 37 ethan ethan 20480 Aug 26 20:26 www
  
  I had set the S bit [probably a nasty mistake] and I thought I was able
  to remove the bit. [it doesn't show above]
  
  How do I extricate myself from the hole into which I have planted
  myself?
  
  TIA
  
  Ethan
 
 This is in no way a php question, as the same result will happen no
 matter what you ask apache to serve from that directory.
 
 You have the directory permissions set to 776 not 777.
 --
 Cheers
 David Robley
 
 Steal this tagline and I'll tie-dye your cat!
 
 
 
 
 776 won't matter in the case of a directory, as the last bit is for the
 eXecute permissions, which aren't applicable to a directory. What

I beg to differ here. If the x bit isn't set on a directory, that will 
prevent scanning of the directory; in this case apache will be prevented 
from scanning the directory and will return a 403.

 It's possible that this is an SELinux issue, which adds an extra layer
 of permissions over files. To see what those permissions are, use the -Z
 flag for ls. Also, check the SELinux logs (assuming that it's running
 and it is causing a problem) to see if it brings up anything. It's
 typically found on RedHat-based distros.
 
 Thanks,
 Ash
 http://www.ashleysheridan.co.uk

-- 
Cheers
David Robley

Artificial Intelligence is no match for natural stupidity.


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



Re: [PHP] Re: Permissions

2013-08-27 Thread Daniel Brown
On Tue, Aug 27, 2013 at 3:07 AM, David Robley robl...@zoho.com wrote:

 I beg to differ here. If the x bit isn't set on a directory, that will
 prevent scanning of the directory; in this case apache will be prevented
 from scanning the directory and will return a 403.

Well, that's partially correct.  If a directory is owned by
someone other than the current user (for example, root) and is 0776,
you can list the directory content from outside of the directory to
get a basic file listing.  What you won't get by doing that, however,
is anything other than the file name and type, because the kernel is
forbidden from executing mtime, ctime, and owner/group queries on the
files.  In addition, you won't be able to enter the directory (cd).

That said, if Ethan is running his Apache server as the user
'ethan' (which isn't mentioned) then it would be fine regardless.

As for the 's' notation, that's either a bitmask of 0400 or 0200,
which are for setuid and setgid, respectively.

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



[PHP] Re: Basic Auth

2013-08-27 Thread B. Aerts

On 27/08/13 15:37, Jim Giner wrote:

Im using basic auth for a few of my pages that I want to limit access
to - nothing of a sensitive nature, but simply want to limit access to.
  Want to implement a signoff process, but can't figure it out.

 From the comments in the manual I take it one can't do this by simply
unsetting the PHP_AUTH_USER and _PW vars.  Can someone explain to me why
this doesn't suffice?  The signon process expects them to be there, so
when they are not (after the 'unset'), how come my signon process still
detects them and their values?


Hello Jim,

at the risk of under-estimating your knowledge (and over-estimating 
mine) of HTTP-requests in PHP - but here it goes.


I see two options of bypassing the JavaScript option.

The first one is to use the default authorization, and error pages of 
your HTTP server.
(For example, in Apache: 
http://httpd.apache.org/docs/2.2/custom-error.html)

This is for a login with invalid credentials.
For some-one to leave the protected site, a HTTP-request without 
credentials, and to a URI outside the protected domain, should do (as 
every HTTP request into the protected domain should repeat the 
Authorisation header).



The second one is to leave header(), and go down one level, to the likes 
of fsockopen() or stream_socket_server() - though personally, I've only 
limited knowledge of a bit of client-side programming.


Unless I've completely misunderstood your question,
Hope this helps,

Bert

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



Re: [PHP] Re: Permissions

2013-08-27 Thread Ethan Rosenberg


On 08/27/2013 03:07 AM, David Robley wrote:

Ashley Sheridan wrote:


On Tue, 2013-08-27 at 16:16 +0930, David Robley wrote:


Ethan Rosenberg wrote:


Dear List -

Tried to run the program, that we have been discussing, and received a
403 error.

rosenberg:/var/www# ls -la StoreInventory.php
-rwxrwxrw- 1 ethan ethan 4188 Aug 26 20:26 StoreInventory.php

rosenberg:/var# ls -ld www
drwxrwxrw- 37 ethan ethan 20480 Aug 26 20:26 www

I had set the S bit [probably a nasty mistake] and I thought I was able
to remove the bit. [it doesn't show above]

How do I extricate myself from the hole into which I have planted
myself?

TIA

Ethan


This is in no way a php question, as the same result will happen no
matter what you ask apache to serve from that directory.

You have the directory permissions set to 776 not 777.
--
Cheers
David Robley

Steal this tagline and I'll tie-dye your cat!





776 won't matter in the case of a directory, as the last bit is for the
eXecute permissions, which aren't applicable to a directory. What


I beg to differ here. If the x bit isn't set on a directory, that will
prevent scanning of the directory; in this case apache will be prevented
from scanning the directory and will return a 403.


It's possible that this is an SELinux issue, which adds an extra layer
of permissions over files. To see what those permissions are, use the -Z
flag for ls. Also, check the SELinux logs (assuming that it's running
and it is causing a problem) to see if it brings up anything. It's
typically found on RedHat-based distros.

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



I checked with the -Z option

ethan@rosenberg:/var/www$ ls -lZ StoreInventory.php
-rwxrwsr-t 1 ethan ethan ? 4232 Aug 27 00:18 StoreInventory.php

Ethan

PS David-

I promise that I will not steal your tag line.  My short hair American 
tabby cat [Gingy Feline Rosenberg]is too nice to have anything done to her.


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



Re: [PHP] Re: Permissions

2013-08-27 Thread Ethan Rosenberg


On 08/27/2013 01:52 PM, Ethan Rosenberg wrote:


On 08/27/2013 03:07 AM, David Robley wrote:

Ashley Sheridan wrote:


On Tue, 2013-08-27 at 16:16 +0930, David Robley wrote:


Ethan Rosenberg wrote:


Dear List -

Tried to run the program, that we have been discussing, and received a
403 error.

rosenberg:/var/www# ls -la StoreInventory.php
-rwxrwxrw- 1 ethan ethan 4188 Aug 26 20:26 StoreInventory.php

rosenberg:/var# ls -ld www
drwxrwxrw- 37 ethan ethan 20480 Aug 26 20:26 www

I had set the S bit [probably a nasty mistake] and I thought I was
able
to remove the bit. [it doesn't show above]

How do I extricate myself from the hole into which I have planted
myself?

TIA

Ethan


This is in no way a php question, as the same result will happen no
matter what you ask apache to serve from that directory.

You have the directory permissions set to 776 not 777.
--
Cheers
David Robley

Steal this tagline and I'll tie-dye your cat!





776 won't matter in the case of a directory, as the last bit is for the
eXecute permissions, which aren't applicable to a directory. What


I beg to differ here. If the x bit isn't set on a directory, that will
prevent scanning of the directory; in this case apache will be prevented
from scanning the directory and will return a 403.


It's possible that this is an SELinux issue, which adds an extra layer
of permissions over files. To see what those permissions are, use the -Z
flag for ls. Also, check the SELinux logs (assuming that it's running
and it is causing a problem) to see if it brings up anything. It's
typically found on RedHat-based distros.

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



I checked with the -Z option

ethan@rosenberg:/var/www$ ls -lZ StoreInventory.php
-rwxrwsr-t 1 ethan ethan ? 4232 Aug 27 00:18 StoreInventory.php

Ethan

PS David-

I promise that I will not steal your tag line.  My short hair American
tabby cat [Gingy Feline Rosenberg]is too nice to have anything done to her.

This has really morphed into a Debian issue.  I have sent it to the 
Debian list.  I will keep you informed.


Ethan

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



[PHP] Re: Permissions

2013-08-27 Thread Ethan Rosenberg


On 08/27/2013 03:31 PM, Steven Post wrote:

On Tue, 2013-08-27 at 13:43 -0400, Ethan Rosenberg wrote:

Dear List -

I apologize for this needle in a haystack  but...

This was originally posted on the PHP list, but has changed into a
Debian question...

Tried to run the program, that we have been discussing,{on the PHP list}
and received a 403 error.

rosenberg:/var/www# ls -la StoreInventory.php
-rwxrwxrw- 1 ethan ethan 4188 Aug 26 20:26 StoreInventory.php

rosenberg:/var# ls -ld www
drwxrwxrw- 37 ethan ethan 20480 Aug 26 20:26 www

I had set the S bit [probably a nasty mistake] and I thought I was able
to remove the bit. [it doesn't show above]

I made the following stupid mistakes...
note commands from the root prompt have a su appended

467  chown -R ethan:www-data wwwsu
469  chown -R ethan:www-data wwwsu
470  chmod -R g+s www   su
471  chgrp -R  www  su
477  chgrp -R ethan www su  
480  chmod -R 766 www   su
482  chmod g-S www  su
485  chmod -S www   su
486  chmod g S www  su
487  chmod gS www   su
488  chmod S wwwsu
489  chmod 776 www  su
492  chmod 776 -R www   su
494  chmod -s -R wwwsu
504  chmod 666 StoreInventory.php
512  chmod 3775 StoreInventory.php

I now have

ethan@rosenberg:/var/www$ ls -la StoreInventory.php
-rwxrwsr-t 1 ethan ethan 4232 Aug 27 00:18 StoreInventory.php

ethan@rosenberg:/var$ ls -ld www
drwxrwxrw- 37 ethan ethan 20480 Aug 26 20:26 www

and still have the 403 error.

How do I extricate myself from the hole into which I have planted myself?



The problem appears to be that Apache does not have access to the file.
Looking at the permissions of the file it should work, however, apache
is not able to go into your /var/www folder. Either you need to set
www-data as the owner of the directory, or as the group owner, or,
possibility number 3, give execute rights to 'others' on that folder.

Pick one (you might need to be root for the first 2 in your situation):
1) chown www-data /var/www
2) chgrp www-data /var/www
3) chmod -R o+X /var/www

Note the capital 'X' on option 3, this gives execute permissions on
folders only, not files, as the -R means all files and subdirectories as
well.

The 't' is known as the sticky bit if I recall correctly, set with 1 on
the first number in a 4 number chmod command, for details see [1].
I guess in your case you can use 0664 for the files and 0775 for
directories (or 0640 and 0750 if you set owner or group back to
www-data)

Best regards,
Steven



you wrote about a 403 error, so I assume you invoke the script by
calling a webserver via browser.
In that case the webserver needs the permission to access /var/www and
to read StoreInventory.php.

By default the webserver runs as user/group www-data (it can be changed
in the webservers config-file(s)).

Try this:

#chown -R ethan:www-data /var/www
#chmod 775 /var/www
#chmod 640 /var/www/StoreInventory.php

Your ls should return something like this:

$ls -hal /var/www
drwxr-x--- 1 ethan www-data 4.0K Jun 3 20:35 .
-rw-r- 1 ethan www-data 623 Jun 3 20:35 StoreInventory.php


If that does not work you might check the configuration- and log-files
of your webserver.

Dear List -

I had to go to a meeting but before I left I tried one last thing -

 chmod 000 www
 chmod 0777 www
rosenberg:/var# ls -ld www
drwxrwxrwx 37 ethan ethan 20480 Aug 27 17:30 www

 chown ethan StoreInventory.php
 chgrp ethan StoreInventory.php
 chmod 000 StoreInventory.php
 chmod 777 StoreInventory.php
ethan@rosenberg:/var/www$ ls -la StoreInventory.php
-rwxrwxrwx 1 ethan ethan 4232 Aug 27 17:25 StoreInventory.php

when I returned...

IT WORKS!!!

Thanks to all.

Ethan

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



[PHP] Re: exec and system do not work

2013-08-26 Thread Tim Streater
On 26 Aug 2013 at 22:01, PhD Ethan Rosenberg erosenb...@hygeiabiomedical.com 
wrote: 

 if( !file_exists(/var/www/orders.txt));

^
|
What's the semicolon doing there ---+

 {
 echo system(touch /var/www/orders.txt, $ret);
 echo system(chmod 766 /var/www/orders.txt, $ret);
 echo 'file2br /';
 echo file_exists(/var/www/orders.txt);
 }

 If you would point out my syntax errors, I will fix them.

See above.

--
Cheers  --  Tim

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

[PHP] Re: windows files and folders permission

2013-08-23 Thread Carlos Medina
Hola Emiliano,
i think you should to redefine your question because i can not
understand what you want. Please post parts of the code, examples,
errors, etc.

regards

Carlos Medina

Am 23.08.2013 06:28, schrieb Emiliano Boragina:
 Night everyone, I did a upload page and when upload a JPG file this is not
 available. Why this happens? Thanks a lot.
 
 
 Emiliano Boragina | gráfico + web
 desarrollos  comunicación
 
 + 15 33 92 60 02
 » emiliano.borag...@gmail.com
 
 © 2013
 
 
 


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



Re: [PHP] Re: PHP vs JAVA

2013-08-22 Thread Sebastian Krebs
2013/8/22 David Harkness davi...@highgearmedia.com

 On Wed, Aug 21, 2013 at 7:56 PM, Curtis Maurand cur...@maurand.comwrote:

 Sebastian Krebs wrote:

  Actually the problem is, that the dot . is already in use. With

   $foo.bar() you cannot tell, if you want to call the method bar() on
 the
  object $foo, or if you want to concatenate the value of $foo to the
  result of the function bar(). There is no other way around this than a
  different operator for method calls.

 I didn't think
 of that.  It seems to me there could be an easier operator than -
 which sometimes will make me stop and look at what keys I'm trying to
 hit.  Just a thought.  I forgot about the concatenation operator
 which is + in Java/C#


 The PHP language developers were pretty stuck. Because of automatic
 string-to-numeric-conversion, they couldn't use + for string concatenation.
 Sadly, they chose . rather than .. which I believe one or two other
 languages use. If they had, . would have been available once objects
 rolled around in PHP 4/5. I suspect they chose - since that's used in C
 and C++ to dereference a pointer.


Actually I think .. is quite error-prone, because it is hard to
distinguish from . or _ on the _first_ glance, which makes the get
quickly through the code. [1]
So . is maybe not the best choice, but also remember when it was
introduced: That was decades ago. That time it was (probably ;)) the best
choice and nowadays I don't think it is too bad at all, beside that _other_
languages use it for other purposes now ;)


[1] Yes, I know, that _ is not an operator, but mixed with strings and
variables names it is there ;)




  Ever tried the jetbrains products? :D (No, they don't pay me)

 I have not, but it looks interesting.
 I'll have to try it.


 Those are very good products which have had a strong following for a
 decade. The free IDE NetBeans also has quite good support for both Java and
 PHP, and the latest beta version provides a web project that provides
 front- and back-end debugging of PHP + JavaScript. You can be stepping
 through JS code and hit an AJAX call and then seamlessly step through the
 PHP code that handles it.

 I use NetBeans for PHP/HTML/JS (though I am evaluating JetBrains' PHPStorm
 now) and Eclipse for Java. You can't beat Eclipse's refactoring support in
 a free tool, though I think NetBeans is close to catching up. I would bet
 IntelliJ IDEA for Java by JetBrains is on par at least.


Eclipse' code-completion and debugger never worked for me well (and most of
the time: at all). It became slower and less responsive with every release.
That was the reason I decided to leave it and I don't regret it :)



 Peace,
 David




-- 
github.com/KingCrunch


Re: [PHP] Re: PHP vs JAVA

2013-08-22 Thread David Harkness
On Thu, Aug 22, 2013 at 12:29 AM, Sebastian Krebs krebs@gmail.comwrote:

 Actually I think .. is quite error-prone, because it is hard to
 distinguish from . or _ on the _first_ glance, which makes the get
 quickly through the code. [1]


I surround all operators except member access (. and -) with spaces,
so that wouldn't be a problem for me. I thought there was an older language
that used .., but all I can find now is Lua which was developed in the
early nineties.

So . is maybe not the best choice, but also remember when it was
 introduced: That was decades ago. That time it was (probably ;)) the best
 choice and nowadays I don't think it is too bad at all, beside that _other_
 languages use it for other purposes now ;)


C introduced . as the field access operator for structs in the early
seventies, C++ kept it for object access, and Java adopted it in the early
nineties. C's use of pointers required a way to access members through a
pointer, and I suppose KR thought - looked like following a pointer (I
agree).

Since PHP was modeled on Perl and wouldn't implement objects or structs for
another decade, it adopted . for string concatenation. It works fine, and
I don't have too much trouble bouncing back-and-forth. I honestly would
have preferred . to be overloaded when the left hand side was an object.
In the rare cases that you want to convert an object to a string to be
concatenated with the RHS, you can always cast it to string, use strval(),
or call __toString() manually. But I'm not staging any protests over the
use of -. :)


 Eclipse' code-completion and debugger never worked for me well (and most
 of the time: at all). It became slower and less responsive with every
 release. That was the reason I decided to leave it and I don't regret it :)


I agree about the slowness, and until this latest release I've always left
autocompletion manual (ctrl + space). They did something with Kepler to
speed it up drastically, so much so I have it turned on with every
keypress. However, it's a little too aggressive in providing choices.
Typing null which is a Java keyword as in PHP, it will insert
nullValue() which is a method from Hamcrest. :( After a couple weeks of
this, I think I'll be switching it back to manual activation. I can type
quickly enough that I only need it when I'm not sure of a method name.

NetBeans, while not as good with refactoring and plugin support, is still
zippier than Eclipse. And my short time with the JetBrains products found
them to be fast as well. Eclipse's PHP support via PDT is not nearly as
good as NetBeans, and no doubt PHPStorm beats them both.

Peace,
David


[PHP] Re: PHP vs JAVA

2013-08-21 Thread Tim Streater
On 20 Aug 2013 at 23:59, PHP List phpl...@arashidigital.com wrote: 

 While I don't have any references to back it up - my guess would be that
 Java may be seen as more versatile in general programming terms.  A
 staggering number of enterprise level web applications are built with
 Java, add to that the possibility of writing Android apps with the same
 knowledge.

To me the salient point is, does java has as extensive a library or set of 
interfaces to other packages (such as SQLite, mysql, etc)?

 I would say that, in general, the other teacher is incorrect speaking
 strictly in terms of web development.  PHP has already won that crown
 many times over.  That said, when I was in University, it was difficult
 to find a programming class that taught anything but Java - and that was
 10yrs ago now.  I chalked it up to the education bubble not being able
 to see what the rest of the world is actually doing.

Was PHP OOP-capable at the time? Perhaps the edu-bubble was simply looking down 
its nose at PHP. There being lots of courses proves nothing in and of itself. 
20 years ago, there were lots of PC mags you could buy, which caused some folks 
to say look how much better the PC is supported than other platforms. Truth 
was, at the time, such support was needed given the mess of 640k limits, DOS, 
IRQs and the like, most of which issues have ceased to be relevant.

Anyway, why should one need a course to learn PHP, assuming you already know 
other languages. It's simple enough.

--
Cheers  --  Tim

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

Re: [PHP] Re: PHP vs JAVA

2013-08-21 Thread georg chambert

Hi,

my I shake the subject a little; Ive been doing some PHP and found it ok 
to work with

not so much fuss, but that was PHP4, what about PHP5 ?
Dont really checked the difference but made a short-scan and found that it 
had be

screwed around with ?

Any think, should I change to 5 ?

BR georg

- Original Message - 
From: Tim Streater t...@clothears.org.uk

To: PHP List phpl...@arashidigital.com; php-general@lists.php.net
Sent: Wednesday, August 21, 2013 1:59 PM
Subject: [PHP] Re: PHP vs JAVA


On 20 Aug 2013 at 23:59, PHP List phpl...@arashidigital.com wrote:


While I don't have any references to back it up - my guess would be that
Java may be seen as more versatile in general programming terms.  A
staggering number of enterprise level web applications are built with
Java, add to that the possibility of writing Android apps with the same
knowledge.


To me the salient point is, does java has as extensive a library or set of 
interfaces to other packages (such as SQLite, mysql, etc)?



I would say that, in general, the other teacher is incorrect speaking
strictly in terms of web development.  PHP has already won that crown
many times over.  That said, when I was in University, it was difficult
to find a programming class that taught anything but Java - and that was
10yrs ago now.  I chalked it up to the education bubble not being able
to see what the rest of the world is actually doing.


Was PHP OOP-capable at the time? Perhaps the edu-bubble was simply looking 
down its nose at PHP. There being lots of courses proves nothing in and of 
itself. 20 years ago, there were lots of PC mags you could buy, which caused 
some folks to say look how much better the PC is supported than other 
platforms. Truth was, at the time, such support was needed given the mess 
of 640k limits, DOS, IRQs and the like, most of which issues have ceased to 
be relevant.


Anyway, why should one need a course to learn PHP, assuming you already know 
other languages. It's simple enough.


--
Cheers  --  Tim








--
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] Re: PHP vs JAVA

2013-08-21 Thread Sebastian Krebs
2013/8/21 georg chambert georg.chamb...@telia.com

 Hi,

 my I shake the subject a little; Ive been doing some PHP and found it ok
 to work with
 not so much fuss, but that was PHP4, what about PHP5 ?
 Dont really checked the difference but made a short-scan and found that it
 had be
 screwed around with ?

 Any think, should I change to 5 ?


ehm ... serious?
http://php.net/eol.php



 BR georg

 - Original Message - From: Tim Streater t...@clothears.org.uk
 To: PHP List phpl...@arashidigital.com; php-general@lists.php.net
 Sent: Wednesday, August 21, 2013 1:59 PM
 Subject: [PHP] Re: PHP vs JAVA



 On 20 Aug 2013 at 23:59, PHP List phpl...@arashidigital.com wrote:

  While I don't have any references to back it up - my guess would be that
 Java may be seen as more versatile in general programming terms.  A
 staggering number of enterprise level web applications are built with
 Java, add to that the possibility of writing Android apps with the same
 knowledge.


 To me the salient point is, does java has as extensive a library or set of
 interfaces to other packages (such as SQLite, mysql, etc)?

  I would say that, in general, the other teacher is incorrect speaking
 strictly in terms of web development.  PHP has already won that crown
 many times over.  That said, when I was in University, it was difficult
 to find a programming class that taught anything but Java - and that was
 10yrs ago now.  I chalked it up to the education bubble not being able
 to see what the rest of the world is actually doing.


 Was PHP OOP-capable at the time? Perhaps the edu-bubble was simply looking
 down its nose at PHP. There being lots of courses proves nothing in and of
 itself. 20 years ago, there were lots of PC mags you could buy, which
 caused some folks to say look how much better the PC is supported than
 other platforms. Truth was, at the time, such support was needed given the
 mess of 640k limits, DOS, IRQs and the like, most of which issues have
 ceased to be relevant.

 Anyway, why should one need a course to learn PHP, assuming you already
 know other languages. It's simple enough.

 --
 Cheers  --  Tim




 --**--**
 



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




-- 
github.com/KingCrunch


Re: [PHP] Re: PHP vs JAVA

2013-08-21 Thread Stuart Dallas
On 21 Aug 2013, at 15:01, georg chambert georg.chamb...@telia.com wrote:

 my I shake the subject a little; Ive been doing some PHP and found it ok to 
 work with
 not so much fuss, but that was PHP4, what about PHP5 ?
 Dont really checked the difference but made a short-scan and found that it 
 had be
 screwed around with ?
 
 Any think, should I change to 5 ?

Yes, even if it's only because PHP4 hasn't been supported in any way, including 
security fixes, since August 7th, 2008! This fact alone makes it pretty 
dangerous to be using it on a public site, and that's without getting into all 
of the improvements that PHP5 has introduced over the past five years!

-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



Re: [PHP] Re: PHP vs JAVA

2013-08-21 Thread Curtis Maurand



Sorry in advance for the top post.

Use the right tool for
the Job.  I've use Java, C# and PHP.

1.  I hate the
Perl-like object calls in PHP.  I'd rather use . notation
in C# and Java.  It saves a lot of wear and tear on my left pinky
finger.
2.  Java and C# are both typed languages.  Say what
you want, but I have working with a string like 02 and have
PHP convert that to an integer.  sometimes I want that zero in
front.  If I want that to be an integer in Java it's int
myInteger = Integer.parseInt(02);

3. 
Java development environments (Eclipses, NetBeans, IBM RAD) are pretty
horrible.  Visual Studio is hands down a better envrionment, even the
older versions of it. I've hooked Visual Studio into SVN in the past and
it works well.

4 PHP development environments are many and
varied and all of them suck at web debugging.  I've used PHPEdit,
Zend, Bluefish, Eclipse and a couple others.  Bluefish works better
on Linux than it does on Windows.

Use the tool for the job at
hand.  

Just my $0.02 worth.

cheers,
Curtis

Tim Streater wrote:
 On 20 Aug 2013 at 23:59,
PHP List phpl...@arashidigital.com wrote:
 

While I don't have any references to back it up - my guess would be
 that
 Java may be seen as more versatile in
general programming terms.  A
 staggering number of
enterprise level web applications are built with
 Java, add
to that the possibility of writing Android apps with the same
 knowledge.
 
 To me the salient point is,
does java has as extensive a library or set of
 interfaces to
other packages (such as SQLite, mysql, etc)?
 
 I
would say that, in general, the other teacher is incorrect speaking
 strictly in terms of web development.  PHP has already won that
crown
 many times over.  That said, when I was in University,
it was difficult
 to find a programming class that taught
anything but Java - and that
 was
 10yrs ago
now.  I chalked it up to the education bubble not being able

to see what the rest of the world is actually doing.
 

Was PHP OOP-capable at the time? Perhaps the edu-bubble was simply
looking
 down its nose at PHP. There being lots of courses proves
nothing in and of
 itself. 20 years ago, there were lots of PC
mags you could buy, which
 caused some folks to say look
how much better the PC is supported than
 other platforms.
Truth was, at the time, such support was needed given
 the mess
of 640k limits, DOS, IRQs and the like, most of which issues have
 ceased to be relevant.
 
 Anyway, why should one
need a course to learn PHP, assuming you already
 know other
languages. It's simple enough.
 
 --
 Cheers 
--  Tim
 
 --
 PHP General Mailing List
(http://www.php.net/)
 To unsubscribe, visit:
http://www.php.net/unsub.php


Re: [PHP] Re: PHP vs JAVA

2013-08-21 Thread Sebastian Krebs
2013/8/21 Curtis Maurand cur...@maurand.com




 Sorry in advance for the top post.

 Use the right tool for
 the Job.  I've use Java, C# and PHP.

 1.  I hate the
 Perl-like object calls in PHP.  I'd rather use . notation
 in C# and Java.  It saves a lot of wear and tear on my left pinky
 finger.


Actually the problem is, that the dot . is already in use. With
$foo.bar() you cannot tell, if you want to call the method bar() on the
object $foo, or if you want to concatenate the value of $foo to the
result of the function bar(). There is no other way around this than a
different operator for method calls.


 2.  Java and C# are both typed languages.  Say what
 you want, but I have working with a string like 02 and have
 PHP convert that to an integer.  sometimes I want that zero in
 front.  If I want that to be an integer in Java it's int
 myInteger = Integer.parseInt(02);

 3.
 Java development environments (Eclipses, NetBeans, IBM RAD) are pretty
 horrible.  Visual Studio is hands down a better envrionment, even the
 older versions of it. I've hooked Visual Studio into SVN in the past and
 it works well.


Ever tried the jetbrains products? :D (No, they  don't pay me)



 4 PHP development environments are many and
 varied and all of them suck at web debugging.  I've used PHPEdit,
 Zend, Bluefish, Eclipse and a couple others.  Bluefish works better
 on Linux than it does on Windows.


I use PhpStorm and it works quite fine.



 Use the tool for the job at
 hand.

 Just my $0.02 worth.

 cheers,
 Curtis

 Tim Streater wrote:
  On 20 Aug 2013 at 23:59,
 PHP List phpl...@arashidigital.com wrote:
 
 
 While I don't have any references to back it up - my guess would be
  that
  Java may be seen as more versatile in
 general programming terms.  A
  staggering number of
 enterprise level web applications are built with
  Java, add
 to that the possibility of writing Android apps with the same
  knowledge.
 
  To me the salient point is,
 does java has as extensive a library or set of
  interfaces to
 other packages (such as SQLite, mysql, etc)?
 
  I
 would say that, in general, the other teacher is incorrect speaking
  strictly in terms of web development.  PHP has already won that
 crown
  many times over.  That said, when I was in University,
 it was difficult
  to find a programming class that taught
 anything but Java - and that
  was
  10yrs ago
 now.  I chalked it up to the education bubble not being able
 
 to see what the rest of the world is actually doing.
 
 
 Was PHP OOP-capable at the time? Perhaps the edu-bubble was simply
 looking
  down its nose at PHP. There being lots of courses proves
 nothing in and of
  itself. 20 years ago, there were lots of PC
 mags you could buy, which
  caused some folks to say look
 how much better the PC is supported than
  other platforms.
 Truth was, at the time, such support was needed given
  the mess
 of 640k limits, DOS, IRQs and the like, most of which issues have
  ceased to be relevant.
 
  Anyway, why should one
 need a course to learn PHP, assuming you already
  know other
 languages. It's simple enough.
 
  --
  Cheers
 --  Tim
 
  --
  PHP General Mailing List
 (http://www.php.net/)
  To unsubscribe, visit:
 http://www.php.net/unsub.php




-- 
github.com/KingCrunch


Re: [PHP] Re: PHP vs JAVA

2013-08-21 Thread Curtis Maurand


Sebastian Krebs wrote:
 2013/8/21 Curtis Maurand
cur...@maurand.com
 



 Sorry in advance for the top post.

 Use the right tool for
 the Job. 
I've use Java, C# and PHP.

 1.  I hate the
 Perl-like object calls in PHP.  I'd rather use .
notation
 in C# and Java.  It saves a lot of wear and tear on
my left pinky
 finger.

 

Actually the problem is, that the dot . is already in use.
With
 $foo.bar() you cannot tell, if you want to call the method
bar() on the
 object $foo, or if you want
to concatenate the value of $foo to the
 result of
the function bar(). There is no other way around this than
a
 different operator for method calls.

I didn't think
of that.  It seems to me there could be an easier operator than -
which sometimes will make me stop and look at what keys I'm trying to
hit.  Just a thought.  I forgot about the concatenation operator
which is + in Java/C#
 
 
 2. 
Java and C# are both typed languages.  Say what
 you want,
but I have working with a string like 02 and have
 PHP convert that to an integer.  sometimes I want that zero
in
 front.  If I want that to be an integer in Java it's
int
 myInteger =
Integer.parseInt(02);

 3.
 Java development environments (Eclipses, NetBeans, IBM RAD) are
pretty
 horrible.  Visual Studio is hands down a better
envrionment, even the
 older versions of it. I've hooked
Visual Studio into SVN in the past and
 it works well.

 
 Ever tried the jetbrains products? :D (No,
they  don't pay me)

I have not, but it looks interesting. 
I'll have to try it.

 
 

 4 PHP development environments are many and

varied and all of them suck at web debugging.  I've used PHPEdit,
 Zend, Bluefish, Eclipse and a couple others.  Bluefish works
better
 on Linux than it does on Windows.

 
 I use PhpStorm and it works quite fine.
 
 

 Use the tool for the job at
 hand.

 Just my $0.02 worth.

 cheers,
 Curtis

 Tim Streater wrote:
  On 20 Aug 2013 at
23:59,
 PHP List phpl...@arashidigital.com wrote:
 
 
 While I don't have
any references to back it up - my guess would be
 
that
  Java may be seen as more versatile in
 general programming terms.  A
  staggering
number of
 enterprise level web applications are built
with
  Java, add
 to that the
possibility of writing Android apps with the same
 
knowledge.
 
  To me the salient point
is,
 does java has as extensive a library or set of
  interfaces to
 other packages (such as
SQLite, mysql, etc)?
 
  I
 would say that, in general, the other teacher is incorrect
speaking
  strictly in terms of web development.  PHP
has already won that
 crown
  many times
over.  That said, when I was in University,
 it was
difficult
  to find a programming class that
taught
 anything but Java - and that
 
was
  10yrs ago
 now.  I chalked it up
to the education bubble not being able
 
 to see what the rest of the world is actually doing.
 
 
 Was PHP OOP-capable at
the time? Perhaps the edu-bubble was simply
 looking
  down its nose at PHP. There being lots of courses
proves
 nothing in and of
  itself. 20 years
ago, there were lots of PC
 mags you could buy, which
  caused some folks to say look
 how much
better the PC is supported than
  other
platforms.
 Truth was, at the time, such support was
needed given
  the mess
 of 640k limits,
DOS, IRQs and the like, most of which issues have
 
ceased to be relevant.
 
  Anyway, why
should one
 need a course to learn PHP, assuming you
already
  know other
 languages. It's simple
enough.
 
  --
 
Cheers
 --  Tim
 
  --
  PHP General Mailing List

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

 


 
 --
 github.com/KingCrunch



Re: [PHP] Re: PHP vs JAVA

2013-08-21 Thread David Harkness
On Wed, Aug 21, 2013 at 7:56 PM, Curtis Maurand cur...@maurand.com wrote:

 Sebastian Krebs wrote:

 Actually the problem is, that the dot . is already in use. With

 $foo.bar() you cannot tell, if you want to call the method bar() on the
  object $foo, or if you want to concatenate the value of $foo to the
  result of the function bar(). There is no other way around this than a
  different operator for method calls.

 I didn't think
 of that.  It seems to me there could be an easier operator than -
 which sometimes will make me stop and look at what keys I'm trying to
 hit.  Just a thought.  I forgot about the concatenation operator
 which is + in Java/C#


The PHP language developers were pretty stuck. Because of automatic
string-to-numeric-conversion, they couldn't use + for string concatenation.
Sadly, they chose . rather than .. which I believe one or two other
languages use. If they had, . would have been available once objects
rolled around in PHP 4/5. I suspect they chose - since that's used in C
and C++ to dereference a pointer.


  Ever tried the jetbrains products? :D (No, they don't pay me)

 I have not, but it looks interesting.
 I'll have to try it.


Those are very good products which have had a strong following for a
decade. The free IDE NetBeans also has quite good support for both Java and
PHP, and the latest beta version provides a web project that provides
front- and back-end debugging of PHP + JavaScript. You can be stepping
through JS code and hit an AJAX call and then seamlessly step through the
PHP code that handles it.

I use NetBeans for PHP/HTML/JS (though I am evaluating JetBrains' PHPStorm
now) and Eclipse for Java. You can't beat Eclipse's refactoring support in
a free tool, though I think NetBeans is close to catching up. I would bet
IntelliJ IDEA for Java by JetBrains is on par at least.

Peace,
David


[PHP] Re: Output to File Instead of Browser

2013-08-20 Thread Jim Giner

On 8/20/2013 12:38 PM, Floyd Resler wrote:

I have a php file that generates a form.  Of course, this displays in the 
browser.  How can I have the form generated from my script but either saved to 
a file or the output returned to another script?

Thanks!
Floyd


Store your generated web page (from !doctype to /html) in a variable. 
 Then either use file_put_contents or save the var to a session one and 
call the next script.


That's what I would do, if I ever found myself needing to do
such a thing.

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



[PHP] Re: Why the difference in email transit times?

2013-08-13 Thread Ian
On 13/08/2013 16:20, Tedd Sperling wrote:
 Hi gang:
 
 I'm using the class.phpmailer.php code to send email -- it works neat -- very 
 classy (no pun intended).
 
 I can send an email from my sperling.com domain and it arrives almost 
 immediately.
 
 However, when I use the exact same code (except for the FROM address) from 
 kvyv.com (another domain I own), the email literally takes hours (up to 12) 
 to arrive.
 
 Any idea of why there is a difference of email transit times between the two 
 domains?
 
 Cheers,
 
 tedd
 
 PS: Note, my receiving email addresses are handled by gmail.com.

Hi,

Have a look at the Received: headers of each email.  They are in
reverse order.  I.e. the one at the top is the most recently added.

Take into account timezone differences too.


12 hours seems like a very long time for a delay.  I suspect one of the
receiving hosts in the chain employs greylisting, and the sending
network employs many different sending servers (ie like Google) in a
round-robin fashion.  The greylisting server may not be configured to
recognise the many different servers as one 'set'.

All speculation of course ;)

Feel free to send the headers off list and I'll take a look.

Regards

Ian
-- 







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



[PHP] Re: gibberish output when using the loadHTMLFile() function.

2013-08-12 Thread Maciek Sokolewicz

On 12-8-2013 2:54, atar wrote:

Hi there!!

When I'm trying to load an external html document with the
loadHTMLFile() function and then I use the saveHTML() function to output
its content, some text in the external html document which is written in
hebrew is displayed in a gibberish format. is anyone here has an idea
how to solve this problem?

NOTE: the document itself is encoded in utf-8 character set.

Thanks in advance!!

atar.


First of all, stop triple-posting to each list. Choose one address, and 
stick to it.


As for your question; the character set needs to be announced as well as 
set. So to display in UTF-8, you need to:

1. make sure the document is actually encoded using the UTF-8 charset
2. make sure the browser recieves an HTTP header which tells it the 
content is in UTF-8: header('Content-type: text/html; charset=utf-8')
3. make sure the document itself states its encoding is UTF-8 (usually 
done using a meta http-equiv=Content-Type content=text/html; 
charset=utf8/


If your output conforms to all three of these, it will work. It probably 
does not conform to it however.

- Tul
- Tul

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



[PHP] Re: How to upstream code changes to php community

2013-08-12 Thread David Robley
Shahina Rabbani wrote:

 Hi,
 
 I have done some modifications to the php source code and i tested it with
 php bench and I observed  some improvement.
 
 I wanted to upstream these code changes to PHP community.
 I searched the wed but i didnt find proper guide to upstream the code to
 php.
 
 Please help me by  providing the information how to upstream my code
 changes to php  source code community.
 
 
 Thanks,
 Shahina Rabbani

Start with https://github.com/php/php-
src/blob/master/README.SUBMITTING_PATCH which is linked from the Community 
menu item on the PHP home page.

-- 
Cheers
David Robley

Enter any 11-digit prime number to continue...


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



[PHP] Re: Operand error...

2013-08-08 Thread Jim Giner

On 8/8/2013 1:32 PM, Karl-Arne Gjersøyen wrote:

$oppdater_lager_med_antall_kg = $kg_pa_lager +
$kg_fra_transportdokument_inn_pa_valgt_lager;


result:
*Fatal error*: Unsupported operand types in *
/Users/karl/Sites/kasen/io/kp/index.php* on line *2970

*I have also tried this:
$kg_pa_lager += $kg_fra_transportdokument_inn_pa_valgt_lager;

Both of them return this Fatal error.
I am using Dreamweaver CS6 and the syntax check in my software say: No
syntax error

What am I doing wrong this time?

Thanks for your good advice!

Karl


You do a var_dump on each variable to see what type they were defined as.

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



Re: [PHP] Re: Operand error...

2013-08-08 Thread Karl-Arne Gjersøyen
2013/8/8 Jim Giner jim.gi...@albanyhandball.com

 On 8/8/2013 1:32 PM, Karl-Arne Gjersøyen wrote:

 $oppdater_lager_med_antall_kg = $kg_pa_lager +
 $kg_fra_transportdokument_inn_**pa_valgt_lager;


 result:
 *Fatal error*: Unsupported operand types in *
 /Users/karl/Sites/kasen/io/kp/**index.php* on line *2970

 *I have also tried this:

 $kg_pa_lager += $kg_fra_transportdokument_inn_**pa_valgt_lager;

 Both of them return this Fatal error.
 I am using Dreamweaver CS6 and the syntax check in my software say: No
 syntax error

 What am I doing wrong this time?

 Thanks for your good advice!

 Karl

  You do a var_dump on each variable to see what type they were defined as.


NULL array(2) { [0]= string(3) 100 [1]= string(3) 340 }


Re: [PHP] Re: Operand error...

2013-08-08 Thread Jim Giner

On 8/8/2013 1:43 PM, Karl-Arne Gjersøyen wrote:

2013/8/8 Jim Giner jim.gi...@albanyhandball.com


On 8/8/2013 1:32 PM, Karl-Arne Gjersøyen wrote:


$oppdater_lager_med_antall_kg = $kg_pa_lager +
$kg_fra_transportdokument_inn_**pa_valgt_lager;


result:
*Fatal error*: Unsupported operand types in *
/Users/karl/Sites/kasen/io/kp/**index.php* on line *2970

*I have also tried this:

$kg_pa_lager += $kg_fra_transportdokument_inn_**pa_valgt_lager;

Both of them return this Fatal error.
I am using Dreamweaver CS6 and the syntax check in my software say: No
syntax error

What am I doing wrong this time?

Thanks for your good advice!

Karl

  You do a var_dump on each variable to see what type they were defined as.



NULL array(2) { [0]= string(3) 100 [1]= string(3) 340 }


That is one var. What is the other var?

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



Re: [PHP] Re: Operand error...

2013-08-08 Thread Karl-Arne Gjersøyen
2013/8/8 Jim Giner jim.gi...@albanyhandball.com

 On 8/8/2013 1:43 PM, Karl-Arne Gjersøyen wrote:

 2013/8/8 Jim Giner jim.gi...@albanyhandball.com

  On 8/8/2013 1:32 PM, Karl-Arne Gjersøyen wrote:

  $oppdater_lager_med_antall_kg = $kg_pa_lager +
 $kg_fra_transportdokument_inn_pa_valgt_lager;



 result:
 *Fatal error*: Unsupported operand types in *
 /Users/karl/Sites/kasen/io/kp/index.php* on line *2970


 *I have also tried this:

 $kg_pa_lager += $kg_fra_transportdokument_inn_pa_valgt_lager;


 Both of them return this Fatal error.
 I am using Dreamweaver CS6 and the syntax check in my software say: No
 syntax error

 What am I doing wrong this time?

 Thanks for your good advice!

 Karl

   You do a var_dump on each variable to see what type they were defined
 as.



 NULL array(2) { [0]= string(3) 100 [1]= string(3) 340 }

  That is one var. What is the other var?


Thank you very much!
Now I know the error.. One of those variables are NULL! When I fix it I
think it work!

Karl


Re: [PHP] Re: Operand error...

2013-08-08 Thread Jim Giner

On 8/8/2013 1:56 PM, Karl-Arne Gjersøyen wrote:

2013/8/8 Jim Giner jim.gi...@albanyhandball.com


On 8/8/2013 1:43 PM, Karl-Arne Gjersøyen wrote:


2013/8/8 Jim Giner jim.gi...@albanyhandball.com

  On 8/8/2013 1:32 PM, Karl-Arne Gjersøyen wrote:


  $oppdater_lager_med_antall_kg = $kg_pa_lager +

$kg_fra_transportdokument_inn_pa_valgt_lager;



result:
*Fatal error*: Unsupported operand types in *
/Users/karl/Sites/kasen/io/kp/index.php* on line *2970


*I have also tried this:

$kg_pa_lager += $kg_fra_transportdokument_inn_pa_valgt_lager;


Both of them return this Fatal error.
I am using Dreamweaver CS6 and the syntax check in my software say: No
syntax error

What am I doing wrong this time?

Thanks for your good advice!

Karl

   You do a var_dump on each variable to see what type they were defined
as.





NULL array(2) { [0]= string(3) 100 [1]= string(3) 340 }

  That is one var. What is the other var?



Thank you very much!
Now I know the error.. One of those variables are NULL! When I fix it I
think it work!

Karl

actually, the null is ok I think.  The array is wrong - you can't 'add' 
an array to a scalar variable, which an integer or null is.


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



Re: [PHP] Re: Operand error...

2013-08-08 Thread Karl-Arne Gjersøyen
2013/8/8 Jim Giner jim.gi...@albanyhandball.com

 On 8/8/2013 1:56 PM, Karl-Arne Gjersøyen wrote:

 2013/8/8 Jim Giner jim.gi...@albanyhandball.com

  On 8/8/2013 1:43 PM, Karl-Arne Gjersøyen wrote:

  2013/8/8 Jim Giner jim.gi...@albanyhandball.com

   On 8/8/2013 1:32 PM, Karl-Arne Gjersøyen wrote:


   $oppdater_lager_med_antall_kg = $kg_pa_lager +

 $kg_fra_transportdokument_inn_**pa_valgt_lager;




 result:
 *Fatal error*: Unsupported operand types in *
 /Users/karl/Sites/kasen/io/kp/**index.php* on line *2970



 *I have also tried this:

 $kg_pa_lager += $kg_fra_transportdokument_inn_**pa_valgt_lager;



 Both of them return this Fatal error.
 I am using Dreamweaver CS6 and the syntax check in my software say:
 No
 syntax error

 What am I doing wrong this time?

 Thanks for your good advice!

 Karl

You do a var_dump on each variable to see what type they were
 defined
 as.



 NULL array(2) { [0]= string(3) 100 [1]= string(3) 340 }

   That is one var. What is the other var?



 Thank you very much!
 Now I know the error.. One of those variables are NULL! When I fix it I
 think it work!

 Karl

  actually, the null is ok I think.  The array is wrong - you can't 'add'
 an array to a scalar variable, which an integer or null is.


Yes, it is me and arrays again :D

$resultat = mysql_query($sql, $tilkobling) or die(mysql_error());
$antall = mysql_num_rows($resultat);
for($i = 0; $i  $antall; $i++){
$rad = mysql_fetch_array($resultat, MYSQL_ASSOC);

and write it tis way can perhaps make someting more correct?
For example $variable[$i] ?

Karl


Re: [PHP] Re: Operand error...

2013-08-08 Thread Jim Giner

On 8/8/2013 2:11 PM, Karl-Arne Gjersøyen wrote:

2013/8/8 Jim Giner jim.gi...@albanyhandball.com


On 8/8/2013 1:56 PM, Karl-Arne Gjersøyen wrote:


2013/8/8 Jim Giner jim.gi...@albanyhandball.com

  On 8/8/2013 1:43 PM, Karl-Arne Gjersøyen wrote:


  2013/8/8 Jim Giner jim.gi...@albanyhandball.com


   On 8/8/2013 1:32 PM, Karl-Arne Gjersøyen wrote:



   $oppdater_lager_med_antall_kg = $kg_pa_lager +


$kg_fra_transportdokument_inn_**pa_valgt_lager;




result:
*Fatal error*: Unsupported operand types in *
/Users/karl/Sites/kasen/io/kp/**index.php* on line *2970



*I have also tried this:

$kg_pa_lager += $kg_fra_transportdokument_inn_**pa_valgt_lager;



Both of them return this Fatal error.
I am using Dreamweaver CS6 and the syntax check in my software say:
No
syntax error

What am I doing wrong this time?

Thanks for your good advice!

Karl

You do a var_dump on each variable to see what type they were
defined
as.





NULL array(2) { [0]= string(3) 100 [1]= string(3) 340 }

   That is one var. What is the other var?





Thank you very much!
Now I know the error.. One of those variables are NULL! When I fix it I
think it work!

Karl

  actually, the null is ok I think.  The array is wrong - you can't 'add'

an array to a scalar variable, which an integer or null is.



Yes, it is me and arrays again :D

$resultat = mysql_query($sql, $tilkobling) or die(mysql_error());
 $antall = mysql_num_rows($resultat);
 for($i = 0; $i  $antall; $i++){
 $rad = mysql_fetch_array($resultat, MYSQL_ASSOC);

and write it tis way can perhaps make someting more correct?
For example $variable[$i] ?

Karl

Not sure what your question is now.  But - $rad will contain a single 
row of values here, all in an array such as 
$rad['field_name1'],$rad['field_name2'],$rad['field_name3'],  .


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



[PHP] Re: Stripe Connect in the UK + PHP Integration.

2013-08-06 Thread Richard Quadling
On 19 July 2013 16:22, Richard Quadling rquadl...@gmail.com wrote:

 Hi.

 Simple question.

 Has anyone got Stripe Connect, Stripe.js and Stripe PHP SDK operational in
 the UK.

 I'm struggling getting the UK Beta to accept a new account/customer set
 for a UK business or individual, accepting GBP.

 And I'm in the UK Beta!

 Any help would be appreciated. Off list if preferred.

 Regards,

 Richard Quadling.


Just in case anyone comes back with this, I've got it sorted.

The UK Beta is by invite only. So to get our merchants signed up, we had to
email them an invite. They then register, authenticate and then authorise
our app with their account. Very long winded and unnecessary. Fortunately,
Stripe fixed it for us (well, others too probably). Now the signup is via
our app (just like GoCardless) and all working well.

So. Stripe UK is on it's way. Hopefully!


Just seen the price of stripe.co.uk ... £22,000! Ha!



-- 
Richard Quadling
Twitter : @RQuadling


[PHP] Re: how to see all sessions sets in server

2013-08-05 Thread Alessandro Pellizzari
Il Sun, 04 Aug 2013 20:47:37 +0430, Farzan Dalaee ha scritto:

Please use better quoting.

 So best way is use a script(javascript) to send ajax to server every 5
 second to check users is logged in or not? Is that okey?

It depends.

 I want to write chat module like facebook and i need a solution to find
 online users and way to send messages when users chat together, does any
 one write similar module like that?

Then knowing who is online is maybe the last of your problems.

You have to find a way to send the message to user B when user A 
writes something.

You absolutely need javascript. You just need to find out how to connect 
to the server. Have a look at socket.io, and find a php library that 
supports it. I think it is the easiets way.

Be aware that the load on your server will be huge, growing exponentially 
with the number of online users. You can't escape it, except by using 
different technologies (XMPP as a protocol, with a javascript client, or 
using node.js with socket.io, for example)

Bye.



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



[PHP] Re: how to see all sessions sets in server

2013-08-04 Thread Alessandro Pellizzari
Il Sun, 04 Aug 2013 13:32:55 +0430, Farzan Dalaee ha scritto:

 hi i want to write online user module for my site and i want to check
 $_SESSION['userID'] to find all users id who loged in but when i echo
 this code its return only current user detail how i can see all
 sessions?

You can't.

  or how i handle online users?

Every user has its session.

If you want to have a super user who has access to all the sessions, 
you can use the filesystem functions to read the directory in which the 
sessions get saved (it depends on the server configuration) or you can 
implement a session handler to save all the sessions in the database, and 
give access to that table to one user.

Bye.



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



[PHP] Re: how to see all sessions sets in server

2013-08-04 Thread Tim Streater
On 04 Aug 2013 at 11:28, Ashley Sheridan a...@ashleysheridan.co.uk wrote: 

 Like Matijn said, unless you're using some kind of client-side method to
 continually poll the server, you can't know if they've just closed their
 browser. There are Javascript events for exiting a page, but they don't
 work correctly on Safari and iOS Safari.

onbeforeunload works fine in Safari; I use it all the time.

--
Cheers  --  Tim

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

Re: [PHP] Re: how to see all sessions sets in server

2013-08-04 Thread Ashley Sheridan
On Sun, 2013-08-04 at 13:27 +0100, Tim Streater wrote:

 On 04 Aug 2013 at 11:28, Ashley Sheridan a...@ashleysheridan.co.uk wrote: 
 
  Like Matijn said, unless you're using some kind of client-side method to
  continually poll the server, you can't know if they've just closed their
  browser. There are Javascript events for exiting a page, but they don't
  work correctly on Safari and iOS Safari.
 
 onbeforeunload works fine in Safari; I use it all the time.
 
 --
 Cheers  --  Tim
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


Apparently it has problems when browsing in porn mode, and mobile
safari has major problems with it. I'm basing this on previous posts on
forums I've been on, so it might have been fixed now, but I don't know
for sure either way.

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




[PHP] Re: What the hell is Begacom?

2013-08-04 Thread Jonesy
On Sun, 4 Aug 2013 14:02:07 +0200, Camilo Sperberg wrote:

 Sent from my iPhone 6 Beta [Confidential use only]

You need not apologize. :-)


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



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

2013-08-02 Thread Jim Giner

On 8/2/2013 6:58 AM, Karl-Arne Gjersøyen wrote:

Hello again, folks!
I wish to delete records in my database that is older than 3 months.

$todays_date = date('Y-m-d');
$old_records_to_delete =  ???

if($old_records_to_delete){
include(connect.php);
$sql = DELETE FROM table WHERE date = '$old_records_to_delete';
mysql_query($sql, $connect_db) or die(mysql_error());
}

Thank you very much for your help to understand also this question :)

Karl


So close!  BUT - you need to reverse your test.

where date = '$old_records_to_delete'



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



[PHP] Re: SELECT data base on a upper level SELECT

2013-08-01 Thread Jim Giner

On 7/31/2013 9:37 PM, iccsi wrote:

I have 5 SELECT for Department, Manager, supervisor, Group Leader and
Employees
I want to every SELECT list narrow down for an upper SELECT.
For example, once user select Department then all Manager, Supervisor,
Group Leader and Employee list will be narrow down by department and
same for manager and supervisor and so on.

I can use iframe or jQuery to do every level, but it needs to call
iframe or jQuery to 5 levels.
I would like to know are there any better way to handle this situation,

Your help and information is great appreciated,

Regards,


Iccsi,

How about using just one select and add variables to the where clause? 
Set the variable(s) to the values that you want to filter on.


For ex.:

your query is
$sel = 1;
$q = select Department, Manager, supervisor, Group Leader,Employees 
where $sel;


Then when the user selects a department $d:

$sel = Department = '$d';

OR if you have selected a department $d and a manager $m:

$sel = Department ='$d' and Manager='$m';

One query.  A variable 'where' clause.

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



[PHP] Re: SELECT data base on a upper level SELECT

2013-08-01 Thread iccsi

Thanks for the information and help,
The query can solve server side, but client side, user might select any one 
dropdown, for example, user might select manager from drop down without 
choose Department dropdown.


For this case, application needs inject data for supervisor and lower level,

Thanks again for helping,

Regards,

Iccsi,

Jim Giner  wrote in message news:8c.41.29774.c0e5a...@pb1.pair.com...

On 7/31/2013 9:37 PM, iccsi wrote:

I have 5 SELECT for Department, Manager, supervisor, Group Leader and
Employees
I want to every SELECT list narrow down for an upper SELECT.
For example, once user select Department then all Manager, Supervisor,
Group Leader and Employee list will be narrow down by department and
same for manager and supervisor and so on.

I can use iframe or jQuery to do every level, but it needs to call
iframe or jQuery to 5 levels.
I would like to know are there any better way to handle this situation,

Your help and information is great appreciated,

Regards,


Iccsi,


How about using just one select and add variables to the where clause?
Set the variable(s) to the values that you want to filter on.

For ex.:

your query is
$sel = 1;
$q = select Department, Manager, supervisor, Group Leader,Employees
where $sel;

Then when the user selects a department $d:

$sel = Department = '$d';

OR if you have selected a department $d and a manager $m:

$sel = Department ='$d' and Manager='$m';

One query.  A variable 'where' clause. 



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



Re: [PHP] Re: SELECT data base on a upper level SELECT

2013-08-01 Thread jomali
On Thu, Aug 1, 2013 at 6:33 PM, iccsi inu...@gmail.com wrote:

 Thanks for the information and help,
 The query can solve server side, but client side, user might select any
 one dropdown, for example, user might select manager from drop down without
 choose Department dropdown.

 For this case, application needs inject data for supervisor and lower
 level,


No, simply prevent client from submitting form until all required fields
are filled in. (A blindingly simple procedure).


 Thanks again for helping,

 Regards,

 Iccsi,

 Jim Giner  wrote in message news:8C.41.29774.C0E5AF15@pb1.**pair.com...

 On 7/31/2013 9:37 PM, iccsi wrote:

 I have 5 SELECT for Department, Manager, supervisor, Group Leader and
 Employees
 I want to every SELECT list narrow down for an upper SELECT.
 For example, once user select Department then all Manager, Supervisor,
 Group Leader and Employee list will be narrow down by department and
 same for manager and supervisor and so on.

 I can use iframe or jQuery to do every level, but it needs to call
 iframe or jQuery to 5 levels.
 I would like to know are there any better way to handle this situation,

 Your help and information is great appreciated,

 Regards,


 Iccsi,

  How about using just one select and add variables to the where clause?
 Set the variable(s) to the values that you want to filter on.

 For ex.:

 your query is
 $sel = 1;
 $q = select Department, Manager, supervisor, Group Leader,Employees
 where $sel;

 Then when the user selects a department $d:

 $sel = Department = '$d';

 OR if you have selected a department $d and a manager $m:

 $sel = Department ='$d' and Manager='$m';

 One query.  A variable 'where' clause.

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




[PHP] Re: OPcache Instead of APC Now?

2013-07-30 Thread Jan Ehrhardt
Timmy Turner in php.general (Tue, 30 Jul 2013 19:02:43 +0200):
I was looking through the changelog for PHP 5.5 and noticed the Zend
OPcache. Will this be replacing APC? (Is APC still being maintained?)

The reason I'm asking is because I use APC's data caching feature heavily,
which Zend's OPcache (currently) does not offer. Given that APC's shared
memory cache is probably as fast as (non-distributed) caching gets (for PHP
anyways), it would be a shame to see it go in the future.

OPcache will replace APC eventually, because APC had too many issues
under PHP 5.5. For APC's data caching you should take a look at APCU
(APC without the opcode cache): https://github.com/krakjoe/apcu

Jan

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



[PHP] Re: What wrong am I doing now?

2013-07-24 Thread Jim Giner

On 7/24/2013 8:19 AM, Karl-Arne Gjersøyen wrote:

mysql SELECT DATE_FORMAT(dato, '%e-%c-%Y') FROM transportdokument WHERE
dato = '2013-07-20' AND dato = '2013-07-24' GROUP BY dato DESC;
+---+
| DATE_FORMAT(dato, '%e-%c-%Y') |
+---+
| 24-7-2013 |
| 23-7-2013 |
+---+
2 rows in set (0.00 sec)

mysql


// My PHP code looks like this.
// -
$sql = SELECT DATE_FORMAT(dato, '%e-%c-%Y') FROM transportdokument WHERE
dato = '2013-07-20' AND dato = '2013-07-24' GROUP BY dato DESC;
$resultat = mysql_query($sql, $tilkobling) or die(mysql_error());

while($rad = mysql_fetch_array($resultat)){
$dato = $rad['dato'];
var_dump($dato);

I gott NULL,NULL here and believe it is something with my PHP Source that
is wrong when using DATE_FORMAT. As you see above it work in terminal.

I hope this not is off-topic for the list. If so, I am sorry for it and
hope you can give me advice about a good MySQL list for newbie's.

Thanks again for your help!

Karl


Add a check on the query result to be sure your query actually ran.
 $resultat = mysql_query($sql, $tilkobling) or die(mysql_error());

if (!$resultat)
{
   echo Query failed to run - .mysql_error();
   exit();
}
 while($rad = mysql_fetch_array($resultat)){

...


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



Re: [PHP] Re: What wrong am I doing now?

2013-07-24 Thread Matijn Woudt
On Wed, Jul 24, 2013 at 2:45 PM, Jim Giner jim.gi...@albanyhandball.comwrote:

 On 7/24/2013 8:19 AM, Karl-Arne Gjersøyen wrote:

 mysql SELECT DATE_FORMAT(dato, '%e-%c-%Y') FROM transportdokument WHERE
 dato = '2013-07-20' AND dato = '2013-07-24' GROUP BY dato DESC;
 +-**--+
 | DATE_FORMAT(dato, '%e-%c-%Y') |
 +-**--+
 | 24-7-2013 |
 | 23-7-2013 |
 +-**--+
 2 rows in set (0.00 sec)

 mysql


 // My PHP code looks like this.
 // --**---
 $sql = SELECT DATE_FORMAT(dato, '%e-%c-%Y') FROM transportdokument WHERE
 dato = '2013-07-20' AND dato = '2013-07-24' GROUP BY dato DESC;
 $resultat = mysql_query($sql, $tilkobling) or die(mysql_error());

 while($rad = mysql_fetch_array($resultat)){
 $dato = $rad['dato'];
 var_dump($dato);

 I gott NULL,NULL here and believe it is something with my PHP Source that
 is wrong when using DATE_FORMAT. As you see above it work in terminal.

 I hope this not is off-topic for the list. If so, I am sorry for it and
 hope you can give me advice about a good MySQL list for newbie's.

 Thanks again for your help!

 Karl

  Add a check on the query result to be sure your query actually ran.

  $resultat = mysql_query($sql, $tilkobling) or die(mysql_error());
 
 if (!$resultat)
 {
echo Query failed to run - .mysql_error();
exit();
 }
  while($rad = mysql_fetch_array($resultat)){
 
 ...


Jim,

He already has that...

- Matijn


Re: [PHP] Re: What wrong am I doing now?

2013-07-24 Thread Jim Giner



Jim,

He already has that...

- Matijn


oops

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



[PHP] Re: How to extract php source code from joomla

2013-07-23 Thread Tedd Sperling
On Jul 23, 2013, at 12:15 AM, elk dolk elkd...@yahoo.com wrote:

 I study for MSc degree at university.
 
  Are you in an advanced class?

Ok, congratulations -- you are studying for an MSc -- but that didn't answer 
the question.

So, let me repeat the question:

[1] Are you in an advanced PHP class?

[2] Or is this just an introductory class?


If [1], then the coursework might be understandable, but still very difficult.

If [2], that is far more than what I teach as an Introduction to PHP course.


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] Re: Foreach and mydql_query problem

2013-07-22 Thread Tim Streater
On 22 Jul 2013 at 12:56, Karl-Arne Gjersøyen karlar...@gmail.com wrote: 

 Yes, i know that only one a singe row is updated and that is the problem.
 What can I do to update several rows at the same time?

Which several rows? The row that will be updated is that (or those) that match 
your WHERE clause. Seems to me you should make sure your WHERE is correct.

--
Cheers  --  Tim

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

[PHP] Re: Foreach and mydql_query problem

2013-07-22 Thread Karl-Arne Gjersøyen
2013/7/22 Tim Streater t...@clothears.org.uk

 On 22 Jul 2013 at 12:56, Karl-Arne Gjersøyen karlar...@gmail.com wrote:

  Yes, i know that only one a singe row is updated and that is the problem.
  What can I do to update several rows at the same time?

 Which several rows? The row that will be updated is that (or those) that
 match your WHERE clause. Seems to me you should make sure your WHERE is
 correct.


Thanks, Tim.
Yes the form is generated in a while loop and have input type=number
name=number_of_items[] size=6 value=?php echo $item; ?. This
field is in several product rows and when I update the form the foreach
loop write all (5) products correct. But the other way: Update actual rows
in the  database did not work. Only the latest row is updated..

Karl


[PHP] Re: query order issue

2013-07-20 Thread Jim Giner

On 7/20/2013 12:21 PM, dealTek wrote:

Hi all,


I have a page that starts with several mysql sql query searches and displays 
data below...

then I added a form (with hidden line do-update value UPDATE) on the same 
page with action to same page...


then above other sql queries - I put...

if ((isset($_POST[do-update]))  ($_POST[do-update] == update)) {

---do update query---

echo 'meta http-equiv=refresh content=0; url=gohere.php';

}

but it shows error that happens AFTER the meta http-equiv=refresh has happened


Catchable fatal error: xxx on line 226



BTW - the meta http-equiv=refresh does work but the error flashes 1st for a 
second...

Q: I would have thought that it would not go past the line - meta 
http-equiv=refresh - but it does any insight on this






--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-3]


YOu are checking for a value of 'update' but you stated that the value 
clause was 'UPDATE'



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



[PHP] Re: query order issue

2013-07-20 Thread Jim Giner

On 7/20/2013 12:21 PM, dealTek wrote:

Hi all,


I have a page that starts with several mysql sql query searches and displays 
data below...

then I added a form (with hidden line do-update value UPDATE) on the same 
page with action to same page...


then above other sql queries - I put...

if ((isset($_POST[do-update]))  ($_POST[do-update] == update)) {

---do update query---

echo 'meta http-equiv=refresh content=0; url=gohere.php';

}

but it shows error that happens AFTER the meta http-equiv=refresh has happened


Catchable fatal error: xxx on line 226



BTW - the meta http-equiv=refresh does work but the error flashes 1st for a 
second...

Q: I would have thought that it would not go past the line - meta 
http-equiv=refresh - but it does any insight on this






--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-3]


YOu are checking for a value of 'update' but you stated that the value 
clause was 'UPDATE'



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



[PHP] Re: zend framework getIdentity

2013-07-19 Thread Dan Joseph
On Wed, Jul 17, 2013 at 5:54 PM, Dan Joseph dmjos...@gmail.com wrote:

 Fatal error: Uncaught exception 'Zend_Session_Exception' with message
 'Zend_Session::start() -
 /product/Messenger-dev/Messenger/library/Zend/Session.php(Line:480): Error
 #2 Class __PHP_Incomplete_Class has no unserializer Array' in
 /product/Messenger-dev/Messenger/library/Zend/Session.php:493


I see I've stumped everyone here, so I wanted to post a reply on what I
found is the root cause of this.

Somewhere in all the code, there's a session_start happening.  Then
elsewhere that our other developer is working, there was another
introduced.  This appears to be the trigger for this error.

Hope this helps someone in the future!

-- 
-Dan Joseph

http://www.danjoseph.me
http://www.dansrollingbbq.com
http://www.youtube.com/DansRollingBBQ


[PHP] Re: Premature end of script

2013-07-17 Thread Jim Giner

On 7/17/2013 11:22 AM, R B wrote:

Hello,

5 years ago, y developed a php system and was working fine. But 20 days
ago, when y try to access to some pages (not all the pages), in the log
appears this message and the page is not displayed:

== /usr/local/apache/logs/error_log ==
[Wed Jul 3 02:36:58 2013] [error] [client 10.30.6.161] Premature end of
script
headers: /home/capitale/public_html/miembros/myscript.php

Can you help me please with this error?

Thank you.

Since you state that you haven't made any changes to the system (in 
general), I'm going to guess that you modified an 'included' file and it 
has an error in it, such as an unmatched curly brace.  As Dan said, turn 
on all error checking and reporting and see what message you get.


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



[PHP] Re: Error checking ON

2013-07-17 Thread Jim Giner

On 7/17/2013 11:49 AM, Tedd Sperling wrote:

Hi gang:

Considering:

On Jul 17, 2013, at 11:41 AM, Jim Giner jim.gi...@albanyhandball.com wrote:


Since you state that you haven't made any changes to the system (in general), 
I'm going to guess that you modified an 'included' file and it has an error in 
it, such as an unmatched curly brace.  As Dan said, turn on all error checking 
and reporting and see what message you get.


This is what I do for error checking:

ini_set('error_reporting', E_ALL | E_STRICT);
ini_set('display_errors', 'On');
ini_set('log_errors', 'On');
ini_set('error_log', 'error_log');  

Is this:

1. Sufficient?

2. An overkill?

3. OK?

4. OR, better served with this (and provide an example).

Cheers,

tedd

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

When I'm in development mode, I leave out the last two settings and take 
my error messages from the screen.  Simpler, quicker.  I use an include 
file that is based upon a switch.  When it's on, I set my devl settings, 
when not, I set my prod settings.


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



[PHP] Re: Hmmm.. I think I need your advice here to get in correct direction...

2013-07-10 Thread Jim Giner

On 7/10/2013 8:30 AM, Karl-Arne Gjersøyen wrote:

I am almost ready with my learning project in PHP/MySQL.
I can register new product in stock.
Add and increase the number and weight.
I can move products between different storehouses
I can also transfer products from store and onto a truck document but
that's it and here I need some advice.

I like to register new products and the amount in number (for example 4)
and weight in kg.

I like to write it in this way:
Dynamite - package 4 - Weight 200 kg
Lunt - Package 10


Show us your code?

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



[PHP] Re: Fwd: Hmmm.. I think I need your advice here to get in correct direction...

2013-07-10 Thread Jim Giner

On 7/10/2013 8:37 AM, Karl-Arne Gjersøyen wrote:

Sorry, the first mail in this subject run out for me. This is an updated
one.



I am almost ready with my learning project in PHP/MySQL.
I can register new product in stock.
Add and increase the number and weight.
I can move products between different storehouses
I can also transfer products from store and onto a truck document but
that's it and here I need some advice.

I like to register new products and the amount in number (for example 4)
and weight in kg.

I like to write it in this way:
Dynamite - package 4 - Weight 200 kg
Lunt - Package 10 - Weight 10kg

Then I like to 4+10 = 14
and 200+10 = 210.

It shall looks like this:
==
Dynamite |  4  | 200
Lunt | 10 |  10
--
TOTAL| 14 | 210

It is easy to register this product by product on their own row.
but in what way can I multiply them? ned products be stored in arrays?
I think it will be similar to shopping cart in online store but i have no
clue about how to do this.
If you have links to pages were i can learn am i Happy for it. If you can
help me here is even better.

Thanks for your time and effort to learn me programming.

Karl





Ahhh.

So - you should run a query that selects the products and information 
that you want.  Then you start by creating an html table header and then 
loop through your query results and echo a table row for each result row.


// start the table
echo table border=1;
echo trthProduct/ththAmount/th/tr;

// loop thru each item found
while ($results = $qrslts-fetch(PDO::FETCH_ASSOC))
{
   echo 
trtd.$results['product_name']./tdtd.$results['product_amt']./td/tr;

}

// finish the table html
echo /table;




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



Re: [PHP] Re: Fwd: Hmmm.. I think I need your advice here to get in correct direction...

2013-07-10 Thread Karl-Arne Gjersøyen
2013/7/10 Jim Giner jim.gi...@albanyhandball.com

 On 7/10/2013 8:37 AM, Karl-Arne Gjersøyen wrote:

 Sorry, the first mail in this subject run out for me. This is an updated
 one.



 I am almost ready with my learning project in PHP/MySQL.
 I can register new product in stock.
 Add and increase the number and weight.
 I can move products between different storehouses
 I can also transfer products from store and onto a truck document but
 that's it and here I need some advice.

 I like to register new products and the amount in number (for example 4)
 and weight in kg.

 I like to write it in this way:
 Dynamite - package 4 - Weight 200 kg
 Lunt - Package 10 - Weight 10kg

 Then I like to 4+10 = 14
 and 200+10 = 210.

 It shall looks like this:
 ==**
 Dynamite |  4  | 200
 Lunt | 10 |  10
 --**--**--
 TOTAL| 14 | 210

 It is easy to register this product by product on their own row.
 but in what way can I multiply them? ned products be stored in arrays?
 I think it will be similar to shopping cart in online store but i have no
 clue about how to do this.
 If you have links to pages were i can learn am i Happy for it. If you can
 help me here is even better.

 Thanks for your time and effort to learn me programming.

 Karl




  Ahhh.

 So - you should run a query that selects the products and information that
 you want.  Then you start by creating an html table header and then loop
 through your query results and echo a table row for each result row.

 // start the table
 echo table border=1;
 echo trthProduct/thth**Amount/th/tr;

 // loop thru each item found
 while ($results = $qrslts-fetch(PDO::FETCH_**ASSOC))
 {
echo trtd.$results['product_**name']./tdtd.$results['**
 product_amt']./td/tr;
 }

 // finish the table html
 echo /table;


Yes that part is OK. I do have problem to add total weight and package at
bottom of the table like this:

Product_one   40kg
Product_two   60kg
-
Total: 100kg
===

Because sometimes it is only a few products and other times many products.
I then need to summing them at bottom. One timer only 3 rows, other times
20 rows. The program need a way to add every singel product and see if it's
a few or many,

Karl


Re: [PHP] Re: Fwd: Hmmm.. I think I need your advice here to get incorrect direction...

2013-07-10 Thread Jim Giner

On 7/10/2013 9:07 AM, Karl-Arne Gjersøyen wrote:

2013/7/10 Jim Giner jim.gi...@albanyhandball.com


On 7/10/2013 8:37 AM, Karl-Arne Gjersøyen wrote:


Sorry, the first mail in this subject run out for me. This is an updated
one.



I am almost ready with my learning project in PHP/MySQL.
I can register new product in stock.
Add and increase the number and weight.
I can move products between different storehouses
I can also transfer products from store and onto a truck document but
that's it and here I need some advice.

I like to register new products and the amount in number (for example 4)
and weight in kg.

I like to write it in this way:
Dynamite - package 4 - Weight 200 kg
Lunt - Package 10 - Weight 10kg

Then I like to 4+10 = 14
and 200+10 = 210.

It shall looks like this:
==**
Dynamite |  4  | 200
Lunt | 10 |  10
--**--**--
TOTAL| 14 | 210

It is easy to register this product by product on their own row.
but in what way can I multiply them? ned products be stored in arrays?
I think it will be similar to shopping cart in online store but i have no
clue about how to do this.
If you have links to pages were i can learn am i Happy for it. If you can
help me here is even better.

Thanks for your time and effort to learn me programming.

Karl




  Ahhh.


So - you should run a query that selects the products and information that
you want.  Then you start by creating an html table header and then loop
through your query results and echo a table row for each result row.

// start the table
echo table border=1;
echo trthProduct/thth**Amount/th/tr;

// loop thru each item found
while ($results = $qrslts-fetch(PDO::FETCH_**ASSOC))
{
echo trtd.$results['product_**name']./tdtd.$results['**
product_amt']./td/tr;
}

// finish the table html
echo /table;



Yes that part is OK. I do have problem to add total weight and package at
bottom of the table like this:

Product_one   40kg
Product_two   60kg
-
Total: 100kg
===

Because sometimes it is only a few products and other times many products.
I then need to summing them at bottom. One timer only 3 rows, other times
20 rows. The program need a way to add every singel product and see if it's
a few or many,

Karl

So - as you loop thru the results, accumulate your totals and then at 
the end before you close the table generate one last row with those 
amounts in it.  Simple!


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



Re: [PHP] Re: Fwd: Hmmm.. I think I need your advice here to get in correct direction...

2013-07-10 Thread Lester Caine

Karl-Arne Gjersøyen wrote:

// start the table


$total = 0;


echo table border=1;
echo trthProduct/thth**Amount/th/tr;

// loop thru each item found
while ($results = $qrslts-fetch(PDO::FETCH_**ASSOC))
{
echo trtd.$results['product_**name']./tdtd.$results['**
product_amt']./td/tr;

$total += $results['product_amt']

}



echo trtdTotal:/tdtd.$total./td/tr;


// finish the table html
echo /table;


Yes that part is OK. I do have problem to add total weight and package at
bottom of the table like this:

Product_one   40kg
Product_two   60kg
-
Total: 100kg
===



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



Re: [PHP] Re: Fwd: Hmmm.. I think I need your advice here to get in correct direction...

2013-07-10 Thread Karl-Arne Gjersøyen
2013/7/10 Lester Caine les...@lsces.co.uk

 Karl-Arne Gjersøyen wrote:

 // start the table


 $total = 0;

  echo table border=1;
 echo trthProduct/ththAmount/th/tr;

 
 // loop thru each item found
 while ($results = $qrslts-fetch(PDO::FETCH_ASSOC))
 {
 echo trtd.$results['product_name']./tdtd.$results['
 
 product_amt']./td/tr;

 $total += $results['product_amt']

 }
 


 echo trtdTotal:/tdtd.$**total./td/tr;


  // finish the table html
 echo /table;


 Yes that part is OK. I do have problem to add total weight and package at
 bottom of the table like this:

 Product_one   40kg
 Product_two   60kg
 -
 Total: 100kg
 ===



Thank you very Much, Both of you Jim and Lester!
You are amazing, folks!

Karl


[PHP] Re: Query regarding temporarily-uploaded files

2013-07-10 Thread Jim Giner

On 7/10/2013 1:21 PM, Ajay Garg wrote:

Hi all.

I have a requirement, wherein I need to allow vanilla uploads of files
to a HTTPD server.

Any client can upload any number of files (one at a time).
Also, there is just one directory, where the files get stored
finally (that is, after being copied from the temporary location,
via move_uploaded_file)

Also, I have been able to get the simple file uploading running via
PHP, by picking up one of the numerous Hello World examples
available :)



Now, I am facing the following use-case ::

1)
User 1 starts uploading a large file, say big_file.avi.

2)
Meanwhile, user 2 also starts uploading a (different) file, but with
the same name big_file.avi.


In an ideal scenario, user 2 should be prompted with a message, that a
file of the same name is already being uploaded by someone else
somewhere.
Is there a way to do this?

( Note that, had the user 2 started uploading AFTER user 1 had
finished with the upload, we could probably modify the PHP-script at
the sever-side, to let user-2 know that a file of the same name
already exits. But I am failing to find a solution, when the user 2
starts the upload WHILE the large file of user 1 is in the process of
completing uploading).


Any way the issue may be solved?

I will be grateful for any pointers :)



Regards,
Ajay

The problem is not of PHP's making.  It is something that you have to 
program around.  Is the user determining the filename to be used?  If 
so, then you need to check for that name before doing you move.  If 
it's a duple, then create a temporary name in your final place, hide it 
in the user's page and send it back to him with a message to change his 
name.


If the user is NOT determining the name, then your normal process would 
be to pick an unused name I presume and send That back to the user 
anyway, so problem never happens.


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



[PHP] Re: htaccess

2013-07-08 Thread Tim Streater
On 07 Jul 2013 at 21:22, Tedd Sperling t...@sperling.com wrote: 

 Confirmed. Those two lines cause the problem.

 However, commenting out those lines causes other problems.

 Are there similar statements to these:

   AddType application/x-httpd-php .php .htm .html

This one tells apache to recognise .php, .htm, and .html as suffixes of files 
that need to be sent to PHP. You probably don't want to remove that [1].

   AddHandler x-httpd-php5-cgi .php .htm .html

Dunno what this one does.

[1] But, having said that, realise that *all* files with those suffixes will be 
sent to PHP by apache, whether they contain any PHP code or not. Is that what 
you want? If I have an html file that contains some PHP code, I tend to use 
.phtml as suffix and so my AddType looks like:

 AddType application/x-httpd-php .php .phtml

--
Cheers  --  Tim

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

[PHP] Re: mongo usage

2013-07-06 Thread Tim Streater
On 06 Jul 2013 at 23:27, Tim Dunphy bluethu...@gmail.com wrote: 

 | You seem to spell the variable differently (1 'd' vs. 2 'd's)?

 Thanks! Fixed the type-o. Still no change.

   $connection = new Mongo();

$db = $connection-jfdb;

//$collection = $db-addresses;

$adresses = $connection-jfdb-addresses;

 ~


 Any other suggestions? Appreciated.

Fix the other typo.

--
Cheers  --  Tim

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

Re: [PHP] Re: mongo usage

2013-07-06 Thread Tim Dunphy
Thanks. Sorry to bug you guys with this. That did it. sigh


On Sat, Jul 6, 2013 at 6:49 PM, Tim Streater t...@clothears.org.uk wrote:

 On 06 Jul 2013 at 23:27, Tim Dunphy bluethu...@gmail.com wrote:

  | You seem to spell the variable differently (1 'd' vs. 2 'd's)?
 
  Thanks! Fixed the type-o. Still no change.
 
$connection = new Mongo();
 
 $db = $connection-jfdb;
 
 //$collection = $db-addresses;
 
 $adresses = $connection-jfdb-addresses;

  ~

 
  Any other suggestions? Appreciated.

 Fix the other typo.

 --
 Cheers  --  Tim


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




-- 
GPG me!!

gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B


[PHP] Re: Web dev, DB and proper db design.

2013-07-04 Thread Tony Marston
Richard Quadling  wrote in message 
news:CAKUjMCWJ4wiUO904OvYkS53Fsg4PPXa=qbokcvhwfemcpkp...@mail.gmail.com...


Hi.

I've just had a conversation regarding DB, foreign keys and their benefits.

I was told I've never worked on a web application where foreign keys were
used in the database.

As someone who has spent 25 years working on accounting/epos systems on MS
SQL Server (yep, windows) and now in a web environment and hearing the
above, ... well, ... slightly concerned.

So, in the biggest broadest terms, what do you lot do?

DBs with no foreign keys (constrainted or not).
ORM builders with manual definition of relationships between the tables.
Inline SQL where you have to just remember all the relationships.
Views for simple lookups? How do you handle updatable views (does mysql
support them?)
etc.

Is there a difference in those in 'startups' and web only situations, or
those doing more traditional development (split that as you like - I'm just
trying to get an understanding and not go off on one!).

No definitive answers, and I hope I get some wide experiences here.

Thanks for looking.

Richard.


There is a difference between having a field which is used as a foreign key 
and having a foreign key constraint defined in the database. Remember that 
foreign keys can be used in SELECT statements without there being a FK 
constraint. Constraints are only used in INSERT/UPDATE/DELETE operations, 
and never used for SELECTs


You cannot have relationships in a database without foreign keys, but you 
can have foreign keys with constraints.


--
Tony Marston

http://www.tonymarston.net
http://www.radicore.org 



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



[PHP] Re: Web dev, DB and proper db design.

2013-07-04 Thread Jim Giner

On 7/4/2013 6:42 AM, Richard Quadling wrote:

Hi.

I've just had a conversation regarding DB, foreign keys and their benefits.

I was told I've never worked on a web application where foreign keys were
used in the database.

As someone who has spent 25 years working on accounting/epos systems on MS
SQL Server (yep, windows) and now in a web environment and hearing the
above, ... well, ... slightly concerned.

So, in the biggest broadest terms, what do you lot do?

DBs with no foreign keys (constrainted or not).
ORM builders with manual definition of relationships between the tables.
Inline SQL where you have to just remember all the relationships.
Views for simple lookups? How do you handle updatable views (does mysql
support them?)
etc.

Is there a difference in those in 'startups' and web only situations, or
those doing more traditional development (split that as you like - I'm just
trying to get an understanding and not go off on one!).

No definitive answers, and I hope I get some wide experiences here.

Thanks for looking.

Richard.

Im going to guess that your source of such drivel never learned about 
such things.  Probably thinks that a 'key' has to be defined as such in 
the db, whereas we know what a FK really is.


Don't worry.  As a former big iron guy and then a c/s guy and now a 
(new) web guy, things haven't changed.


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



[PHP] Re: Thread-Hijacking (was: Re: [PHP] Fwd: Is it possible???)

2013-06-25 Thread Maciek Sokolewicz
On 25 June 2013 10:02, Tamara Temple tamouse.li...@gmail.com wrote:

 Maciek Sokolewicz maciek.sokolew...@gmail.com wrote:
  Please please please please don't do this!

 Please Please Please Do Not Hijack Threads.


Hijacking would be starting a completely different discussion in the same
thread. This wasn't a discussion-starter, rather a warning ;)

- Tul


[PHP] Re: Some Advice

2013-06-25 Thread Jonesy
On Tue, 25 Jun 2013 09:40:04 -0300, Samuel Lopes Grigolato wrote:
 --047d7b2e430e0b34d004dff9d47c
 Content-Type: text/plain; charset=ISO-8859-1
 Content-Transfer-Encoding: quoted-printable

 Just be cautious if going to check IP, because:

 1) The two users could be in the same house or cybercaf=E9, which gives the=
 m
 the same IP.
 2) The user could be traveling with a wireless card, his IP would change
 quite a lot in this scenario.

Or, it could be an AOL user and requess could be routed through
who knows how many different requestors.



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



[PHP] Re: Problem with variables

2013-06-25 Thread Jim Giner

On 6/25/2013 5:46 PM, Fernando A wrote:

Hello,

I am working with php and codeigniter, but I have not yet experienced.
I need create a variable that is available throughout  system.
This variable contains the number of company and can change.
as I can handle this?

Thank you, very much!

Ferd


One way would be to create a file like this:

?
// company_info.php
$_SESSION['company_name'] = My Company;
$_SESSION['company_addr1'] = 1 Main St.;
etc.
etc.
etc.

Then - in your startup script (or in every script), use an include 
statement:


?php
session_start();
include($path_to_includes./company_info.php);


Now you will have those SESSION vars available for the entire session, 
basically until you close your browser.


You can also use the php.ini auto-prepend setting, which automatically 
does this for you, altho the vars would not be session vars, since the 
prepend-ed file happens before your script issues the session_start (I 
think).


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



  1   2   3   4   5   6   7   8   9   10   >