Re: [PHP] Variable representation

2012-04-01 Thread Adam Randall
It would better to just use an array, and then iterate through that.

$images[] =  stripslashes( $row['image_1'] );
$images[] =  stripslashes( $row['image_2'] );
$images[] =  stripslashes( $row['image_3'] );
$images[] =  stripslashes( $row['image_4'] );

foreach( $images as $k = $v ) {
$k++; // increment k since it starts at 0, instead of 1
if ( strlen( trim( $v ) ) ) {
echo lia href=\http://www.theverseoftheday.info/store-images/;
. $v . \ title=\Image  . $k . \Image  . $k . /a/li\r\n;
}
}

Adam.

On Sun, Apr 1, 2012 at 8:52 PM, Ron Piggott
ron.pigg...@actsministries.orgwrote:

 Hi Everyone:

 I am assigning the value of 4 images to variables following a database
 query:

 $image_1 = stripslashes( $row['image_1'] );
 $image_2 = stripslashes( $row['image_2'] );
 $image_3 = stripslashes( $row['image_3'] );
 $image_4 = stripslashes( $row['image_4'] );

 What I need help with is how to represent the variable using $i for the
 number portion in the following WHILE loop.  I am not sure of how to
 correctly do it.  I am referring to: $image_{$i}

 ===
 $i = 1;
 while ( $i = 4 ) {

if ( trim( $image_{$i} )   ) {

echo lia href=\http://www.theverseoftheday.info/store-images/;
 . $image_{$i} . \ title=\Image  . $i . \Image  . $i .
 /a/li\r\n;

}

 ++$i;
 }
 ===

 How do I substitute $i for the # so I may use a WHILE loop to display the
 images?  (Not all 4 variables have an image.)

 Ron Piggott



 www.TheVerseOfTheDay.info




-- 
Adam Randall
http://www.xaren.net
AIM: blitz574
Twitter: @randalla0622

To err is human... to really foul up requires the root password.


Re: [PHP] Unable to get output from exec ssh remote-server 'ping -c4 ip'

2009-12-29 Thread Adam Randall
If you are just checking to see if the IP is pingable, but don't care about
the output you could just test against the exit code:

$host = 'hostorip';
$sshhost = 'hostorip';
$alive = trim( shell_exec( 'ssh ' . $sshhost . ' ping -q -n -c 5 -W 2 ' .
$host . ' \/dev/null 2\\1 \\ echo Alive' ) ) == 'Alive';
var_dump( $alive );

I use a variant of the above with good success on Gentoo.

Adam.

On Sun, Dec 27, 2009 at 1:53 PM, robert mena robert.m...@gmail.com wrote:

 Hi,

 I need to develop an interface that will, for example, ping IPs from a
 remote server. So the php script will be hosted in a server with ssh access
 (key) to the remote server.

 I can make it work from the console but when I try

 $cmd = ssh remote-server 'ping -c 4 ip'
 exec($cmd, $ouput);

 the output is empty.

 the same command (with the remote-server and IP changed to the real ones)
 works fine from command line.

 I've added the key/config in the webserver's user .ssh directory so I am
 assuming that that there is something wrong with my setup.

 any ideas?




-- 
Adam Randall
http://www.xaren.net
AIM: blitz574
Twitter: @randalla0622


Re: [PHP] DailyWTF - Maybe I Needing Later

2009-12-23 Thread Adam Randall
Unfortunately, this is how government works too. About 10 years ago while
maintaining the Golden Gate website I had to post contracts to their site.
These would be for things like seismic retrofits, etc. Contractors would bid
on the contracts, and whoever came up the lowest was the winner.

Nice to know that the guys making your bridges more earthquake resistant are
the ones who are the cheapest.

Adam.

On Wed, Dec 23, 2009 at 7:34 AM, John Meyer
johnme...@pueblocomputing.comwrote:

 On 12/22/2009 9:10 PM, Daevid Vincent wrote:

 http://thedailywtf.com/Articles/Maybe-I-Needing-Later.aspx




 Read this, just loved it.  Moral of the story (though some may turn it
 racist or otherwise moronic): maybe hiring at the lowest possible bidder
 isn't always the best idea.

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




-- 
Adam Randall
http://www.xaren.net
AIM: blitz574


Re: [PHP] Checkbox in PHP form

2009-11-10 Thread Adam Randall
INPUT class=text id=myCheck1 type=checkbox?php echo( $row[33] ==
'no' ? ' checked=checked' : '' ); ? value=PFDs
name=f_sequipment1/bfont size=2PFDsb
Or with short tags:

INPUT class=text id=myCheck1 type=checkbox?= $row[33] == 'no' ? '
checked=checked' : '' ? value=PFDs name=f_sequipment1/bfont
size=2PFDsb
Adam.

On Sun, Nov 8, 2009 at 5:39 PM, Ernie Kemp ernie.k...@sympatico.ca wrote:

   Need some help here with checkboxes in an html form.



 My issue is I have a form that needs to be viewed with checkboxes filled in
 depending on the values in the table.



 I tried:

 INPUT class=text id=myCheck1 type=checkbox ?php if ( $row[33] = 'no')
 { echo checked=yes;  } else { echo '';  } ? value=PFDs
 name=f_sequipment1/bfont size=2PFDsb

 but the checkbox field is always checked.



 I thought of JavaScript also but it would have to be a “if $row[33] then
 run a JavaScript function” .  This is not working for me neither.



 Sorry if this seems trivial but I need your help.



 Thanks in advance.












-- 
Adam Randall
http://www.xaren.net
AIM: blitz574


Re: [PHP] Re: Checkbox in PHP form

2009-11-10 Thread Adam Randall
On Sun, Nov 8, 2009 at 9:52 PM, Brian Hazelton bdh_2...@comcast.net wrote:
 input class=text id=myCheck1 type=checkbox ?php if ( $row[33] ==
 'no') { echo checked=checked;  } ? value=PFDs
 name=f_sequipment1/bfont size=2PFDsb


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





-- 
Adam Randall
http://www.xaren.net
AIM: blitz574

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



Re: [PHP] =??Q?Esco=AE?= Frontier Acela High Performance Fume Hoods

2009-11-03 Thread Adam Randall
Spam.

On Tue, Nov 3, 2009 at 5:28 PM, Hanjie Xu iamj...@gmail.com wrote:
 What's this?

 2009/11/4 Esco Biotech Pvt. Ltd. escobiot...@vsnl.net

     Esco® Frontier Acela High Performance Fume Hoods



 *ESCO's Industry Leading Frontier Acela Fume Hood gives you **
 Maximum Flexibility, Energy Savings and Quality all at an Affordable Price!
 *

 ·         Low Velocity (0.3 m/s) yet High Performance.

 ·         Annual energy savings up to US $ 8,000 (Evan Mills, Dale Sartor.
 Energy use and savings potential for Laboratory Fume Hoods. Energy 30 (2005)
 1859-1864) to help reduce your carbon footprint.

 ·         CAV or VAV Modes.

 ·         Full range of worktop materials including Stainless Steel,
 Ceramic or Epoxy Resin.

 ·         4, 5, 6, or 8 ft sizes to suit your needs.

 ·         Wide range of accessories to tailor your fume cupboard to meet
 your requirements.

 ·         Ergonomically angled sash window to enhance usability.

 ·         The tapered fibreglass exhaust collar reduces airflow
 turbulence, static pressure loss, noise level and increases face velocity
 uniformity.

 ·         Tri-wall construction and chain-and-sprocket sash system for
 maximum durability.

 ·         Certified to EN14175.



 * *

 * *



 Literature http://escoglobal.com/products/download/EFA_brochure.pdf

 Safe Use of Fume Hoods 
 Videohttp://escoglobal.com/resources/video/video.php?id=Fumehoods

 Fume Hood Testing According to ANSI/ASHRAE 110 
 Standardhttp://escoglobal.com/resources/video/video.php?id=fumehood



 Esco performs testing in accordance with more than 20 of the world's most
 recognized standards, of local, regional and international scopes

 Learn About International 
 Standardshttp://escoglobal.com/resources/biological-safety-cabinets/learn-about-international-standards.php



 Esco Clean Room Construction 
 Componentshttp://escoglobal.com/products/cleanroom-equipment/



 Esco PowderMax Powder Weighing Balance Enclosures White 
 Paperhttp://escoglobal.com/products/download/PW1_microbalance.pdf



 Biological Safety Cabinets

 Order Free 
 CDhttp://escoglobal.com/resources/biological-safety-cabinets/order-cd.php

  *Please Visit us at Hall No. H, Booth No. 18, 19 at Pharma Expo 2009
 concurrent with 61st Indian Pharmaceutical Congress (IPC), Nirma
 University of Science  Technology, Ahmedabad to be held from 11 - 13
 December, 2009.***

 *ESCO BIOTECH PVT. LTD.*

 101 – 102, Sita Niwas, Plot No. 94, Road No.1, Liberty Garden, Malad (W),
 Mumbai – 400 064

 Tel : + 91 22 4073 0202 / 2880 3636 / 3293 3535 Fax : + 91 22 2880 3738 /
 2889 3636

 E mail :* *escobiot...@vsnl.net

 Website : www.escoindia.co.in

 I Biological Safety 
 Cabinetshttp://escoglobal.com/products/biological-safety-cabinets/I Laminar
 Flow Cabinets http://escoglobal.com/products/laminar-flow-cabinets/ I 
 Laboratory
 Fume Hoods http://escoglobal.com/products/laboratory-fume-hoods/ I Ductless
 Fume Hoods http://escoglobal.com/products/ductless-fume-hoods/ I Cleanroom
 Equipments http://escoglobal.com/products/cleanroom-equipment/ I Air
 Showershttp://escoglobal.com/products/cleanroom-equipment/detail.php?id=EASI
  Sampling
  Dispensing Booth http://escoglobal.com/products/containment-pharma/ I 
 Hospital
 Pharmacy 
 Productshttp://escoglobal.com/products/hospital-pharmacy-products/I 
 Cytoculture™
 Cytotoxic Safety 
 Cabinetshttp://escoglobal.com/products/hospital-pharmacy-products/detail.php?id=CYT-AI
  Isoclean
 Hospital Pharmacy 
 Isolatorshttp://escoglobal.com/products/hospital-pharmacy-products/detail.php?id=HPI-NI
  IVF
 Workstations http://escoglobal.com/products/ivf-workstations/ I Lab
 Animal Research 
 Productshttp://escoglobal.com/products/lab-animal-research-products/I 
 Laboratory
 Incubators http://escoglobal.com/products/laboratory-incubators/ I 
 Laboratory
 Ovens http://escoglobal.com/products/laboratory-ovens/ I PCR 
 Cabinetshttp://escoglobal.com/products/pcr-cabinets/I PCR
 Thermal 
 Cyclershttp://escoglobal.com/products/pcr-thermal-cyclers/detail.php?id=SWT-MXI
  Real
 Time Thermal 
 Cyclershttp://escoglobal.com/products/pcr-thermal-cyclers/detail.php?id=SPT-RTI
  Ultralow
 Freezers http://escoglobal.com/products/ultralow-freezers/ I Esco on
 Twitter http://twitter.com/escoglobal I Esco on You 
 Tubehttp://youtube.com/escoglobal
 I Esco Bio Safety Cabinet Micro-Site http://biologicalsafetycabinet.com/
 I




 --
 Xu Han-Jie




-- 
Adam Randall
http://www.xaren.net
AIM: blitz574

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



Re: [PHP] How is this possible?

2009-10-28 Thread Adam Randall
I don't do this personally, but you can probably get your script
working by doing something like this:

foreach( $_GET as $k = $v ) $$k = $v;

You would put that at the top of your page, but be aware that it
allows other people to set variables on your page (just like register
globals does).

If you want to do basic sanitization to your incoming values, such as
trimming them, you can do something like this too:

foreach( $_GET as $k = $v ) $$k = trim( $v );

None of this is best practices, FYI.

Adam.

On Wed, Oct 28, 2009 at 10:29 AM, David Otton
phpm...@jawbone.freeserve.co.uk wrote:
 2009/10/28 tedd t...@sperling.com:

 Hi gang:


 http://php.net/manual/en/security.globals.php

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





-- 
Adam Randall
http://www.xaren.net
AIM: blitz574

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



Re: [PHP] security/deployment issue

2009-10-16 Thread Adam Randall
Rsync preserves the UID and GID, not the visible username or visible
group name. This means that if the UIDs and GIDs do not match your
expected users and groups on the destination server they will match
whatever is setup there according to the /etc/passwd or /etc/group
files. If there's no match for the UID and GID then it will just
display the UID or GID number.

Adam.

On Fri, Oct 16, 2009 at 1:13 PM, Augusto Flavio afla...@gmail.com wrote:
 Humm.. thanks for the replies. But i have another problem about rsync again.



 When i deploy a project using the rsync the permissions of all home
 directory is changed. i tried to use the parameter -p -o -g (preserve
 permissions, owner and group):


 I dont know but the rsync doesnt preserve the permissions and group/owner.


 Then always after a deploy i need to execute the cmd chmod 755 user:group
 /home/project . Have someone this problem?


 Thanks


 Augusto Morais




-- 
Adam Randall
http://www.xaren.net
AIM: blitz574

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



[PHP] COM Help (hopefully)

2009-10-09 Thread Adam Randall
We have a US postal database called ZP4 that we that we use to scrub
client addresses into something useful. For future projects we need to
expand on this scrubbing so that we can view counties and such. The
scrubbing is currently being performed by a custom application a
former employee wrote for us while he still worked here.
Unfortunately, he didn't commit the source of that application into
our SVN repository (bad). Sadly, I don't have C/C++ creation skills
worth relying upon.

What I found in ZP4 is a COM wrapper for the ZP4 DLL. From the
examples it should be simple to implement what I want, and this VB
code does work fine:

--- begin ---
Set ZP4 = CreateObject(zp4ipcom.zp4com)
ZP4.reset
ZP4.input Address, 2401 Utah avenue south
ZP4.input City, seattle
ZP4.input State, wa
ZP4.input ZIP, 98134
ZP4.correct

WScript.Echo ZP4.output(Error code)
WScript.Echo ZP4.output(Address (final))
WScript.Echo ZP4.output(City (final))
WScript.Echo ZP4.output(State (final))
WScript.Echo ZP4.output(ZIP (five-digit))
WScript.Echo ZP4.output(County name)
--- end ---

However, when I implement this code in PHP using COM all I get are errors:

?php
try
{
$zp4 = new com( 'zp4ipcom.zp4com' );

$zp4-reset();
$zp4-input( 'Address', '2401 Utah avenue south' );
$zp4-input( 'City', 'seattle' );
$zp4-input( 'State', 'wa' );
$zp4-input( 'ZIP', '98134' );
$zp4-correct();

echo( $zp4-output( 'Error code' ) . \n );
echo( $zp4-output( 'Address (final)' ) . \n );
echo( $zp4-output( 'City (final)' ) . \n );
echo( $zp4-output( 'State (final)' ) . \n );
echo( $zp4-output( 'ZIP (five-digit)' ) . \n );
echo( $zp4-output( 'County name' ) . \n );
}
catch( exception $e )
{
echo( $e . \n );
}
?

Results:

exception 'com_exception' with message 'Error [0x80020003] Member not found.
' in C:\Documents and Settings\adamr\Desktop\zp4.com.php:7
Stack trace:
#0 C:\Documents and Settings\adamr\Desktop\zp4.com.php(7): com-reset()
#1 {main}

I've tried everything I could think to get the above to work. If I
specify a member that I know is not in the ZP4 DLL I get a different
error. The Member not found error always seems to line up with the
procedures/functions defined in the ZP4IPCOM source.

ZP4 is a Windows only application. My development machine is running
PHP 5.2.6. I've done other COM related code with Word without any
troubles. I'm guessing that maybe the ZP4IPCOM interface itself is not
complete enough for PHP, or there is some bug that I'm missing. The
source for the ZP4IPCOM is provided with the ZP4 disk, but it's all in
Pascal and I'm not sure hot to either tweak or rebuild that (my VS
2005 doesn't seem to think much of it :)

While I could go with a VB solution for doing the address scrubbing, I
had wanted to set it up in PHP so that I could open one COM connection
to the DLL, and then via database burn through a large number of
addresses. If I had the skills I'd also rather just create an
extension for PHP itself that is a wrapper for the ZP4 DLL. If someone
is interested in building that for my company on commission I'd love
to discuss that with you.

If anyone wants to help me with this I'd greatly appreciate it.

Regards,

Adam.

-- 
Adam Randall
http://www.xaren.net
AIM: blitz574

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



Re: [PHP] Is there limitation for switch case: argument's value?

2009-08-21 Thread Adam Randall
I've never understood why people use switch statements like this as in
reality you are using it more like an if/else block, but anyway.

The reason why your code is not working is that you are passing into
the switch the value of 0, or false, which means that when any of
those $sum == N conditionals comes up as false (say $sum == 8 ), then
that is what is returned because they match up. In PHP's eyes, 0 ==
false in switch statements.

To fix your code, change the switch( $sum ) to switch( true ):

switch( true )
{
case ($sum == 8):
echo sum=8\n;
break;
case ($sum == 7 || $sum == 6):
echo sum=7 or 6\n;
break;
case ($sum == 2 || $sum == 1):
echo sum=2 or 1\n;
break;
case ($sum == 0):
echo sum=0\n;
break;
default:
echo sum=3/4/5\n;
break;
}

Or, write your switch like this:

switch( $sum )
{
case 8:
echo sum=8\n;
break;
case 6:
case 7:
echo sum=7 or 6\n;
break;
case 1:
case 2:
echo sum=2 or 1\n;
break;
case 0:
echo sum=0\n;
break;
default:
echo sum=3/4/5\n;
break;
}

Regards,

Adam.

On Thu, Aug 20, 2009 at 8:40 PM, Keithsurvivor_...@hotmail.com wrote:
 Hi,
 I encounter a funny limitation here with switch case as below:
 The value for $sum is worked as expected for 1 to 8, but not for 0.
 When the $sum=0, the first case will be return, which is sum=8.
 Is there any limitation / rules for switch case? Thanks for advice!

 Keith

 $sum=0;
 switch($sum)
 {
   case ($sum==8):
   echo sum=8;
   break;
       case ($sum==7 || $sum==6):
       echo sum=7 or 6;
       break;
   case ($sum==2 || $sum==1):
   echo sum=2 or 1;
   break;
       case 0:
       echo sum=0;
       break;
   default:
   echo sum=3/4/5;
   break;
 }
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php





-- 
Adam Randall
http://www.xaren.net
AIM: blitz574

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



Re: [PHP] Form Spam

2009-08-20 Thread Adam Randall
I was getting those as well on my website's form, so I added a
honeypot field and a math question (I'm not overly fond of captchas
for my own stuff, but anyway). The field itself is hidden, so bots
will fill it out causing the e-mail sending routine to bail out
(though they don't know that since it looks like it was sent :) That's
assuming that they were able to figure out the math question before
hand. Maybe not fort knox, but it does help out for me at least.

Adam.

On Thu, Aug 20, 2009 at 6:11 AM, Garygwp...@ptd.net wrote:
 I have a client with a form on his site and he is getting spammed.  It
 appears not to be from bots but human generated.  While they are coming from
 India, they do not all have the same IP address, but they all have gmail
 addresses, New York  addresses are used in the input field and they all
 offer SEO services.  It is not overwhleming, but about 5 a month.

 What is the best way to stop this.

 Thanks

 Gary



 __ Information from ESET Smart Security, version of virus signature 
 database 4351 (20090820) __

 The message was checked by ESET Smart Security.

 http://www.eset.com





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





-- 
Adam Randall
http://www.xaren.net
AIM: blitz574

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



Re: [PHP] Sanitizing mysql inserts of user data

2009-08-16 Thread Adam Randall
What you are doing here is potentially altering valid user information
coming into MySQL. For example, if someone legitimately enters in --
or ; into some string that is going to be put into MySQL, some comment
or such, then what is put in, and then put out if you display it,
won't be the same.

You should in pretty much all cases be safe with just using the
mysql_real_escape_string, which takes care of the - for you as well.

Adam.

On Sun, Aug 16, 2009 at 11:42 AM, Dotan Cohendotanco...@gmail.com wrote:
 I am sanitizing user-entered data before storing in mysql with this function:

 function clean_mysql ($dirty) {
    $dirty=trim($dirty);
    $dirty=str_replace (--, , $dirty);
    $dirty=str_replace (;, , $dirty);
    $clean=mysql_real_escape_string($dirty);
    return $clean;
 }

 Is this good enough to prevent SQL injection attacks? Should I add
 anything else? Thanks!

 Dotan Cohen

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





-- 
Adam Randall
http://www.xaren.net
AIM: blitz574

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



Re: [PHP] reason for a Notice:.. on one site but not another? (Same code.)

2009-08-10 Thread Adam Randall
That should be !== not !===

Adam.

On Mon, Aug 10, 2009 at 12:17 PM, Ralph Deffkeralph_def...@yahoo.de wrote:
 for the same story there are the

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



Re: [PHP] Re: how to say inverse your value (to a boolean)?

2009-08-10 Thread Adam Randall
http://us3.php.net/manual/en/language.operators.comparison.php

Find Ternary on that page.

It's a shortened conditional:

cond ? true : false

Adam.

On Mon, Aug 10, 2009 at 6:27 PM, John
Butlergovinda.webdnat...@gmail.com wrote:
  echo something  . (($a = $a^1) ? red\n : green\n);

 Re: The ? char in this  line above..
 where in the php docs can I read about what that is doing?
 I have not come across this construct before today, from you guys.

 thanks
 -John

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





-- 
Adam Randall
http://www.xaren.net
AIM: blitz574

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



Re: [PHP] Re: how to say inverse your value (to a boolean)?

2009-08-10 Thread Adam Randall
No...not zerowing...no...

But yes, the ternary operator is the bomb, which you can get carried
away with. Daevid knows what I mean :)

Adam.

On Mon, Aug 10, 2009 at 6:59 PM, Daevid Vincentdae...@daevid.com wrote:
 Pretty much the best operator ever invented IMHO. And Since PHP 5.3, it is
 possible to leave out the middle part of the ternary operator. Expression
 expr1 ?: expr3 returns expr1 if expr1  evaluates to TRUE, and expr3
 otherwise. Awesome!

 Also, Adam Randall set up us the bomb. ;-)
 (http://www.youtube.com/watch?v=qItugh-fFgg)

 -Original Message-
 From: Adam Randall [mailto:randa...@gmail.com]
 Sent: Monday, August 10, 2009 6:41 PM
 To: php-general@lists.php.net
 Subject: Re: [PHP] Re: how to say inverse your value (to a boolean)?

 http://us3.php.net/manual/en/language.operators.comparison.php

 Find Ternary on that page.

 It's a shortened conditional:

 cond ? true : false

 Adam.

 On Mon, Aug 10, 2009 at 6:27 PM, John
 Butlergovinda.webdnat...@gmail.com wrote:
   echo something  . (($a = $a^1) ? red\n : green\n);
 
  Re: The ? char in this  line above..
  where in the php docs can I read about what that is doing?
  I have not come across this construct before today, from you guys.
 
  thanks
  -John
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 



 --
 Adam Randall
 http://www.xaren.net
 AIM: blitz574

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






-- 
Adam Randall
http://www.xaren.net
AIM: blitz574

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



Re: [PHP] Sending email w/ attachments

2009-08-10 Thread Adam Randall
Funny, I just had to figure out today how to nicely do HTML e-mails. I
ended up using PEAR:Mail_mime, and it worked pretty well. It will also
work for your attachments. I believe that PHP itself recommends it on
their mail() function reference page.

Adam.

On Mon, Aug 10, 2009 at 6:49 PM, Skip Evanss...@bigskypenguin.com wrote:
 Hey all,

 Trying to send emails with attachments, first try at this. And am trying to
 adapt sample code I found here:

 http://www.webcheatsheet.com/PHP/send_email_text_html_attachment.php

 Trying this:

 ($data contains the contents of the file; I've verified this)

 $hash = md5(date('r', time()));
 $attachment = chunk_split(base64_encode($data));
 $body_attachment = --PHP-mixed-$hash--\n .
 Content-Type: application/octet-stream; name=\$filename\\r\n .
 Content-Transfer-Encoding: base64\n .
 Content-Disposition: attachment\n.
 $attachment . \n .
 --PHP-mixed-$hash--\n;

 I then append $attachment this to the end of the email body and send it on.
 I've verified it is reading the file properly, in this test case it is a
 place text file. But I've tried a PDF and that did not work as well.

 What happens is the email comes through and shows an attachment paper clip
 icon in Thunderbird, but when the email is clicked on the icon disappears
 and the email is empty, even the body is not there and no attachment either.

 A final question I have is does the content-type value need to change for
 text files, Word Docs, PDFs, Excel files, etc, or is there one type that can
 handle any file type?

 Any help would be great. I'm rather stuck and floundering here.

 Thanks,
 Skip

 --
 
 Skip Evans
 Big Sky Penguin, LLC
 503 S Baldwin St, #1
 Madison WI 53703
 608.250.2720
 http://bigskypenguin.com
 
 Those of you who believe in
 telekinesis, raise my hand.
  -- Kurt Vonnegut

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





-- 
Adam Randall
http://www.xaren.net
AIM: blitz574

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



Re: [PHP] Undefined symbol ssl_onceonlyinit

2009-08-08 Thread Adam Randall
I wonder if it's downloading the imap.so as a binary instead of source
(or php as a binary instead of source). But this is the reason you are
getting the errors. It has to do with the shared libraries at build
time not matching the shared libraries at runtime (eg the symbol in
the shared library I'm expecting is not in the shared library I am
using).

You know, looking at the error messages that you posted again I now
realize that the incompatability is not between imap and php, but imap
and /libexec/ld-elf.so.1. That's where you need to look it seems.

Adam.

On Sat, Aug 8, 2009 at 1:34 AM, Ebbe Hjorthebbe.hjo...@gmail.com wrote:
 Hi,

 Sounds like mac ports and freebsd ports i kinda the same.

 I tried deinstalling the extensions ports, and reinstalling it, meaning it
 all gets build from source once more, and it didnt help.


 / Ebbe

 2009/8/8 Adam Randall randa...@gmail.com

 While I haven't used FreeBSD, the message you are getting basically
 means that when the imap.so was built it was against a different,
 incompatible version of PHP. I'm going to assume that the freebsd
 ports is related to my Mac Ports, which I think is based off it. If
 that's true, then ports is downloading and building PHP from source.
 If the imap.so was downloaded as a binary, or not rebuilt when php was
 last built, you will get this symbol mismatch. If possible, rebuild
 imap from source against your currently installed PHP and that should
 resolve it for you.

 Adam.

 On Sat, Aug 8, 2009 at 1:06 AM, Ebbe Hjorthebbe.hjo...@gmail.com wrote:
  Hi,
 
  I just installed FreeBSD 7.2, Apache 2.2, php5-5.2.10 and
  php5-extensions
  1.3, all from the freebsd ports.
 
  When i try to start apache with the imap.so extension enabled in
  extensions.ini, i get the error
  /libexec/ld-elf.so.1: /usr/local/lib/php/20060613/imap.so: Undefined
  symbol
  ssl_onceonlyinit
 
  I tried to google it, but all i get is an old bug from 2002.
 
  Please help ;)
 
  Thanks, Ebbe, Denmark
 



 --
 Adam Randall
 http://www.xaren.net
 AIM: blitz574





-- 
Adam Randall
http://www.xaren.net
AIM: blitz574

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



Re: [PHP] Server change affecting ability to send downloaded files???

2009-08-07 Thread Adam Randall
Change to cron -i to see what other information, if any, is also being
passed back. You might get some errors, or some such. Since you are
getting empty files my gut tells me you aren't getting anything. Since
you are actually getting a PHP 500 error, that lends me to believe
that it's not some type of external influence (aka the malware
thoughts).

Since the code looks reasonable, I'm thinking that it may be
permission related. While your code/files may not have been updated,
that doesn't mean that permissions were not. Trace through your file
structure and see what's going on in the ../../store/files path.

Adam.

On Fri, Aug 7, 2009 at 5:05 PM, Brian Dunningbr...@briandunning.com wrote:
 Correct, the files on the server have not changed either, and have been
 working fine for a long time. No funny characters.

 On Aug 7, 2009, at 4:59 PM, Adam Randall wrote:

 Sorry for replying to myself, but the files themselves only contain
 US-ASCII characters, and no quotes, correct? Having extended
 characters in your file names might cause weirdness, and quotes will
 break your HTTP header in your code there.




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





-- 
Adam Randall
http://www.xaren.net
AIM: blitz574

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



[PHP] Read/decode barcodes from an image

2008-12-17 Thread Adam Randall
I'm amazed that this either doesn't exist, or is hard to find. I
basically am looking for a way to read in an image into PHP, or shell
out to something on the Linux side, and determine, and see if it has a
barcode in it or not. If it does, I need to decode the barcode so that
I can identify the page as a separator page or not.

Basically, what I'm doing is reading in a PDF or TIF which will
contain multiple pages (probably a lot of pages) and look for a page
containing a barcode. The barcode will identify the page as a
separator page which will be used to split the multipage document into
smaller single or multipage documents.

Has anyone ever heard of anything that might help me in this process?

Adam.
-- 
Adam Randall
AIM: blitz574

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



Re: [PHP] Read/decode barcodes from an image

2008-12-17 Thread Adam Randall
Are you referring to a project, class, or just generally curious about
what I'm asking? Barcode reader can be many things, including a
scanning wand (not applicable to what I am looking for).

On Wed, Dec 17, 2008 at 3:47 PM, Robert Cummings rob...@interjinn.com wrote:
 On Wed, 2008-12-17 at 14:56 -0800, Adam Randall wrote:
 I'm amazed that this either doesn't exist, or is hard to find. I
 basically am looking for a way to read in an image into PHP, or shell
 out to something on the Linux side, and determine, and see if it has a
 barcode in it or not. If it does, I need to decode the barcode so that
 I can identify the page as a separator page or not.

 Basically, what I'm doing is reading in a PDF or TIF which will
 contain multiple pages (probably a lot of pages) and look for a page
 containing a barcode. The barcode will identify the page as a
 separator page which will be used to split the multipage document into
 smaller single or multipage documents.

 Has anyone ever heard of anything that might help me in this process?

 Barcode reader?

 Cheers,
 Rob.
 --
 http://www.interjinn.com
 Application and Templating Framework for PHP





-- 
Adam Randall
AIM: blitz574

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



Re: [PHP] Re: Read/decode barcodes from an image

2008-12-17 Thread Adam Randall
This completely internal, and highly sensitive. Also, the documents
themselves will different every time likely as they can either be
faxes with who knows what type of skewing/quality/orientation. I need
to be able to read them and find out what the barcodes are, if any.

Adam.

On Wed, Dec 17, 2008 at 4:04 PM, Nathan Rixham nrix...@gmail.com wrote:
 Adam Randall wrote:

 I'm amazed that this either doesn't exist, or is hard to find. I
 basically am looking for a way to read in an image into PHP, or shell
 out to something on the Linux side, and determine, and see if it has a
 barcode in it or not. If it does, I need to decode the barcode so that
 I can identify the page as a separator page or not.

 Basically, what I'm doing is reading in a PDF or TIF which will
 contain multiple pages (probably a lot of pages) and look for a page
 containing a barcode. The barcode will identify the page as a
 separator page which will be used to split the multipage document into
 smaller single or multipage documents.

 Has anyone ever heard of anything that might help me in this process?

 Adam.

 ooh ooh why don't you do what recaptcha did and have the public decode them
 for you!

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





-- 
Adam Randall
AIM: blitz574

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



Re: [PHP] Re: Read/decode barcodes from an image

2008-12-17 Thread Adam Randall
I would have thought so too, but haven't found anything yet. Maybe
there is an answer there (I have Imagick installed for example).
iText, a java utility, has the ability to write barcodes nicely to
PDF, too bad that there's no some reverse there either.

Adam.

On Wed, Dec 17, 2008 at 4:42 PM, Al n...@ridersite.org wrote:
 If anything can do it, it'll be ImageMagick

 Adam Randall wrote:

 I'm amazed that this either doesn't exist, or is hard to find. I
 basically am looking for a way to read in an image into PHP, or shell
 out to something on the Linux side, and determine, and see if it has a
 barcode in it or not. If it does, I need to decode the barcode so that
 I can identify the page as a separator page or not.

 Basically, what I'm doing is reading in a PDF or TIF which will
 contain multiple pages (probably a lot of pages) and look for a page
 containing a barcode. The barcode will identify the page as a
 separator page which will be used to split the multipage document into
 smaller single or multipage documents.

 Has anyone ever heard of anything that might help me in this process?

 Adam.

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





-- 
Adam Randall
AIM: blitz574

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



Re: [PHP] Re: Read/decode barcodes from an image

2008-12-17 Thread Adam Randall
Yeah, I have played with JOCR/GOCR, but it seemed somewhat inaccurate.
Does anyone have any examples of working with it in code so that I can
figure out how to incorporate it into my solutions?

Adam.

On Wed, Dec 17, 2008 at 5:17 PM, Bastien Koert phps...@gmail.com wrote:
 On Wed, Dec 17, 2008 at 7:42 PM, Al n...@ridersite.org wrote:

 If anything can do it, it'll be ImageMagick

 Adam Randall wrote:

 I'm amazed that this either doesn't exist, or is hard to find. I
 basically am looking for a way to read in an image into PHP, or shell
 out to something on the Linux side, and determine, and see if it has a
 barcode in it or not. If it does, I need to decode the barcode so that
 I can identify the page as a separator page or not.

 Basically, what I'm doing is reading in a PDF or TIF which will
 contain multiple pages (probably a lot of pages) and look for a page
 containing a barcode. The barcode will identify the page as a
 separator page which will be used to split the multipage document into
 smaller single or multipage documents.

 Has anyone ever heard of anything that might help me in this process?

 Adam.


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


 your best bet would likely be to find an open source OCR package (like
 http://jocr.sourceforge.net/ ) and shell out to it to do the reading in. One
 of our clients wrote a .NET app to just this that renames the file with the
 ocr barcode after which we pick it up and handle the rest

 hth

 --

 Bastien

 Cat, the other other white meat




-- 
Adam Randall
AIM: blitz574

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



[PHP] Help: DOMXPath-Query, quotes and apostrophes

2007-03-15 Thread Adam Randall
I seem to be hitting a wall here. I have the need to run an XPath query
on strings that may contain quotes, apostrophes or both. Going through
google turned up some interesting information, but nothing that solved
my issue.

An example of what I am trying to do is as follows:

$query = '\'foobar';
$xpath-query('/[EMAIL PROTECTED]'.$query.']')-item(0);

This produces these warnings and errors:

Warning: DOMXPath::query() [function.DOMXPath-query]: Invalid predicate
Warning: DOMXPath::query() [function.DOMXPath-query]: Invalid expression
Fatal error: Call to a member function item() on a non-object

I've tried to escape the characters in the query, but that seems to be
illegal for XPath from what I've read. I've tried turning the quotes
into quot; and apostrophes into apos; but it appears that XPath
requires that the data be unencoded to work.

I've seen reference to using XSLT to set XPath variables instead, but I
don't understand how to do implement this.

I would really appreciate any examples on what people have done to get
around this issue, if any one has at all.

Regards,

Adam.

--
Adam Randall [EMAIL PROTECTED]
(206) 285-8080
100 West Harrison
North Tower, Suite 300
Seattle, WA
98119

Engineers like to solve problems. If there are no problems handily
available, they will create their own problems. - Dilbert

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