Re: [PHP] XML to Array

2013-03-11 Thread Karl DeSaulniers


On Mar 11, 2013, at 8:22 AM, Bastien Koert wrote:

On Sun, Mar 10, 2013 at 6:28 PM, Karl DeSaulniers k...@designdrumm.com 
 wrote:


On Mar 10, 2013, at 6:03 AM, richard gray wrote:


On 10/03/2013 11:47, Karl DeSaulniers wrote:


Hi Guys,
I am hoping someone can guide me or help me fix this issue.
I have been lost in the code for some time now.
I am trying to get the attributes of an xml node.
I have this code:
[snip]


this may help -
http://stackoverflow.com/questions/1156957/php-xml-attribute-parsing


I do admit I haven't the foggiest idea what I am doing here, so I  
am

noobing out here on how this php function is really working.
I got it off php.net and am trying to implement it in my code.  
Without my

addition it works well except it doesn't grab any attributes
which I need in order for my script to work properly.

Any ideas on what I am doing wrong?

TIA,



HTH
rich




Thanks rich,
That uses simpleXML. I am using xml_parse_create.
Any ideas for xml_parse_create? I really like the way this function
puts everything into an array that I can traverse. I only need it  
to put
the attribute values in the array for the corresponding node and I  
am done.

*Sigh

Thanks for your help,

Best,


Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



I came across this XML to JSON to an array some time ago. It might  
be something


function xmlToArray($xml)
{
	return json_decode(json_encode((array) simplexml_load_string($xml)), 
1);

}

--

Bastien

Cat, the other other white meat


Thanks Bastien!
That worked very well. I now see the attributes. However it does not  
load the root node?
I am going to need that node to display too. Any thoughts as to why it  
is not showing?
I just copied and pasted your code. I'm going to look at some docs to  
see if I can find out why,

but if you know, please let me know your solution. Thanks again.

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] XML to Array

2013-03-11 Thread Karl DeSaulniers


On Mar 11, 2013, at 8:22 AM, Bastien Koert wrote:

On Sun, Mar 10, 2013 at 6:28 PM, Karl DeSaulniers k...@designdrumm.com 
 wrote:


On Mar 10, 2013, at 6:03 AM, richard gray wrote:


On 10/03/2013 11:47, Karl DeSaulniers wrote:


Hi Guys,
I am hoping someone can guide me or help me fix this issue.
I have been lost in the code for some time now.
I am trying to get the attributes of an xml node.
I have this code:
[snip]


this may help -
http://stackoverflow.com/questions/1156957/php-xml-attribute-parsing


I do admit I haven't the foggiest idea what I am doing here, so I  
am

noobing out here on how this php function is really working.
I got it off php.net and am trying to implement it in my code.  
Without my

addition it works well except it doesn't grab any attributes
which I need in order for my script to work properly.

Any ideas on what I am doing wrong?

TIA,



HTH
rich




Thanks rich,
That uses simpleXML. I am using xml_parse_create.
Any ideas for xml_parse_create? I really like the way this function
puts everything into an array that I can traverse. I only need it  
to put
the attribute values in the array for the corresponding node and I  
am done.

*Sigh

Thanks for your help,

Best,


Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



I came across this XML to JSON to an array some time ago. It might  
be something


function xmlToArray($xml)
{
	return json_decode(json_encode((array) simplexml_load_string($xml)), 
1);

}

--

Bastien

Cat, the other other white meat


Actually no, I don't need the root node after all.
Looks like it finally works! :)

Thank you Bastien! Nice one-liner.

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] XML to Array

2013-03-10 Thread Karl DeSaulniers


On Mar 10, 2013, at 6:03 AM, richard gray wrote:


On 10/03/2013 11:47, Karl DeSaulniers wrote:

Hi Guys,
I am hoping someone can guide me or help me fix this issue.
I have been lost in the code for some time now.
I am trying to get the attributes of an xml node.
I have this code:
[snip]

this may help - 
http://stackoverflow.com/questions/1156957/php-xml-attribute-parsing
I do admit I haven't the foggiest idea what I am doing here, so I  
am noobing out here on how this php function is really working.
I got it off php.net and am trying to implement it in my code.  
Without my addition it works well except it doesn't grab any  
attributes

which I need in order for my script to work properly.

Any ideas on what I am doing wrong?

TIA,


HTH
rich



Thanks rich,
That uses simpleXML. I am using xml_parse_create.
Any ideas for xml_parse_create? I really like the way this function
puts everything into an array that I can traverse. I only need it to put
the attribute values in the array for the corresponding node and I am  
done.

*Sigh

Thanks for your help,

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] Arrays

2013-02-26 Thread Karl DeSaulniers


On Feb 26, 2013, at 10:35 PM, tamouse mailing lists wrote:

On Mon, Feb 25, 2013 at 9:51 PM, Karl DeSaulniers k...@designdrumm.com 
 wrote:
Never mind. I found a different function that reads out the  
children as well

into the array.


   function xml_parse_into_assoc($data) {
 $p = xml_parser_create();

 xml_parser_set_option($p,  
XML_OPTION_CASE_FOLDING,

0);
 xml_parser_set_option($p,  
XML_OPTION_SKIP_WHITE,

1);

 xml_parse_into_struct($p, $data, $vals,  
$index);

 xml_parser_free($p);

 $levels = array(null);

 foreach ($vals as $val) {
   if ($val['type'] == 'open' ||  
$val['type'] ==

'complete') {
 if (!array_key_exists($val['level'],  
$levels))

{
   $levels[$val['level']] = array();
 }
   }

   $prevLevel = $levels[$val['level'] - 1];
   $parent =  
$prevLevel[sizeof($prevLevel)-1];


   if ($val['type'] == 'open') {
 $val['children'] = array();
 array_push($levels[$val['level']],  
$val);

 continue;
   }

   else if ($val['type'] == 'complete') {
 $parent['children'][$val['tag']] =
$val['value'];
   }

   else if ($val['type'] == 'close') {
 $pop =  
array_pop($levels[$val['level']]);

 $tag = $pop['tag'];

 if ($parent) {
   if (!array_key_exists($tag,
$parent['children'])) {
 $parent['children'][$tag] =
$pop['children'];
   }
   else if
(is_array($parent['children'][$tag])) {
   if(!isset($parent['children'] 
[$tag][0]))

{
   $oldSingle =
$parent['children'][$tag];
   $parent['children'][$tag] =  
null;

   $parent['children'][$tag][] =
$oldSingle;

   }
 $parent['children'][$tag][] =
$pop['children'];
   }
 }
 else {
   return(array($pop['tag'] =
$pop['children']));
 }
   }

   $prevLevel[sizeof($prevLevel)-1] =  
$parent;

 }
   }


   $params = xml_parse_into_assoc($result);// 
$result =

xml result from USPS api

Original function by: jemptymethod at gmail dot com
Duplicate names fix by: Anonymous (comment right above original  
function)


Best,
Karl



On Feb 25, 2013, at 7:50 PM, Jim Lucas wrote:


On 02/25/2013 05:40 PM, Karl DeSaulniers wrote:


Hi Guys/Gals,
If I have an multidimensional array and it has items that have  
the same

name in it, how do I get the values of each similar item?

EG:

specialservices = array(
specialservice = array(
serviceid = 1,
servicename= signature required,
price = $4.95
),
secialservice = array(
serviceid = 15,
servicename = return receipt,
price = $2.30
)
)

How do I get the prices for each? What would be the best way to  
do this?

Can I utilize the serviceid to do this somehow?
It is always going to be different per specialservice.

TIA,

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com




This will never work.  Your last array will always overwrite your  
previous

array.

Here is how I would suggest building it:


$items = array(
  1 = array(
  serviceid = 1,
  servicename= signature required,
  price = $4.95
  ),
  15 = array(
  serviceid = 15,
  servicename = return receipt,
  price = $2.30
  )
)

This will ensure that your first level indexes never overwrite  
themselves.


But, with that change made, then do this:

foreach ( $items AS $item ) {
if ( array_key_exists('price', $item) ) {
  echo $item['price'];
} else {
  echo 'Item does not have a price set';
}
}

Resources:
http://php.net/foreach
http://php.net/array_key_exists

--
Jim Lucas

http://www.cmsws.com/
http://www.cmsws.com/examples/



Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Would this work for you?
http://us.php.net/manual/en/function.xml-parse-into-struct.php



That is where I got this function. :)
Comment 12 and 13 on that page.
Yes it worked for me.

Best,

Karl DeSaulniers
Design Drumm
http

[PHP] Arrays

2013-02-25 Thread Karl DeSaulniers

Hi Guys/Gals,
If I have an multidimensional array and it has items that have the  
same name in it, how do I get the values of each similar item?


EG:

specialservices = array(
specialservice = array(
serviceid = 1,
servicename= signature required,
price = $4.95
),
secialservice = array(
serviceid = 15,
servicename = return receipt,
price = $2.30
)
)

How do I get the prices for each? What would be the best way to do this?
Can I utilize the serviceid to do this somehow?
It is always going to be different per specialservice.

TIA,

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com



Re: [PHP] Arrays

2013-02-25 Thread Karl DeSaulniers


On Feb 25, 2013, at 7:48 PM, Adam Richardson wrote:

On Mon, Feb 25, 2013 at 8:40 PM, Karl DeSaulniers k...@designdrumm.com 
 wrote:

Hi Guys/Gals,
If I have an multidimensional array and it has items that have the  
same name

in it, how do I get the values of each similar item?

EG:

specialservices = array(
   specialservice = array(
   serviceid = 1,
   servicename= signature required,
   price = $4.95
   ),
   secialservice = array(
   serviceid = 15,
   servicename = return receipt,
   price = $2.30
   )
)

How do I get the prices for each? What would be the best way to do  
this?

Can I utilize the serviceid to do this somehow?
It is always going to be different per specialservice.


Something appears to be amiss, as your array couldn't contain multiple
items with the specialservice key (I'm assuming the second key
'secialservice' is just a typo), as any subsequent assignments would
overwrite the previous value.

Adam

--
Nephtali:  A simple, flexible, fast, and security-focused PHP  
framework

http://nephtaliproject.com



Hi Adam,
Actually you are correct. Sorry to confuse.
Its an XML response  from the USPS api I am going through, which I am  
converting to an array.


Here is the response that I am trying to convert to a multidimensional  
array.


?xml version=1.0?
RateV4ResponsePackage ID=1STZipOrigination75287/ 
ZipOriginationZipDestination87109/ZipDestinationPounds70/ 
PoundsOunces0/OuncesContainerRECTANGULAR/ 
ContainerSizeLARGE/SizeWidth2/WidthLength15/ 
LengthHeight10/HeightZone4/ZonePostage  
CLASSID=1MailServicePriority Maillt;supgt;amp;reg;lt;/ 
supgt;/MailServiceRate62.95/ 
RateSpecialServicesSpecialServiceServiceID1/ 
ServiceIDServiceNameInsurance/ServiceNameAvailabletrue/ 
AvailableAvailableOnlinetrue/AvailableOnlinePrice1.95/ 
PricePriceOnline1.95/PriceOnlineDeclaredValueRequiredtrue/ 
DeclaredValueRequiredDueSenderRequiredfalse/DueSenderRequired/ 
SpecialServiceSpecialServiceServiceID0/ 
ServiceIDServiceNameCertified Maillt;supgt;amp;reg;lt;/supgt;/ 
ServiceNameAvailabletrue/AvailableAvailableOnlinefalse/ 
AvailableOnlinePrice3.10/PricePriceOnline0/PriceOnline/ 
SpecialServiceSpecialServiceServiceID19/ 
ServiceIDServiceNameAdult Signature Required/ 
ServiceNameAvailablefalse/AvailableAvailableOnlinetrue/ 
AvailableOnlinePrice0/PricePriceOnline4.95/PriceOnline/ 
SpecialService/SpecialServices/Postage/PackagePackage  
ID=2NDZipOrigination75287/ZipOriginationZipDestination87109/ 
ZipDestinationPounds55/PoundsOunces0/ 
OuncesContainerRECTANGULAR/ContainerSizeLARGE/SizeWidth2/ 
WidthLength15/LengthHeight10/HeightZone4/ZonePostage  
CLASSID=1MailServicePriority Maillt;supgt;amp;reg;lt;/ 
supgt;/MailServiceRate52.55/ 
RateSpecialServicesSpecialServiceServiceID1/ 
ServiceIDServiceNameInsurance/ServiceNameAvailabletrue/ 
AvailableAvailableOnlinetrue/AvailableOnlinePrice1.95/ 
PricePriceOnline1.95/PriceOnlineDeclaredValueRequiredtrue/ 
DeclaredValueRequiredDueSenderRequiredfalse/DueSenderRequired/ 
SpecialServiceSpecialServiceServiceID0/ 
ServiceIDServiceNameCertified Maillt;supgt;amp;reg;lt;/supgt;/ 
ServiceNameAvailabletrue/AvailableAvailableOnlinefalse/ 
AvailableOnlinePrice3.10/PricePriceOnline0/PriceOnline/ 
SpecialServiceSpecialServiceServiceID19/ 
ServiceIDServiceNameAdult Signature Required/ 
ServiceNameAvailablefalse/AvailableAvailableOnlinetrue/ 
AvailableOnlinePrice0/PricePriceOnline4.95/PriceOnline/ 
SpecialService/SpecialServices/Postage/Package/RateV4Response


This is my attempt to convert. I thought of setting up a blank array  
then filling that array with the specialservice arrays


$data = strstr($result, '?');
// echo '!-- '. $data. ' --'; // Uncomment to show XML in comments
$xml_parser = xml_parser_create();
xml_parser_set_option($xml_parser,XML_OPTION_TARGET_ENCODING,  
ISO-8859-1);

xml_parse_into_struct($xml_parser, $result, $vals, $index);
xml_parser_free($xml_parser);
$params = array();
$level = array();
foreach ($vals as $xml_elem) {
if ($xml_elem['type'] == 'open') {
if (array_key_exists('attributes',$xml_elem)) {
	list($level[$xml_elem['level']],$extra) =  
array_values($xml_elem['attributes']);

} else {
$level[$xml_elem['level']] = $xml_elem['tag'];
}
}
if ($xml_elem['type'] == 'complete') {
$start_level = 1;
$php_stmt = '$params';
while($start_level  $xml_elem['level']) {
$php_stmt .= '[$level['.$start_level.']]';
$start_level++;
}
$php_stmt .= '[$xml_elem[\'tag\']] = $xml_elem[\'value\'];';

eval($php_stmt);
}
}

... then trying to pull data from the results of the $php_stmt


$sid = array();
$numserv = count($params['RATEV4RESPONSE'][''.$p.$ack.''][$cId] 
['SPECIALSERVICES']);

if($numserv  0) {
	foreach($params['RATEV4RESPONSE'][''.$p.$ack.''][$cId] 
['SPECIALSERVICES']['SPECIALSERVICE'] as $sp_servs) {

$sid_val

Re: [PHP] Arrays

2013-02-25 Thread Karl DeSaulniers


On Feb 25, 2013, at 7:50 PM, Jim Lucas wrote:


On 02/25/2013 05:40 PM, Karl DeSaulniers wrote:

Hi Guys/Gals,
If I have an multidimensional array and it has items that have the  
same

name in it, how do I get the values of each similar item?

EG:

specialservices = array(
specialservice = array(
serviceid = 1,
servicename= signature required,
price = $4.95
),
secialservice = array(
serviceid = 15,
servicename = return receipt,
price = $2.30
)
)

How do I get the prices for each? What would be the best way to do  
this?

Can I utilize the serviceid to do this somehow?
It is always going to be different per specialservice.

TIA,

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com




This will never work.  Your last array will always overwrite your  
previous array.


Here is how I would suggest building it:


$items = array(
   1 = array(
   serviceid = 1,
   servicename= signature required,
   price = $4.95
   ),
   15 = array(
   serviceid = 15,
   servicename = return receipt,
   price = $2.30
   )
)

This will ensure that your first level indexes never overwrite  
themselves.


But, with that change made, then do this:

foreach ( $items AS $item ) {
 if ( array_key_exists('price', $item) ) {
   echo $item['price'];
 } else {
   echo 'Item does not have a price set';
 }
}

Resources:
http://php.net/foreach
http://php.net/array_key_exists

--
Jim Lucas

http://www.cmsws.com/
http://www.cmsws.com/examples/



Thanks Jim,
However I have no control over how the USPS sends back the response.
See my more detailed email.

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] Arrays

2013-02-25 Thread Karl DeSaulniers
Never mind. I found a different function that reads out the children  
as well into the array.



function xml_parse_into_assoc($data) {
  $p = xml_parser_create();

  xml_parser_set_option($p, XML_OPTION_CASE_FOLDING, 0);
  xml_parser_set_option($p, XML_OPTION_SKIP_WHITE, 1);

  xml_parse_into_struct($p, $data, $vals, $index);
  xml_parser_free($p);

  $levels = array(null);

  foreach ($vals as $val) {
if ($val['type'] == 'open' || $val['type'] == 
'complete') {
  if (!array_key_exists($val['level'], $levels)) {
$levels[$val['level']] = array();
  }
}

$prevLevel = $levels[$val['level'] - 1];
$parent = $prevLevel[sizeof($prevLevel)-1];

if ($val['type'] == 'open') {
  $val['children'] = array();
  array_push($levels[$val['level']], $val);
  continue;
}

else if ($val['type'] == 'complete') {
  $parent['children'][$val['tag']] = $val['value'];
}

else if ($val['type'] == 'close') {
  $pop = array_pop($levels[$val['level']]);
  $tag = $pop['tag'];

  if ($parent) {
if (!array_key_exists($tag, 
$parent['children'])) {
  $parent['children'][$tag] = $pop['children'];
}
else if (is_array($parent['children'][$tag])) {
if(!isset($parent['children'][$tag][0])) {
$oldSingle = $parent['children'][$tag];
$parent['children'][$tag] = null;
$parent['children'][$tag][] = 
$oldSingle;

}
  $parent['children'][$tag][] = 
$pop['children'];
}
  }
  else {
return(array($pop['tag'] = $pop['children']));
  }
}

$prevLevel[sizeof($prevLevel)-1] = $parent;
  }
}


			$params = xml_parse_into_assoc($result);//$result = xml result from  
USPS api


Original function by: jemptymethod at gmail dot com
Duplicate names fix by: Anonymous (comment right above original  
function)


Best,
Karl


On Feb 25, 2013, at 7:50 PM, Jim Lucas wrote:


On 02/25/2013 05:40 PM, Karl DeSaulniers wrote:

Hi Guys/Gals,
If I have an multidimensional array and it has items that have the  
same

name in it, how do I get the values of each similar item?

EG:

specialservices = array(
specialservice = array(
serviceid = 1,
servicename= signature required,
price = $4.95
),
secialservice = array(
serviceid = 15,
servicename = return receipt,
price = $2.30
)
)

How do I get the prices for each? What would be the best way to do  
this?

Can I utilize the serviceid to do this somehow?
It is always going to be different per specialservice.

TIA,

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com




This will never work.  Your last array will always overwrite your  
previous array.


Here is how I would suggest building it:


$items = array(
   1 = array(
   serviceid = 1,
   servicename= signature required,
   price = $4.95
   ),
   15 = array(
   serviceid = 15,
   servicename = return receipt,
   price = $2.30
   )
)

This will ensure that your first level indexes never overwrite  
themselves.


But, with that change made, then do this:

foreach ( $items AS $item ) {
 if ( array_key_exists('price', $item) ) {
   echo $item['price'];
 } else {
   echo 'Item does not have a price set';
 }
}

Resources:
http://php.net/foreach
http://php.net/array_key_exists

--
Jim Lucas

http://www.cmsws.com/
http://www.cmsws.com/examples/


Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



[PHP] Re: [PHP-DB] Re: [PHP] Shopping Cart Discount System

2012-12-31 Thread Karl DeSaulniers


On Dec 31, 2012, at 3:36 AM, Ashley Sheridan wrote:




Karl DeSaulniers k...@designdrumm.com wrote:


Hello Everyone,
Hope all are well. Quick and hopefully painless question.
Is there any examples on how to build a discount system
into your shopping cart out there that anyone knows of?
I am using MySQL and PHP. I have built one of my own so far,
but am having trouble making sense of what goes where.

For example. If a product has miscellaneous charges,
lets say.. glitter is extra on your shirt.
How is discounts applied? I mean, as far as discounts go,
lets say its 20% a shirt and this shirt has glitter.
Is it best practice to apply the discount to just the shirt
or the shirt and glitter as a combo discount.
I know this is somewhat dependent on the owners choice
of what he/she wants to give the discount on,
but my question is of the programing of it.
Do I build conditions for the shirt to get a discount applied
then the miscellaneous charges, or combine the totals of the two,
then apply the discount to the sum?

Then lets say there is a cart discount also being applied.
Is it best practice to apply this to the total of items then
add the shipping, rush charges and tax, or to the total of the whole
cart
including shipping, rush charges then add the tax after applying the
discount?

Sorry for the run-on question, hope this makes sense enough to merit
help.

HNY,

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com

PS: Because this question could be answered by either database or
general, is the only reason for the double post.
Wont be making a habit of it.. :)


I would apply the discounts where they made sense from a customer  
POV. Would you expect a t-shirt discount to be applied to only the  
base item or the product as a whole? I'd say tge whole thing. You  
could have various areas in your code that apply discounts at  
different levels: per item, per group of items (bogof, etc), and per  
basket.



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

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




That does make more sense now that you say.
I guess I would want or expect the discount to apply to the whole thing.
Thanks Ash.

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] Shopping Cart Discount System

2012-12-31 Thread Karl DeSaulniers


On Dec 31, 2012, at 3:51 PM, tamouse mailing lists wrote:

On Mon, Dec 31, 2012 at 2:31 AM, Karl DeSaulniers k...@designdrumm.com 
 wrote:

Hello Everyone,
Hope all are well. Quick and hopefully painless question.
Is there any examples on how to build a discount system
into your shopping cart out there that anyone knows of?
I am using MySQL and PHP. I have built one of my own so far,
but am having trouble making sense of what goes where.

For example. If a product has miscellaneous charges,
lets say.. glitter is extra on your shirt.
How is discounts applied? I mean, as far as discounts go,
lets say its 20% a shirt and this shirt has glitter.
Is it best practice to apply the discount to just the shirt
or the shirt and glitter as a combo discount.
I know this is somewhat dependent on the owners choice
of what he/she wants to give the discount on,
but my question is of the programing of it.
Do I build conditions for the shirt to get a discount applied
then the miscellaneous charges, or combine the totals of the two,
then apply the discount to the sum?

Then lets say there is a cart discount also being applied.
Is it best practice to apply this to the total of items then
add the shipping, rush charges and tax, or to the total of the  
whole cart

including shipping, rush charges then add the tax after applying the
discount?


These sound much more like business operating questions than
programming questions, per se. I think it really depends a lot on what
other businesses in the same niche as yours do, or if you can find
out. Once you have figured out the business practices, coding them
should be easier, I'd say, but doing it the other way 'round seems
like would lead to confusion.

Some questions from a really non-business person:

1. Why are you offering discounts at all? What do you hope to
accomplish by offering discounts?
2. Who qualifies for which discounts and why?
3. Do discounts apply to just the base merchandise, or the whole end
piece, with whatever customisations it might have, and if so or if
not, why?
4. Are there different discount rates applied to base merchandise and
subsequent customisations, and if so, why?
5. Is there any reason to make this complicated, or instead just offer
a flat rate discount on final price, before taxes and SH?



My appologies if this is an OT thread. I was in the midst of coding  
these things when I asked it.
Yes, it is a little confusing. This is a small t-shirt company a  
friend and I are putting together.
I have thought out most of the business logic for the company and the  
website.
The only thing I guess I forgot to plan in was these discounts and how  
to apply them.
I currently have discounts per item and per the cart. The discounts  
are set up to apply on birthdays
and added by admins for discounting items to clear inventory. The cart  
discounts are set to apply
at a certain interval of purchase amounts. For eg. (and im really just  
throwing numbers) if someone buys $1,000
worth of merch, they are sent a 50% off your cart discount to their  
email.


I guess the question was more how to apply the discounts to the cart.  
Discount item + miscellaneous or just item.
Discount cart or cart + shipping + handling. I was also asking if  
anyone had or knew of a sample script I could pick apart.
That was probably the programing part of the question. But thank you  
guys for taking the time to answer.

I believe it helped. We will see.. :)

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] Missing email

2012-10-22 Thread Karl DeSaulniers

Strange, it did when I signed up and for a number of years after.


On Oct 22, 2012, at 10:09 AM, Gerardo Benitez wrote:


Hi Daniel,

I think that the robot that manage the list is not sending you your  
own emails.


Gerardo.

On Sat, Oct 20, 2012 at 10:38 AM, Daniel Brown danbr...@php.net  
wrote:
On Sat, Oct 20, 2012 at 5:00 AM, Karl DeSaulniers k...@designdrumm.com 
 wrote:

 @Moderator
 Any reason why my emails do not post or at least dont post for  
hours later?


There is no moderator on this list.  I'm probably about as close
as it comes.  Can you explain more about the problems you're
experiencing so that I can look into it further?

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




--
Gerardo Benitez
-
Programador Web Freelance



Karl DeSaulniers
Design Drumm
http://designdrumm.com



Re: [PHP] Re: User Timezone

2012-10-21 Thread Karl DeSaulniers


On Oct 21, 2012, at 5:01 AM, Maciek Sokolewicz wrote:


On 21-10-2012 01:11, Karl DeSaulniers wrote:

Thanks for the response. Yes, for the US I plan on calculating by
state, but
this website is not geared to just the US.
So I am looking for a solution that lets me also calculate by
country/region.
Was looking on google and found geoip, but not sure if this will do
the job
I am looking for.
Anyone with experience on geoip that can send pointers?

Thanks,


Best,
Karl DeSaulniers
Design Drumm
http://designdrumm.com



Geo IP is based on IP, and I must warn you that IP data is not  
always

accurate. Especially here in Europe, companies that are based in
multiple countries sometimes only register their IPs in a single
country, and share them between all the countries they are active  
in.

This will give you wrong data from GeoIP. The time difference will
only be 1 hour at max, but still.



That was what my own suspicions were leading to.
I am familiar with the fact that ips can be spoofed.
Thanks for the corroboration.

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com



As Bart said, IP is not ideal for this situation.

Since you do have information about the location of that person (as  
in country and possible state), you can find out the timezone via a  
static database.


The HTML5 geolocation tool is nice, and would certainly help a lot!  
However, be aware of the fact that it only works if there is the  
device on which the browser runs actually has the ability to find  
out its location. Many smartphones have GPS chips, but most PCs  
don't. Asking a PC where are you located? the PC will answer How  
should I know?.


Luckily for you, the way of country and state is pretty easy. I've  
handed you a list to find it in the USA. For most countries in the  
world, there's a simple 1:1 mapping of timezone and country (http://en.wikipedia.org/wiki/List_of_time_zones_by_country 
), there are however 21 countries which have multiple timezones. In  
these cases, you'll need extra information to be able to distinguish  
between them.


For the USA, you already have a way.
For (ex-)colonical islands and such (such as for France), you could  
always add them to the country list:

- France
- France (Marquesas Islands)
- France (Gambier)
etc.
Thus treating them as separate countries for your timezone db.

In Russia, Canada, Australia, New Zealand, Brasil, Indonesia,  
Kiribati, Mexico,Congo, Ecuador, Micronesia, Kazakhstan and Mongolia  
you'll need to know their province / state to more accurately assess  
the ideal timezone.


So for most countries, it's a simple 1:1 translation. For the above  
countries, you'll need some extra info, and translate further based  
on that. You should be able to find the info required yourself, it  
just takes a while to collect it.


Alternatively, and this is the most simple way; since you're asking  
people for their country and such, simply also ask them about their  
timezone. Don't bother automating and putting a heck of a lot of  
time into hard to realize solutions, when you can ask a very simple  
and easy-to-answer question to the browser instead. :)


- Tul



Yes, I had thought about asking the user his/her timezone, but being  
that the product will be bought by some people who may have no idea, I  
figured I would try and see if I can set it up myself.
Maybe if the country has a province, i could ask the user then what  
province and get my 1:2 that way. If it is a country I can get the  
timezone for, just skip that question.

Thanks for the thoughts!

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] Re: User Timezone

2012-10-21 Thread Karl DeSaulniers


On Oct 21, 2012, at 5:11 PM, tamouse mailing lists wrote:

On Sun, Oct 21, 2012 at 7:30 AM, Matijn Woudt tijn...@gmail.com  
wrote:

On Sun, Oct 21, 2012 at 12:01 PM, Maciek Sokolewicz
maciek.sokolew...@gmail.com wrote:

On 21-10-2012 01:11, Karl DeSaulniers wrote:


Thanks for the response. Yes, for the US I plan on calculating by
state, but
this website is not geared to just the US.
So I am looking for a solution that lets me also calculate by
country/region.
Was looking on google and found geoip, but not sure if this  
will do

the job
I am looking for.
Anyone with experience on geoip that can send pointers?

Thanks,


Best,
Karl DeSaulniers
Design Drumm
http://designdrumm.com




Geo IP is based on IP, and I must warn you that IP data is not  
always

accurate. Especially here in Europe, companies that are based in
multiple countries sometimes only register their IPs in a single
country, and share them between all the countries they are  
active in.

This will give you wrong data from GeoIP. The time difference will
only be 1 hour at max, but still.




That was what my own suspicions were leading to.
I am familiar with the fact that ips can be spoofed.
Thanks for the corroboration.

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com



As Bart said, IP is not ideal for this situation.

Since you do have information about the location of that person  
(as in
country and possible state), you can find out the timezone via a  
static

database.

The HTML5 geolocation tool is nice, and would certainly help a  
lot! However,
be aware of the fact that it only works if there is the device on  
which the

browser runs actually has the ability to find out its location. Many
smartphones have GPS chips, but most PCs don't. Asking a PC where  
are you

located? the PC will answer How should I know?.

Luckily for you, the way of country and state is pretty easy. I've  
handed
you a list to find it in the USA. For most countries in the world,  
there's a

simple 1:1 mapping of timezone and country
(http://en.wikipedia.org/wiki/List_of_time_zones_by_country),  
there are
however 21 countries which have multiple timezones. In these  
cases, you'll

need extra information to be able to distinguish between them.

For the USA, you already have a way.
For (ex-)colonical islands and such (such as for France), you  
could always

add them to the country list:
- France
- France (Marquesas Islands)
- France (Gambier)
etc.
Thus treating them as separate countries for your timezone db.

In Russia, Canada, Australia, New Zealand, Brasil, Indonesia,  
Kiribati,
Mexico,Congo, Ecuador, Micronesia, Kazakhstan and Mongolia you'll  
need to
know their province / state to more accurately assess the ideal  
timezone.


So for most countries, it's a simple 1:1 translation. For the above
countries, you'll need some extra info, and translate further  
based on that.
You should be able to find the info required yourself, it just  
takes a while

to collect it.

Alternatively, and this is the most simple way; since you're  
asking people
for their country and such, simply also ask them about their  
timezone. Don't
bother automating and putting a heck of a lot of time into hard to  
realize
solutions, when you can ask a very simple and easy-to-answer  
question to the

browser instead. :)

- Tul



Don't forget that some countries have DST, and some don't. And those
that have DST, all use different dates.. So in to keep a static
database you would also need to have DST info from all countries.

- Matijn


Using the standard labels in /usr/share/zoneinfo should be able to
avoid having to keep track of who is and isn't in DST, *provided* you
find a way to map the user's address to one of those files.



I am not familiar with this. Can you elaborate?

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



[PHP] User Timezone

2012-10-20 Thread Karl DeSaulniers

Hello all,
Happy weekend. Hoping you can help me with an age old question.
I am trying to get a users timezone for a purchase online.
I know that php is not really able to get a timzone of a user because  
its a server side execution with the date functions.
But I wanted to get a little help on my work around. I am hoping  
someone can help. TIA


I have a form that a user must fill out in order to purchase anything.
On this form they are required to put their city, state, country and  
zip code.

These are all required fields.

Now, I know there is a way to get a timezone offset if you have a  
location to offset.
So is there a way based on the fields provided that I can get that  
offset for each user?


(The users have to put a correct city, state, country and zip in order  
to get there purchase.
This address has to match their paypal or cc address in order to  
purchase as well.
So I know there will still be a margin of error with user manipulated  
info. So that is moot point for now.)


My thoughts are to get a timezone offset based on the country and zip  
code, with a backup check of city state country zip.
I just don't know where to start looking for how to get the timezone  
or UTC location based on country and zip or city state country zip.


Any help is appreciated.

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com



[PHP] Re: User Timezone

2012-10-20 Thread Karl DeSaulniers


On Oct 20, 2012, at 7:23 AM, Maciek Sokolewicz wrote:


On 20-10-2012 09:39, Karl DeSaulniers wrote:

Hello all,
Happy weekend. Hoping you can help me with an age old question.
I am trying to get a users timezone for a purchase online.
I know that php is not really able to get a timzone of a user because
its a server side execution with the date functions.
But I wanted to get a little help on my work around. I am hoping  
someone

can help. TIA

I have a form that a user must fill out in order to purchase  
anything.
On this form they are required to put their city, state, country  
and zip

code.
These are all required fields.

Now, I know there is a way to get a timezone offset if you have a
location to offset.
So is there a way based on the fields provided that I can get that
offset for each user?

(The users have to put a correct city, state, country and zip in  
order

to get there purchase.
This address has to match their paypal or cc address in order to
purchase as well.
So I know there will still be a margin of error with user manipulated
info. So that is moot point for now.)

My thoughts are to get a timezone offset based on the country and zip
code, with a backup check of city state country zip.
I just don't know where to start looking for how to get the  
timezone or

UTC location based on country and zip or city state country zip.



Hi Karl,

so basically what you're looking for is a database map between  
timezone and country/state/zip.


Did you try to google such a thing?

One of the first posts I found was a StackOverflow question about  
this; one of the answers mentioned just such a database on Tom  
Boutell's website (the same person who created the GD library [used  
for image-creation in php]): http://www.boutell.com/zipcodes/
It includes states, cities, zip codes, etc. for the USA. Since you  
specifically mentioned you want to find it by state, it means  
you're mainly focussing on the USA (barely any other country even  
bothers with states).


Apart from the above data, I'm sure you can find more on google.

Good luck.
- Tul




Thanks for the response. Yes, for the US I plan on calculating by  
state, but this website is not geared to just the US.
So I am looking for a solution that lets me also calculate by country/ 
region.
Was looking on google and found geoip, but not sure if this will do  
the job I am looking for.

Anyone with experience on geoip that can send pointers?

Thanks,

Best,
Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: RES: [PHP] Re: User Timezone

2012-10-20 Thread Karl DeSaulniers

Dont know how I would get longitude and latitude of my users.
Also, not using HTML5 except for layout reasons. Liquid canvas.
So I am using HTML 4 transitional for structure.

Thanks for the response! I will at least look into your solution.
Couldn't hurt. :)

Best,
Karl


On Oct 20, 2012, at 7:35 AM, Samuel Lopes Grigolato wrote:


Have you tried Google Timezone API?
(https://developers.google.com/maps/documentation/timezone/)

I don't know if it's free to use, probably not.

You may note that you need user's longitude/latitude to query this  
API. A

solution is to query Google Places API
(https://developers.google.com/places/) based on the State name, or  
use the
HTML5 Geolocation API (http://www.w3schools.com/html/html5_geolocation.asp 
,

I won't recommend as AFAIK it is not stable, others could correct me).

Hope it helps.

Cheers,
Samuel.

-Mensagem original-
De: Maciek Sokolewicz [mailto:tula...@gmail.com] Em nome de Maciek
Sokolewicz
Enviada em: sábado, 20 de outubro de 2012 09:24
Para: Karl DeSaulniers
Cc: php-general
Assunto: [PHP] Re: User Timezone

On 20-10-2012 09:39, Karl DeSaulniers wrote:

Hello all,
Happy weekend. Hoping you can help me with an age old question.
I am trying to get a users timezone for a purchase online.
I know that php is not really able to get a timzone of a user because
its a server side execution with the date functions.
But I wanted to get a little help on my work around. I am hoping
someone can help. TIA

I have a form that a user must fill out in order to purchase  
anything.

On this form they are required to put their city, state, country and
zip code.
These are all required fields.

Now, I know there is a way to get a timezone offset if you have a
location to offset.
So is there a way based on the fields provided that I can get that
offset for each user?

(The users have to put a correct city, state, country and zip in  
order

to get there purchase.
This address has to match their paypal or cc address in order to
purchase as well.
So I know there will still be a margin of error with user manipulated
info. So that is moot point for now.)

My thoughts are to get a timezone offset based on the country and zip
code, with a backup check of city state country zip.
I just don't know where to start looking for how to get the timezone
or UTC location based on country and zip or city state country zip.



Hi Karl,

so basically what you're looking for is a database map between  
timezone and

country/state/zip.

Did you try to google such a thing?

One of the first posts I found was a StackOverflow question about  
this; one
of the answers mentioned just such a database on Tom Boutell's  
website (the
same person who created the GD library [used for image-creation in  
php]):
http://www.boutell.com/zipcodes/ It includes states, cities, zip  
codes, etc.

for the USA. Since you specifically mentioned you want to find it by
state, it means you're mainly focussing on the USA (barely any other
country even bothers with states).

Apart from the above data, I'm sure you can find more on google.

Good luck.
- Tul


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




Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] Re: User Timezone

2012-10-20 Thread Karl DeSaulniers


On Oct 20, 2012, at 6:02 PM, Matijn Woudt wrote:

On Sun, Oct 21, 2012 at 12:56 AM, Karl DeSaulniers k...@designdrumm.com 
 wrote:


On Oct 20, 2012, at 7:23 AM, Maciek Sokolewicz wrote:


On 20-10-2012 09:39, Karl DeSaulniers wrote:


Hello all,
Happy weekend. Hoping you can help me with an age old question.
I am trying to get a users timezone for a purchase online.
I know that php is not really able to get a timzone of a user  
because

its a server side execution with the date functions.
But I wanted to get a little help on my work around. I am hoping  
someone

can help. TIA

I have a form that a user must fill out in order to purchase  
anything.
On this form they are required to put their city, state, country  
and zip

code.
These are all required fields.

Now, I know there is a way to get a timezone offset if you have a
location to offset.
So is there a way based on the fields provided that I can get that
offset for each user?

(The users have to put a correct city, state, country and zip in  
order

to get there purchase.
This address has to match their paypal or cc address in order to
purchase as well.
So I know there will still be a margin of error with user  
manipulated

info. So that is moot point for now.)

My thoughts are to get a timezone offset based on the country and  
zip

code, with a backup check of city state country zip.
I just don't know where to start looking for how to get the  
timezone or

UTC location based on country and zip or city state country zip.



Hi Karl,

so basically what you're looking for is a database map between  
timezone

and country/state/zip.

Did you try to google such a thing?

One of the first posts I found was a StackOverflow question about  
this;
one of the answers mentioned just such a database on Tom Boutell's  
website
(the same person who created the GD library [used for image- 
creation in

php]): http://www.boutell.com/zipcodes/
It includes states, cities, zip codes, etc. for the USA. Since you
specifically mentioned you want to find it by state, it means  
you're
mainly focussing on the USA (barely any other country even bothers  
with

states).

Apart from the above data, I'm sure you can find more on google.

Good luck.
- Tul




Thanks for the response. Yes, for the US I plan on calculating by  
state, but

this website is not geared to just the US.
So I am looking for a solution that lets me also calculate by
country/region.
Was looking on google and found geoip, but not sure if this will do  
the job

I am looking for.
Anyone with experience on geoip that can send pointers?

Thanks,


Best,
Karl DeSaulniers
Design Drumm
http://designdrumm.com



Geo IP is based on IP, and I must warn you that IP data is not always
accurate. Especially here in Europe, companies that are based in
multiple countries sometimes only register their IPs in a single
country, and share them between all the countries they are active in.
This will give you wrong data from GeoIP. The time difference will
only be 1 hour at max, but still.



That was what my own suspicions were leading to.
I am familiar with the fact that ips can be spoofed.
Thanks for the corroboration.

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



[PHP] define()

2012-06-16 Thread Karl DeSaulniers
Quick question phprz. Is it ok to put a token inside a define()  
statement?


IE:
define('TOKEN', $sometoken);

I guess what I am really after is if this can be read by a hacker?
I may be misguided as to what define()'s parameters are.
Once you define something it becomes a server variable?
And server variables are easy to read/get ?

If it is unsafe, what is the best method of storing/using a token so  
that it can be called at will?
Kind of like a global, just more secure. Can you secure a define  
statement?


TIA,

Best,
Karl DeSaulniers
Design Drumm
http://designdrumm.com



[PHP] Re: define()

2012-06-16 Thread Karl DeSaulniers


On Jun 16, 2012, at 6:39 AM, Maciek Sokolewicz wrote:


On 16-06-2012 08:36, Karl DeSaulniers wrote:
Quick question phprz. Is it ok to put a token inside a define()  
statement?


IE:
define('TOKEN', $sometoken);

I guess what I am really after is if this can be read by a hacker?
I may be misguided as to what define()'s parameters are.
Once you define something it becomes a server variable?
And server variables are easy to read/get ?

If it is unsafe, what is the best method of storing/using a token so
that it can be called at will?
Kind of like a global, just more secure. Can you secure a define  
statement?


TIA,

Best,
Karl DeSaulniers
Design Drumm
http://designdrumm.com




I don't think you understand what define does, or what a constant is.

The define function literally defines a constant. That is, it  
creates a constant in your script.
A constant isn't a server variable, it's not some kind of special  
global whatever.


A constant is a kind of variable, but which is constant; that is, it  
can not change value once set. Constants in PHP look like variables,  
only without the preceding $-mark. They are not inherently safer or  
better than normal variables.


Now, the question we would all like to pose is: what are you trying  
to do?. You say you're looking for the best method of storing/using  
a token to be called at will. Then of course a good question would  
be what do you mean by 'token'? and what do you want to do with  
that 'token'? Why is that 'token' so important to you?


Thanks for the reply. I had a feeling I was off-track.
I am using the token for a paypal verification. Paypals PDT.
Would like to know how to store safely in my config file to use in my  
scripts.


Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



[PHP] Converting date string to unix timestamp

2012-05-11 Thread Karl DeSaulniers

Hello everyone,
Got a quick one (I hope), and probably an easy one.
For some reason it is eluding me at the moment.
Hoping someone can help.

I am building an ics file with PHP and the form that is submitting to  
create this ics file has a jQuery date picker on it.
The date furnished comes to me like this Saturday, January 1, 2012,  
and a time furnished like 4:20 pm with no seconds.


Now for the ics file, I need the date/time combo to be..

Ymd\THis\Z  or in the case of the above date and time, 20120101T042000Z

Here is the block of code that I am using for this.

CODE [
...
}
else {  
	$dt_start = $_POST[field20] ? $_POST[field20] :  
$_POST[field21];  //Saturday, January 1, 2012

$dt_end = $_POST[field22]; //Saturday, January 1, 2012
$t_start = $_POST[field24]; //4:20 pm
$t_end = $_POST[field25];  //5:55 pm
//date_default_timezone_set('UTC');
try {
$start_DT = new DateTime($dt_start .   . $t_start);
$st_date_fmt = new DateTime($start_DT-format(l, F d, Y\TH:ia 
T));
//$startdate_stamp = strtotime($st_date_fmt);
$startdate = $st_date_fmt-format('U');
//$startdate = date('Ymd\THis\Z', $startdate_stamp);
}
catch (Exception $e) {
trigger_error(startdate error:  . $e-getMessage(), 
E_USER_ERROR);
exit(1);
}
try {
if(empty($dt_end)) {
			$enddate = $startdate + (60 * 60); //If no end date provided,  
enddate is 1 hour after startdate.

} else {
$end_DT = new DateTime($dt_end .   . $t_end);
$end_date_fmt = new DateTime($end_DT-format(l, F d, 
Y\TH:ia T));
//$enddate_stamp = strtotime($end_date_fmt);
$enddate = $end_date_fmt-format('U');
//$enddate = date('Ymd\THis\Z', $enddate_stamp);
}
}
catch (Exception $e) {
trigger_error(enddate error:  . $e-getMessage(), 
E_USER_ERROR);
exit(1);
}
$stampnow = date('Ymd\THis\Z', time());
//$datestampnow = strtotime($stampnow);
}
...
]

I have a feeling I am mixing something up on my own, but I have been  
staring at this code to long to see it.

Can anyone help me please? Like I said, this is probably an easy one.

TIA!!

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com



Re: [PHP] Converting date string to unix timestamp

2012-05-11 Thread Karl DeSaulniers

Thanks Jim,
To tell you the truth, this was handed off to me.
Thank you for the response. I knew this was just bloated code.
Thanks for verifying that for me. :)

Just one question, why does it echo the 7th and not the 1st?

Should be
20120101T162000Z
not
20120107T162000Z

Best,
Karl


On May 11, 2012, at 7:42 PM, Jim Lucas wrote:


On 05/11/2012 04:11 PM, Karl DeSaulniers wrote:

Hello everyone,
Got a quick one (I hope), and probably an easy one.
For some reason it is eluding me at the moment.
Hoping someone can help.

I am building an ics file with PHP and the form that is submitting to
create this ics file has a jQuery date picker on it.
The date furnished comes to me like this Saturday, January 1, 2012,
and a time furnished like 4:20 pm with no seconds.

Now for the ics file, I need the date/time combo to be..

Ymd\THis\Z or in the case of the above date and time,  
20120101T042000Z


Here is the block of code that I am using for this.



Why do you have so much code to do such a simple thing?

This works for me.

?php
$date = Saturday, January 1, 2012;
$time = 4:20 pm;

echo date('Ymd\THis\Z', strtotime($date.' '.$time));

// Outputs  20120107T162000Z

?

Check it out in action:
http://www.cmsws.com/examples/php/jquery_time_stamp.php
http://www.cmsws.com/examples/php/jquery_time_stamp.phps

Jim


CODE [
...
}
else {
$dt_start = $_POST[field20] ? $_POST[field20] :  
$_POST[field21];

//Saturday, January 1, 2012
$dt_end = $_POST[field22]; //Saturday, January 1, 2012
$t_start = $_POST[field24]; //4:20 pm
$t_end = $_POST[field25]; //5:55 pm
//date_default_timezone_set('UTC');
try {
$start_DT = new DateTime($dt_start .   . $t_start);
$st_date_fmt = new DateTime($start_DT-format(l, F d, Y\TH:ia T));
//$startdate_stamp = strtotime($st_date_fmt);
$startdate = $st_date_fmt-format('U');
//$startdate = date('Ymd\THis\Z', $startdate_stamp);
}
catch (Exception $e) {
trigger_error(startdate error:  . $e-getMessage(), E_USER_ERROR);
exit(1);
}
try {
if(empty($dt_end)) {
$enddate = $startdate + (60 * 60); //If no end date provided,  
enddate is

1 hour after startdate.
} else {
$end_DT = new DateTime($dt_end .   . $t_end);
$end_date_fmt = new DateTime($end_DT-format(l, F d, Y\TH:ia T));
//$enddate_stamp = strtotime($end_date_fmt);
$enddate = $end_date_fmt-format('U');
//$enddate = date('Ymd\THis\Z', $enddate_stamp);
}
}
catch (Exception $e) {
trigger_error(enddate error:  . $e-getMessage(), E_USER_ERROR);
exit(1);
}
$stampnow = date('Ymd\THis\Z', time());
//$datestampnow = strtotime($stampnow);
}
...
]

I have a feeling I am mixing something up on my own, but I have been
staring at this code to long to see it.
Can anyone help me please? Like I said, this is probably an easy one.

TIA!!

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com





--
Jim Lucas

http://www.cmsws.com/
http://www.cmsws.com/examples/
http://www.bendsource.com/


Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] Converting date string to unix timestamp

2012-05-11 Thread Karl DeSaulniers

Never mind, it's because January 1st is not a Saturday.
The 7th is.

Interesting... so it corrects the date per the text representation of  
the day??


Thanks again.

Best,
Karl



On May 11, 2012, at 7:42 PM, Jim Lucas wrote:


On 05/11/2012 04:11 PM, Karl DeSaulniers wrote:

Hello everyone,
Got a quick one (I hope), and probably an easy one.
For some reason it is eluding me at the moment.
Hoping someone can help.

I am building an ics file with PHP and the form that is submitting to
create this ics file has a jQuery date picker on it.
The date furnished comes to me like this Saturday, January 1, 2012,
and a time furnished like 4:20 pm with no seconds.

Now for the ics file, I need the date/time combo to be..

Ymd\THis\Z or in the case of the above date and time,  
20120101T042000Z


Here is the block of code that I am using for this.



Why do you have so much code to do such a simple thing?

This works for me.

?php
$date = Saturday, January 1, 2012;
$time = 4:20 pm;

echo date('Ymd\THis\Z', strtotime($date.' '.$time));

// Outputs  20120107T162000Z

?

Check it out in action:
http://www.cmsws.com/examples/php/jquery_time_stamp.php
http://www.cmsws.com/examples/php/jquery_time_stamp.phps

Jim


CODE [
...
}
else {
$dt_start = $_POST[field20] ? $_POST[field20] :  
$_POST[field21];

//Saturday, January 1, 2012
$dt_end = $_POST[field22]; //Saturday, January 1, 2012
$t_start = $_POST[field24]; //4:20 pm
$t_end = $_POST[field25]; //5:55 pm
//date_default_timezone_set('UTC');
try {
$start_DT = new DateTime($dt_start .   . $t_start);
$st_date_fmt = new DateTime($start_DT-format(l, F d, Y\TH:ia T));
//$startdate_stamp = strtotime($st_date_fmt);
$startdate = $st_date_fmt-format('U');
//$startdate = date('Ymd\THis\Z', $startdate_stamp);
}
catch (Exception $e) {
trigger_error(startdate error:  . $e-getMessage(), E_USER_ERROR);
exit(1);
}
try {
if(empty($dt_end)) {
$enddate = $startdate + (60 * 60); //If no end date provided,  
enddate is

1 hour after startdate.
} else {
$end_DT = new DateTime($dt_end .   . $t_end);
$end_date_fmt = new DateTime($end_DT-format(l, F d, Y\TH:ia T));
//$enddate_stamp = strtotime($end_date_fmt);
$enddate = $end_date_fmt-format('U');
//$enddate = date('Ymd\THis\Z', $enddate_stamp);
}
}
catch (Exception $e) {
trigger_error(enddate error:  . $e-getMessage(), E_USER_ERROR);
exit(1);
}
$stampnow = date('Ymd\THis\Z', time());
//$datestampnow = strtotime($stampnow);
}
...
]

I have a feeling I am mixing something up on my own, but I have been
staring at this code to long to see it.
Can anyone help me please? Like I said, this is probably an easy one.

TIA!!

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com





--
Jim Lucas

http://www.cmsws.com/
http://www.cmsws.com/examples/
http://www.bendsource.com/


Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] Converting date string to unix timestamp

2012-05-11 Thread Karl DeSaulniers

Oh,.. no it works just fine.
I wrote Saturday myself not looking to see if it was actually the 1st.
My fault for a non-existent date.

Thanks for your help though, looks like that did the trick.


On another note, just curious why I keep getting your responses, but  
don't get the emails that I post.

Anyone else having trouble with the list like that?

Best,
Karl


On May 11, 2012, at 8:06 PM, Jim Lucas wrote:


On 05/11/2012 05:55 PM, Karl DeSaulniers wrote:

Thanks Jim,
To tell you the truth, this was handed off to me.
Thank you for the response. I knew this was just bloated code.
Thanks for verifying that for me. :)

Just one question, why does it echo the 7th and not the 1st?


I see that...  Figuring their is a logical reason...

Ah!

The first Saturday in the month of January this year WAS the 7th.   
The 1st was on a Sunday.  I would say that your date picker has  
issues.




Should be
20120101T162000Z
not
20120107T162000Z

Best,
Karl


On May 11, 2012, at 7:42 PM, Jim Lucas wrote:


On 05/11/2012 04:11 PM, Karl DeSaulniers wrote:

Hello everyone,
Got a quick one (I hope), and probably an easy one.
For some reason it is eluding me at the moment.
Hoping someone can help.

I am building an ics file with PHP and the form that is  
submitting to

create this ics file has a jQuery date picker on it.
The date furnished comes to me like this Saturday, January 1,  
2012,

and a time furnished like 4:20 pm with no seconds.

Now for the ics file, I need the date/time combo to be..

Ymd\THis\Z or in the case of the above date and time,  
20120101T042000Z


Here is the block of code that I am using for this.



Why do you have so much code to do such a simple thing?

This works for me.

?php
$date = Saturday, January 1, 2012;
$time = 4:20 pm;

echo date('Ymd\THis\Z', strtotime($date.' '.$time));

// Outputs 20120107T162000Z

?

Check it out in action:
http://www.cmsws.com/examples/php/jquery_time_stamp.php
http://www.cmsws.com/examples/php/jquery_time_stamp.phps

Jim


CODE [
...
}
else {
$dt_start = $_POST[field20] ? $_POST[field20] :  
$_POST[field21];

//Saturday, January 1, 2012
$dt_end = $_POST[field22]; //Saturday, January 1, 2012
$t_start = $_POST[field24]; //4:20 pm
$t_end = $_POST[field25]; //5:55 pm
//date_default_timezone_set('UTC');
try {
$start_DT = new DateTime($dt_start .   . $t_start);
$st_date_fmt = new DateTime($start_DT-format(l, F d, Y\TH:ia  
T));

//$startdate_stamp = strtotime($st_date_fmt);
$startdate = $st_date_fmt-format('U');
//$startdate = date('Ymd\THis\Z', $startdate_stamp);
}
catch (Exception $e) {
trigger_error(startdate error:  . $e-getMessage(),  
E_USER_ERROR);

exit(1);
}
try {
if(empty($dt_end)) {
$enddate = $startdate + (60 * 60); //If no end date provided,  
enddate is

1 hour after startdate.
} else {
$end_DT = new DateTime($dt_end .   . $t_end);
$end_date_fmt = new DateTime($end_DT-format(l, F d, Y\TH:ia T));
//$enddate_stamp = strtotime($end_date_fmt);
$enddate = $end_date_fmt-format('U');
//$enddate = date('Ymd\THis\Z', $enddate_stamp);
}
}
catch (Exception $e) {
trigger_error(enddate error:  . $e-getMessage(), E_USER_ERROR);
exit(1);
}
$stampnow = date('Ymd\THis\Z', time());
//$datestampnow = strtotime($stampnow);
}
...
]

I have a feeling I am mixing something up on my own, but I have  
been

staring at this code to long to see it.
Can anyone help me please? Like I said, this is probably an easy  
one.


TIA!!

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com





--
Jim Lucas

http://www.cmsws.com/
http://www.cmsws.com/examples/
http://www.bendsource.com/


Karl DeSaulniers
Design Drumm
http://designdrumm.com





--
Jim Lucas

http://www.cmsws.com/
http://www.cmsws.com/examples/
http://www.bendsource.com/


Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



[PHP] Re: [PHP-DB] Re: foreach

2012-04-05 Thread Karl DeSaulniers
And POST[] is not the same as $_POST[]

Karl

Sent from losPhone

On Apr 5, 2012, at 3:24 PM, Jim Giner jim.gi...@albanyhandball.com wrote:

 I don't know about others, but I can't make sense of this - way too much 
 presented with no idea of what I am looking at - code or output.
 
 One thing:  $_Request is not the same var as $_REQUEST. 
 
 
 
 -- 
 PHP Database 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] Variable scope

2011-07-14 Thread Karl DeSaulniers

Can anyone explain this to me.

function sendEmail($uname,$subjField,$firstname,$lastname,$email, 
$reply,$e_cc,$e_bcc,$comments,$ip,$Date,$time){


$uname = trim($uname);
$subjField = trim($subjField);
$firstname = trim($firstname);
$lastname = trim($lastname);
$email = trim($email);
$reply = trim($reply);
$e_cc = trim($e_cc);
$e_bcc = trim($e_bcc);
$comments = trim($comments);
$ip = trim($ip);
$Date = trim($Date);
$time = trim($time);

//If I trace here email, reply and the CCs are ok

	if(($firstname  strlen($firstname = trim($firstname))  2)   
($lastname  strlen($lastname = trim($lastname))  2)) {

$fullname = $firstname. .$lastname;
} else {
$fullname = Member;
}
$fullname = trim($fullname);
$To = ;
$from = ;
$headerTXT = ;
$bounce_email = CO_NAME. .BOUNCE_ADDR.;
$subject = $subjectField;
$bulk = false;
//What kind of email is being sent
//Email exists, no Cc or Bcc
if(!empty($email)  empty($_email_cc)  empty($_email_bcc)) {
$To = $fullname. .$email.;
$from = Member .$reply.;
$headerTXT = New message from .CO_NAME. member .$uname;
$bulk = false;
}
//Email empty, Cc exists no Bcc
else if(empty($email)  !empty($e_cc)  empty($e_bcc)) {
$To = $bounce_email;
$from = Member .$reply.;
$headerTXT = New message from .CO_NAME. member .$uname;
$bulk = true;
}
...

//If I trace here $To, $from have everything except the (anything  
between), so for instance..

$To = John Doe ;
$from = Member ;

not

$To = John Doe j...@email.com ;
$from = Member mem...@company.com;

So $email and $reply are loosing their value/scope

But the .CO_NAME. and .BOUNCE_ADDR. are working!?!?
This is also in a page with many other email functions just like this  
one and they work.

Only difference is the $To and $from are not inside an if() { statement.
How did my variables loose scope???

One other note, if I put..
$To = htmlspecialchars($fullname. .$email.);
then $To is correct when I trace..
$To = John Doe j...@email.com ;
but it wont send because the smtp mail will not send to
$To = John Doe lt;j...@email.comgt;

I MUST be doing something wrong.
Also, I did read about using Name em...@email.com but the other  
email functions work fine with those, so I'm not sure what's going on.

TIA,
Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com



[PHP] Re: Variable scope

2011-07-14 Thread Karl DeSaulniers

Lol.. thanks Shawn..
You just caught me trying to hide my actually variable names.
guess I missed some. :P
They are actually the same in my code

*blushing*

Any clue why the if(){ statement would make the variables $email and  
$reply loose their value?

That was the chunk of it. Thanks for the error reporting code.


Best,
Karl


On Jul 14, 2011, at 4:17 PM, Shawn McKenzie wrote:


On 07/14/2011 03:54 PM, Karl DeSaulniers wrote:

Can anyone explain this to me.


I can't read through all that crap, but I notice multiple times  
that you
use undefined variables, due to typo or just not remembering what  
they are.


You pass in $subjField but later try and use $subjectField.  You  
pass in

$e_cc but try and use $_email_cc, etc, etc, etc...

Develop with:

error_reporting(E_ALL);
ini_set('display_errors', '1');

This will tell you about all of those undefined variables.

--
Thanks!
-Shawn
http://www.spidean.com


Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



[PHP] str_replace around a character??

2011-07-13 Thread Karl DeSaulniers

Hello All,
I am needing some assistance. I am trying to add some Cc and Bcc to a  
mail script I have.
On the form I have instructions for each to be separated by a comma +  
a space.
In an all perfect world each user would do this perfectly. ...but  
since were working with something different,

how can I check for this? and catch any that dont do this perfectly?

Is there a reg exp that covers this? I have seen many, but some make  
the head cramp. Mi mui novicio.

To wrap it up, I am basically trying to do this...

$cc = ema...@domain.com ,ema...@doamin.com,ema...@domain.com ,  
ema...@domain.com, 


to be

$cc = ema...@domain.com, ema...@doamin.com, ema...@domain.com,  
ema...@domain.com


Any pointers would be much appreciated.
TIA
Best Regards,

Karl DeSaulniers
Design Drumm
http://designdrumm.com



[PHP] Re: str_replace around a character??

2011-07-13 Thread Karl DeSaulniers


On Jul 13, 2011, at 9:59 AM, Shawn McKenzie wrote:


On 07/13/2011 02:54 AM, Karl DeSaulniers wrote:

Hello All,
I am needing some assistance. I am trying to add some Cc and Bcc to a
mail script I have.
On the form I have instructions for each to be separated by a  
comma + a

space.
In an all perfect world each user would do this perfectly. ...but  
since

were working with something different,
how can I check for this? and catch any that dont do this perfectly?

Is there a reg exp that covers this? I have seen many, but some  
make the

head cramp. Mi mui novicio.
To wrap it up, I am basically trying to do this...

$cc = ema...@domain.com ,ema...@doamin.com,ema...@domain.com ,
ema...@domain.com, 

to be

$cc = ema...@domain.com, ema...@doamin.com, ema...@domain.com,
ema...@domain.com

Any pointers would be much appreciated.
TIA
Best Regards,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


$cc = implode(', ', array_filter(array_map('trim', explode(',',  
$cc;


--
Thanks!
-Shawn
http://www.spidean.com



Thanks Shawn,
I had actually found the same thing myself..

$subCc = array_map('trim',explode(,,$subCc));

But I could not find my post last night to make a new comment about it.
Thank you for yours though.. I did not think of the implode part.

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



[PHP] Re: [PHP-DB] Re: [PHP] Re: [PHP-DB] Re: [PHP] PHP EOL

2011-07-04 Thread Karl DeSaulniers

Hello Stuart,
After some closer look at the RFC Compliant manuals you suggested,
I have determined that the creator of that code was in fact RFC821  
Compliant.
Being that this was a code I found several years ago, RFC822 may not  
have been in effect.
This being the reason (I believe) that the creator went with a check  
for System OS when determining the end of line characters to use.
Not substantiated in any way, but that is what it looks like to me. I  
could stand corrected.


Best,
Karl


On Jul 3, 2011, at 6:11 PM, Karl DeSaulniers wrote:


I see. Yes, I was referring to the PHP manual.
I will investigate the RFC manuals as well like you had noted.
No offense taken. Thank you for the clarification.

Best,
Karl


On Jul 3, 2011, at 6:07 PM, Stuart Dallas wrote:

On Sun, Jul 3, 2011 at 11:22 PM, Karl DeSaulniers  
k...@designdrumm.com wrote:

@Stuart,
Actually that is what made me look into the PHP_EOL Stuart.  
Wanting to do things right.
Did you not read my initial email? I am not suggesting anyone  
adopt my code.
The question was directed to what the differences are so I COULD  
learn the right way.
Being that this was something I got off a tutorial from an  
accredited website, your saying that to the wrong person.
I went and read the manuals and am here now posting the question  
so as to get the right direction.
I have heard the argument and actually agreed. It would be better  
to use the PHP_EOL instead.
I have been directed in the right direction. So I will be changing  
my code to reflect.


I meant no offence, I was simply responding to your comment:   
Also, It has worked for years with no problem and I would still  
use it ...and took it to mean you would have no issue with using  
that code, so I thought it worth pointing out that the standards  
exist for a reason.


In the name of clarification, the manual I was referring to is  
the sum total of the RFCs that define the various protocols used  
on the internet, not the PHP manual which I believe you think I  
meant.


-Stuart

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


Karl DeSaulniers
Design Drumm
http://designdrumm.com



Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



[PHP] Re: [PHP-DB] Re: [PHP] Re: [PHP-DB] Re: [PHP] Re: [PHP-DB] Re: [PHP] PHP EOL

2011-07-04 Thread Karl DeSaulniers

@Stuart
Ah, then you are right that they were not compliant. The code is not  
that old.
Thank you so much for the links and information too. Much more than I  
expected.
I did not know that they were sent OS-Independent, but that makes  
perfect sense.

Again, please excuse my lack of understanding.
My thought on why I would still use the code was that even though the  
SMTP server
would not be OS specific, the email program or browser would be and  
that it would format

for the user depending on that program/browser and the OS it runs on.
IE: Thunderbird on PC or Mac Mail; viewing yahoo on Safari Mac or IE  
on PC.


Technically speaking, is it not possible to determine with a if {} to  
see which catches?
This is probably not the best way to go about formating, just more  
for my intuit.
With that code, I did not get any bounce backs or messages pertaining  
to ill formatting or no send no show.

So it didn't seem to be a bad code. Thus I continued use.
But like what was said earlier in the thread, I agree PHP_EOL would  
be the best fit.


Thank you for all your input, help and resources.

Best,
Karl

On Jul 4, 2011, at 2:01 AM, Stuart Dallas wrote:

On Mon, Jul 4, 2011 at 7:11 AM, Karl DeSaulniers  
k...@designdrumm.comwrote:



Hello Stuart,
After some closer look at the RFC Compliant manuals you suggested,
I have determined that the creator of that code was in fact RFC821
Compliant.
Being that this was a code I found several years ago, RFC822 may  
not have

been in effect.
This being the reason (I believe) that the creator went with a  
check for

System OS when determining the end of line characters to use.
Not substantiated in any way, but that is what it looks like to  
me. I could

stand corrected.



RFC821: Simple Mail Transfer Protocol, dated August 1982 (
http://www.faqs.org/rfcs/rfc821.html)

RFC822: Standard for the Format of ARPA Internet Text Messages,  
dated August

13, 1982 (http://www.faqs.org/rfcs/rfc822.html)

So, unless you started using that code before PHP was created (1995  
if we go

back as far as PHP/FI) then no, RFC822 predates that snippet of code.

Further, RFC821 defines the end of lines as CRLF, so the creator of  
that
code was not RFC821 compliant if it was being used to send commands  
to an

SMTP server.

From RFC821, MAIL FROM command definition: MAIL SP FROM:reverse- 
path

CRLF

From RFC822, general header field definition: field = field-name : [
field-body ] CRLF

Note the CRLF at the end of both definitions.

Now, technically speaking the body of email messages can use any line
endings they want to, but the headers should use CRLF, and commands  
sent to

servers should also use CRLF.

One final thing for you to consider... what we've been talking  
about is
commands and messages being sent to other computers, so what good  
does it do
to send them in a format that's dependent on the OS of the sending  
machine?
The standards exist so they are OS-independant, because you usually  
cannot

tell what OS the computer you're talking to is running.

-Stuart

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


Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



[PHP] Re: [PHP-DB] Re: [PHP] PHP EOL

2011-07-04 Thread Karl DeSaulniers


On Jul 4, 2011, at 2:34 AM, Tim Streater wrote:


On 04 Jul 2011 at 08:01, Stuart Dallas stu...@3ft9.com wrote:

On Mon, Jul 4, 2011 at 7:11 AM, Karl DeSaulniers  
k...@designdrumm.comwrote:



Hello Stuart,
After some closer look at the RFC Compliant manuals you suggested,
I have determined that the creator of that code was in fact RFC821
Compliant.
Being that this was a code I found several years ago, RFC822 may  
not have

been in effect.
This being the reason (I believe) that the creator went with a  
check for

System OS when determining the end of line characters to use.
Not substantiated in any way, but that is what it looks like to  
me. I could

stand corrected.



RFC821: Simple Mail Transfer Protocol, dated August 1982 (
http://www.faqs.org/rfcs/rfc821.html)

RFC822: Standard for the Format of ARPA Internet Text Messages,  
dated August

13, 1982 (http://www.faqs.org/rfcs/rfc822.html)


There are more recent RFCs than these. RFC822 was obsoleted by  
RFC2822, for example, which was itself obsoleted by RFC 5322. See  
here:


http://tools.ietf.org/html/rfc5322

I always use this site for looking at RFCs as every line in the  
contents of an RFC is an internal link which makes finding things  
in the RFC rather easier. The following list of RFCs is the set I  
consulted when writing my own email client:


a)  RFC 5034 POP3
b)  RFC 2821 SMTP
c)  RFC 5322 Internet Message Format
d)  RFC 2045, 2046, 2047, 2048, 2049, (MIME), and 2183


--
Cheers  --  Tim

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


Thank you for that Tim!

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] PHP EOL

2011-07-03 Thread Karl DeSaulniers

Hello All,
Just so you know, this is not something I made up myself.
It was taken from an online HTML email tutorial.
Also, It has worked for years with no problem and I would still use it,
however I found out about the PHP_EOL and was just curious as to the  
difference.


Thanks viraj...

Best,
Karl


On Jul 2, 2011, at 8:28 PM, viraj wrote:


hi all,
looking at the code Karl has posted, this code bit is not going to be
a help in setting the 'new line' character in an email body, because
it decides based on the server operating system.

 if (strtoupper(substr(PHP_OS,0,5)**=='WIN')) {

   $eol=\r\n;


when sending out emails, the most compatible way is to use \r\n as
Stuart has pointed out (plain text emails).


~viraj


On Sat, Jul 2, 2011 at 7:15 PM, Stuart Dallas stu...@3ft9.com wrote:
On Sat, Jul 2, 2011 at 9:01 AM, Karl DeSaulniers  
k...@designdrumm.comwrote:



Hello All,
Happy pre independence for my American PHPers. And good health to  
all

others.
Have a quick question..

I have this code I use for the end of line characters used in my  
mailers.


[Code]
// Is the OS Windows or Mac or Linux
if (strtoupper(substr(PHP_OS,0,5)**=='WIN')) {
   $eol=\r\n;
} else if (strtoupper(substr(PHP_OS,0,5)**=='MAC')) {
   $eol=\r;
} else {
   $eol=\n;
}
[End Code]

Does this suffice or should I be using the php supplied end of line?

$eol=PHP_EOL;

Or do these do the same thing?
What advantages over the code I use does the PHP_EOL have?
Or does it not matter with these and either are good to go?

It seems to me that they do the same thing.. am I on the right  
track or

missing something?
Is there any other OS's that are not WIN or MAC and use the \r  
or \r\n

?
If their are, then I can see an advantage of using the PHP_EOL.

Like I said, just a quick question. ;)



When you say mailers are you talking about emails? If so then  
you should
be using \r\n at all times since that's what numerous email- 
related RFCs
specify. If you use anything else then you may find your email  
gets rejected
by strictly implemented mail servers (rare these days, but it  
happens).


Incidentally, CR only applies to Mac OS9 and earlier. OSX uses LF  
due to its

BSD roots. For a near-complete list, see Representations here:
http://en.wikipedia.org/wiki/Newline.

-Stuart

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



Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



[PHP] Re: [PHP-DB] Re: [PHP] PHP EOL

2011-07-03 Thread Karl DeSaulniers

@Stuart,
Actually that is what made me look into the PHP_EOL Stuart. Wanting  
to do things right.
Did you not read my initial email? I am not suggesting anyone adopt  
my code.
The question was directed to what the differences are so I COULD  
learn the right way.
Being that this was something I got off a tutorial from an accredited  
website, your saying that to the wrong person.
I went and read the manuals and am here now posting the question so  
as to get the right direction.
I have heard the argument and actually agreed. It would be better to  
use the PHP_EOL instead.
I have been directed in the right direction. So I will be changing my  
code to reflect.


Thank you,

Best,
Karl

A am going to end this thread here. Since it is getting cross-post  
responses.


On Jul 3, 2011, at 4:37 PM, Stuart Dallas wrote:

On Sun, Jul 3, 2011 at 10:31 PM, Karl DeSaulniers  
k...@designdrumm.comwrote:



Hello All,
Just so you know, this is not something I made up myself.
It was taken from an online HTML email tutorial.
Also, It has worked for years with no problem and I would still  
use it,

however I found out about the PHP_EOL and was just curious as to the
difference.



You've checked that every single email it has ever sent has been  
received
correctly at the destination mailbox? The internet is built on  
RFCs, and
their general principle is be strict in what you send and liberal  
in what

you accept - if it wasn't like that the internet would fall apart. I
encourage you to do your part to do things right, but it's  
completely up to

you if you don't want to follow the users' manual.

-Stuart

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

On Jul 2, 2011, at 8:28 PM, viraj wrote:


 hi all,
looking at the code Karl has posted, this code bit is not going  
to be

a help in setting the 'new line' character in an email body, because
it decides based on the server operating system.

 if (strtoupper(substr(PHP_OS,0,5)=='WIN')) {


  $eol=\r\n;



when sending out emails, the most compatible way is to use \r\n as
Stuart has pointed out (plain text emails).


~viraj


On Sat, Jul 2, 2011 at 7:15 PM, Stuart Dallas stu...@3ft9.com  
wrote:


On Sat, Jul 2, 2011 at 9:01 AM, Karl DeSaulniers  
k...@designdrumm.com

wrote:


 Hello All,
Happy pre independence for my American PHPers. And good health  
to all

others.
Have a quick question..

I have this code I use for the end of line characters used in my
mailers.

[Code]
// Is the OS Windows or Mac or Linux
if (strtoupper(substr(PHP_OS,0,5)=='WIN')) {
  $eol=\r\n;
} else if (strtoupper(substr(PHP_OS,0,5)=='MAC')) {
  $eol=\r;
} else {
  $eol=\n;
}
[End Code]

Does this suffice or should I be using the php supplied end of  
line?


$eol=PHP_EOL;

Or do these do the same thing?
What advantages over the code I use does the PHP_EOL have?
Or does it not matter with these and either are good to go?

It seems to me that they do the same thing.. am I on the right  
track or

missing something?
Is there any other OS's that are not WIN or MAC and use the  
\r or

\r\n
?
If their are, then I can see an advantage of using the PHP_EOL.

Like I said, just a quick question. ;)



When you say mailers are you talking about emails? If so then you
should
be using \r\n at all times since that's what numerous email- 
related

RFCs
specify. If you use anything else then you may find your email gets
rejected
by strictly implemented mail servers (rare these days, but it  
happens).


Incidentally, CR only applies to Mac OS9 and earlier. OSX uses  
LF due to

its
BSD roots. For a near-complete list, see Representations here:
http://en.wikipedia.org/wiki/**Newlinehttp://en.wikipedia.org/ 
wiki/Newline

.

-Stuart

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



Karl DeSaulniers
Design Drumm
http://designdrumm.com


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




Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] Re: [PHP-DB] Re: [PHP] PHP EOL

2011-07-03 Thread Karl DeSaulniers

I see. Yes, I was referring to the PHP manual.
I will investigate the RFC manuals as well like you had noted.
No offense taken. Thank you for the clarification.

Best,
Karl


On Jul 3, 2011, at 6:07 PM, Stuart Dallas wrote:

On Sun, Jul 3, 2011 at 11:22 PM, Karl DeSaulniers  
k...@designdrumm.com wrote:

@Stuart,
Actually that is what made me look into the PHP_EOL Stuart. Wanting  
to do things right.
Did you not read my initial email? I am not suggesting anyone adopt  
my code.
The question was directed to what the differences are so I COULD  
learn the right way.
Being that this was something I got off a tutorial from an  
accredited website, your saying that to the wrong person.
I went and read the manuals and am here now posting the question so  
as to get the right direction.
I have heard the argument and actually agreed. It would be better  
to use the PHP_EOL instead.
I have been directed in the right direction. So I will be changing  
my code to reflect.


I meant no offence, I was simply responding to your comment:   
Also, It has worked for years with no problem and I would still  
use it ...and took it to mean you would have no issue with using  
that code, so I thought it worth pointing out that the standards  
exist for a reason.


In the name of clarification, the manual I was referring to is  
the sum total of the RFCs that define the various protocols used on  
the internet, not the PHP manual which I believe you think I meant.


-Stuart

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


Karl DeSaulniers
Design Drumm
http://designdrumm.com



[PHP] PHP EOL

2011-07-02 Thread Karl DeSaulniers

Hello All,
Happy pre independence for my American PHPers. And good health to all  
others.

Have a quick question..

I have this code I use for the end of line characters used in my  
mailers.


[Code]
// Is the OS Windows or Mac or Linux
if (strtoupper(substr(PHP_OS,0,5)=='WIN')) {
$eol=\r\n;
} else if (strtoupper(substr(PHP_OS,0,5)=='MAC')) {
$eol=\r;
} else {
$eol=\n;
}
[End Code]

Does this suffice or should I be using the php supplied end of line?

$eol=PHP_EOL;

Or do these do the same thing?
What advantages over the code I use does the PHP_EOL have?
Or does it not matter with these and either are good to go?

It seems to me that they do the same thing.. am I on the right track  
or missing something?
Is there any other OS's that are not WIN or MAC and use the \r or  
\r\n ?

If their are, then I can see an advantage of using the PHP_EOL.

Like I said, just a quick question. ;)


Karl DeSaulniers
Design Drumm
http://designdrumm.com



Re: [PHP] PHP EOL

2011-07-02 Thread Karl DeSaulniers

On Jul 2, 2011, at 3:10 AM, viraj wrote:


PHP_EOL is the best fit. you do not have to write multiple lines of
code to do the same thing.

~viraj

p.s. cross-posting is bad. removed db. from the cc list.

On Sat, Jul 2, 2011 at 1:31 PM, Karl DeSaulniers  
k...@designdrumm.com wrote:

Hello All,
Happy pre independence for my American PHPers. And good health to all
others.
Have a quick question..

I have this code I use for the end of line characters used in my  
mailers.


[Code]
// Is the OS Windows or Mac or Linux
if (strtoupper(substr(PHP_OS,0,5)=='WIN')) {
   $eol=\r\n;
} else if (strtoupper(substr(PHP_OS,0,5)=='MAC')) {
   $eol=\r;
} else {
   $eol=\n;
}
[End Code]

Does this suffice or should I be using the php supplied end of line?

$eol=PHP_EOL;

Or do these do the same thing?
What advantages over the code I use does the PHP_EOL have?
Or does it not matter with these and either are good to go?

It seems to me that they do the same thing.. am I on the right  
track or

missing something?
Is there any other OS's that are not WIN or MAC and use the \r  
or \r\n ?

If their are, then I can see an advantage of using the PHP_EOL.

Like I said, just a quick question. ;)


Karl DeSaulniers
Design Drumm
http://designdrumm.com





Oops sory for the cross post. Didn't realize that's what that was.
I have seen others do it in the past.
I am a bit of a list novice.
Wont happen again.
Thanks for your reply.


Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



[PHP] Re: [PHP-DB] Re: [PHP] PHP EOL

2011-07-02 Thread Karl DeSaulniers

Thanks Stuart!

Karl

Sent from losPhone

On Jul 2, 2011, at 8:45 AM, Stuart Dallas stu...@3ft9.com wrote:

On Sat, Jul 2, 2011 at 9:01 AM, Karl DeSaulniers  
k...@designdrumm.comwrote:



Hello All,
Happy pre independence for my American PHPers. And good health to all
others.
Have a quick question..

I have this code I use for the end of line characters used in my  
mailers.


[Code]
// Is the OS Windows or Mac or Linux
if (strtoupper(substr(PHP_OS,0,5)**=='WIN')) {
  $eol=\r\n;
} else if (strtoupper(substr(PHP_OS,0,5)**=='MAC')) {
  $eol=\r;
} else {
  $eol=\n;
}
[End Code]

Does this suffice or should I be using the php supplied end of line?

$eol=PHP_EOL;

Or do these do the same thing?
What advantages over the code I use does the PHP_EOL have?
Or does it not matter with these and either are good to go?

It seems to me that they do the same thing.. am I on the right  
track or

missing something?
Is there any other OS's that are not WIN or MAC and use the \r or  
\r\n

?
If their are, then I can see an advantage of using the PHP_EOL.

Like I said, just a quick question. ;)



When you say mailers are you talking about emails? If so then you  
should
be using \r\n at all times since that's what numerous email- 
related RFCs
specify. If you use anything else then you may find your email gets  
rejected
by strictly implemented mail servers (rare these days, but it  
happens).


Incidentally, CR only applies to Mac OS9 and earlier. OSX uses LF  
due to its

BSD roots. For a near-complete list, see Representations here:
http://en.wikipedia.org/wiki/Newline.

-Stuart

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


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



[PHP] Re: [PHP-DB] Two forms on one page

2011-01-03 Thread Karl DeSaulniers

On Jan 3, 2011, at 5:17 PM, Ethan Rosenberg wrote:


'Submit Ktten'




Shouldn't this be..

'Submit Kitten'

If your asking for it to explicitly equal that (===), then you need  
to spell Kitten with an i in it?
But, that may not be what is actually wrong, just somehting I think I  
caught.


Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



[PHP] Re: [PHP-DB] Re: [PHP] Regex for telephone numbers

2010-12-29 Thread Karl DeSaulniers

Hi Ethan,
Could you do a string compare and check at certain characters for a  
dash?

IE:
check the second character to see if it is a dash for 1-800...
if that is not a dash, check the fourth character for a dash, 469-9...
then the other places  where dashes would be based on those two  
characters.
You may have to investigate how international numbers would work and  
adjust appropriately, but for the US, that should work.

Then just send an error message when it isn't like you want.
JAT

Karl


On Dec 29, 2010, at 6:27 PM, Josh Kehn wrote:




On Dec 29, 2010, at 7:12 PM, Ethan Rosenberg eth...@earthlink.net  
wrote:



Dear List -

Thank you for all your help in the past.

Here is another one

I would like to have a regex  which would validate that a  
telephone number is in the format xxx-xxx-.


Thanks.

Ethan

MySQL 5.1  PHP 5  Linux [Debian (sid)]


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



You can't, phone numbers are more complex then that. You could use  
\d{3}-\d{3}-\d{4} to match that basic pattern for all numbers though.


Regards,

-Josh
___
http://joshuakehn.com
Sent from my iPod
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



[PHP] Re: [PHP-DB] Re: [PHP] Regex for telephone numbers

2010-12-29 Thread Karl DeSaulniers

You could also help them out a little with something like..

$phone = str_replace((, , $phone);
$phone = str_replace(), -, $phone);

HTH,

Karl


On Dec 29, 2010, at 6:27 PM, Josh Kehn wrote:




On Dec 29, 2010, at 7:12 PM, Ethan Rosenberg eth...@earthlink.net  
wrote:



Dear List -

Thank you for all your help in the past.

Here is another one

I would like to have a regex  which would validate that a  
telephone number is in the format xxx-xxx-.


Thanks.

Ethan

MySQL 5.1  PHP 5  Linux [Debian (sid)]


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



You can't, phone numbers are more complex then that. You could use  
\d{3}-\d{3}-\d{4} to match that basic pattern for all numbers though.


Regards,

-Josh
___
http://joshuakehn.com
Sent from my iPod
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] include html

2010-11-02 Thread Karl DeSaulniers


On Nov 2, 2010, at 12:37 AM, Nathan Nobbe wrote:

On Mon, Nov 1, 2010 at 11:22 PM, Karl DeSaulniers  
k...@designdrumm.com wrote:
I need to basically grab the source of the page as text. Then I can  
do a replace() on the link tag. Then insert the text into an  
Iframe. In theory, this I thought would be handled better server  
side. Is this possible?


yes, there are a few options, fopen wrappers, curl or raw sockets  
all come to mind.  fopen wrappers sound like they may be easiest  
for you.


Any examples or urls to make a fopen wrapper? Or is there a simple  
function for getting the source text from a URL?
Thats all I really need, if I can get html.../html in text, I'm  
good!
From that point I can insert the text into a hidden form field and  
grab the text via javascript if need be (but very hackish) or with php.
I think that may be a solution, if I assign an include statement or  
echo of the url inside a hidden form field.
A hidden form field will force the text to be saved and not parsed. I  
think.




I think the problem I'm having is that the domain I'm requesting  
from is not the same domain as mine so their may be some security  
issue.


right, this is why you would setup a server side proxy, to avoid  
client side cross domain security restrictions, however you'll have  
to change all the instances of the remote domain to your domain,  
and ensure that your server actually is able to fulfill requests  
for those resources.


Server side proxy.. I have  heard of this, but do not know exactly  
what a proxy does to know if it would be a solution.
I also have not seen one in action nor made one (that I know of), any  
beginner tuts you can lend?




I also thought about injecting a link tag into the iframe at the  
same time I load the HTML.


when you say link tag are you talking about a tags?  you lost me  
on this last line here.


IE:  [code]
Get the text from their source, something like:

$htmlTextresult = html
head
link href=css/fromtheirsite.css rel=stylesheet type=text/css  
media=all /

/head
body
... their content
/body
/html

then do a string replace on the link tag..
$newTextresult = str_replace($htmlTextresult, 'link href=css/ 
fromtheirsite.css rel=stylesheet type=text/css media=all /',  
'link href=css/frommysite.css rel=stylesheet type=text/css  
media=all /');

or
$newTextresult = str_replace($htmlTextresult, 'css/ 
fromtheirsite.css', 'css/frommysite.css');


insert new text into the iframe..
$newTextresult = html
head
link href=css/frommysite.css rel=stylesheet type=text/css  
media=all /

/head
body
... their content/ my style :)
/body
/html

Or is there a way to strip the text that is in the head , body  
and script  tags?

I could then insert those into a blank html file?



Browsers load the last style sheet on top of others.

this is true, but i doubt you'll be able to have it load a css file  
from your domain atop a css file from a remote domain.


Well contrary, I think, only because all css tuts I found warned  
about using the !important in your css as it would override an  
external css.
Imported css has the least priority out of all and their css is  
imported, maybe if I wrote the css as a style inline within the  
text I received from the source?
I know that would work as far as my css beating out theirs. And the  
idea is to get the source and replace the text that points to their  
css (the  link tag) with mine before its parsed.




 If I could just get the link tag into the iframes contents right  
after I get the source text in there, it may work. But there is  
also the issue of correctly assigning the classes and I'd that are  
used in the iframe. Like


iframe.holder .someclassusedbythem {}

Or do I do?

iframe#holder .someclassusedbythem {}

Or

#holder .someclassusedbythem {}

Sorry if I'm OT with that.

shrug, no worries, but im too lazy to dig into the details of  
client side options. :)


Hey thanks for your help Nathan. I was starting to think I needed to  
scrap.

You have sparked the curiosity again.

Best,



-nathan




Karl DeSaulniers
Design Drumm
http://designdrumm.com



Re: [PHP] include html

2010-11-01 Thread Karl DeSaulniers
I need to basically grab the source of the page as text. Then I can do  
a replace() on the link tag. Then insert the text into an Iframe. In  
theory, this I thought would be handled better server side. Is this  
possible? I think the problem I'm having is that the domain I'm  
requesting from is not the same domain as mine so their may be some  
security issue. I also thought about injecting a link tag into the  
iframe at the same time I load the HTML. Browsers load the last style  
sheet on top of others.  If I could just get the link tag into the  
iframes contents right after I get the source text in there, it may  
work. But there is also the issue of correctly assigning the classes  
and I'd that are used in the iframe. Like


iframe.holder .someclassusedbythem {}

Or do I do?

iframe#holder .someclassusedbythem {}

Or

#holder .someclassusedbythem {}

Sorry if I'm OT with that.

Karl

Sent from losPhone

On Nov 1, 2010, at 11:50 PM, Nathan Nobbe quickshif...@gmail.com  
wrote:



On Sunday, October 31, 2010, a...@ashleysheridan.co.uk
a...@ashleysheridan.co.uk wrote:
This can only be done with javascript, as the iframe is client- 
side, which php knows nothing about.


sounds to me like OP is building the page which will have the iframe
in it which means this is totally doable server side.  in fact, id
almost prefer server side as that allows masking of the origin making
overriding css values easier afaict.


I am building a website for a tshirt company that uses another
company to get garments and promo items to print on.
The client wants to just have those pages load on top of their
website, but wants the layout to go with their look and feel. their  
css.

We have the go ahead from the other companies to do so as well.


Karl,

this could be done server or client side, however the trouble is
altering the css for every page inside the iframe could be a real
pain.  basically what you could do is act as a proxy, each 'page' from
the original site should be 'made a page' on your site.  basically
youll have to change anchor tag href attributes so each request that
would go back to the original site goes through your site first.  that
way youll have the chance to change the result before handing it back
to the client.  also youll obviously need to change the url to css
file(s) per your primary requirement.  if you do as i suggested above
and make the remote site appear as being served from your domain, you
should be able to get away w/ using a css file served from your domain
as well.

as one of my college professors used to say however, the devil is in
the details, mwahaha.  i would recommend initially experimening to see
if you can use w/e look  feel customizations the remote site offers
to determine if embedding in the iframe w/o any proxy effort is
possible.

-nathan


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



[PHP] include html

2010-10-30 Thread Karl DeSaulniers

Hello,
I am looking for a solution to inject some dynamic html into an  
iframe and rework the css from the results.
Is there a way to do this in PHP? I am not talking about just using  
the src attribute of the iframe either.


Basically,
I want to call on a web page, grab the html code, replace the link  
tag with my own and insert it into an iframe on my page.


I am sure this is not as complicated as I am making it, but I have  
been trying with Ajax for the past couple of days and no luck.
So I was wondering if there was a php alternative to do this with. Or  
if it is even possible or ok to do so.


I am building a website for a tshirt company that uses another  
company to get garments and promo items to print on.
The client wants to just have those pages load on top of their  
website, but wants the layout to go with their look and feel. their css.

We have the go ahead from the other companies to do so as well.

TIA,

Karl DeSaulniers
Design Drumm
http://designdrumm.com



Re: [PHP] Multiple Login in a single PC should not be possible

2010-09-07 Thread Karl DeSaulniers


On Sep 7, 2010, at 12:47 AM, Robert Cummings wrote:


On 10-09-07 01:21 AM, Karl DeSaulniers wrote:

@Jagdeep Singh

Hi Jagdeep,
I know it has been a while now, but I thought I'd let you know.
Setting up a database with a session login and some checks and
balances will allow you to do
what you were wanting with controlling a user using multiple browsers
on the same machine.
I just finished my login system and it is set up with a session that
checks the login status of a user
on every page they go to. I was testing to see how some css was
working on one of the user info pages,
and so I was already logged into the account on safari, I then went
to Opera and Firefox and tried to view the page I
was on and they told me I was not logged in. I also tried logging in
on those browsers and it did not let me.
Hence, I know now it is possible to achieve the results your looking
for.
I just built a query to an ACTIVE_USERS table in my database on the
login page and a session check when each page was visited.
When a user successfully logs into the system, their username and
time of login get stamped in this ACTIVE_USERS table for you to check
against.
You could even put a field in this table that stamps what page they
are on. JAT


Don't know if you still need help with this or not, but thought I'd
let you know what I found out.


If I recall this thread from several months ago... the issue is not  
detecting that a single user is logged in multiple times (this is  
known to be trivial - congratulations you've solved a solved  
problem), but that a person is logged in from one computer multiple  
times (whether it be via different browsers or virtual machines)  
where the logged in account is not necessarily the same user  
account in each logged in instance.


Cheers,
Rob.
--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.



Oh, that's right. Sorry for the rehash, but I found myself in a  
similar situation.


Would using flash and LocalConnection work for this?
Have a hidden flash file with a LocalConnection sending out a beacon  
(if you will) and it will answer itself if any other

browser windows are open that have that LocalConnection.
I think LC would even work if say I had Virtual PC running on my Mac  
and a safari window open on both.

That plus the twice-solved problem and your good I am thinking.

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] Multiple Login in a single PC should not be possible

2010-09-06 Thread Karl DeSaulniers

@Jagdeep Singh

Hi Jagdeep,
I know it has been a while now, but I thought I'd let you know.
Setting up a database with a session login and some checks and  
balances will allow you to do
what you were wanting with controlling a user using multiple browsers  
on the same machine.
I just finished my login system and it is set up with a session that  
checks the login status of a user
on every page they go to. I was testing to see how some css was  
working on one of the user info pages,
and so I was already logged into the account on safari, I then went  
to Opera and Firefox and tried to view the page I
was on and they told me I was not logged in. I also tried logging in  
on those browsers and it did not let me.
Hence, I know now it is possible to achieve the results your looking  
for.
I just built a query to an ACTIVE_USERS table in my database on the  
login page and a session check when each page was visited.
When a user successfully logs into the system, their username and  
time of login get stamped in this ACTIVE_USERS table for you to check  
against.
You could even put a field in this table that stamps what page they  
are on. JAT



Don't know if you still need help with this or not, but thought I'd  
let you know what I found out.


Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] Removing link on the fly, but leave link text

2010-09-01 Thread Karl DeSaulniers


On Aug 31, 2010, at 3:06 PM, Ashley Sheridan wrote:


On Tue, 2010-08-31 at 15:01 -0500, Karl DeSaulniers wrote:


On Aug 31, 2010, at 2:32 PM, Ashley Sheridan wrote:

 On Tue, 2010-08-31 at 14:31 -0500, Karl DeSaulniers wrote:

 Hi,
 Say I have some text.

 $text = 'You can logon here: a href=http://website.com/shop/
 index.php?username='.$username.'http://website.com/shop/ 
index.php?

 username='.$username.'/a. This link will take you to your web
 browser to login.'.$eol;

 I want to be able to strip the a href=http://website.com/shop/
 index.php?username='.$username.' and /a.
 Leaving just the http://website.com/shop/index.php?username='.
 $username.' text, so it would end up like.


 $text = 'You can logon here: http://website.com/shop/index.php?
 username='.$username.'. This link will take you to your web  
browser

 to login.'.$eol;

 I have tried MANY different ways and have no success.
 Can anyone help me?
 TIA


 Karl DeSaulniers
 Design Drumm
 http://designdrumm.com


 strip_tags() will do the job here.

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



Hi Ash,
I tried that, but it did not work.
I do not want it to strip all tags, just the a href=/a. so if
there was a p or br /. I don't want those removed.
There is more text than just what I posted.

This is what I am trying currently.
This is someones code from a forum that I am trying to adopt.

//CODE start
function strip_only($str, $tags) { // Thanks Steve
 if(!is_array($tags)) {
 $tags = (strpos($str, '') !== false ? explode('',
str_replace('', '', $tags)) : array($tags));
 if(end($tags) == '') array_pop($tags);
 }
 foreach($tags as $tag) $str = preg_replace('#/?'.$tag.'[^]
*#is', '', $str);
 return $str;
}

$str = 'p style=text-align:centerParagraph/pstrongBold/
strongbr/span style=color:redRed/spanh1Header/h1';

echo strip_only($str, array('p', 'h1'));
echo strip_only($str, 'ph1');

//CODE end

I was using it like so.

$text = strip_only($text, array('a'));
or
$text = strip_only($text, 'a');

But got my results back like:
'You can logon here: href=http://website.com/shop/
index.php?username='.$username.'http://website.com/shop/index.php?
username='.$username.'. This link will take you to your web
browser to login.'.$eol;
uugh..

Karl DeSaulniers
Design Drumm
http://designdrumm.com



Look at the second argument to strip_tags() which allows you to  
specify a list of allowable tags. It will do what you want, you  
just need to look at the manual.


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





Hey Ash,
I did as you suggested and still got the same results.

Results:
'You can logon here: href=http://website.com/shop/
index.php?username='.$username.'http://website.com/shop/index.php?
username='.$username.'. This link will take you to your web
browser to login.'.$eol;
Could it be because there is a ? in the string or the php variable?

Karl DeSaulniers
Design Drumm
http://designdrumm.com



Re: [PHP] Removing link on the fly, but leave link text

2010-08-31 Thread Karl DeSaulniers


On Aug 31, 2010, at 2:32 PM, Ashley Sheridan wrote:


On Tue, 2010-08-31 at 14:31 -0500, Karl DeSaulniers wrote:


Hi,
Say I have some text.

$text = 'You can logon here: a href=http://website.com/shop/
index.php?username='.$username.'http://website.com/shop/index.php?
username='.$username.'/a. This link will take you to your web
browser to login.'.$eol;

I want to be able to strip the a href=http://website.com/shop/
index.php?username='.$username.' and /a.
Leaving just the http://website.com/shop/index.php?username='.
$username.' text, so it would end up like.


$text = 'You can logon here: http://website.com/shop/index.php?
username='.$username.'. This link will take you to your web browser
to login.'.$eol;

I have tried MANY different ways and have no success.
Can anyone help me?
TIA


Karl DeSaulniers
Design Drumm
http://designdrumm.com



strip_tags() will do the job here.

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




Hi Ash,
I tried that, but it did not work.
I do not want it to strip all tags, just the a href=/a. so if  
there was a p or br /. I don't want those removed.

There is more text than just what I posted.

This is what I am trying currently.
This is someones code from a forum that I am trying to adopt.

//CODE start
function strip_only($str, $tags) { // Thanks Steve
if(!is_array($tags)) {
$tags = (strpos($str, '') !== false ? explode('',  
str_replace('', '', $tags)) : array($tags));

if(end($tags) == '') array_pop($tags);
}
foreach($tags as $tag) $str = preg_replace('#/?'.$tag.'[^] 
*#is', '', $str);

return $str;
}

$str = 'p style=text-align:centerParagraph/pstrongBold/ 
strongbr/span style=color:redRed/spanh1Header/h1';


echo strip_only($str, array('p', 'h1'));
echo strip_only($str, 'ph1');

//CODE end

I was using it like so.

$text = strip_only($text, array('a'));
or
$text = strip_only($text, 'a');

But got my results back like:
'You can logon here: href=http://website.com/shop/
index.php?username='.$username.'http://website.com/shop/index.php?
username='.$username.'. This link will take you to your web
browser to login.'.$eol;
uugh..

Karl DeSaulniers
Design Drumm
http://designdrumm.com



Re: [PHP] Removing link on the fly, but leave link text

2010-08-31 Thread Karl DeSaulniers


On Aug 31, 2010, at 2:34 PM, Joshua Kehn wrote:


On Aug 31, 2010, at 3:31 PM, Karl DeSaulniers wrote:


Hi,
Say I have some text.

$text = 'You can logon here: a href=http://website.com/shop/ 
index.php?username='.$username.'http://website.com/shop/ 
index.php?username='.$username.'/a. This link will take you to  
your web browser to login.'.$eol;


I want to be able to strip the a href=http://website.com/shop/ 
index.php?username='.$username.' and /a.
Leaving just the http://website.com/shop/index.php?username='. 
$username.' text, so it would end up like.



$text = 'You can logon here: http://website.com/shop/index.php? 
username='.$username.'. This link will take you to your web  
browser to login.'.$eol;


I have tried MANY different ways and have no success.
Can anyone help me?
TIA


Karl DeSaulniers
Design Drumm
http://designdrumm.com



Would it be safe to simply strip out anything between  and  ?

Regards,

-Josh

Joshua Kehn | josh.k...@gmail.com
http://joshuakehn.com




Hi Josh,

Safe? Not sure what you mean.
The text is for an email that is originally done in html code,
that when sent, checks to see if the recipiant can get html emails.
if not the text version is sent, but I want to remove any a href/ 
a tags before sending.


This is how it starts:
$text = 'You can logon here: a href=http://website.com/shop/ 
index.php?username='.$username.'http://website.com/shop/index.php? 
username='.$username.'/a. This link will take you to your web  
browser to login.'.$eol;

This is how I want it if they dont get the thml version
$text = 'You can logon here: http://website.com/shop/index.php? 
username='.$username.'. This link will take you to your web browser  
to login.'.$eol;


Hope that clarifies
Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] Removing link on the fly, but leave link text

2010-08-31 Thread Karl DeSaulniers


On Aug 31, 2010, at 3:06 PM, Ashley Sheridan wrote:


On Tue, 2010-08-31 at 15:01 -0500, Karl DeSaulniers wrote:


On Aug 31, 2010, at 2:32 PM, Ashley Sheridan wrote:

 On Tue, 2010-08-31 at 14:31 -0500, Karl DeSaulniers wrote:

 Hi,
 Say I have some text.

 $text = 'You can logon here: a href=http://website.com/shop/
 index.php?username='.$username.'http://website.com/shop/ 
index.php?

 username='.$username.'/a. This link will take you to your web
 browser to login.'.$eol;

 I want to be able to strip the a href=http://website.com/shop/
 index.php?username='.$username.' and /a.
 Leaving just the http://website.com/shop/index.php?username='.
 $username.' text, so it would end up like.


 $text = 'You can logon here: http://website.com/shop/index.php?
 username='.$username.'. This link will take you to your web  
browser

 to login.'.$eol;

 I have tried MANY different ways and have no success.
 Can anyone help me?
 TIA


 Karl DeSaulniers
 Design Drumm
 http://designdrumm.com


 strip_tags() will do the job here.

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



Hi Ash,
I tried that, but it did not work.
I do not want it to strip all tags, just the a href=/a. so if
there was a p or br /. I don't want those removed.
There is more text than just what I posted.

This is what I am trying currently.
This is someones code from a forum that I am trying to adopt.

//CODE start
function strip_only($str, $tags) { // Thanks Steve
 if(!is_array($tags)) {
 $tags = (strpos($str, '') !== false ? explode('',
str_replace('', '', $tags)) : array($tags));
 if(end($tags) == '') array_pop($tags);
 }
 foreach($tags as $tag) $str = preg_replace('#/?'.$tag.'[^]
*#is', '', $str);
 return $str;
}

$str = 'p style=text-align:centerParagraph/pstrongBold/
strongbr/span style=color:redRed/spanh1Header/h1';

echo strip_only($str, array('p', 'h1'));
echo strip_only($str, 'ph1');

//CODE end

I was using it like so.

$text = strip_only($text, array('a'));
or
$text = strip_only($text, 'a');

But got my results back like:
'You can logon here: href=http://website.com/shop/
index.php?username='.$username.'http://website.com/shop/index.php?
username='.$username.'. This link will take you to your web
browser to login.'.$eol;
uugh..

Karl DeSaulniers
Design Drumm
http://designdrumm.com



Look at the second argument to strip_tags() which allows you to  
specify a list of allowable tags. It will do what you want, you  
just need to look at the manual.


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





I did and it seemed like the long way around.
I dont need/want to set all the tags that are allowed.
I just need to set the one that isnt.
But thank you, I will take another look at strip_tags().
Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com



[PHP] PHP Reference

2010-08-14 Thread Karl DeSaulniers

Hello all,
I was wondering, can you reference php in a url string like you can  
javascript.

EG:
javascript:someFunction()

Can you do something similar in php like

php:someFunction()

I am thinking that you can not do this, but was wondering if there  
was something like that.

Thanks,


Karl DeSaulniers
Design Drumm
http://designdrumm.com



Re: [PHP] PHP Reference

2010-08-14 Thread Karl DeSaulniers

That is what I thought.
Thank you for confirming.

Karl


On Aug 14, 2010, at 1:54 AM, Peter Lind wrote:

On 14 August 2010 08:08, Karl DeSaulniers k...@designdrumm.com  
wrote:

Hello all,
I was wondering, can you reference php in a url string like you can
javascript.
EG:
javascript:someFunction()

Can you do something similar in php like

php:someFunction()

I am thinking that you can not do this, but was wondering if there  
was

something like that.
Thanks,


No, you can't.

Regards
Peter

--
hype
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
BeWelcome/Couchsurfing: Fake51
Twitter: http://twitter.com/kafe15
/hype


Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] PHP Reference

2010-08-14 Thread Karl DeSaulniers

Thank you Andre.
Yes, I had been doing it that way, but was just wondering if PHP had  
a reference like that of javascript with the colin : in it.


Best,

Karl


On Aug 14, 2010, at 3:50 AM, Andre Polykanine wrote:


Hello Karl,

If I understood you properly, try this:
?SomeFunction();?
--
With best regards from Ukraine,
Andre
Skype: Francophile
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

- Original message -
From: Karl DeSaulniers k...@designdrumm.com
To: php-general php-general@lists.php.net
Date: Saturday, August 14, 2010, 9:08:20 AM
Subject: [PHP] PHP Reference

Hello all,
I was wondering, can you reference php in a url string like you can
javascript.
EG:
javascript:someFunction()

Can you do something similar in php like

php:someFunction()

I am thinking that you can not do this, but was wondering if there
was something like that.
Thanks,


Karl DeSaulniers
Design Drumm
http://designdrumm.com




Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] PHP Reference

2010-08-14 Thread Karl DeSaulniers


On Aug 14, 2010, at 5:19 AM, Ashley Sheridan wrote:


On Sat, 2010-08-14 at 01:57 -0500, Karl DeSaulniers wrote:


That is what I thought.
Thank you for confirming.

Karl


On Aug 14, 2010, at 1:54 AM, Peter Lind wrote:

 On 14 August 2010 08:08, Karl DeSaulniers k...@designdrumm.com
 wrote:
 Hello all,
 I was wondering, can you reference php in a url string like you  
can

 javascript.
 EG:
 javascript:someFunction()

 Can you do something similar in php like

 php:someFunction()

 I am thinking that you can not do this, but was wondering if there
 was
 something like that.
 Thanks,

 No, you can't.

 Regards
 Peter

 --
 hype
 WWW: http://plphp.dk / http://plind.dk
 LinkedIn: http://www.linkedin.com/in/plind
 BeWelcome/Couchsurfing: Fake51
 Twitter: http://twitter.com/kafe15
 /hype

Karl DeSaulniers
Design Drumm
http://designdrumm.com




The reason you can't is because PHP is on the server and Javascript  
is local (e.g. the browser).


Even if the PHP code you're executing is through localhost, because  
PHP needs the server to run, it has to be run on the server, and  
exposing functions directly like this would expose all sorts of  
security issues (imagine calling up a getUserDetails() on a website  
you're not logged into for example, which would mean every function  
of a system would need some sort of user auth check and would slow  
the whole thing to a crawl)


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





I see. Very good point. Thanks Ash.
I figured it was because of the whole pre-processing part of PHP.
Thanks for the explination.
Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com



Re: [PHP] PHP Reference

2010-08-14 Thread Karl DeSaulniers

Thanks tedd.


On Aug 14, 2010, at 7:45 AM, tedd wrote:


At 1:08 AM -0500 8/14/10, Karl DeSaulniers wrote:

Hello all,
I was wondering, can you reference php in a url string like you  
can javascript.

EG:
javascript:someFunction()

Can you do something similar in php like

php:someFunction()

I am thinking that you can not do this, but was wondering if there  
was something like that.

Thanks,


Karl:

As others have answered, no php doesn't work that way.

However, you can still send/receive strings through a url via a  
$_GET) and direct the actions of a receiving php script and you can  
do the same thing via a $_POST.


As such, a php:someFunction() could be a:

url?php=someFunction

Where the receiving script takes the command and runs someFunction().

However, I would shorten it a bit and say

url?php=18

Where php would be the command to run a function and 18 would be  
the function you want to run.


So, while you can't use the same syntax as javascript, you can get  
the same performance.


Cheers,

tedd


--
---
http://sperling.com/


Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



[PHP] Creating image on-the-fly

2010-07-07 Thread Karl DeSaulniers

Hello,
I was wondering if there was any way I can create an image from some  
text with php?


For Eg: I have a text box that will have a number/letter combo,
I want it to dynamically gen the num/lett combo,
then create say a transparent png of that number/letter combo then  
display it to the user.

Can I take this text box and make it a png?

Any pointers or insight appreciated.
If anyone happens to knows of a javascript equiv., that would work too.
TIA

Karl DeSaulniers
Design Drumm
http://designdrumm.com



Re: [PHP] Multiple Login in a single PC should not be possible

2010-06-15 Thread Karl DeSaulniers


On Jun 15, 2010, at 6:24 AM, Ashley Sheridan wrote:


On Tue, 2010-06-15 at 16:52 +0530, Shreyas Agasthya wrote:


Karl,

Which app are you talking about?

Regards,
Shreyas

On Tue, Jun 15, 2010 at 8:21 AM, Karl DeSaulniers  
k...@designdrumm.comwrote:


 Hey,
 I just found this app that I think will do your single user  
login. It is a
 MySQL monitoring app called MySQL Query Analyzer. It has the  
functionality I

 think you were looking for. Might be worth a look-see.

 :))

 Hth,
 Karl






I think he means MySQL Query Analyzer, but I'm not sure how that is  
an answer to the question though!


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





Yes. MySQL Query Analyzer.
I read that it has single user login capability.
Is that not what you were wanting?


Karl DeSaulniers
Design Drumm
http://designdrumm.com



Re: [PHP] Multiple Login in a single PC should not be possible

2010-06-15 Thread Karl DeSaulniers



Sent from losPhone

On Jun 15, 2010, at 7:08 AM, Ashley Sheridan  
a...@ashleysheridan.co.uk wrote:



On Tue, 2010-06-15 at 07:04 -0500, Karl DeSaulniers wrote:


On Jun 15, 2010, at 6:24 AM, Ashley Sheridan wrote:


On Tue, 2010-06-15 at 16:52 +0530, Shreyas Agasthya wrote:


Karl,

Which app are you talking about?

Regards,
Shreyas

On Tue, Jun 15, 2010 at 8:21 AM, Karl DeSaulniers
k...@designdrumm.comwrote:


Hey,
I just found this app that I think will do your single user

login. It is a

MySQL monitoring app called MySQL Query Analyzer. It has the

functionality I

think you were looking for. Might be worth a look-see.

:))

Hth,
Karl







I think he means MySQL Query Analyzer, but I'm not sure how that is
an answer to the question though!

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





Yes. MySQL Query Analyzer.
I read that it has single user login capability.
Is that not what you were wanting?


Karl DeSaulniers
Design Drumm
http://designdrumm.com




Erm...

According to mysql.com it's for Java and .Net (no mention of PHP)  
and it
doesn't look like the source is released, so you can't reverse  
engineer

it, so I don't see how it's an answer to the OP's question.

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




Darn. I missed that part.
Well, sry for getting your hopes up.
I thought I was on to something.

Is there the off chance he could mix JavaScript with his site and this  
program to control his users?


Karl

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



Re: [PHP] Multiple Login in a single PC should not be possible

2010-06-15 Thread Karl DeSaulniers



Sent from losPhone

On Jun 15, 2010, at 12:37 PM, Karl DeSaulniers k...@designdrumm.com  
wrote:





Sent from losPhone

On Jun 15, 2010, at 7:08 AM, Ashley Sheridan  
a...@ashleysheridan.co.uk wrote:



On Tue, 2010-06-15 at 07:04 -0500, Karl DeSaulniers wrote:


On Jun 15, 2010, at 6:24 AM, Ashley Sheridan wrote:


On Tue, 2010-06-15 at 16:52 +0530, Shreyas Agasthya wrote:


Karl,

Which app are you talking about?

Regards,
Shreyas

On Tue, Jun 15, 2010 at 8:21 AM, Karl DeSaulniers
k...@designdrumm.comwrote:


Hey,
I just found this app that I think will do your single user

login. It is a

MySQL monitoring app called MySQL Query Analyzer. It has the

functionality I

think you were looking for. Might be worth a look-see.

:))

Hth,
Karl







I think he means MySQL Query Analyzer, but I'm not sure how that is
an answer to the question though!

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





Yes. MySQL Query Analyzer.
I read that it has single user login capability.
Is that not what you were wanting?


Karl DeSaulniers
Design Drumm
http://designdrumm.com




Erm...

According to mysql.com it's for Java and .Net (no mention of PHP)  
and it
doesn't look like the source is released, so you can't reverse  
engineer

it, so I don't see how it's an answer to the OP's question.

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




Darn. I missed that part.
Well, sry for getting your hopes up.
I thought I was on to something.

Is there the off chance he could mix JavaScript


Oops meant Java

with his site and this program to control his users?

Karl

--
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] Multiple Login in a single PC should not be possible

2010-06-15 Thread Karl DeSaulniers



Sent from losPhone

On Jun 15, 2010, at 12:41 PM, Ashley Sheridan  
a...@ashleysheridan.co.uk wrote:



On Tue, 2010-06-15 at 12:37 -0500, Karl DeSaulniers wrote:



Sent from losPhone

On Jun 15, 2010, at 7:08 AM, Ashley Sheridan
a...@ashleysheridan.co.uk wrote:


On Tue, 2010-06-15 at 07:04 -0500, Karl DeSaulniers wrote:


On Jun 15, 2010, at 6:24 AM, Ashley Sheridan wrote:


On Tue, 2010-06-15 at 16:52 +0530, Shreyas Agasthya wrote:


Karl,

Which app are you talking about?

Regards,
Shreyas

On Tue, Jun 15, 2010 at 8:21 AM, Karl DeSaulniers
k...@designdrumm.comwrote:


Hey,
I just found this app that I think will do your single user

login. It is a

MySQL monitoring app called MySQL Query Analyzer. It has the

functionality I

think you were looking for. Might be worth a look-see.

:))

Hth,
Karl







I think he means MySQL Query Analyzer, but I'm not sure how that  
is

an answer to the question though!

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





Yes. MySQL Query Analyzer.
I read that it has single user login capability.
Is that not what you were wanting?


Karl DeSaulniers
Design Drumm
http://designdrumm.com




Erm...

According to mysql.com it's for Java and .Net (no mention of PHP)
and it
doesn't look like the source is released, so you can't reverse
engineer
it, so I don't see how it's an answer to the OP's question.

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




Darn. I missed that part.
Well, sry for getting your hopes up.
I thought I was on to something.

Is there the off chance he could mix JavaScript with his site and  
this

program to control his users?

Karl




No, because Java and Javascript are not the same thing at all, and  
this

program doesn't control user logins, it's for analysing MySQL queries,
hence its name!

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



Ok.
I was referring to this.
The enhanced MySQL Query Analyzer is available via the latest release  
of MySQL Enterprise at the Gold and Platinum subscriber levels. The  
latest release of MySQL Enterprise also includes:


Improved Enterprise Monitor security with read-only user role and  
single sign-on capabilities through LDAP integration
Are they talking about single user access to this program? I should  
have read more before posting. Sry all. Just trying to help.



Karl

Re: [PHP] Multiple Login in a single PC should not be possible

2010-06-15 Thread Karl DeSaulniers


On Jun 15, 2010, at 12:52 PM, Ashley Sheridan wrote:


On Tue, 2010-06-15 at 12:51 -0500, Karl DeSaulniers wrote:



Sent from losPhone

On Jun 15, 2010, at 12:41 PM, Ashley Sheridan
a...@ashleysheridan.co.uk wrote:


On Tue, 2010-06-15 at 12:37 -0500, Karl DeSaulniers wrote:



Sent from losPhone

On Jun 15, 2010, at 7:08 AM, Ashley Sheridan
a...@ashleysheridan.co.uk wrote:


On Tue, 2010-06-15 at 07:04 -0500, Karl DeSaulniers wrote:


On Jun 15, 2010, at 6:24 AM, Ashley Sheridan wrote:


On Tue, 2010-06-15 at 16:52 +0530, Shreyas Agasthya wrote:


Karl,

Which app are you talking about?

Regards,
Shreyas

On Tue, Jun 15, 2010 at 8:21 AM, Karl DeSaulniers
k...@designdrumm.comwrote:


Hey,
I just found this app that I think will do your single user

login. It is a

MySQL monitoring app called MySQL Query Analyzer. It has the

functionality I

think you were looking for. Might be worth a look-see.

:))

Hth,
Karl







I think he means MySQL Query Analyzer, but I'm not sure how that
is
an answer to the question though!

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





Yes. MySQL Query Analyzer.
I read that it has single user login capability.
Is that not what you were wanting?


Karl DeSaulniers
Design Drumm
http://designdrumm.com




Erm...

According to mysql.com it's for Java and .Net (no mention of PHP)
and it
doesn't look like the source is released, so you can't reverse
engineer
it, so I don't see how it's an answer to the OP's question.

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




Darn. I missed that part.
Well, sry for getting your hopes up.
I thought I was on to something.

Is there the off chance he could mix JavaScript with his site and
this
program to control his users?

Karl




No, because Java and Javascript are not the same thing at all, and
this
program doesn't control user logins, it's for analysing MySQL  
queries,

hence its name!

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



Ok.
I was referring to this.
The enhanced MySQL Query Analyzer is available via the latest release
of MySQL Enterprise at the Gold and Platinum subscriber levels. The
latest release of MySQL Enterprise also includes:

Improved Enterprise Monitor security with read-only user role and
single sign-on capabilities through LDAP integration
Are they talking about single user access to this program? I should
have read more before posting. Sry all. Just trying to help.


Karl



Yeah, it's access to that software! lol

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




Ahhh. My appologies.
It was late when I read it.
:-/

Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] Quick Question

2010-06-14 Thread Karl DeSaulniers

Thanks Malka,
I was wondering if you had a web page I could go to before I sign up  
to see some discussions that have taken place.
I tried using the  lists.evolt.org, but it did not show the  
javascript section.

TIA,

Karl


On Jun 14, 2010, at 3:20 AM, Malka Cymbalista wrote:


javascr...@lists.evolt.org
--

Malka Cymbalista
Webmaster, Weizmann Institute of Science
malki.cymbali...@weizmann.ac.il
08-934-3036



On 6/14/2010 at  2:06 AM, in message
26040320-88f0-4cf3-84ca-2ff81891b...@designdrumm.com, Karl  
DeSaulniers

k...@designdrumm.com wrote:

Hello List,
I may have asked this before, but can not find any emails about it.
Does anyone know of a general-javascript email list like this php  
list?

Hoping someone here can point me in the right direction.
TIA

Karl DeSaulniers
Design Drumm
http://designdrumm.com




Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] Quick Question

2010-06-14 Thread Karl DeSaulniers


On Jun 14, 2010, at 3:45 PM, Paul M Foster wrote:


On Sun, Jun 13, 2010 at 06:06:16PM -0500, Karl DeSaulniers wrote:


Hello List,
I may have asked this before, but can not find any emails about it.
Does anyone know of a general-javascript email list like this php  
list?

Hoping someone here can point me in the right direction.
TIA


Listen, Karl, if you find something like this, let me know. I've been
looking for a javascript list as well.

Thanks,

Paul

--
Paul M. Foster


Hi Paul,
I will post my results here when I find something.


Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] Multiple Login in a single PC should not be possible

2010-06-14 Thread Karl DeSaulniers

Hey,
I just found this app that I think will do your single user login. It  
is a MySQL monitoring app called MySQL Query Analyzer. It has the  
functionality I think you were looking for. Might be worth a look-see.


:))

Hth,
Karl

Re: [PHP] String Parse Help for novice

2010-06-13 Thread Karl DeSaulniers


On Jun 13, 2010, at 5:13 PM, Rick Dwyer wrote:


Hello List.

I need to parse the PATH portion of URL.  I have assigned the path  
portion to a variable using the following:


$thepath = parse_url($url);


Now I need to break each portion of the path down into its own  
variable.  The problem is, the path can vary considerably as follows:


/mydirectory/mysubdirectory/anothersubdirectory/mypage.php

vs.

/mydirectory/mypage.php

How do I get the either of the above url paths broken out so the  
variables equal the following


$dir1 = mydirectory
$dir2 = mysubdirectory
$dir3 = anothersubdirectory
$page = mypage.php

...etc... if there were 5 more subdirectories... they would be  
dynamically assigned to a variable.


 Thanks for any help.

 --Rick



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



Hi Rick,

Just a thought, but cant you do something to separate them according  
to the / (forward slash)?

maybe preg_replace or something. Sorry not much more help.


Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] String Parse Help for novice

2010-06-13 Thread Karl DeSaulniers


On Jun 13, 2010, at 5:23 PM, Ashley Sheridan wrote:


On Sun, 2010-06-13 at 18:13 -0400, Rick Dwyer wrote:


Hello List.

I need to parse the PATH portion of URL.  I have assigned the path
portion to a variable using the following:

$thepath = parse_url($url);


Now I need to break each portion of the path down into its own
variable.  The problem is, the path can vary considerably as follows:

/mydirectory/mysubdirectory/anothersubdirectory/mypage.php

vs.

/mydirectory/mypage.php

How do I get the either of the above url paths broken out so the
variables equal the following

$dir1 = mydirectory
$dir2 = mysubdirectory
$dir3 = anothersubdirectory
$page = mypage.php

...etc... if there were 5 more subdirectories... they would be
dynamically assigned to a variable.

  Thanks for any help.

  --Rick






$filename = basename($path);
$parts = explode('/', $path);
$directories = array_pop($parts);

Now you have your directories in the $directories array and the  
filename

in $filename.

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





Hi Ash,
What about the // in  the beginning?


Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] String Parse Help for novice

2010-06-13 Thread Karl DeSaulniers


On Jun 13, 2010, at 5:31 PM, Ashley Sheridan wrote:


On Sun, 2010-06-13 at 17:27 -0500, Karl DeSaulniers wrote:


On Jun 13, 2010, at 5:23 PM, Ashley Sheridan wrote:


On Sun, 2010-06-13 at 18:13 -0400, Rick Dwyer wrote:


Hello List.

I need to parse the PATH portion of URL.  I have assigned the path
portion to a variable using the following:

$thepath = parse_url($url);


Now I need to break each portion of the path down into its own
variable.  The problem is, the path can vary considerably as  
follows:


/mydirectory/mysubdirectory/anothersubdirectory/mypage.php

vs.

/mydirectory/mypage.php

How do I get the either of the above url paths broken out so the
variables equal the following

$dir1 = mydirectory
$dir2 = mysubdirectory
$dir3 = anothersubdirectory
$page = mypage.php

...etc... if there were 5 more subdirectories... they would be
dynamically assigned to a variable.

  Thanks for any help.

  --Rick






$filename = basename($path);
$parts = explode('/', $path);
$directories = array_pop($parts);

Now you have your directories in the $directories array and the
filename
in $filename.

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





Hi Ash,
What about the // in  the beginning?


Karl DeSaulniers
Design Drumm
http://designdrumm.com





As your example string didn't have a double slash I didn't write code
for that, but it's easy enough to remove 0-length strings from the
$directories array.

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




:) Rick's example, but how in your example do we look for a double  
forward slash?

THX

Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] String Parse Help for novice

2010-06-13 Thread Karl DeSaulniers


On Jun 13, 2010, at 5:35 PM, Rick Dwyer wrote:


OK, I get the following error:

Warning: basename() expects parameter 1 to be string, array given  
in


When I use the following:

$thepath = parse_url($url);
$filename = basename($thepath);

Is my variable thepath not automatically string?

 --Rick




try echo($url); and see


Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] String Parse Help for novice

2010-06-13 Thread Karl DeSaulniers


On Jun 13, 2010, at 5:35 PM, Rick Dwyer wrote:


OK, I get the following error:

Warning: basename() expects parameter 1 to be string, array given  
in


When I use the following:

$thepath = parse_url($url);
$filename = basename($thepath);

Is my variable thepath not automatically string?

 --Rick


Oops I meant
echo($the_path);
or echo both and see.


Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] String Parse Help for novice

2010-06-13 Thread Karl DeSaulniers


On Jun 13, 2010, at 5:40 PM, Ashley Sheridan wrote:


On Sun, 2010-06-13 at 17:35 -0500, Karl DeSaulniers wrote:


On Jun 13, 2010, at 5:31 PM, Ashley Sheridan wrote:

 On Sun, 2010-06-13 at 17:27 -0500, Karl DeSaulniers wrote:

 On Jun 13, 2010, at 5:23 PM, Ashley Sheridan wrote:

 On Sun, 2010-06-13 at 18:13 -0400, Rick Dwyer wrote:

 Hello List.

 I need to parse the PATH portion of URL.  I have assigned the  
path

 portion to a variable using the following:

 $thepath = parse_url($url);


 Now I need to break each portion of the path down into its own
 variable.  The problem is, the path can vary considerably as
 follows:

 /mydirectory/mysubdirectory/anothersubdirectory/mypage.php

 vs.

 /mydirectory/mypage.php

 How do I get the either of the above url paths broken out so the
 variables equal the following

 $dir1 = mydirectory
 $dir2 = mysubdirectory
 $dir3 = anothersubdirectory
 $page = mypage.php

 ...etc... if there were 5 more subdirectories... they would be
 dynamically assigned to a variable.

   Thanks for any help.

   --Rick





 $filename = basename($path);
 $parts = explode('/', $path);
 $directories = array_pop($parts);

 Now you have your directories in the $directories array and the
 filename
 in $filename.

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




 Hi Ash,
 What about the // in  the beginning?


 Karl DeSaulniers
 Design Drumm
 http://designdrumm.com




 As your example string didn't have a double slash I didn't write  
code

 for that, but it's easy enough to remove 0-length strings from the
 $directories array.

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



:) Rick's example, but how in your example do we look for a double
forward slash?
THX

Karl DeSaulniers
Design Drumm
http://designdrumm.com




You don't look for one, that's the point. The explode() breaks the  
string into an array at every occurrence of a '/' character. This  
will leave zero length strings in the array if there is a double //  
(which wasn't in any given example in this thread that I saw) When  
you use the array, just don't do anything with empty elements!


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





Ahh.. that makes sense. Thanks Ash.


Karl DeSaulniers
Design Drumm
http://designdrumm.com



Re: [PHP] Finding a font.

2010-06-08 Thread Karl DeSaulniers

I knew it had to be a script or handwriting font.
I googled script font, went to that site and had all the fonts  
display the A and started scrolling.

Gave up on script fonts and typed in handwriting fonts and BAM!

;)

Karl


On Jun 8, 2010, at 7:45 PM, David McGlone wrote:


On Monday 07 June 2010 22:22:31 Karl DeSaulniers wrote:

Hi Dave,
It is called Fine Hand I believe. Found a copy here.

http://www.fonts.com/FindFonts/Detail.htm?pid=203813/cgi-bin/
MsmGo.exe?grab_id=0page_id=8346query=HANDWRITINGSCOPE=Fonts


Thank you Karl,  how did you find it? every google search I did, I  
could find

all types of fonts, but never could find that A to compare it.

--
Blessings,
David M.

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



Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] Finding a font.

2010-06-08 Thread Karl DeSaulniers

That and I have an uncanny scanning ability while scrolling.
Don't know where it comes from, but glad its there.

lol

Karl


On Jun 8, 2010, at 7:45 PM, David McGlone wrote:


On Monday 07 June 2010 22:22:31 Karl DeSaulniers wrote:

Hi Dave,
It is called Fine Hand I believe. Found a copy here.

http://www.fonts.com/FindFonts/Detail.htm?pid=203813/cgi-bin/
MsmGo.exe?grab_id=0page_id=8346query=HANDWRITINGSCOPE=Fonts


Thank you Karl,  how did you find it? every google search I did, I  
could find

all types of fonts, but never could find that A to compare it.

--
Blessings,
David M.

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



Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] Battle of Spam

2010-06-07 Thread Karl DeSaulniers
Well you coud do just that but after you turn it back on. Set up a  
fresh error log based on the reset of the mail server. You then have  
some kind of script monitoring the in and out of your server.  
Disconnecting the mail server momentarily and maybe a pass reset for  
your users would stunt the hacker for a second, but would help you set  
up a line if defense before they found a way back in. I am not a sysad  
myself, but that seems like a logical way about it. If you let your  
users know ahead of time that this server and pass reset is to save  
their server from attack, most will ablige. Also let them know to not  
use the same password. There may be a better solution though that I  
don't know of. I'll let the gurus interject. :)


Hth

Karl

Sent from losPhone

On Jun 7, 2010, at 4:34 PM, Brian Dunning br...@briandunning.com  
wrote:


I think I must have misstated the problem. Thanks to everyone for  
the replies, but the question is not how to fix it, it's how to find  
the script being attacked. Many different admins manage many  
different sites on this server, and I can't even begin to guess how  
many mail forms are on there from different programmers.


I'm currently downloading the logs as Peter suggested, and will take  
a look. I'm not much of a sysad and I just thought maybe someone  
might know a way to sniff outgoing email or something, I really  
don't know how to attack this. Fixing the scripts is a long term  
solution, obviously, but I need a short term fix other than killing  
email on the apache account.


Might be more of a Linux question than a PHP question.


--
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] Finding a font.

2010-06-07 Thread Karl DeSaulniers

Hi Dave,
It is called Fine Hand I believe. Found a copy here.

http://www.fonts.com/FindFonts/Detail.htm?pid=203813/cgi-bin/ 
MsmGo.exe?grab_id=0page_id=8346query=HANDWRITINGSCOPE=Fonts


HTH,

Karl



On Jun 7, 2010, at 9:01 PM, David McGlone wrote:

Sorry everyone, I know this isn't PHP related and I hope I'm not  
out of line,

If I am I sincerly appologize. I don't know who else I could ask.

What I want to know if anyone can reconize this font. I have  
searched the web
high and low and can't find any matching letter A's in the font  
examples. I
could have found the correct font, but didn't have the A to  
compare it to.
I've also checked Ooo.org's list of fonts and Gimp's list of fonts  
without any

luck. Anyway I stuck the image of the letter on my website

http://www.dmcentral.net/letterA.jpg

--
Blessings,
David M.

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



Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] What's wrong with this code?

2010-06-05 Thread Karl DeSaulniers
Could the exit() be terminating it? Do you need this exit() as the  
else for that if statement? Try deleting just the else {}.


JAT

Karl

Sent from losPhone

On Jun 5, 2010, at 6:54 PM, David Mehler dave.meh...@gmail.com wrote:


Hello,
I've got a while loop outputting values from a database. Briefly it
looks like this:

while($row = mysql_fetch_array($result3))
{
echo tr;
echo td . $row['name'] . /td;
echo td . $row['type'] . /td;
echo td . $row['startdate'] . /td;
if (!empty($row['EndDate'])) {
echo td . $row['enddate'] . /td;
} else {
exit();
}
echo td . $row['location'] . /td;
echo td . $row['summary'] . /td;
echo td . $row['description'] . /td;
echo /tr;
}

That's not the whole code, but it is the problem code. Some output has
the ending date set, one or two records i can't remember how many i
entered with one, most do not, i want the echo to be conditional. The
output stops right before the if statement, echoes startdate and
that's it, comment out the if block and it works fine.
Thanks.
Dave.

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



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



Re: [PHP] What's wrong with this code?

2010-06-05 Thread Karl DeSaulniers

So your code looks like this?

while($row = mysql_fetch_array($result3))
{
echo tr;
echo td . $row['name'] . /td;
echo td . $row['type'] . /td;
echo td . $row['startdate'] . /td;
if (!empty($row['EndDate'])) {  //This should probably be $row 
['enddate']

echo td . $row['enddate'] . /td;
}

echo td . $row['location'] . /td;
echo td . $row['summary'] . /td;
echo td . $row['description'] . /td;
echo /tr;
}


Not to mention, you have a $row['EndDate'] and a $row['enddate'].
Probably need to choose one or the other.

HTH,

Karl



On Jun 5, 2010, at 7:43 PM, David Mehler wrote:


Hi,
Thanks. I took out the entire else section including the exit call, it
now all processes, however $row['enddate'] is not displayed on the two
records where it is set.
Thanks.
Dave.


On 6/5/10, Karl DeSaulniers k...@designdrumm.com wrote:

Could the exit() be terminating it? Do you need this exit() as the
else for that if statement? Try deleting just the else {}.

JAT

Karl

Sent from losPhone

On Jun 5, 2010, at 6:54 PM, David Mehler dave.meh...@gmail.com  
wrote:



Hello,
I've got a while loop outputting values from a database. Briefly it
looks like this:

while($row = mysql_fetch_array($result3))
{
echo tr;
echo td . $row['name'] . /td;
echo td . $row['type'] . /td;
echo td . $row['startdate'] . /td;
if (!empty($row['EndDate'])) {
echo td . $row['enddate'] . /td;
} else {
exit();
}
echo td . $row['location'] . /td;
echo td . $row['summary'] . /td;
echo td . $row['description'] . /td;
echo /tr;
}

That's not the whole code, but it is the problem code. Some  
output has

the ending date set, one or two records i can't remember how many i
entered with one, most do not, i want the echo to be conditional.  
The

output stops right before the if statement, echoes startdate and
that's it, comment out the if block and it works fine.
Thanks.
Dave.

--
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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] File Downloads

2010-05-28 Thread Karl DeSaulniers

On May 28, 2010, at 3:54 PM, Marc Guay wrote:

How can I go about restricting the number of downloads of a file  
on my

server?


Something like this could be triggered every time and then you can do
whatever you want once it hits 150... maybe have it send you an email
notification or something...

http://www.stevedawson.com/article0007.php

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




Very interesting link.
Thank you for sharing.
Not sure how this could be tied into what I'm trying for.
Would I add this to the function that did the downloading of the file?

Best,


Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] File Downloads

2010-05-28 Thread Karl DeSaulniers


On May 28, 2010, at 4:25 PM, tedd wrote:


At 3:39 PM -0500 5/28/10, Karl DeSaulniers wrote:

Hello,
How can I go about restricting the number of downloads of a file  
on my server?
For Eg: if I want a music track to only be able to be downloaded  
by 150 people and thats it.. ever,

how can I go about doing this?

Much obliged,

Karl DeSaulniers


Karl:

Just have the download pass through a script that counts, such as  
found here:


http://sperling.com/freeware.php

When someone click the link, it activates a script that provides  
the download and saves a count. It would be trivial to stop the  
download at a specific number.


Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Hey thanks Tedd.
Quick question. Were you referring me to this link to download one of  
their demos or just to show that they count their downloads?

EG:  Binary-Tree v1.1 Downloads:  2806

THX

Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] File Downloads

2010-05-28 Thread Karl DeSaulniers
The users will have gone through a registration and login to get to  
the downloads.

The files will be served from MySQL and output to HTML of Flash.
This is for a small project of limited edition audio or pictures or  
scripts, etc.
Hens, I'd like to limit each user in the allotted 150 to be able to  
download (whatever it is) only once.

But up to 150 users can get in on it kind of thing.

Karl


On May 28, 2010, at 4:41 PM, Karl DeSaulniers wrote:



On May 28, 2010, at 4:25 PM, tedd wrote:


At 3:39 PM -0500 5/28/10, Karl DeSaulniers wrote:

Hello,
How can I go about restricting the number of downloads of a file  
on my server?
For Eg: if I want a music track to only be able to be downloaded  
by 150 people and thats it.. ever,

how can I go about doing this?

Much obliged,

Karl DeSaulniers


Karl:

Just have the download pass through a script that counts, such as  
found here:


http://sperling.com/freeware.php

When someone click the link, it activates a script that provides  
the download and saves a count. It would be trivial to stop the  
download at a specific number.


Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Hey thanks Tedd.
Quick question. Were you referring me to this link to download one  
of their demos or just to show that they count their downloads?

EG:  Binary-Tree v1.1 Downloads:  2806

THX

Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] Multiple Login in a single PC should not be possible

2010-05-23 Thread Karl DeSaulniers
What about creating a java or ajax proxy that verifies the system  
mixed with PHP login security and cookies?

Maybe mix it with some SSL??

Karl


On May 22, 2010, at 10:37 PM, Karl DeSaulniers wrote:


I am going to ask my flash guru buddies.
Let me see if I can find anything out.

Karl


On May 22, 2010, at 10:10 PM, Robert Cummings wrote:


Robert Cummings wrote:

Karl DeSaulniers wrote:
Wow. I'm going to stay away from that one. I'm just trying to  
help  this guy secure his learning API and that would be one way  
to insure  that two browsers were not logged in on the same  
system. Especially if  you weren't using a browser in the first  
place.


Have you ever programed in flash?

Yes. But I prefer open source all the way :)


BTW, I'm still not sure how you expect flash to solve the problem.  
I can just run a virtual machine with another flash instance.  
Seems to me like your trading cauliflower for broccoli... they're  
both vegetables.


Cheers,
Rob.
--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.

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



Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] Multiple Login in a single PC should not be possible

2010-05-23 Thread Karl DeSaulniers
Also, on the flash subject, I believe you can utilize the  
SharedObject class to achieve what they are wanting.
I was told that you MUST remember to delete the SharedObject if the  
browser window is closed or crashes.

Not sure on how this is done.

Karl


On May 23, 2010, at 3:59 AM, Karl DeSaulniers wrote:

What about creating a java or ajax proxy that verifies the system  
mixed with PHP login security and cookies?

Maybe mix it with some SSL??

Karl


On May 22, 2010, at 10:37 PM, Karl DeSaulniers wrote:


I am going to ask my flash guru buddies.
Let me see if I can find anything out.

Karl


On May 22, 2010, at 10:10 PM, Robert Cummings wrote:


Robert Cummings wrote:

Karl DeSaulniers wrote:
Wow. I'm going to stay away from that one. I'm just trying to  
help  this guy secure his learning API and that would be one  
way to insure  that two browsers were not logged in on the same  
system. Especially if  you weren't using a browser in the first  
place.


Have you ever programed in flash?

Yes. But I prefer open source all the way :)


BTW, I'm still not sure how you expect flash to solve the  
problem. I can just run a virtual machine with another flash  
instance. Seems to me like your trading cauliflower for  
broccoli... they're both vegetables.


Cheers,
Rob.
--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.

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



Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] Multiple Login in a single PC should not be possible

2010-05-23 Thread Karl DeSaulniers

Hi Nathan,
The problem is not mine to speak of necessarily. I was trying to help  
find a solution for another.
But from what I understand, they have a online lesson that they dont  
want people to be able to log in as another user and get the answers to.


Here is the their post.

On May 14, 2010, at 2:18 AM, Jagdeep Singh wrote:


Hi All!

I am looking for a solution, I want a user to do a single Login  
only on a PC

.

E.g. If a User has logged on my website website.com in Internet  
explorer,
then he cant login on same website in another browser like Firefox  
etc with

same loginid or another.

Can I trace MAC address of a single machine to solve this issue?

Or is there a concept of GLOBAL COOKIE / Cross Browser Cookie which  
will

work for all browsers in a single machine..

I hope You will help me out


Regards

Jagdeep Singh
+91 9988009272


Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] Multiple Login in a single PC should not be possible

2010-05-23 Thread Karl DeSaulniers
I was given a solution, or a work-around. You will have to use flash,  
but,
you can set up a LocalConnection class that determines if the swf is  
being run on the same system and if it is boot one.
You have the LocalConnection class send out a message to itself and  
if it answers itself, then there are two running.
Otherwise only that one is running. Sort of hackish, but would  
probably do the trick.


HTH

Karl


On May 23, 2010, at 3:35 PM, Karl DeSaulniers wrote:


Hi Nathan,
The problem is not mine to speak of necessarily. I was trying to  
help find a solution for another.
But from what I understand, they have a online lesson that they  
dont want people to be able to log in as another user and get the  
answers to.


Here is the their post.

On May 14, 2010, at 2:18 AM, Jagdeep Singh wrote:


Hi All!

I am looking for a solution, I want a user to do a single Login  
only on a PC

.

E.g. If a User has logged on my website website.com in Internet  
explorer,
then he cant login on same website in another browser like Firefox  
etc with

same loginid or another.

Can I trace MAC address of a single machine to solve this issue?

Or is there a concept of GLOBAL COOKIE / Cross Browser Cookie  
which will

work for all browsers in a single machine..

I hope You will help me out


Regards

Jagdeep Singh
+91 9988009272


Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] Multiple Login in a single PC should not be possible

2010-05-23 Thread Karl DeSaulniers

You may still have trouble with virtual machines though.

Karl


On May 23, 2010, at 4:18 PM, Karl DeSaulniers wrote:

I was given a solution, or a work-around. You will have to use  
flash, but,
you can set up a LocalConnection class that determines if the swf  
is being run on the same system and if it is boot one.
You have the LocalConnection class send out a message to itself and  
if it answers itself, then there are two running.
Otherwise only that one is running. Sort of hackish, but would  
probably do the trick.


HTH

Karl


On May 23, 2010, at 3:35 PM, Karl DeSaulniers wrote:


Hi Nathan,
The problem is not mine to speak of necessarily. I was trying to  
help find a solution for another.
But from what I understand, they have a online lesson that they  
dont want people to be able to log in as another user and get the  
answers to.


Here is the their post.

On May 14, 2010, at 2:18 AM, Jagdeep Singh wrote:


Hi All!

I am looking for a solution, I want a user to do a single Login  
only on a PC

.

E.g. If a User has logged on my website website.com in Internet  
explorer,
then he cant login on same website in another browser like  
Firefox etc with

same loginid or another.

Can I trace MAC address of a single machine to solve this issue?

Or is there a concept of GLOBAL COOKIE / Cross Browser Cookie  
which will

work for all browsers in a single machine..

I hope You will help me out


Regards

Jagdeep Singh
+91 9988009272


Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] Multiple Login in a single PC should not be possible

2010-05-23 Thread Karl DeSaulniers
I was also told that you can use Adobe Air to control this as well.  
Air only allows one copy per machine to run originally.
Here is a link to set it to run multiple copies. You can use this to  
see how to set it up and figure a way to not let yours. If that is  
the route you take.


http://www.colettas.org/?p=273

But here again, if they have a virtual machine...
HTH,


Karl


On May 23, 2010, at 4:21 PM, Karl DeSaulniers wrote:


You may still have trouble with virtual machines though.

Karl


On May 23, 2010, at 4:18 PM, Karl DeSaulniers wrote:

I was given a solution, or a work-around. You will have to use  
flash, but,
you can set up a LocalConnection class that determines if the swf  
is being run on the same system and if it is boot one.
You have the LocalConnection class send out a message to itself  
and if it answers itself, then there are two running.
Otherwise only that one is running. Sort of hackish, but would  
probably do the trick.


HTH

Karl


On May 23, 2010, at 3:35 PM, Karl DeSaulniers wrote:


Hi Nathan,
The problem is not mine to speak of necessarily. I was trying to  
help find a solution for another.
But from what I understand, they have a online lesson that they  
dont want people to be able to log in as another user and get the  
answers to.


Here is the their post.

On May 14, 2010, at 2:18 AM, Jagdeep Singh wrote:


Hi All!

I am looking for a solution, I want a user to do a single Login  
only on a PC

.

E.g. If a User has logged on my website website.com in Internet  
explorer,
then he cant login on same website in another browser like  
Firefox etc with

same loginid or another.

Can I trace MAC address of a single machine to solve this issue?

Or is there a concept of GLOBAL COOKIE / Cross Browser Cookie  
which will

work for all browsers in a single machine..

I hope You will help me out


Regards

Jagdeep Singh
+91 9988009272


Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] Multiple Login in a single PC should not be possible

2010-05-23 Thread Karl DeSaulniers
The consensus I have been getting is that there really is no way to  
block this type of activity,

BUT you can make it difficult enough to deter most attempts.


Karl


On May 23, 2010, at 9:42 PM, Karl DeSaulniers wrote:

I was also told that you can use Adobe Air to control this as well.  
Air only allows one copy per machine to run originally.
Here is a link to set it to run multiple copies. You can use this  
to see how to set it up and figure a way to not let yours. If that  
is the route you take.


http://www.colettas.org/?p=273

But here again, if they have a virtual machine...
HTH,


Karl


On May 23, 2010, at 4:21 PM, Karl DeSaulniers wrote:


You may still have trouble with virtual machines though.

Karl


On May 23, 2010, at 4:18 PM, Karl DeSaulniers wrote:

I was given a solution, or a work-around. You will have to use  
flash, but,
you can set up a LocalConnection class that determines if the swf  
is being run on the same system and if it is boot one.
You have the LocalConnection class send out a message to itself  
and if it answers itself, then there are two running.
Otherwise only that one is running. Sort of hackish, but would  
probably do the trick.


HTH

Karl


On May 23, 2010, at 3:35 PM, Karl DeSaulniers wrote:


Hi Nathan,
The problem is not mine to speak of necessarily. I was trying to  
help find a solution for another.
But from what I understand, they have a online lesson that they  
dont want people to be able to log in as another user and get  
the answers to.


Here is the their post.

On May 14, 2010, at 2:18 AM, Jagdeep Singh wrote:


Hi All!

I am looking for a solution, I want a user to do a single Login  
only on a PC

.

E.g. If a User has logged on my website website.com in Internet  
explorer,
then he cant login on same website in another browser like  
Firefox etc with

same loginid or another.

Can I trace MAC address of a single machine to solve this issue?

Or is there a concept of GLOBAL COOKIE / Cross Browser Cookie  
which will

work for all browsers in a single machine..

I hope You will help me out


Regards

Jagdeep Singh
+91 9988009272


Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] Multiple Login in a single PC should not be possible

2010-05-22 Thread Karl DeSaulniers
Yeah. Don't be concerned about which browser. Just set up an active  
users table in your database that gets checked at login. Then it  
doesn't matter which machine or browser. Unless you know that the  
computers are giving the true ip, there is no way to keep a user from  
logging in with two account on the same computer. Otherwise add the  
active users ip to the active users table and check it as well on login


Easy peasey

Karl

Sent from losPhone

On May 22, 2010, at 12:34 AM, Gautam Bhatia  
mail2gautambha...@gmail.com wrote:



On Friday 14 May 2010 12:48 PM, Jagdeep Singh wrote:

Hi All!

I am looking for a solution, I want a user to do a single Login  
only on a PC

.

E.g. If a User has logged on my website website.com in Internet  
explorer,
then he cant login on same website in another browser like Firefox  
etc with

same loginid or another.

Can I trace MAC address of a single machine to solve this issue?

Or is there a concept of GLOBAL COOKIE / Cross Browser Cookie which  
will

work for all browsers in a single machine..

I hope You will help me out


Regards

Jagdeep Singh
+91 9988009272



hi Jagdeep,
I am not really sure , i got your question right but
there is something you can try if this helps, in the mysql dbase add
field like loggedIn , which can be true/false, when person logs in
change it to true , so even if the person is using other browser, you
can check the value from dbase, if user is already logged in or not.  
If

that makes sense to you , good luck.

regards,
Gautam Bhatia

--
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] Multiple Login in a single PC should not be possible

2010-05-22 Thread Karl DeSaulniers

On May 22, 2010, at 3:37 PM, Robert Cummings wrote:

This was beaten to death last week. The solution is not possible  
because it's not about restricting a single user from logging over  
multiple machines, it about restricting a single computer to only  
one session (so running IE, Firefox, Opera, Safari on same computer  
with different users would not be allowed).


Cheers,
Rob.


Karl DeSaulniers wrote:
Yeah. Don't be concerned about which browser. Just set up an  
active  users table in your database that gets checked at login.  
Then it  doesn't matter which machine or browser. Unless you know  
that the  computers are giving the true ip, there is no way to  
keep a user from  logging in with two account on the same  
computer. Otherwise add the  active users ip to the active users  
table and check it as well on login

Easy peasey
Karl
Sent from losPhone
On May 22, 2010, at 12:34 AM, Gautam Bhatia   
mail2gautambha...@gmail.com wrote:

On Friday 14 May 2010 12:48 PM, Jagdeep Singh wrote:

Hi All!

I am looking for a solution, I want a user to do a single Login   
only on a PC

.

E.g. If a User has logged on my website website.com in Internet   
explorer,
then he cant login on same website in another browser like  
Firefox  etc with

same loginid or another.

Can I trace MAC address of a single machine to solve this issue?

Or is there a concept of GLOBAL COOKIE / Cross Browser Cookie  
which  will

work for all browsers in a single machine..

I hope You will help me out


Regards

Jagdeep Singh
+91 9988009272



hi Jagdeep,
I am not really sure , i got your question right but
there is something you can try if this helps, in the mysql dbase add
field like loggedIn , which can be true/false, when person logs in
change it to true , so even if the person is using other browser,  
you
can check the value from dbase, if user is already logged in or  
not.  If

that makes sense to you , good luck.

regards,
Gautam Bhatia

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



--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.



Sorry for the top posting.

Ah, I see. Don't mean to beat a dead horse.
I still stand by my suggestion though.
If you record the username and ip in an active user table,
then set a cookie on the computer that is cross referenced with the  
ip and username,

you will have a little better check system.

Also, if you set a fall back that say checks to see if the cookie is  
being reset or set for the first time or if the cookie has been  
deleted, you can kick them.
Set the cookie to expire and be reset while in session to check to  
see if it changes while the user is logged in.


Basically, if you check for log-in status from the active user table  
and cross reference the ip,
it will probably cover say 75% of the cases. Using the cookie and  
putting strict requirements
for the cookie to have been pre-existing with the right ip or if it  
is being set for the first time,
you will have a little more control. Plus you could create a blob of  
ips that is referenced with
each username that can be cross referenced to see if a user has  
multiple ip sets or if two users have a similar ip.
Thus a little more granular control on the computers accessing your  
site.


But like having an expensive painting in your house,
if the thief is going to put that much work in to get it, chances are  
they will.

Just make sure its insured. :)


Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] Multiple Login in a single PC should not be possible

2010-05-22 Thread Karl DeSaulniers


On May 22, 2010, at 7:43 PM, Brandon Rampersad wrote:

These third world internet providers are screwing up the IP address  
system with their shared IPs which defeats the entire purpose of an  
IP address.


On Sat, May 22, 2010 at 6:19 PM, Karl DeSaulniers  
k...@designdrumm.com wrote:

On May 22, 2010, at 3:37 PM, Robert Cummings wrote:

This was beaten to death last week. The solution is not possible  
because it's not about restricting a single user from logging over  
multiple machines, it about restricting a single computer to only  
one session (so running IE, Firefox, Opera, Safari on same computer  
with different users would not be allowed).


Cheers,
Rob.


Karl DeSaulniers wrote:
Yeah. Don't be concerned about which browser. Just set up an  
active  users table in your database that gets checked at login.  
Then it  doesn't matter which machine or browser. Unless you know  
that the  computers are giving the true ip, there is no way to keep  
a user from  logging in with two account on the same computer.  
Otherwise add the  active users ip to the active users table and  
check it as well on login

Easy peasey
Karl
Sent from losPhone
On May 22, 2010, at 12:34 AM, Gautam Bhatia   
mail2gautambha...@gmail.com wrote:

On Friday 14 May 2010 12:48 PM, Jagdeep Singh wrote:
Hi All!

I am looking for a solution, I want a user to do a single Login   
only on a PC

.

E.g. If a User has logged on my website website.com in Internet   
explorer,
then he cant login on same website in another browser like Firefox   
etc with

same loginid or another.

Can I trace MAC address of a single machine to solve this issue?

Or is there a concept of GLOBAL COOKIE / Cross Browser Cookie  
which  will

work for all browsers in a single machine..

I hope You will help me out


Regards

Jagdeep Singh
+91 9988009272


hi Jagdeep,
   I am not really sure , i got your question right but
there is something you can try if this helps, in the mysql dbase add
field like loggedIn , which can be true/false, when person logs in
change it to true , so even if the person is using other browser, you
can check the value from dbase, if user is already logged in or  
not.  If

that makes sense to you , good luck.

regards,
Gautam Bhatia

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


--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.


Sorry for the top posting.

Ah, I see. Don't mean to beat a dead horse.
I still stand by my suggestion though.
If you record the username and ip in an active user table,
then set a cookie on the computer that is cross referenced with the  
ip and username,

you will have a little better check system.

Also, if you set a fall back that say checks to see if the cookie  
is being reset or set for the first time or if the cookie has been  
deleted, you can kick them.
Set the cookie to expire and be reset while in session to check to  
see if it changes while the user is logged in.


Basically, if you check for log-in status from the active user  
table and cross reference the ip,
it will probably cover say 75% of the cases. Using the cookie and  
putting strict requirements
for the cookie to have been pre-existing with the right ip or if it  
is being set for the first time,
you will have a little more control. Plus you could create a blob  
of ips that is referenced with
each username that can be cross referenced to see if a user has  
multiple ip sets or if two users have a similar ip.
Thus a little more granular control on the computers accessing your  
site.


But like having an expensive painting in your house,
if the thief is going to put that much work in to get it, chances  
are they will.

Just make sure its insured. :)



Karl DeSaulniers
Design Drumm
http://designdrumm.com


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




--
A Brandon_R Production



Duley noted, but the combo of tracking ips and cookies on computers  
should still work.
If you are checking the ip against ALL users, if two users in the  
active database have the same ip,
then whichever has the older timestamp stays and the new one gets  
booted.
And if your periodically checking and reassigning cookies with the ip  
stored, it should work.


Maybe if you have a situation with multiple computers having the same  
ip, store the ips in a blob and then check their system info against  
eachother.
If its the same system info, boot them. Something like using the  
browser's user agent identifier $_SERVER['HTTP_USER_AGENT'] with the  
aformentioned checks and balances.
I could stand corrected, and have not had to implement such  
parameters, but for what they are doing, it should work.


Now if you

Re: [PHP] Multiple Login in a single PC should not be possible

2010-05-22 Thread Karl DeSaulniers

Well you could alway build it as an Adobe AIR app.
Then it would be its own application. Not viewed through a browser.


Karl


On May 22, 2010, at 8:46 PM, Robert Cummings wrote:

Yeah, but flash is proprietary and I for one hate hitting flash  
websites.


Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] Multiple Login in a single PC should not be possible

2010-05-22 Thread Karl DeSaulniers
Wow. I'm going to stay away from that one. I'm just trying to help  
this guy secure his learning API and that would be one way to insure  
that two browsers were not logged in on the same system. Especially if  
you weren't using a browser in the first place.


Have you ever programed in flash?

Karl

Sent from losPhone

On May 22, 2010, at 9:11 PM, Robert Cummings rob...@interjinn.com  
wrote:


But then I don't get to use worldwide accepted and open standards  
for development.




Karl DeSaulniers wrote:

Well you could alway build it as an Adobe AIR app.
Then it would be its own application. Not viewed through a browser.
Karl
On May 22, 2010, at 8:46 PM, Robert Cummings wrote:
Yeah, but flash is proprietary and I for one hate hitting flash   
websites.

Karl DeSaulniers
Design Drumm
http://designdrumm.com


--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.

--
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] Multiple Login in a single PC should not be possible

2010-05-22 Thread Karl DeSaulniers

I am going to ask my flash guru buddies.
Let me see if I can find anything out.

Karl


On May 22, 2010, at 10:10 PM, Robert Cummings wrote:


Robert Cummings wrote:

Karl DeSaulniers wrote:
Wow. I'm going to stay away from that one. I'm just trying to  
help  this guy secure his learning API and that would be one way  
to insure  that two browsers were not logged in on the same  
system. Especially if  you weren't using a browser in the first  
place.


Have you ever programed in flash?

Yes. But I prefer open source all the way :)


BTW, I'm still not sure how you expect flash to solve the problem.  
I can just run a virtual machine with another flash instance. Seems  
to me like your trading cauliflower for broccoli... they're both  
vegetables.


Cheers,
Rob.
--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.

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



Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] Multiple Login in a single PC should not be possible

2010-05-14 Thread Karl DeSaulniers

Hi Jagdeep,
I would make an active users table in your database that the  
username gets loaded into on successful login
and in your login script also check this table before letting them  
log in.


Karl


On May 14, 2010, at 2:18 AM, Jagdeep Singh wrote:


Hi All!

I am looking for a solution, I want a user to do a single Login  
only on a PC

.

E.g. If a User has logged on my website website.com in Internet  
explorer,
then he cant login on same website in another browser like Firefox  
etc with

same loginid or another.

Can I trace MAC address of a single machine to solve this issue?

Or is there a concept of GLOBAL COOKIE / Cross Browser Cookie which  
will

work for all browsers in a single machine..

I hope You will help me out


Regards

Jagdeep Singh
+91 9988009272


Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] Multiple Login in a single PC should not be possible

2010-05-14 Thread Karl DeSaulniers

Just remember to remove them from this table on log out.

Karl

Sent from losPhone

On May 14, 2010, at 2:23 AM, Karl DeSaulniers k...@designdrumm.com  
wrote:



Hi Jagdeep,
I would make an active users table in your database that the  
username gets loaded into on successful login
and in your login script also check this table before letting them  
log in.


Karl


On May 14, 2010, at 2:18 AM, Jagdeep Singh wrote:


Hi All!

I am looking for a solution, I want a user to do a single Login  
only on a PC

.

E.g. If a User has logged on my website website.com in Internet  
explorer,
then he cant login on same website in another browser like Firefox  
etc with

same loginid or another.

Can I trace MAC address of a single machine to solve this issue?

Or is there a concept of GLOBAL COOKIE / Cross Browser Cookie which  
will

work for all browsers in a single machine..

I hope You will help me out


Regards

Jagdeep Singh
+91 9988009272


Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



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



Re: [PHP] Multiple Login in a single PC should not be possible

2010-05-14 Thread Karl DeSaulniers

You lost me on that one.

You want it so that multiple users can log in, but they have to be on  
separate browsers?



Karl


On May 14, 2010, at 3:26 AM, Jagdeep Singh wrote:


Hi,

yes, I can make a databse table to record LOGIN details, But I want  
that No

other user can login on same machine on smae or another browser.

E.g.

If user1 has logged in from IE then user2 should not login from  
Firefox or

Chrome etc..

I need ONLY ONE USER ACCESS AT SAME TIME ON SAME MACHINE  (On Same  
or Other

broswers)

Regards

Jagdeep Singh

On Fri, May 14, 2010 at 1:26 PM, Peter Lind  
peter.e.l...@gmail.com wrote:



On 14 May 2010 09:29, Lester Caine les...@lsces.co.uk wrote:

Jagdeep Singh wrote:


Hi All!

I am looking for a solution, I want a user to do a single Login  
only on

a

PC
.

E.g. If a User has logged on my website website.com in Internet

explorer,
then he cant login on same website in another browser like  
Firefox etc

with
same loginid or another.

Can I trace MAC address of a single machine to solve this issue?


The browser IP address works for us quite reliably. Once logged  
in, you

get
a message saying already logged on ... and where ... but it does  
need a
little help if the user closes the browser without logging out.  
One needs

a
facility to 'bounce' a user now and again  however some  
remote users

may

well have 'floating' IP addresses :(



Don't rely on IP addresses staying the same for a user, it's not safe
in any way and not needed anyway. Karls method is probably the best
bet - just remember to record last accessed time so anyone not
accessing for more than 15-20 minutes will succeed if trying to  
log in

again.

Regards
Peter

--
hype
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51
/hype



Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] Multiple Login in a single PC should not be possible

2010-05-14 Thread Karl DeSaulniers

Hi J,
Well, if you have an active users table with a users name in it and  
you check when logging in to see if that users name is in that table,
They can not log in again. No matter what machine or browser they are  
in.


As far as another user logging in on that same machine, you could  
match a cookie on the machine and the database that holds what  
browser they are using and username,  an MD5 ip, etc.
But someone can always delete cookies and some even know how to  
bounce ip addresses, so unless you have a bunch of hackers using your  
machines, these suggestions should work.

Unless someone else has a better suggestion.
GL,

:)

Karl


On May 14, 2010, at 4:08 AM, Jagdeep Singh wrote:

I want that only single user can login on a single machine If  
User has logged in one browser he should not login through 2nd  
browser...


And no other user should login on same machine in any browser

in Simple words:

MAXIMUM ONE USER SHOULD LOGIN IN ONE MACHINE...

On Fri, May 14, 2010 at 2:23 PM, Karl DeSaulniers  
k...@designdrumm.com wrote:

You lost me on that one.

You want it so that multiple users can log in, but they have to be  
on separate browsers?



Karl



On May 14, 2010, at 3:26 AM, Jagdeep Singh wrote:

Hi,

yes, I can make a databse table to record LOGIN details, But I want  
that No

other user can login on same machine on smae or another browser.

E.g.

If user1 has logged in from IE then user2 should not login from  
Firefox or

Chrome etc..

I need ONLY ONE USER ACCESS AT SAME TIME ON SAME MACHINE  (On Same  
or Other

broswers)

Regards

Jagdeep Singh

On Fri, May 14, 2010 at 1:26 PM, Peter Lind  
peter.e.l...@gmail.com wrote:


On 14 May 2010 09:29, Lester Caine les...@lsces.co.uk wrote:
Jagdeep Singh wrote:

Hi All!

I am looking for a solution, I want a user to do a single Login  
only on

a
PC
.

E.g. If a User has logged on my website website.com in Internet
explorer,
then he cant login on same website in another browser like Firefox etc
with
same loginid or another.

Can I trace MAC address of a single machine to solve this issue?

The browser IP address works for us quite reliably. Once logged in,  
you

get
a message saying already logged on ... and where ... but it does  
need a
little help if the user closes the browser without logging out. One  
needs

a
facility to 'bounce' a user now and again  however some remote  
users

may
well have 'floating' IP addresses :(


Don't rely on IP addresses staying the same for a user, it's not safe
in any way and not needed anyway. Karls method is probably the best
bet - just remember to record last accessed time so anyone not
accessing for more than 15-20 minutes will succeed if trying to log in
again.

Regards
Peter

--
hype
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51
/hype


Karl DeSaulniers
Design Drumm
http://designdrumm.com


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




Karl DeSaulniers
Design Drumm
http://designdrumm.com



Re: [PHP] Multiple Login in a single PC should not be possible

2010-05-14 Thread Karl DeSaulniers

Only other thing I could think of is a session timeout.
Because if two people are using the same computer, one person is  
going to be away long enough to time out.


HTH

Karl



On May 14, 2010, at 4:21 AM, Karl DeSaulniers wrote:


Hi J,
Well, if you have an active users table with a users name in it and  
you check when logging in to see if that users name is in that table,
They can not log in again. No matter what machine or browser they  
are in.


As far as another user logging in on that same machine, you could  
match a cookie on the machine and the database that holds what  
browser they are using and username,  an MD5 ip, etc.
But someone can always delete cookies and some even know how to  
bounce ip addresses, so unless you have a bunch of hackers using  
your machines, these suggestions should work.

Unless someone else has a better suggestion.
GL,

:)

Karl


On May 14, 2010, at 4:08 AM, Jagdeep Singh wrote:

I want that only single user can login on a single machine If  
User has logged in one browser he should not login through 2nd  
browser...


And no other user should login on same machine in any browser

in Simple words:

MAXIMUM ONE USER SHOULD LOGIN IN ONE MACHINE...

On Fri, May 14, 2010 at 2:23 PM, Karl DeSaulniers  
k...@designdrumm.com wrote:

You lost me on that one.

You want it so that multiple users can log in, but they have to be  
on separate browsers?



Karl



On May 14, 2010, at 3:26 AM, Jagdeep Singh wrote:

Hi,

yes, I can make a databse table to record LOGIN details, But I  
want that No

other user can login on same machine on smae or another browser.

E.g.

If user1 has logged in from IE then user2 should not login from  
Firefox or

Chrome etc..

I need ONLY ONE USER ACCESS AT SAME TIME ON SAME MACHINE  (On Same  
or Other

broswers)

Regards

Jagdeep Singh

On Fri, May 14, 2010 at 1:26 PM, Peter Lind  
peter.e.l...@gmail.com wrote:


On 14 May 2010 09:29, Lester Caine les...@lsces.co.uk wrote:
Jagdeep Singh wrote:

Hi All!

I am looking for a solution, I want a user to do a single Login  
only on

a
PC
.

E.g. If a User has logged on my website website.com in Internet
explorer,
then he cant login on same website in another browser like Firefox  
etc

with
same loginid or another.

Can I trace MAC address of a single machine to solve this issue?

The browser IP address works for us quite reliably. Once logged  
in, you

get
a message saying already logged on ... and where ... but it does  
need a
little help if the user closes the browser without logging out.  
One needs

a
facility to 'bounce' a user now and again  however some remote  
users

may
well have 'floating' IP addresses :(


Don't rely on IP addresses staying the same for a user, it's not safe
in any way and not needed anyway. Karls method is probably the best
bet - just remember to record last accessed time so anyone not
accessing for more than 15-20 minutes will succeed if trying to  
log in

again.

Regards
Peter

--
hype
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51
/hype


Karl DeSaulniers
Design Drumm
http://designdrumm.com


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




Karl DeSaulniers
Design Drumm
http://designdrumm.com



Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] jquery password problem

2010-05-14 Thread Karl DeSaulniers

On May 14, 2010, at 4:01 AM, Manolis Vlachakis wrote:


I encode my password with md5 base 64 ..on the php side but
i have a problem with the POST that this function i using on my form.
after posting my data + is replaced with space

I came out with that  explanation after a lot of tries and echos in  
my code

files i found out that
after using numbers ,onlu on that case, in the password field the  
space

between the encoding was replaced with a + or / sometimes
i tried to remove the + or / but still i get the same results
any ideas


  data: firstname=+ firstname + lastname=+ lastname +  
username=+
username + email=+ email + password=+ password + save=+  
save+

user_type=+ user_type,


I don't know JQuery, but when passing a variable in a url with the  
, you cant have a space after the  nor a space before or after  
the +.
If that is actually what you are doing with data. The browser may  
be just deleting the +. Not positive.


 lastname=+ lastname +

needs to be

lastname=+lastname+

Not sure if that would solve your problem, but may be a problem in  
its own.


HTH some,

Karl


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



Re: [PHP] jquery password problem

2010-05-14 Thread Karl DeSaulniers


On May 14, 2010, at 4:38 AM, Peter Lind wrote:


On 14 May 2010 11:29, Karl DeSaulniers k...@designdrumm.com wrote:

On May 14, 2010, at 4:01 AM, Manolis Vlachakis wrote:


I encode my password with md5 base 64 ..on the php side but
i have a problem with the POST that this function i using on my  
form.

after posting my data + is replaced with space

I came out with that  explanation after a lot of tries and echos  
in my

code
files i found out that
after using numbers ,onlu on that case, in the password field the  
space

between the encoding was replaced with a + or / sometimes
i tried to remove the + or / but still i get the same results
any ideas


 data: firstname=+ firstname + lastname=+ lastname +  
username=+
username + email=+ email + password=+ password + save=+  
save+

user_type=+ user_type,


I don't know JQuery, but when passing a variable in a url with the  
, you

cant have a space after the  nor a space before or after the +.
If that is actually what you are doing with data. The browser  
may be just

deleting the +. Not positive.

 lastname=+ lastname +

needs to be

lastname=+lastname+



As it's javascript, those spaces are not in string: they're ignored by
the interpreter when the string is concatenated.

Regards
Peter

--
hype
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51
/hype

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




Ah, ok.


Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] GD - import a PNG image and make transparant

2010-05-13 Thread Karl DeSaulniers

Hey tedd,
Sorry bout that.. here you go.

http://designdrumm.com/upload_images_test.zip

Karl


On May 13, 2010, at 9:06 AM, tedd wrote:


At 6:40 PM -0500 5/12/10, Karl DeSaulniers wrote:

Hi Alex,
I have a php file I made just a few months ago.
It takes a gif, jpeg or png of any size and sizes it  
proportionately to a specified size and then outputs a png.
If the image is a transparent png or transparent gif, it will  
still hold the transparency.
This is just a test page and it tested ok for me, but it is my  
first one. I also tested it on PHP 5. Dont know about  
compatibility to older versions.

Knowing that, here you go.

http://designdrumm.com/upload_images_test.php.zip

HTH,

Karl



Bad link.

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] regexp questions

2010-05-12 Thread Karl DeSaulniers


On May 12, 2010, at 11:20 AM, Ashley Sheridan wrote:


On Wed, 2010-05-12 at 18:23 +0200, Spud. Ivan. wrote:






Subject: RE: [PHP] regexp questions
From: a...@ashleysheridan.co.uk
To: spudm...@hotmail.com
CC: php-general@lists.php.net
Date: Wed, 12 May 2010 17:11:11 +0100

On Wed, 2010-05-12 at 18:13 +0200, Spud. Ivan. wrote:




Date: Tue, 11 May 2010 15:38:41 -0700
From: li...@cmsws.com
To: spudm...@hotmail.com
CC: php-general@lists.php.net
Subject: Re: [PHP] regexp questions

Spud. Ivan. wrote:


I think we've not so much only with the regex, but maybe you can  
tell me somethin helpful ;)


/Word1:\/a\/h4\(a href=\http:\/\/www.thiswebsite.com\/some- 
script.php\fir.*?st word.*?(.*)Word2:\/a\/h4ul(.*)Second  
word:\/a\/h4ul(.*)Word3:\/a\/h4ul(.*)rd word/is


Thanks.
I.Lopez.

On 05/11/2010 09:56 AM, Spud. Ivan. wrote:
But it doesn't explain why my regexps work fine within php 5.1  
but 5.3


Ivan.



Post a regex and what you think it should match but doesn't.




Again...

Why don't you show us an example of what it is you are trying to  
match this
against. Then, after that example, show us what you would like to  
see as the

output.

Then, send us a copy of the code you are trying to use to make it  
all happen.


--
Jim Lucas

Some men are born to greatness, some achieve greatness,
and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare





I'm sorry Jim, but as majority of regexp, I can't explain you what  
I want with words...


I simply want to pick specific text at  very specific places  
inside the html.




I'm sending you to your email the html and regex so you can test  
it if you want :)




Thanks.

I. Lopez.



_
Consejos para seducir ¿Puedes conocer gente nueva a través de  
Internet? ¡Regístrate ya!

http://contactos.es.msn.com/?mtcmk=015352

It might be better to use some of the DOM functions for something  
like this. You can pull out specific tags and tag content as you  
need. It's better to rely on DOM functions for these sorts of  
things than using regular expressions.







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











But If I remove tags, I can't match this specific place, because  
are just these tags who distinct the place where to match.




I.Lopez.




_
Consejos para seducir ¿Puedes conocer gente nueva a través de  
Internet? ¡Regístrate ya!

http://contactos.es.msn.com/?mtcmk=015352



It depends what you need to do. If you want to match specific tags,  
then
something like getElementsByTagName() (I believe this function  
exists in

the set of DOM functions) would very easily grab all those tags so you
can work on them. I don't see much that a regex could do here that the
DOM can't handle.

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




Dont know if you found your solution or not, but here is a good  
website for regexp.


http://lawrence.ecorp.net/inet/samples/regexp-intro.php

HTH,


Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



  1   2   >