[PHP] The Cat Signal

2012-07-19 Thread Kris Craig
Hey guys,

I just became aware of this:

http://internetdefenseleague.org/


It's a site setup by Mozilla, Reddit, and others to defend internet freedom
in the wake of recent legislative events in the U.S. and elsewhere (full
members list here:  http://www.internetdefenseleague.org/members).

They've setup what they're calling the cat signal, an invisible bit of
embeddable code you can put in your website that will activate (and display
the afore-mentioned signal/link/etc) if/when the next SOPA/PIPA/etc comes
along that threatens the open internet.

I'd like to propose that we integrate this into the PHP website.  This
issue directly affects our community and we already staked a claim in this
fight when we participated in the last great blackout.

In addition, I'd also l ike to propose that we officially join this group
as a member.  I'm not sure if we'd do this by vote or something similar to
the RFC process  etc, but if you'll grant me permission, I'd be happy to
do the legwork on this myself (make the HTML edits, contact the
organization on PHP's behalf, etc).


Thoughts?

--Kris


[PHP] Re: [PHP-WEBMASTER] Re: [PHP] The Cat Signal

2012-07-19 Thread Kris Craig
On Thu, Jul 19, 2012 at 12:36 PM, Ferenc Kovacs tyr...@gmail.com wrote:


 2012.07.19. 20:21, Daniel Brown danbr...@php.net ezt írta:

 
  Forwarding to php-webmas...@lists.php.net, as it's not a general
  user issue where it pertains to php.net.
 
  On Thu, Jul 19, 2012 at 2:02 PM, Kris Craig kris.cr...@gmail.com
 wrote:
   Hey guys,
  
   I just became aware of this:
  
   http://internetdefenseleague.org/
  
  
   It's a site setup by Mozilla, Reddit, and others to defend internet
 freedom
   in the wake of recent legislative events in the U.S. and elsewhere
 (full
   members list here:  http://www.internetdefenseleague.org/members).
  
   They've setup what they're calling the cat signal, an invisible bit
 of
   embeddable code you can put in your website that will activate (and
 display
   the afore-mentioned signal/link/etc) if/when the next SOPA/PIPA/etc
 comes
   along that threatens the open internet.
  
   I'd like to propose that we integrate this into the PHP website.  This
   issue directly affects our community and we already staked a claim in
 this
   fight when we participated in the last great blackout.
  
   In addition, I'd also l ike to propose that we officially join this
 group
   as a member.  I'm not sure if we'd do this by vote or something
 similar to
   the RFC process  etc, but if you'll grant me permission, I'd be happy
 to
   do the legwork on this myself (make the HTML edits, contact the
   organization on PHP's behalf, etc).
  
  
   Thoughts?
  
   --Kris
 
 
 
  --
  /Daniel P. Brown
  Network Infrastructure Manager
  http://www.php.net/
 
  --
  PHP Webmaster List Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 

  Btw. we were asked by the to join the league as we were a big traffic
 source on the black out day.
 I don't know if Rasmus is on the webmaster list or not, but we should cc
 him, as he was the driving force behind us joining the anti SOPA movement.

I heard back from the webmaster saying that we're already participating
with the cat signal on our website.  Given this and no objections, I went
ahead and contacted them and asked that they list us on their participating
members page.

--Kris


[PHP] Re: [PHP-WEBMASTER] Re: [PHP] The Cat Signal

2012-07-19 Thread Kris Craig
On Thu, Jul 19, 2012 at 1:52 PM, Ferenc Kovacs tyr...@gmail.com wrote:


  Btw. we were asked by the to join the league as we were a big traffic
  source on the black out day.
  I don't know if Rasmus is on the webmaster list or not, but we should cc
  him, as he was the driving force behind us joining the anti SOPA
 movement.

 He is everywhere.

 But I thought we were already 'members'?
 See also http://php.markmail.org/message/7e4uqo73fmtlgjeo

 -Hannes


 Thanks, that was the mail that I was referring to.
 I didn't see anybody reply on that thread, so except we replied in private
 (why would we do that?) I guess we never officially accepted that
 invitation.

 --
 Ferenc Kovács
 @Tyr43l - http://tyrael.hu


Can we officially accept it now?  It sounds like everyone is all for
this.  We're already technically a member anyway with the cat signal code
implemented, plus I've already reached out to them based on this thread and
the response I got from our webmaster.  Do we have any procedure or secret
handshake or whatever for this, or can we just say, Yep we're down with
this and be done with it?  =)

--Kris


[PHP] Re: [PHP-WEBMASTER] Re: [PHP] The Cat Signal

2012-07-19 Thread Kris Craig
On Thu, Jul 19, 2012 at 2:11 PM, Hannes Magnusson 
hannes.magnus...@gmail.com wrote:

 On Thu, Jul 19, 2012 at 10:01 PM, Kris Craig kris.cr...@gmail.com wrote:
 
 
  On Thu, Jul 19, 2012 at 1:52 PM, Ferenc Kovacs tyr...@gmail.com wrote:
 
 
   Btw. we were asked by the to join the league as we were a big traffic
   source on the black out day.
   I don't know if Rasmus is on the webmaster list or not, but we should
   cc
   him, as he was the driving force behind us joining the anti SOPA
   movement.
 
  He is everywhere.
 
  But I thought we were already 'members'?
  See also http://php.markmail.org/message/7e4uqo73fmtlgjeo
 
  -Hannes
 
 
  Thanks, that was the mail that I was referring to.
  I didn't see anybody reply on that thread, so except we replied in
 private
  (why would we do that?) I guess we never officially accepted that
  invitation.
 
  --
  Ferenc Kovács
  @Tyr43l - http://tyrael.hu
 
 
  Can we officially accept it now?  It sounds like everyone is all for
 this.
  We're already technically a member anyway with the cat signal code
  implemented, plus I've already reached out to them based on this thread
 and
  the response I got from our webmaster.  Do we have any procedure or
 secret
  handshake or whatever for this, or can we just say, Yep we're down with
  this and be done with it?  =)

 You need to write an RFC, run one round around a church, submit a call
 for open discussion for the request for comment, run backwards around
 a church, spit on the grave of your first born, then vote.

 Or in other words; What exactly are you looking to do here?
 If we are already pencilled down as members, great!
 Is there anything else left then?

 -Hannes


I don't think so, no.  I just wanted to double-check and make sure I'm
being kosher in asking them to list us and our logo on their top members
page.  =)

--Kris

P.S. I don't have any dead kids yet, so can I substitute someone else's
dead kid to spit on?


[PHP] Detect timeout of stream_socket_client using STREAM_CLIENT_ASYNC_CONNECT ?

2010-11-06 Thread Craig Mason

(apologies if this sends twice - email verification issues)

Is it possible to detect the timeout of a stream created with 
stream_socket_client() using the flag 'STREAM_CLIENT_ASYNC_CONNECT' ?


As soon as this flag is used, it seems there is no way to detect a 
timeout situation.


tcp://192.168.100.100:123 is a fictional, non-existent endpoint.


Code:
===

?php
ini_set('default_socket_timeout', 1);

$flags = STREAM_CLIENT_CONNECT | STREAM_CLIENT_ASYNC_CONNECT;
$conn = stream_socket_client('tcp://192.168.100.100:123', $errNo, 
$errStr, 1, $flags);

stream_set_timeout($conn, 1);

$read = array($conn);
$write = array($conn);
$e = null;
stream_select($read, $write, $e, 5, 0);

var_dump($read);
var_dump($write);
var_dump($errNo);
var_dump($errStr);
var_dump(stream_get_meta_data($conn));



Output:
===

array(0) {
}
array(0) {
}
int(0)
string(0) 
array(7) {
  [stream_type]=
  string(14) tcp_socket/ssl
  [mode]=
  string(2) r+
  [unread_bytes]=
  int(0)
  [seekable]=
  bool(false)
  [timed_out]=
  bool(false)
  [blocked]=
  bool(true)
  [eof]=
  bool(false)
}

Thanks

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



Re: [PHP] Re: Independent Contractor Suggestions

2010-10-22 Thread Kris Craig
Alrighty, thanks for waiting.  I've posted the files here:

http://freelancetools.sourceforge.net/


Currently, there are two documents there:  A general contract and a
statement of work (SOW) contract.  Typically, the general contract
would be signed first, essentially laying out the overall terms of the
business relationship.  Then, the SOW is signed, which outlines the
specifics of the project (work to be done, budget, payment schedule,
etc).

You'll want to read each document carefully.  At the top, you'll want
to replace the generic information with yours and your client's.
After the first paragraph of each document, both parties are referred
to as Client and Provider, so you won't have to change names in a
whole bunch of places.  The SOW provided contains budget/work for a
hypothetical sample project; you will want to replace this with the
details of the actual project you're working on.

I may add more stuff later, like SEO scripts and whatnot I've created
over the years, but for now this should at least help you with your
current situation.  Everything uploaded to the project URL above is in
the public domain, which means you are free to do with it as you
please.  And, as always, use it at your own risk.


Please feel free to let me know if you have any
questions/feedback/etc.  I hope this helps.  =)


--Kris


On Thu, Oct 21, 2010 at 1:52 PM, Kris Craig kris.cr...@gmail.com wrote:
 I've had a few emails from people making the same request, so what I'm
 gonna do is stick them up someplace public like SourceForge or
 whatever in the public domain for anyone who wants them.

 Legal disclaimer:  Please note that, though these have been reviewed
 by the legal departments of my past clients, I myself am not a lawyer
 and can offer no warranty regarding these documents.  If you have any
 questions/concerns about any part of either of the documents, I would
 strongly advise you to consult an attorney who specializes in contract
 law.  There is no lifeguard on duty.  Batteries not included.  So
 there.


 Now that that's out of the way, I'll get those up either tomorrow or
 Monday then post a link here.  I hope this helps.  =)

 --Kris


 On Wed, Oct 20, 2010 at 6:47 PM, Jason Pruim li...@pruimphotography.com 
 wrote:

 On Oct 20, 2010, at 8:47 PM, Kris Craig wrote:


 I hope this helps.  If you like, I'd be happy to email you a sample
 copy of the SOW/contract I've used with past clients.

 Hey Kris,

 If you don't mind I would love a copy my self! I have started doing some
 freelance work and I'm always looking for info that I can use :)

 Jason Pruim




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



Re: [PHP] Re: Independent Contractor Suggestions

2010-10-21 Thread Kris Craig
I've had a few emails from people making the same request, so what I'm
gonna do is stick them up someplace public like SourceForge or
whatever in the public domain for anyone who wants them.

Legal disclaimer:  Please note that, though these have been reviewed
by the legal departments of my past clients, I myself am not a lawyer
and can offer no warranty regarding these documents.  If you have any
questions/concerns about any part of either of the documents, I would
strongly advise you to consult an attorney who specializes in contract
law.  There is no lifeguard on duty.  Batteries not included.  So
there.


Now that that's out of the way, I'll get those up either tomorrow or
Monday then post a link here.  I hope this helps.  =)

--Kris


On Wed, Oct 20, 2010 at 6:47 PM, Jason Pruim li...@pruimphotography.com wrote:

 On Oct 20, 2010, at 8:47 PM, Kris Craig wrote:


 I hope this helps.  If you like, I'd be happy to email you a sample
 copy of the SOW/contract I've used with past clients.

 Hey Kris,

 If you don't mind I would love a copy my self! I have started doing some
 freelance work and I'm always looking for info that I can use :)

 Jason Pruim



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



Re: [PHP] WHILE LOOP PROBLEM

2009-03-27 Thread Craig Whitmore
On Fri, 2009-03-27 at 08:11 +, Andrew Williams wrote:
 can some tell why the below loop stop running after some time.
 
 $start=10;
 const run=0;
 while($start run){
 
 //do somthing
 
 }
 
max_execution_time


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



Re: [PHP] RSS feeder in PHP5?

2009-01-12 Thread Craig Whitmore
On Mon, 2009-01-12 at 11:02 +, Richard Heyes wrote:
  Is there something in PHP5 which can generate the RSS feed?
 
 You don't need an extension to help you generate an XML feed. You
 dimply output XML data instead of HTML and send an appropriate content
 type header, eg:
 
 header('Content-Type: text/xml');
 
 You actually mean application/xml not text/xml

And its alot better to use DOMDocument in PHP5 for XML Creation rather
than hardcode everything.





Thanks




 And the actual data:
 
 ?xml version=1.0 encoding=iso-8859-1?
 rss version=0.91
 channel



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



[PHP] PHP5 DOM Problem

2008-12-05 Thread Craig Whitmore
Hi there. I don't kno id this is the correct place to post but...

I am using the PHP5 DOM to make up RSS Feeds ..

A Problem I have is I want to make this up for itunes..

?xml version=1.0 encoding=UTF-8?
rss version=2.00 xmlns:itunes=http://www.itunes.com/dtds/podcast-1.0.dtd;


etc.. 

I use..
$p_dom = new DOMDocument('1.0','UTF-8');
$p_rss = $p_dom-createElement('rss');
$p_rss-setAttribute('version', '2.00');
$p_rss-setAttribute('xmlns:itunes','http://www.itunes.com/dtds/podcast-1.0.dtd');
$p_dom-appendChild($p_rss);

which is working for me.. Debian (PHP 5.2.6-2+b1)

but doesn't work on some other people with other versions of php5  ( I don't 
know yet which version they have)

they only get 

?xml version=1.0 encoding=UTF-8?
rss version=2.00

So the name space is missing..

So I looked up http://nz2.php.net/manual/en/domelement.setattribute.php

and it says the correct way is to use createElementNS.. but I have tried and 
tried and I cannot get it to make up what I want it to do.

can someone help?

I also want to make something like

?xml version=1.0 encoding=UTF-8?
rss version=0.91 xmlns:media=http://search.yahoo.com/mrss/; 
xmlns:dcterms=http://purl.org/dc/terms/; 
xmlns:gm=http://www.google.com/schemas/gm/1.1; 
xmlns:av=http://www.searchvideo.com/schemas/av/1.0; 
xmlns:dc=http://purl.org/dc/elements/1.1/;

for mediarss feeds + other types . but I can't seem to be able to use 
CreateElementNS to make this up either


Can someone help??








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



RE: [PHP] $_GET and multiple spaces.

2008-01-14 Thread Churchill, Craig
 -Original Message-
 From: Andrés Robinet [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, 15 January 2008 6:33 AM
 To: php-general@lists.php.net
 Subject: RE: [PHP] $_GET and multiple spaces.


 Like this?
 
 $url =
 htmlspecialchars('whatever.php?'.urlencode($name).'='.urlencode($value));
 
 Regards,
 
 Rob
 

I'm now using urlencode on the values and htmlspecialchars on the entire url
and it's working nicely.

Thanks to everyone who helped.
Craig.
 

museumvictoria.com.au
This e-mail is solely for the named addressee and may be confidential.You 
should only read, disclose, transmit, copy, distribute, act in relianceon or 
commercialise the contents if you are authorised to do so. If you are not the 
intended recipient of this e-mail, please notify [EMAIL PROTECTED] by e-mail 
immediately, or notify the sender and then destroy any copy of this message. 
Views expressed in this e-mailare those of the individual sender, except where 
specifically stated to be those of an officer of Museum Victoria. Museum 
Victoria does not represent,warrant or guarantee that the integrity of this 
communication has been maintained nor that it is free from errors, virus or 
interference.

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



[PHP] $_GET and multiple spaces.

2008-01-13 Thread Churchill, Craig
Hello,

One of the values I'm passing in a URL string contains multiple spaces.

a href=browse.php?DarScientificName=Argononemertes  australiensis.../a
(The multiple spaces are between Argononemertes and australiensis)

However when I retrieve the value using $_GET[DarScientificName]
there is only a single space between the two names which I understand is the 
intended behaviour?

Is there a way to preserve the multiple spaces?

Thanks
Craig.



Craig Churchill
Collection Systems Specialist
Museum Victoria
GPO Box 666
Melbourne VIC 3001
Australia
Telephone   +61 3 8341 7743
Email [EMAIL PROTECTED]
 

museumvictoria.com.au
This e-mail is solely for the named addressee and may be confidential.You 
should only read, disclose, transmit, copy, distribute, act in relianceon or 
commercialise the contents if you are authorised to do so. If you are not the 
intended recipient of this e-mail, please notify [EMAIL PROTECTED] by e-mail 
immediately, or notify the sender and then destroy any copy of this message. 
Views expressed in this e-mailare those of the individual sender, except where 
specifically stated to be those of an officer of Museum Victoria. Museum 
Victoria does not represent,warrant or guarantee that the integrity of this 
communication has been maintained nor that it is free from errors, virus or 
interference.

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



FW: [PHP] unsubscribing

2005-11-16 Thread Brown, Craig
I tried several times as well. So far, no luck. I tried the unsubscribe
address but it doesn't work.

-Original Message-
From: wayne [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, November 15, 2005 9:34 PM
To: php-general@lists.php.net
Subject: [PHP] unsubscribing


I tried to unsubscribe on several occasion without
success. I followed the instruction at the bottom 
of the email. Can someone take me off the list.
Thank You.

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

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



[PHP] Sessions - going back in browser

2005-04-19 Thread Craig Donnelly
Hello,

I had an issue that I needed to be able to go back in the browser while in a
session without getting page has expired, I was reading through the manual
and came across a comment about adding the following to the sessions page to
allow users to traverse back:

header(Cache-control: private);
(http://www.php.net/manual/en/function.session-start.php)

This works fine on a Win32 dev box running Apache 1.3.x and PHP 5.0.3, but
then I loaded the pages onto a RedHat box running PHP 5.0.3 on Apache
1.3.27.  This box is running these pages through SSl (https)

Anyone any ideas?

Regards,
Craig

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



[PHP] Re:^^

2005-04-19 Thread Craig Donnelly

So now the page expires

Any help appreciated.

Craig Donnelly [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hello,

 I had an issue that I needed to be able to go back in the browser while in
a
 session without getting page has expired, I was reading through the
manual
 and came across a comment about adding the following to the sessions page
to
 allow users to traverse back:

 header(Cache-control: private);
 (http://www.php.net/manual/en/function.session-start.php)

 This works fine on a Win32 dev box running Apache 1.3.x and PHP 5.0.3, but
 then I loaded the pages onto a RedHat box running PHP 5.0.3 on Apache
 1.3.27.  This box is running these pages through SSl (https)

 Anyone any ideas?

 Regards,
 Craig

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



[PHP] Migration from php4 to php 5 open_basedir directive.

2005-03-14 Thread Craig Lewis
Hello,
I have just attempted to migrate for the first time from  php4 to php5. 
The problem i am having is some sort of change in how the open_basedir 
directive works in php 5. I don't see much discussion about this, so I 
must be doing something stupid, otherwise, I would think there would be 
a lot of people bumping into this.

On both servers I have safe mode on and open_basedir directive set for 
the virtual host in apache. The offending php code from the top level 
file calls another php file with require_once ('path/file.php') and then 
file.php in turn calls another php file require_once ('path/file2'). Its 
this second require_once that causes the fatal  error, in otherwords, I 
can call the first file with require_once, and put just about any sort 
of reasonable php code in this file, and it works, i.e. its included in 
the origional file. When the called file, calls another file, in php 5, 
I get an error,

==
Warning: main() [function.main]: open_basedir restriction in effect. 
File(/usr/local/pkg/php/php-5.0.2//lib/php/config/_config.inc.php) is 
not within the allowed path(s): (/www/htdocs/midwifefinder.com/site) in 
/www/htdocs/midwifefinder.com/site/includes/app.php on line 3

Warning: main(config/_config.inc.php) [function.main]: failed to open 
stream: Operation not permitted in 
/www/htdocs/midwifefinder.com/site/includes/app.php on line 3

Fatal error: main() [function.require]: Failed opening required 
'config/_config.inc.php' 
(include_path='.:/usr/local/pkg/php/php-5.0.2//lib/php') in 
/www/htdocs/midwifefinder.com/site/includes/app.php on line 3


The code and paths are unchanged, works on php4, not on php5, apache  
version unchanged. (1.3.x). I have tried various php.ini files, of 
course turning open_basedir off will make the error go away. The file 
being called is clearly within the scope of the open_basedir 
restriction, and thus it works just fine in php4.

/usr/local/pkg/php/php-5.0.2//lib/php/config/_config.inc.php is not the 
correct path to the file, I guess because it doesn't find the file in 
the . (dot) part of the include path, then it blows up when it tries to 
find the file in (what is basically) /usr/local/lib/php.

This kind of sounds like a TRANSPATH related problem, and its certainly 
a path problem (where is dot), but as I read the docs, TRANSPATH is 
something that changed for apache 2.

Any advice would be appreciated.
CL
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Migration from php4 to php 5 open_basedir directive.

2005-03-14 Thread Craig Lewis

The files in question are 'within' the open_basedir directive.
To explain further/better
within virtualhost,
php_admin_value open_basedir /www/htdocs/midwifefinder.com/site
and...
/www/htdocs/midwifefinder.com/site/index.php contains
===
?php
require_once(includes/app.php);

which is /www/htdocs/midwifefinder.com/site/includes/app.php and this 
file contains

===
?php
// base includes, don't change
require_once('config/_config.inc.php'); // config
===
which is /www/htdocs/midwifefinder.com/site/includes/config/_config.inc.php
but I have tried this with simple file names and a simpler structure, 
the contents of add.php is
parsed, and the contents of config/_config.php is never parsed.

why not just add the necessary directories to the open_basedir setting
(I'm guessing it can take multiple dirs because the error says 
'allowed path(s)')?
e.g.:
/usr/local/pkg/php/php-5.0.2//lib/php/config/_config.inc.php

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


[PHP] PHP5 FreeTDS

2005-01-13 Thread Craig Donnelly
I had FreeTDS and PHP 4.3.x working fine, then I upgraded my PHP

installation to PHP 5.0.3, now It isnt working.

On the page where I connect to the MSSQL server I get the following error:

Warning: mssql_connect() [function.mssql-connect]: Unable to connect to
server: 172.16.xx.xxx in /var/ftpusers/tarot/tarot/admin/sqltest.php on line
4

This worked fine before, and I tested it on another box which is also
running freeTDS with PHP 5.0.1 and it

connects fine. Anyone any Ideas??

Regards,

Craig

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



[PHP] Re: : [PHP] empty() problem

2004-12-13 Thread Craig Slusher
There has already been a thread about this like 1-2 days ago. Check the archives


On Mon, 13 Dec 2004 14:10:34 +0800, yangshiqi [EMAIL PROTECTED] wrote:
 Maybe this can help you.
 
 If (empty((string)$Game_rating))
 
 
 --
 : Ahmed Abdel-Aliem [mailto:[EMAIL PROTECTED]
 : 20041212 21:58
 : [EMAIL PROTECTED]
 : [PHP] empty() problem
 
 Hi Group Members
 i have a problem with function empty()
 i use it to check if user entered the form fields and store it in array
 
 for example :
 
 if (empty($Game_rating))
 $errors[] = You didn't enter the Online Status for the Game.;
 
 the problem when the user enters 0 in the form field
 the empty function returns the error.
 
 can i  use another function that doesn't return false when the 0 is passes ?
 
 any help plz ?
 
 --
 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
 
 


-- 
Craig Slusher
Web Programmer
[EMAIL PROTECTED]

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



Re: [PHP] PHP cross platform IDE

2004-12-13 Thread Craig Slusher
I don't think that there is a _great_ PHP IDE out there. For the most
part I will use Gvim, JEdit, or some other programmer's editor like
these. However, when I'm at work, we use Zend Studio to do all
development. It's nice because it integrates with CVS, has code
completion, debugging, etc., but it still has a lot of features
missing which I would really like to see (code folding, source
formatting, extssh for cvs, refactoring, split panes, better
keybinding support, phpdoc support). Another alternative is to use
Eclipse IDE with the PHPEclipse.de plugin. I've messed around with it
a little bit and it's not too bad.

-- 
Craig Slusher
Web Programmer
[EMAIL PROTECTED]

On Tue, 14 Dec 2004 10:29:41 -0500, Bryan Dina [EMAIL PROTECTED] wrote:
 I have done a little checking and I think I already know the answer, but
 I wanted to toss this one out there anyway.
 
 Are there any cross platform IDE's available for PHP v.5 development,
 specifically I am looking for Linux/Mac.
 
 A bit off topic, what are people out there using for PHP IDE's?
 
 thanks!
 --Bryan
 
 --
 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] Byte Array

2004-12-13 Thread Craig Slusher
Use bit shifting to make sense out of the data.


On Mon, 13 Dec 2004 15:55:54 +0100, Ian Firla [EMAIL PROTECTED] wrote:
 
 Hello All,
 
 I've hit a bit of a show stopper in a project I'm working on.
 
 I'm getting a 65 byte stream of data. 32 of those bytes are of the type
 Byte Array. Is there a way that I can covert that data into something
 useful?
 
 For the record, the data stream that I'm getting is in the format:
 
 |ascii|ascii|asciiX10|integerX4|byte arrayX32|
 
 The byte array looks like this: 
 g..UA9x|%r9.
 
 Any ideas?
 
 Ian
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
Craig Slusher
Web Programmer
[EMAIL PROTECTED]

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


Re: [PHP] empty() problem

2004-12-12 Thread Craig Slusher
I use this function which I find is very useful:

function isEmpty(  $var )
{
return isset($var)  strlen(trim($var)) == 0;
}


On Sun, 12 Dec 2004 10:12:34 -0500, John Holmes
[EMAIL PROTECTED] wrote:
 Ahmed Abdel-Aliem wrote:
 
 
  Hi Group Members
  i have a problem with function empty()
  i use it to check if user entered the form fields and store it in array
 
  for example :
 
  if (empty($Game_rating))
$errors[] = You didn't enter the Online Status for the Game.;
 
  the problem when the user enters 0 in the form field
  the empty function returns the error.
 
 Is $Game_rating supposed to be an integer? If so, then make it one and
 check for = to zero.
 
 if(!isset($_Game_rating) || (int)$Game_rating = 0)
 { $errors[] = You didn't enter the Online Status for the Game.; }
 
 Now you _know_ $Game_rating is an integer above zero and is safe to
 display and/or put into a query.
 
 Simply checking for
 
 if($Game_rating == '')
 
 will throw notices on some setups about an undefined variable (depending
 upon error_reporting level) and will allow text through when it's
 supposed to just be an integer.
 
 --
 
 ---John Holmes...
 
 Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
 
 php|architect: The Magazine for PHP Professionals  www.phparch.com
 
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
Craig Slusher
Web Programmer
[EMAIL PROTECTED]

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



Re: [PHP] array_merge_recursive

2004-12-10 Thread Craig Slusher
foreach ($animal_counts as $animal = $total) {
echo $animal. ':' .$total. 'br';
}


On Fri, 10 Dec 2004 13:51:36 -0500, Sebastian
[EMAIL PROTECTED] wrote:
 actually, what i mean is i need to get the animal name as well..
 
 ie:
 echo $animal . ' : ' .  $total
 would output:
 
 animal name : total
 animal name : total
 
 etc. thanks.
 
 
 
 - Original Message -
 From: Sebastian [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Friday, December 10, 2004 12:24 PM
 Subject: [PHP] array_merge_recursive
 
  Hi.
 
  I am using this array_merge_recursive to merge two arrays, the array looks
  like this:
 
  Array
  (
  [0] = Array
  (
  [animal] = Dogs
  [total] = 5
 
  )
 
  [1] = Array
  (
  [animal] = Cats
  [total] = 3
  )
 
  [2] = Array
  (
  [animal] = Cats
  [total] = 6
  )
 
  )
 
  the output i need is:
  Dogs 5
  Cats 9
 
  I need to add the total but keep just one animal if its already there. can
  someone please help? i been stuck for two days. i appreciate it.
 
  --
  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
 
 


-- 
Craig Slusher
Web Programmer
[EMAIL PROTECTED]

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


[PHP] Re: Using before a variable

2004-09-03 Thread Craig Donnelly
http://php.us.themoes.org/manual/en/language.references.pass.php

Passing by reference instead of value.

HTH
Craig

Shaun [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi,

 I have noticed that some of the functions in a tutorial I am studying have
 an  in the variable parameters i.e.

 function add($id) {
  /* function body */
 }

 I would be most grateful if some can shed some light on this as i cant fnd
 any reference to this in the PHP manual...

 Thanks

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



Re: [PHP] Array?

2004-08-25 Thread Craig Brothers
how many elements are returned by the sql statement?

If you want the 7th item returned in the sql statement would need to
code $things[6]

Just a hunch...

--
Craig Brothers
@utoRevenue
[EMAIL PROTECTED]
(413) 528-8000 x105



On Wed, 2004-08-25 at 14:17, Nathan Mealey wrote:
 I cannot seem to access elements inside of the array $things in the 
 code below.  All of the errors say Undefined offset:  7 in 
 /Library/WebServer/Documents/lis/check.php on line 26  I don't see 
 why...
 
 The code is:
   
   $q = select * from users where email='.$email.' and 
 password='.$pass.';
   $results = mysql_query($q);
   if ($results) {
   while ($list=mysql_fetch_assoc($results)) {
   $things[]=$list;
   }
   }
   //$things[7] is a MySQL timestamp column named last_login
   $date = strtotime($things[7]);
 
 
 Thanks in advance,
 Nathan
 --
 Nathan Mealey
 Director of Operations
 Cycle-Smart, Inc.
 P.O. Box 1482
 Northampton, MA
 01061-1482
 [EMAIL PROTECTED]
 (413) 587-3133
 (413) 210-7984 Mobile
 (512) 681-7043 Fax

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



[PHP] Re: Sessions nightmare continue...

2004-08-17 Thread Craig Donnelly
Why are you testing if $_POST['submit'] is set are you posting something to
the page??

In the two scripts you posted the code block wont be executed because there
is no post variable
being set.

Try this:

a1.php
==
   ?php

 session_start();
 header(Cache-control: private); // IE 6 Fix.

 $_SESSION[login]=inside;
 session_write_close();
 header(Location: a2.php);
 exit();
?

pre
 ?php print_r($_SESSION); ?
/pre
==

AND

a2.php
==
?php
 session_start();
 header(Cache-control: private); // IE 6 Fix.

 if(!isset($_SESSION[login])){
  echo(brsession variable NOT set);
 }else{
  echo(brsession variable set);
 }

 echo(brsession ID:  . session_id());
 echo(brsession value:  . $_SESSION[login]);
?

pre
 ?php print_r($_SESSION); ?
/pre
==

Works fine now.

HTH

Craig


Angelo Zanetti [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi all,

 Still no luck with sessions. I have installed an older version: 4.3.1
 and have register_globals=Off

 I have 2 test pages a1.php and a2.php

 All I want to do is register a session variable, set a value for it and
 then in a2.php check that it is still registered and view the session's
 value.

 a1.php:

 ?
 session_start();
 header(Cache-control: private); // IE 6 Fix.

 if(isset($_POST['Submit']))
 {
 $_SESSION[login]=inside;
 session_write_close();
 header(Location: a2.php);
 exit();
 }
 ?


 I can successfully register the session variable and set the value of
 it on page a1.php but when I go to page a2.php the session variable is
 not set and the value isnt set either.

 a2.php:

 ?
 session_start();
 header(Cache-control: private); // IE 6 Fix.

 if(!isset($_SESSION[login]))
echo(brsession variable NOT set);
 else
 echo(brsession variable set);

 echo(brsession ID:  . session_id());
 echo(brsession value:  . $_SESSION[login]);

 ?

 I have been trying to get this to work for ages with no luck. I have
 been reading the manual and have googled and cant seem to find the
 problem. if anyone can help that would be great.

 thanks in advance
 Angelo
 
 Disclaimer
 This e-mail transmission contains confidential information,
 which is the property of the sender.
 The information in this e-mail or attachments thereto is
 intended for the attention and use only of the addressee.
 Should you have received this e-mail in error, please delete
 and destroy it and any attachments thereto immediately.
 Under no circumstances will the Cape Technikon or the sender
 of this e-mail be liable to any party for any direct, indirect,
 special or other consequential damages for any use of this e-mail.
 For the detailed e-mail disclaimer please refer to
 http://www.ctech.ac.za/polic or call +27 (0)21 460 3911

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



[PHP] Re: POST superglobal is empty

2004-08-04 Thread Craig Donnelly
Show the code you are using...

Craig

Andy Loftus [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Does anyone have any ideas as to why $_POST would be empty when
 submitting a form to php?

 I am running PHP5 as CGI in apache 1.3.22 on redhat linux.
 I've also tried php4.3.8 CGI (same php configuration and .ini file)
 and I get the same behavior.

 When I submit an html form with method=post, the $_POST superglobal
 array is empty.  GET works fine.  I've tried many different
 configuration options with PHP but none seem to help.  I've tried the
 default php.ini-dist config file with no luck.

 I've gone through all the relevant bug reports and search all the
 mailing lists, FAQ's and newsgroups.  I can't find any useful,
 applicable information.

 My configure command is:
 ./configure \
 --prefix=/usr/local/php/php5.0.0 \
 --with-config-file-path=/usr/local/php/php5.0.0/ \
 --with-config-file=/usr/local/php/php5.0.0/php.ini \
 --enable-force-cgi-redirect \
 --disable-path-info-check \
 --enable-safe-mode \
 --disable-short-tags \
 --with-regex=system \
 --with-mysql \
 --enable-debug \
 --with-mcrypt \
 --enable-versioning \
 --disable-libxml


 --
 Andy

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



[PHP] Re: Checking for form submission

2004-08-04 Thread Craig Donnelly
Hi Shaun,

Your  expression is evaluating, if you like does the $_POST superglobal
exist and it does
but might be empty, this would be the same for $_GET and other superglobals.

If you did the following:

if (isset($_POST)  !empty($_POST)) {
   echo '(isset($_POST))';
}

This would only appear if there was in fact a $_POST variable 'set'.

If you want to test to see if a form has been submitted, I would suggest
that you
use the name from the submit button.

e.g - input type=submit value=Send Form Data name=sendform

if(isset($_POST['sendform'])){
echo Form has been submitted!;
}

So basically this checks if the form button sendform is set.

HTH,

Craig

Shaun [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi,

 I am trying to create some code to check whether a form has been
submitted.
 The following code seems to print evertime, whether a form has been
 submitted or not:

 if (isset($_POST)) {
   echo '(isset($_POST))';
  }

 This seems most odd, could someone tell me why this happens?

 Thanks for your help.

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



Re: [PHP] Re: Checking for form submission

2004-08-04 Thread Craig Donnelly
Ok, in simple form - If the submit button was clicked,
If some one hits enter this would be a problem, easy way to resolve
this would be to have a hidden form element flagged and to terst for that
instead of the
submit button, wouldnt you agree Jason?

Craig

Jason Wong [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 On Wednesday 04 August 2004 17:34, Craig Donnelly wrote:

  If you want to test to see if a form has been submitted, I would suggest
  that you
  use the name from the submit button.
 
  e.g - input type=submit value=Send Form Data name=sendform
 
  if(isset($_POST['sendform'])){
  echo Form has been submitted!;
  }
 
  So basically this checks if the form button sendform is set.

 This is not reliable, some browsers does not set the submit button if it
was
 not explicitly clicked on. Even some big name free webmail providers fall
 into this trap of just checking for the submit button rather than checking
 the form as a whole.

 -- 
 Jason Wong - Gremlins Associates - www.gremlins.biz
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development *
 --
 Search the list archives before you post
 http://marc.theaimsgroup.com/?l=php-general
 --
 /*
 The biggest difference between time and space is that you can't reuse
time.
 -- Merrick Furst
 */

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



[PHP] Re: Calling a function at a certain time of day.

2004-07-30 Thread Craig Donnelly
Have a look at Cron

http://www.webmasters-central.com/t/cron.shtml

HTH

Craig

Angelo Zanetti [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 HI,

 Im slightly in the dark as to do the following. What I need is a thread of
 some sort that runs and when the time is midnight, it automatically calls
a
 script that does something. Can anyone point me in the right direction as
to
 where to start. Thanks

 Angelo

 
 Disclaimer
 This e-mail transmission contains confidential information,
 which is the property of the sender.
 The information in this e-mail or attachments thereto is
 intended for the attention and use only of the addressee.
 Should you have received this e-mail in error, please delete
 and destroy it and any attachments thereto immediately.
 Under no circumstances will the Cape Technikon or the sender
 of this e-mail be liable to any party for any direct, indirect,
 special or other consequential damages for any use of this e-mail.
 For the detailed e-mail disclaimer please refer to
 http://www.ctech.ac.za/polic or call +27 (0)21 460 3911

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



[PHP] Re: Calling a function at a certain time of day.

2004-07-30 Thread Craig Donnelly
Sorry I meant to say, assuming your on Unix/Linux system,
Otherwise if Windows use task scheduler Control Panel  Scheduled Tasks

Cheers,
Craig
Craig Donnelly [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Have a look at Cron

 http://www.webmasters-central.com/t/cron.shtml

 HTH

 Craig

 Angelo Zanetti [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  HI,
 
  Im slightly in the dark as to do the following. What I need is a thread
of
  some sort that runs and when the time is midnight, it automatically
calls
 a
  script that does something. Can anyone point me in the right direction
as
 to
  where to start. Thanks
 
  Angelo
 
  
  Disclaimer
  This e-mail transmission contains confidential information,
  which is the property of the sender.
  The information in this e-mail or attachments thereto is
  intended for the attention and use only of the addressee.
  Should you have received this e-mail in error, please delete
  and destroy it and any attachments thereto immediately.
  Under no circumstances will the Cape Technikon or the sender
  of this e-mail be liable to any party for any direct, indirect,
  special or other consequential damages for any use of this e-mail.
  For the detailed e-mail disclaimer please refer to
  http://www.ctech.ac.za/polic or call +27 (0)21 460 3911

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



[PHP] Re: Parse Error, Unexpected $

2004-07-19 Thread Craig Donnelly

Put all your values in the following {}...

So:

VALUES('{$Title}','{$ChristianName}','{$MiddleName}','{$Surname}'. and
so on.

HTH
Craig

Harlequin [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I've checked my syntax but obviously missing something.

 Would anyone mind a quick scan:

 // Convert Values to Variables:
   $Title = $_POST[Title];
   $ChristianName = $_POST[ChristianName];
   $MiddleName = $_POST[MiddleName];
   $Surname = $_POST[Surname];
   $HomePhone = $_POST[HomePhone];
   $Address01 = $_POST[Address01];
   $Address02 = $_POST[Address02];
   $Address03 = $_POST[Address03];
   $City = $_POST[City];
   $Postcode = $_POST[Postcode];
   $Country = $_POST[Country];
   $Nationality = $_POST[Nationality];
   $Gender = $_POST[Gender];
   $WorkPermitRequired = $_POST[WorkPermitRequired];
   $MyStatus = $_POST[MyStatus];

 // Dump Data Into MembersData:
   $UserDataDump = INSERT INTO MembersData (Title, ChristianName,
 MiddleName, Surname, DOB, TelephoneHome, Address01, Address02, Address03,
 AddressCity, AddressPostcode, AddressCountry, Nationality, Gender,
 WorkPermit, Status)


VALUES('$Title','$ChristianName','$MiddleName','$Surname','$HomePhone','$Add

ress01','$Address02','$Address03','$City','$Postcode','$Country','$Nationali
 ty','$Gender','$WorkPermitRequired','$MyStatus');
mysql_query($UserDataDump) or die(Couldn't Create User Data Entry.
MySQL
 Error:  . mysql_error());

 -- 
 -
  Michael Mason
  Arras People
  www.arraspeople.co.uk
 -

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



[PHP] Re: MySQL QUERY Results Not Appearing

2004-06-30 Thread Craig Donnelly
$result is an array that has to be fetched...try this

echo h3active members should appear here/h3;

$query = mysql_query(SELECT * FROM RegisteredMembers) or die(could not
execute query);
while($result = mysql_fetch_array($query)){
echo $result['YOUR_DB_FIELDNAME'];
}

change YOUR_DB_FIELDNAME' to whatever the fields are you are querying.
you could also:

pre
?php print_r($result); ?
/pre

HTH

Craig

Harlequin [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi all...

 Despite being able to make a connection to the server and execute a query
I
 am unable to do this through PHP using the following commands:

  echo h3active members should appear here/h3;
  $query = SELECT * FROM RegisteredMembers;
  $result = mysql_query($query) or die (could not execute query);
  echo $result;

 Any ideas...?

 -- 
 -
  Michael Mason
  Arras People
  www.arraspeople.co.uk
 -

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



Re: [PHP] Protecting database passwords

2004-06-30 Thread Craig Donnelly
MD5 - http://ie2.php.net/md5
One way in encryption.


Chris W. Parker [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Bob Hockney mailto:[EMAIL PROTECTED]
on Tuesday, June 29, 2004 5:58 PM said:

 I wrote a php script that accesses a database, and I am wondering
 about securing the password to the database.  I could prompt the user
 for the password every session, but I don't necessarily want the user
 to have the password.

you don't want the user to have the password?? how else are they
supposed to login?

 Unless I'm missing something, any on-disk
 place I store the password needs to be readable by PHP, and therefore
 isn't very secure.

1. don't store the password in plain text. store it as a hash.
2. make the file readable only to root and the user that PHP/Apache runs
under.

that's about all i know.



chris.

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



[PHP] Re: Running a PHP script on an automated regular schedule

2004-06-10 Thread Craig Donnelly
Best way to achieve this would be cron/crontab

http://www.webmasters-central.com/t/cron.shtml

HTH
Craig


I.A. Gray [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi.

 I am wanting to use a PHP script to check on an hourly/daily basis on a
few
 things- ie links on my sites, whether the sites are up and running and
also
 to send an e-mail to me.  I know how to do this using PHP but my problem
is
 how to have this running 24/7.  I can't really have this on a web page as
 wouldn't it time out?  I don't have my own server and so use a hosting
 company.  Is there a way of running a PHP script on a regular basis (say
 every 10 or 30 mins, or hourly or daily)?  Would I have to set up my own
 server to do this?  I just the simplest way of acheiving this.  Any ideas?
 Does anyone know of any decent link checkers written in PHP that I could
 implement?

 Many thanks,

 Ian Gray




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



[PHP] Re: SELECT

2004-06-02 Thread Craig Donnelly
SELECT * FROM foo_table WHERE field_foo  some_value

The above will select all from foo_table except where field_foo is equal to
some value.

HTH

Craig


Phpu [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Hi,

Is there any way  to select all entries in the database except one entry or
tho entries?

Thanks

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



[PHP] Re: how to insert form data

2004-06-02 Thread Craig Donnelly
?php

include(connect.php);

$name = $_POST['name'];
$quote = $_POST['quote'];

$sql = mysql_query(INSERT INTO whosaid (name,quote) VALUES (' . $name
. ',' . $quote . '));
?

HTH

Craig


Bigmark [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I am trying to learn how to take the value of $name and $quote from a form
 and put it in the database -whosaid
 but obviuosly i have it all wrong. Can anyone point out what im doing
wrong.

 thx in advance


 ?php
 include(connect.php);
 $name = $_POST['name'];
 $quote = $_POST['quote'];
 $sql = INSERT INTO whosaid values (name='$name',quote='$quote');
 ?

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



[PHP] Re: Simple calender

2004-05-31 Thread Craig
Ryan,

with a bit of tweaking you can edit that script to what you want.
heres an example

=
?php

  function calendar($date)
 {
 //If no parameter is passed use the current date.
 if($date == null)
$date = getDate();

 $day = $date[mday];
 $month = $date[mon];
 $month_name = $date[month];
 $year = $date[year];

 $this_month = getDate(mktime(0, 0, 0, $month, 1, $year));
 $next_month = getDate(mktime(0, 0, 0, $month + 1, 1, $year));

 //Find out when this month starts and ends.
 $first_week_day = $this_month[wday];
 $days_in_this_month = floor(($next_month[0] - $this_month[0]) / (60
* 60 * 24));

 $calendar_html = table style=\background-color:99;
color:ff;\;

 $calendar_html .= trtd colspan=\7\ align=\center\
style=\background-color:cc; color:00;\ .
   $month_name .   . $year . /td/tr;

   $calendar_html .= tr;
   $calendar_html .= tdS/td;
   $calendar_html .= tdM/td;
   $calendar_html .= tdT/td;
   $calendar_html .= tdW/td;
   $calendar_html .= tdT/td;
   $calendar_html .= tdF/td;
   $calendar_html .= tdS/td;
   $calendar_html .= /tr;

 $calendar_html .= tr;

 //Fill the first week of the month with the appropriate number of
blanks.
 for($week_day = 0; $week_day  $first_week_day; $week_day++)
{
$calendar_html .= td style=\background-color:cc;
color:00;\ /td;
}

 $week_day = $first_week_day;
 for($day_counter = 1; $day_counter = $days_in_this_month;
$day_counter++)
{
$week_day %= 7;

if($week_day == 0)
   $calendar_html .= /trtr;

   $dispDate = $day_counter .   . $month_name .   . $year;

//Do something different for the current day.
if($day == $day_counter)
   $calendar_html .= td bgcolor=\#FF\
align=\center\ba href=\show.php?date= . urlencode($dispDate) .
isToday=1\ . $day_counter . /a/b/td;
else
   $calendar_html .= td align=\center\
style=\background-color:cc; color:00;\a href=\show.php?date= .
urlencode($dispDate) . isToday=0\ .
 $day_counter . /a/td;

$week_day++;
}

 $calendar_html .= /tr;
 $calendar_html .= /table;

 return($calendar_html);
 }


echo calendar(NULL);

?
=


Ryan A [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hey,

 been looking at a lot of calenders most of them are either too big for my
 use (whole page), not free, in javascript or  too complicated.

 I require a calender that is simple, loads fast,small and not javascript,
 the closest I found is at:
 http://scripts.franciscocharrua.com/calendar.php

 just two problems with it,
 1. It does not have the days on top (eg: s,m,t,w,t,f,s - sunday,
 mondayetc)
 2. (not required but would be nice if it would) allow me to link from the
 days of the calender to some page/s

 I guess I could modify the above calender as it pretty good + open
 source...but if anybody is using a calender already which is like the
above
 + the 1 or two points I wroteyour response would be appreciated. ;-)

 Thanks,
 -Ryan

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



[PHP] Re: duplicating a row

2004-05-31 Thread Craig
http://dev.mysql.com/doc/mysql/en/INSERT_SELECT.html


Bob Lockie [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I want to duplicate a row (back it up - copy to a table with the same
 schema) regardless of the table schema.
 This in MySQL but I need a solution that can be made easily portable to
 other databases.

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



Re: [PHP] Re: clearing new pages

2004-05-27 Thread Craig
?php
echo Hello;
echo meta http-equiv=\Refresh\ content=\2;url=b.php\\n;
?

Is another option

Craig

Rick Fletcher [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
   Hi,
a file called a.php prints hello to the browser then calls
   b.php which prints goodbye to the browser.
   the output looks like this:
  
   hello
   goodbye
  
   how do I clear the screen so the end results looks like this:
 
  a.php:
 
  echo 'hello';
  header('location: b.php'); exit;

 That actually wouldn't work, because once there's output (echo) you
can't
 send a header.

 --Rick

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



[PHP] Re: combining string values

2004-05-27 Thread Craig
Concatenate using: .

?php

 $stringA = Hello from;
 $stringB = over here!;

 $stringC = $stringA .   . $stringB;
?

HTH

Craig

Tommy Atherton [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 hi

 I have a problem, I'm trying to combine the value of two strings
 together into a final string. For example

 $path = '/tmp/photos/';
 $filename = 'pic1.jpg';

 $finalvalue = $path + $filename; (I know that the + is not used its
 there for explanation only)

 The value for path will remain constant (for the time being at least
 although) but the value for filename will be read from a database so
 that will change.

 Anyone care to help???

 thanks in advance

 Tommy




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



Re: [PHP] Re: test

2004-05-26 Thread Craig
Yeah those damn email always come at same time.
Well on my blocked list now.


Jordi Canals [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Sherri wrote:
  Woah!
 
  Signed up litterally 1 minute ago and I'm already getting spam. From
  Advance Credit Suisse Bank
 
 Just wait. There are some more waiting for you ;) You should receive the
 Information Desk and Ingram Computer Services mails yet.

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



[PHP] Re: Simplistic PHP tutorial

2004-05-25 Thread Craig
Personally I would buy a book on programming in general or maybe just go
straight for a
PHP beginners book.

But this is pretty straight forward from the ground up:
http://www.w3schools.com/php/default.asp

HTH
Craig

Neal [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi,

 I've looked at the php.net tutorial, and though I'm learning some things
  from it, it's still a bit over my head. It seems to presuppose a comfort
 level with programming which I do not have.

 Can anyone recommend a simple, hand-holding, introductory tutorial
 suitable for someone with no programming experience to speak of?

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



[PHP] Re: Now I can't start the session either...

2004-05-25 Thread Craig
Can you post your whole file?


Brian Dunning [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Here is the top of my file:

 ?php
 // Start the session
 session_start();

 Which looks OK to me, but it returns:

 Parse error: parse error, unexpected T_STRING in
 c:\inetpub\wwwroot\palms\htdocs\start-selling.php on line 3

 What's going on here??

 - Brian

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



[PHP] Re: Now I can't start the session either...

2004-05-25 Thread Craig
It doesnt necessarily mean the error occured on that line, that may have
been the last executed statement
post a few more lines or we cant help you.

Regards


Craig [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Can you post your whole file?


 Brian Dunning [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  Here is the top of my file:
 
  ?php
  // Start the session
  session_start();
 
  Which looks OK to me, but it returns:
 
  Parse error: parse error, unexpected T_STRING in
  c:\inetpub\wwwroot\palms\htdocs\start-selling.php on line 3
 
  What's going on here??
 
  - Brian

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



[PHP] Re: CONSTANTS and good coding practice

2004-05-21 Thread Craig
Constants are useful when a variable will remain exactly the same (constant)
through
the life of a script.  e.g a script I wrote to calculate dates be it in the
past or future
would have constant values for how many seconds are in a day or a week. to
be used
in calculations.
e.g:

define(SECONDSINWEEK, 604800); // Number of seconds in week
 define(SECONDSINDAY, 86400); // Number of seconds in day
 $iDayOfWeek = 1; // 0 to 6 - 0 being Sunday
 $iNumWeeks = 12; // Number of weeks to lookback
 $iOffsetTimestamp = 0; // Initialize this var
 $iCurTime = time();
 $iCurDay = date(w, $iCurTime);

^^^ The above constants will always be what they are defined as. Constant
:-)
Also another advantage of using constants, is that it can make your code
easier
to read. Usually constant names are declare in uppercase, which helps to
break
up your code.

HTH

Craig



Al [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Can someone explain to me the value of using defined custom constants,
 in the context of good coding practice.

 I don't recall ever seeing define() used in the scripts I've seen and
 only the characteristics are described in the my php book and the php
 manual; but, not the use.

 Thanks.

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



[PHP] Re: CONSTANTS and good coding practice

2004-05-21 Thread Craig
Have a look here also: http://ie2.php.net/define


Al [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Can someone explain to me the value of using defined custom constants,
 in the context of good coding practice.

 I don't recall ever seeing define() used in the scripts I've seen and
 only the characteristics are described in the my php book and the php
 manual; but, not the use.

 Thanks.

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



[PHP] Re: CONSTANTS and good coding practice

2004-05-21 Thread Craig
yes, constants have global scope also :-)

Craig [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Have a look here also: http://ie2.php.net/define


 Al [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  Can someone explain to me the value of using defined custom constants,
  in the context of good coding practice.
 
  I don't recall ever seeing define() used in the scripts I've seen and
  only the characteristics are described in the my php book and the php
  manual; but, not the use.
 
  Thanks.

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



[PHP] Re: send mail error

2004-05-20 Thread Craig
On windows I believe this will work:

ini_set(sendmail_from,[EMAIL PROTECTED]);

Try that. http://www.php.net/ini_set

HTH

Craig

Tassos T [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 hello,

 i  face a problem with send mail via php.
 i have a server with ms IIS and i have not access to php.ini
 how i send a email with php script with auto add the sendmail_from into
 php.ini ?

 PS. i write a php script to send email but i receive the follow error
 message

 mail(): sendmail_from not set in php.ini or custom From: header
 missing in *...


 *please advise

 Thanks

 Tassos

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



[PHP] Re: Simple MySQL/PHP Query

2004-05-20 Thread Craig
Is the text the same on every page?

Where you print your body, concatenate the string you want to your content
variable.

HTH



Nick Wilson [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi all,

 First off, yeah, it's a dumb Q ;-) but I cant remember enuf about mysql
 to know if I need a php script or it might be done from the command
 line...

 I have a DB that has a field called 'body' - it holds the body of html
 pages of course... What I need to do, is add to the very end of each
 html page, one short peice of text.. not a footer, just an adition to
 every page.

 How do I do that? - Do I need to select the body, then add the text to
 it, then UPDATE it, or can i just appened somthing to what's already
 there?

 Many thx!
 -- 
 Nick W

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



[PHP] Re: Distance and info

2004-05-19 Thread Craig
Probably useing something like this, not altogether sure.
http://www.maxmind.com/geoip/

Brent Clark [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi all

 I have a question regarding phpclasses.org.

 There is a section, where is says, Find the closest mirror.

 My question is, does anyone know how do they determine the distance (Sits
on
 the right of the screen) and also
 the details for Your approximate location.
 Cause its pretty acurrate.

 Kind Regards
 Brent Clark

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



[PHP] Re: WDDX

2004-05-17 Thread Craig
take a look on http://www.phpclasses.org

Good luck,
Craig

Dave Avent [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi All,

 Does anyone know if there is a WDDX Class for PHP. I have googled and
 checked phpclasses.org. I am unable to recompile my webserver so I cannot
 include wddx support that way, so if anyone can help me with any
suggestions
 I would be very gratefull

 Cheers

 Dave

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



Re: [PHP] Re: WDDX

2004-05-17 Thread Craig Donnelly
You bet it is.. :-)
Sorry Dave.

- Original Message - 
From: Sam Masiello [EMAIL PROTECTED]
To: Craig [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Monday, May 17, 2004 4:41 PM
Subject: RE: [PHP] Re: WDDX


 
 Hehe must be too early on a Monday for Craig :)
 
 --Sam
 
  
 
 -Original Message-
 From: Craig [mailto:[EMAIL PROTECTED] 
 Sent: Monday, May 17, 2004 9:31 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Re: WDDX
 
 take a look on http://www.phpclasses.org
 
 Good luck,
 Craig
 
 Dave Avent [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  Hi All,
 
  Does anyone know if there is a WDDX Class for PHP. I have googled and 
  checked phpclasses.org. I am unable to recompile my webserver so I 
  cannot include wddx support that way, so if anyone can help me with 
  any
 suggestions
  I would be very gratefull
 
  Cheers
 
  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] A work around my HTTP_REFERER Prob...

2004-05-10 Thread Craig Donnelly
If returning a floating point variable, cast it back to an (int)
hth

Tristan Pretty [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Cheers for all ideas/suggetions so far..
 I've made a little progres...
 Visit this URL:
 http://www.risk.sungard.com/secure.php?secure=126807.714285714

 and here's the code..
 ?
 $today_day = date(d);
 $code1 = ($today_day+1) * $_GET[secure];
 $code2 = $today_day * $_GET[secure];
 $code3 = ($today_day-1) * $_GET[secure];
 $master_code = 887654;

 if (($code1 == $master_code) || ($code2 == $master_code) || ($code3 ==
 $master_code)) {
 $woopee = h2DONE IT!!!/h2;
 }

 ?
 html
 head
 titleSecure Test/title
 /head
 body
 ?=$woopee ?
 bDebug:/b
 br /Secure: ?=$_GET[secure] ?
 br /Day: ?=$today_day ?
 br /Master: ?=$master_code ?
 br /Code 1: ?=$code1 ?
 br /Code 2: ?=$code2 ?
 br /Code 3: ?=$code3 ?
 /body
 /html

 If I change the GET requests to simple variables, and assign a new
 variable called $secure, and asign it the value: 126807.714285714
 The page works!
 Makes me think there's a GET error?

 Can anyone spot my potentially obvious error?

 Tris...






 Jason Wong [EMAIL PROTECTED]
 07/05/2004 13:37

 To
 [EMAIL PROTECTED]
 cc

 Subject
 Re: [PHP] A work around my HTTP_REFERER Prob...






 On Friday 07 May 2004 20:05, [EMAIL PROTECTED] wrote:

   varibale called 'secure'
   we asign that variable that value of '4654376534' and divide it by the
 
  day
 
   (eg: if it's the 12th of may, we divide by 12.. 7th of June, we divide
 
  by
 
   7)

 That would result in a floating point number ...

   if (($code1 == $master_code) || ($code2 == $master_code) || ($code3 ==
   $master_code)) {

 ... which does not lend easily to such comparisons.

 If you're still intent on using this *ahem* 'security' scheme then I
 suggest
 you use multiplication instead (just make sure that the largest number
 you're
 processing is less than 2147483648 - or use the BCMath functions).

 -- 
 Jason Wong - Gremlins Associates - www.gremlins.biz
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development *
 --
 Search the list archives before you post
 http://marc.theaimsgroup.com/?l=php-general
 --
 /*
 After all, it is only the mediocre who are always at their best.
  -- Jean Giraudoux
 */

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





 *
 The information contained in this e-mail message is intended only for
 the personal and confidential use of the recipient(s) named above.
 If the reader of this message is not the intended recipient or an agent
 responsible for delivering it to the intended recipient, you are hereby
 notified that you have received this document in error and that any
 review, dissemination, distribution, or copying of this message is
 strictly prohibited. If you have received this communication in error,
 please notify us immediately by e-mail, and delete the original message.
 ***

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



[PHP] Re: Remove white space?

2004-04-23 Thread Craig
trim($YOUR_VARIABLE) = Remove whitespace from beginning and end of string
http://ie2.php.net/trim

strtolower($YOUR_VARIABLE) = Makes a string lowercase
http://ie2.php.net/strtolower

Hope that helps



Robert Sossomon [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I am pulling data from a MySQL DB and I need to remove the whitespace on
 the variable and turn it to lowercase.

 ! Code Snippet

 $get_items = select * from PFS_items;
 $get_items_res = mysql_query($get_items) or die(mysql_error());
 while ($items = mysql_fetch_array($get_items_res))
 {
  $item_id = $items[id];
  $item_num = $items[item_num];

 ! End Code Snippet

 Overtime I need to rewrite my DB loading script to handle this for me,
 but right now I need to band-aid it so that I can auto-generate pages
 and get them loaded into a catalog.

 Thanks!

 Robert

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



Re: [PHP] Button ???

2004-04-23 Thread Craig
This has nothing to do with PHP.

Its javascript, http://www.jguru.com/faq/view.jsp?EID=280434
Please keep to topic.

Thanks

Brent Clark [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]

  Something like this:
 
  input type=submit value=submit disabled

 Hi

 Yes this is correct
 But how do you get it from an active to disabled state

 Kind Regards
 Brent Clark

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



[PHP] Re: insert twice pb

2004-04-23 Thread Craig
Try this and see what happens:

?php

 if(isset($_POST['empfullname'])  isset($_POST['empmidname']) 
isset($_POST['empbdate'])  isset($_POST['emptitle']) 
isset($_POST['departement']))
 {
  $empfullname = $_POST['empfullname'];
  $empmidname = $_POST['empmidname'];
  $empbdate = $_POST['empbdate'];
  $empjobtitle = $_POST['emptitle'];
  $empdepartement = $_POST['departement'];

  //Connect to DB

  //Change the Fields in this query
  $iqry_employees = mysql_query(INSERT INTO employess
(FIELD1,FIELD2,FIELD3,FIELD4,FIELD5) VALUES ('',' . $empfullname . ',' .
$empmidname . ',' . $empbdate . ',' . $empjobtitle . ',' .
$empdepartement . ','',''));

  if(!$iqry_employees)
   die(Unable To Insert Into Employees Due To An Error);

  //Close DB
 }
 ?


Ronald Rahal [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Why this code is inserting twice in the database ?




 ?php
  if (   (isset($_POST['empfullname']))  (isset($_POST['empmidname']))
  (isset($_POST['empbdate']))
   (isset($_POST['emptitle'])) (isset($_POST['departement']))  )
  {
  $empfullname=$HTTP_POST_VARS['empfullname'];
  $empmidname=$HTTP_POST_VARS['empmidname'];
  $empbdate=$HTTP_POST_VARS['empbdate'];
  $empjobtitle=$HTTP_POST_VARS['emptitle'];
  $empdepartement=$HTTP_POST_VARS['departement'];

  $insert=insert into employee values
 ('','$empfullname','$empmidname','$empbdate','$empjobtitle','$empdeparte
 ment','','');
 $exec=mysql_query($insert);
 if(!$exec)
 die(Unable To Insert Into Employees Due To An
 Error);

 }

  ?


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



[PHP] Re: strange urlencode/decode problem

2004-04-21 Thread Craig
http://ie.php.net/manual/en/function.get-magic-quotes-gpc.php

use stripslashes() :

?php
echo stripslashes(urldecode($_GET[strSQL]));
?

Cheers



Victor spång arthursson [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Perhaps I'm tired, perhaps I've missed something obvious, but I can't
get this simple thing which I practically does every week to work…

Ok, here is what I do:

?php

$foo = urlencode(Delete from whatever where ditten = 'datten');
echo 'a href=foo.php?strSQL=' . $foo . 'Click here to test/a';

?

I sidan foo.php skriver jag:

?php

echo urldecode($_GET[strSQL]);

?

and gets the result:

Delete from whatever where ditten = \'datten\'

The question is why PHP escapes the single qoutes? This has never
happened to me before, except if I have been using addslashes() or
similiar functions…

And they occur even if I don't urlencode at all…

Why!?!?!?!?

Sincerely

Victor Spång Arthursson - Copenhagen

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



[PHP] Re: Form Data Transfer b/w Pages

2004-04-21 Thread Craig
For ease of use, i would create a session and handle it that way or you
could pass it through $_GET[]
Query string.
Would recommend $_SESSION though.
Cheers

Sobajo [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Two forms (form1 and form2 submit to the same controller.php file. The
 controller redirects the page depending on the value of hidden value
 'page'. I want form data 'username' and 'password' to be available on
 both redirected pages (staff.php and customer.php). How do I accomplish
 this?

 !--form1.php--
 form action=controller.php method=post
input type=hidden name=page value=staff.php
input name=password type=password
input name=username type=text
input type=submit value=Submit
 /form

 !--form2.php--
 form action=controller.php method=post
input type=hidden name=page value=customer.php
input name=password type=password
input name=username type=text
input type=submit value=Submit
 /form

 ?php
   //controller.php
   header(Location: http://; . $_SERVER['HTTP_HOST']
  . dirname($_SERVER['PHP_SELF'])
  . /
  . $_POST[page]);
 ?

 ?php
   //user.php
   echo Staff Name =  . $_POST[username];
   echo Staff Password =  . $_POST[password];
 ?


 ?php
   //customer.php
   echo Customer Name =  . $_POST[username];
   echo Customer Password =  . $_POST[password];
 ?

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



[PHP] Re: adding -'s to a numeric string

2004-04-21 Thread Craig
Something like this would work:
=

?php

 function dateConvert($date)
 {
  $newdate = ;

  $newdate .= substr($date,0,2);
  $newdate .= -;
  $newdate .= substr($date,2,2);
  $newdate .= -;
  $newdate .= substr($date,4,4);

  return $newdate;
 }

 echo dateConvert(04212004);
?

Adam Williams [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi, I have a form where I have a user entering in the date in a numeric
 string.  For today they would enter 04212004 and so on...I'm working on
 this date within mysql server, and mssql server handles dates as
 04-21-2004 when you use convert(varchar,field,110).  So how in PHP can I
 change a variable's value which is 04122004 into 04-21-2204

 thanks!

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



[PHP] SOAP function call

2004-04-21 Thread Craig Gardner
I'm trying to create a simple (I think) SOAP function that checks 
whether or not a file was uploaded to a server.  I have everything set 
up, but when I try to use the function I get an array disguised as an 
object.  The function I've created should return either TRUE or FALSE 
and I can't find either result in the array.  What am I doing wrong?

Thanks,

Craig.

Server:

?php
require_once('SOAP/Server.php');
class validate
{
   var $method_namespace = 'urn:validate';
   function check($filename)
   {
   if(file_exists($filename))
   {
   $return = TRUE;
   }
   else
   {
   $fp = fopen($filename, a);
   $contents = fread($filename, filesize($filename));
   if(!strstr($contents, $filename))
   fwrite($fp, $filename./r/n);
   fclose($fp);

   $return = FALSE;
   }
   return $return;
   }
}
$check = new validate;

$server = new SOAP_Server;
$server-addObjectMap($check);
$server-service($HTTP_RAW_POST_DATA);
?

Client:

require_once(SOAP/Client.php);
$soap = new SOAP_Client('http://10.0.1.100/scanned_docs/index.php');
$params = array(filename = $tmpname);
$urn = urn:validate;
$obj = $soap-call('verify', $params, $urn)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Parse error: parse error, unexpected '='

2004-04-20 Thread Craig
?php

 $args = array(a,b,b);
 $keys = array(0,1,2);

 function array_key_remove($args,$keys,$replacement=NULL)
 {
  echo Foo!;
 }

?


Lasse Motroen [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I have received some code and am trying to run it. However, I get the
 following error:

 *Parse error*: parse error, unexpected '=', expecting ')'

 It happens on this line when $args=array() is reached:

 function array_key_remove($args=array(), $keys=array(),$replacement=NULL)

 I have php-4.2.2-17 and Apache 2.0.40 installed, and am runnig RedHat 9.
 What's wrong, please help.

 Regards,
 not-really-too-familiar-with-PHP

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



[PHP] Re: $PHP_SELF problem

2004-04-20 Thread Craig
http://ie.php.net/globals

Instead of $PHP_SELF use $_SERVER['PHP_SELF']

Craig


Red Wingate [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 [EMAIL PROTECTED] wrote:

  Hi
 
  $thisFileName = $PHP_SELF; works in a file just a few lines after the
  program start.
 
  $thisFileName = $PHP_SELF; doesn't work (echo (pDebug: self:
  $PHP_SELF/p); returns pDebug: self: /p) if it's within function
  getNavigation() in the Navigation object called by another program.
 
 You better check the docs on 'global' and $GLOBALS :-)

 -- red

  Why?
 
  The Navigation object is called like this:
  include (Navigation.php4);
  $myNavigation = new Navigation (a, b);
  $myNavigation-getNavigation();
 
  I guess I'm asking $PHP_SELF something confusing. Does it respond
  index.php4 which is where the above three lines reside, or
  Navigation.php4 which is where the actual $PHP_SELF resides.
 
  All help appreciated :-)
 
  Cheers
  J

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



Re: [PHP] Parse error, unexpected T_STRING!!

2004-03-04 Thread Craig Gardner
What do you have before line 73?


On Thu, 2004-03-04 at 12:03, Enrique Martinez wrote:
 Hello, I'm getting an error that says: 
 
 Parse error, unexpected T_STRING on line 73
 
 line 73 is: ?xml version=1.0 encoding=iso-8859-1
 ?
 
 this is what I have below line 73:
 
 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0
 Transitional//EN
 http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
 html xmlns=http://www.w3.org/1999/xhtml;
 
 I have PHP-4.2.2, Apache 2.0 on RedHat Linux 9.0
 
 Any idea how can I fix the problem? Thanks in advance.
 
 
 
 __
 Do you Yahoo!?
 Yahoo! Search - Find what youre looking for faster
 http://search.yahoo.com

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



RE: [PHP] resize an image with php

2004-02-20 Thread craig
 I want to resize an image before display it in the window.
 Is there a php fonction which do it ?

 Thanks !


this will actually resize the photo,
hope it helps,

Craig
/***
**
Function: resizeImageJPG
Parameters: $forcedwidth = new width of jpeg to be created
$forcedheight = new height of jpeg to be created
$sourcefile = original jpeg that is to be resized
$destfile = new jpeg that is to be created
$imgqual = image quality (0 is best quality, 100 is most compressed)
Returns: true on success, false on failure
Side Effects: creates a new jpeg of $forcedwidth*$forcedheight size
called $destfile

*/
function resizeImageJPG($forcedwidth, $forcedheight, $sourcefile,
$destfile, $imgqual) {
   $g_imgcomp=100-$imgqual;
   $g_srcfile=$sourcefile;
   $g_dstfile=$destfile;
   $g_fw=$forcedwidth;
   $g_fh=$forcedheight;

   if (file_exists($g_srcfile)) {
  $g_is=getimagesize($g_srcfile);
  if(($g_is[0]-$g_fw)=($g_is[1]-$g_fh)) {
 $g_iw=$g_fw;
 $g_ih=($g_fw/$g_is[0])*$g_is[1];
  }
  else {
 $g_ih=$g_fh;
 $g_iw=($g_ih/$g_is[1])*$g_is[0];
  }


  $img_src=imagecreatefromjpeg($g_srcfile);
$img_dst=imagecreatetruecolor($g_iw,$g_ih);
  $imgCpRES=imagecopyresampled($img_dst, $img_src, 0, 0, 0, 0,
$g_iw, $g_ih, $g_is[0], $g_is[1]);
  $imgJPEG=imagejpeg($img_dst, $g_dstfile, $g_imgcomp);
  imagedestroy($img_dst);
if ($imgJPEG) {
 return true;
}
else{
 return false;
}
   }
}// end function resizeImageJPG

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



[PHP] functions and session variables

2004-02-18 Thread craig
Hi,
I just want to verify something that seems counterintuitive
to me. Do you have to pass session variables to functions?
It would seem to me that they should be available anywhere.

I took a cursory look through the manual, but didn't see
anything relevant.

Thanks,
Craig

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



RE: [PHP] Image Quality Depreciation with GD

2004-02-17 Thread craig

 Greetings, all.  I'm trying to upload and crop an image.  I'm 
 not able 
 to do it without the quality of the image suffering.  I've 
 fiddled with 
 the quality parameter in the imagejpeg function but it seems 
 to have no 
 effect.  I've tried varying values and leaving the parameter out 
 altogether.
 
 Any pearls of wisdom out there?


if you are using imagecreate(), switch to imagecreatetruecolor().
I got a big improvement from that.

don't think it's a pearl, but I hope it helps,
Craig

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



[PHP] mycrypt 3des (php vs .net)

2004-02-13 Thread craig
Hi all,

I am truly hoping that someone can help with this.
I am making the ecommerce site for a product that
I had nothing to do with the development of. =)

The product is making a licence file using  the .net
3des, but I am not able to get the same output using
the mcrypt 3des.

this is the .net original text and the cipher text:
Golf Genie 5.0
ª:b•#–æaŒž[EMAIL PROTECTED]#p0, 7

this is what i get
¿^U`ÎdÀ4`oãõwÑî%  - from Golf Genie 5.0
¿^U`ÎdÀ4!é$”GIø  - from Golf Genie 5.0\r\n


I don't know too much about encyrption, and I have found
the documentation of mcrypt to be the worst of any php
module I have yet used, so i'm not sure of the consequenses
of using cbc versus ecb are, etc.

here is the code i am using.

   $key =
\x6B\x00\x64\x00\x4E\x00\x44\x00\x38\x00\x37\x00\x5E\x00\x21\x00;
   $input = Golf Genie 5.0;
   $iv  = \x2B\x00\x5F\x00\x65\x00\x6B\x00;

   $td = mcrypt_module_open ('tripledes', '', 'cbc', '');
   mcrypt_generic_init ($td, $key, $iv);
   $encrypted_data = mcrypt_generic ($td, $input);
   mcrypt_module_close ($td);

   echo  $encrypted_data;

ps. I can't use mcrypt_generic_deinit - i get 'Fatal error: Call to
undefined function: mcrypt_generic_deinit()... '

thanks in advance,
Craig

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



RE: [PHP] Re: mycrypt 3des (php vs .net)

2004-02-13 Thread craig
  I am not sure if it will help of if you have already tried
 this but try
 all of the cipher modes available for the tripledes cipher (eg. cfb,
 ecb, etc.).  There may be a difference in the way .net and mcrypt
 produces the cipher text but if that were the case then it
 wouldn't be a
 true tripledes encryption for either the .net or mcrypt encryption
 libraries.  Are you able to view the source of the .net code which
 originally produced the cipher text?  If so then see what mode it is
 using with the tripledes cipher.  And you are right about the
 documentation, it took me awhile to get it working and even longer to
 figure out how it worked.  Good luck,
 Jas

I did check out the .net documentation and it uses cbc, but maybe I'll
try
the other modes for kicks.

-Craig

 Craig wrote:
  Hi all,
 
  I am truly hoping that someone can help with this.
  I am making the ecommerce site for a product that
  I had nothing to do with the development of. =)
 
  The product is making a licence file using  the .net
  3des, but I am not able to get the same output using
  the mcrypt 3des.
 
  this is the .net original text and the cipher text:
  Golf Genie 5.0
  :b#a[EMAIL PROTECTED]#p0, 7
 
  this is what i get
  ^U`d4`ow%  - from Golf Genie 5.0
  ^U`d4!$GI  - from Golf Genie 5.0\r\n
 
 
  I don't know too much about encyrption, and I have found
  the documentation of mcrypt to be the worst of any php
  module I have yet used, so i'm not sure of the consequenses
  of using cbc versus ecb are, etc.
 
  here is the code i am using.
 
 $key =
  \x6B\x00\x64\x00\x4E\x00\x44\x00\x38\x00\x37\x00\x5E\x00\x21\x00;
 $input = Golf Genie 5.0;
 $iv  = \x2B\x00\x5F\x00\x65\x00\x6B\x00;
 
 $td = mcrypt_module_open ('tripledes', '', 'cbc', '');
 mcrypt_generic_init ($td, $key, $iv);
 $encrypted_data = mcrypt_generic ($td, $input);
 mcrypt_module_close ($td);
 
 echo  $encrypted_data;
 
  ps. I can't use mcrypt_generic_deinit - i get 'Fatal error: Call to
  undefined function: mcrypt_generic_deinit()... '
 
  thanks in advance,
  Craig

 --
 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] triple DES encryption

2004-02-09 Thread craig
Hi all,
I have to replicate the file encryption of a desktop bound
application. This means using triple DES, but I can't find 
anything on the web or in the maunual (other than single 
DES).

Does anyone know if it is doable to implement this using php, 
or if I should just tell the client that it can't be done?

TIA,
Craig

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



RE: [PHP] triple DES encryption

2004-02-09 Thread craig
Thanks, I wasn't looking for 3DES.

That should do the trick for me.

Craig

 -Original Message-
 From: Adam Bregenzer [mailto:[EMAIL PROTECTED]
 Sent: February 9, 2004 10:36 AM
 To: craig
 Cc: Php
 Subject: Re: [PHP] triple DES encryption


 On Mon, 2004-02-09 at 12:36, craig wrote:
  Hi all,
  I have to replicate the file encryption of a desktop bound
  application. This means using triple DES, but I can't find
  anything on the web or in the maunual (other than single
  DES).

 The mcrypt[1] module will do triple DES as well as stronger encryption
 methods.  In the manual it is referred to as 3DES.

 [1] http://www.php.net/mcrypt

 --
 Adam Bregenzer
 [EMAIL PROTECTED]
 http://adam.bregenzer.net/

 --
 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] Surpressing a 'foreach' Error Message

2004-02-06 Thread craig
 Hi,

 I have some check boxes in a form and when the form is
 submitted I read the
 checkboxes that have been ticked. However if no checkboxes
 have been ticked
 the following line produces an error, is there a way to suppress this?

if (is_array($project))
 foreach ($project as $project_id = $value) {
   $fields[] = $project_id;
   $values[] = $value;
 }


if (is_array($project))
  foreach ($project as $project_id = $value) {
$fields[] = $project_id;
$values[] = $value;
  }
}

HTH,
Craig

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



RE: [PHP] Surpressing a 'foreach' Error Message

2004-02-06 Thread craig
  craig mailto:[EMAIL PROTECTED]
 on Friday, February 06, 2004 2:24 PM said:
 
  if (is_array($project))
foreach ($project as $project_id = $value) {
  $fields[] = $project_id;
  $values[] = $value;
}
  }
 
 you're missing a curly brace after the if ().
 

my bad, that's what you get when you don't actually
run the code. Thank god for compilers ;)

-Craig

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



RE: [PHP] Need a way to automate user logout

2004-02-05 Thread craig
 I can write a script in
 perl, php, java, u name it, but how do I have it run on a set
 schedule?
 Thanks

 Christian

you will want to use the cron command. run 'man cron' at a shell prompt
to
get the manual page that will explain the finer points. =)

HTH,
Craig

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



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



RE: [PHP] php-general list question - [Fwd: Delivery Report (failure) forphp-general@lists.php.net]

2004-02-05 Thread craig

 I get one of these for almost every message I send, usually
 with a delay
 of a few days and always the same error.  I see my posts come from the
 list to me and I see people replying to my messages so the
 list seems to
 be processing my posts.  It's annoying however to keep getting these.
 Anybody else getting this?


Yeah, I am getting bundles of these as well...

-Craig

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



[PHP] problem referencing a mysql object

2004-02-04 Thread craig

Hi,

the problem is that I am trying to use a varible in the objects
attribute name. the offending line of code is:

echo img src='$row-cPic$count' border='1';

this is giving the warning:
Undefined property:  cPic 

I have tried playing with eval and variable variables to 
get 'cPic$count' to look like 'cPic1' before trying to
use it, but nothing is working. There has to be a way
to do this. Any help is greatly appreciated.

-Craig

while ($row = mysql_fetch_object($result)) {
   //other code...
   $count = 1;
   while ($count = $row-tiPicCount) {
  echo img src='$row-cPic$count' border='1';
  ++$count;
   }
   //other code...
}

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



RE: [PHP] Re: How check credit card or magnetic card number.

2004-02-02 Thread craig
   Hi, how i can check credit card or magnetic card number for
 a site of
 electronic commerce that i have to design.

 Sorry for my english.

 Pedro.


I think this should work for you, but it's not production tested yet.

-Craig

function verifyCC($name='', $type='', $number='', $expmonth='',
$expyear='') {
   //make sure all fields are filled in
   if (empty($name) || empty($type) || empty($number) || empty($expyear)
|| empty($expmonth)) {
  return FALSE;
   }

   //verify month makes sense
   if(!is_numeric($expmonth) || $expmonth  1 || $expmonth  12) {
  return FALSE;
   }

   // Get the current year
   $currentYear = date('Y');
   expyear = '20' . $expyear;
   settype($currentYear, 'integer');

   //verify year makes sense
   if (!is_numeric($expyear) || $expyear  $currentYear || $expyear 
$currentYear + 10) {
  return FALSE;
   }

   //strip out non-numeric numbers from number
   $number = preg_replace('/[^0-9]/', '', $number);
   $type = strtolower($type);

   //check length and prefix of number
   if ($type == 'mastercard' || $type == 'mc') {
  $validFormat = ereg(^5[1-5][0-9]{14}$, $number);
   }
   elseif ($type == 'visa') {
  $validFormat = ereg(^4[0-9]{12}([0-9]{3})?$, $number);
   }
   elseif ($type == 'amex' || $type == 'american express') {
  $validFormat = ereg(^3[47][0-9]{13}$, $number);
   }
   elseif ($type == 'diners club' || $type == 'dc' || $type = 'diners')
{
  $validFormat = ereg(^3(0[0-5]|[68][0-9])[0-9]{11}$, $number);
   }
   elseif ($type == 'discover' || $type == 'disc') {
  $validFormat = ereg(^6011[0-9]{12}$, $number);
   }
   elseif ($type == 'jcb') {
  $validFormat = ereg(^(3[0-9]{4}|2131|1800)[0-9]{11}$, $number);
   }
   else {
  return FALSE;
   }

   if (!$validFormat) {
  return FALSE;
   }

   //do mod 10 algorithm
   $revNum = strrev($number);
   $sum = 0;

   for($i = 0; $i  strlen($revNum); $i++) {
  $currentNum = substr($revNum, $i, 1);

  //double every second digit
  if($i % 2 == 1) {
 $currentNum *= 2;
  }

  //add digits of 2-digit numbers together
  if($currentNum  9) {
 $firstNum = $currentNum % 10;
 $secondNum = ($currentNum - $firstNum) / 10;
 $currentNum = $firstNum + $secondNum;
  }

  $sum += $currentNum;
   }

   //check if there's a remainder
   if ($sum % 10  0) {
  return FALSE;
   }

   return TRUE;
}

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



RE: [PHP] random?

2004-01-29 Thread craig

 Maybe MySQL's RAND() function isn't very random.


From the mysql manual:

RAND() is not meant to be a perfect random generator, but instead 
a fast way to generate ad hoc random numbers that will be portable 
between platforms for the same MySQL version. 

doesn't help, but at least you know you're not imagining things ;)

-Craig

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



RE: [PHP] eregi_replace help needed

2004-01-29 Thread craig


 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: January 29, 2004 8:53 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] eregi_replace help needed
 
 
 Hi,
 
 I want to locate patterns such as
 
 12345678
 1 23 45 67 89
 1 2 34 567 890
 
 and replace the pattern string with a new string.
 
 I tried
 
 $filter['message'] = eregi_replace([0-9\s]{4,},'string 
 replaced', $filter['message']);
 
 but it does not work on all the above examples.
 
 Thanks for the assistance!
 
 Nico
 

off the top of my head, I don't think '\s' is valid in a character
class, so just use ' ' instead 

try  eregi_replace([0-9 ]{4,}

-Craig

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



RE: [PHP] Encoding for uploaded files

2004-01-29 Thread craig
check out http://www.php.net/manual/en/features.file-upload.php,
it spells out the entire upload process

specifally, you want:
$_FILES['userfile']['type'] = The mime type of the file, if 
the browser provided this information. An example would 
be image/gif. 

-Craig

 -Original Message-
 From: Cesar Cordovez [mailto:[EMAIL PROTECTED]
 Sent: January 29, 2004 10:35 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Encoding for uploaded files
 
 
 Hi list!
 
 How can I know the encoding for an uploaded file?
 
 Thanks!
 
 -- 
 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] transactions

2004-01-29 Thread craig
  Is there anyway to do something similar to Transactions in mysql?

Yes, use transactions

http://www.mysql.com/doc/en/Transactional_Commands.html

-Craig

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



RE: [PHP] Encoding for uploaded files

2004-01-29 Thread craig
 I don't know if you are right here, or maybe I don't understood 
 correctly... the file type is actually the encoding of the 
 file?  If a 
 file type is text/plain, where is the encoding format?  ISO-8859-1?
 
 Puzzled!

sorry, I misunderstood the question.
I have no idea of how to get the actual encoding. =(

-Craig

 
 Cesar
 
 craig wrote:
 
  check out http://www.php.net/manual/en/features.file-upload.php,
  it spells out the entire upload process
  
  specifally, you want:
  $_FILES['userfile']['type'] = The mime type of the file, if 
  the browser provided this information. An example would 
  be image/gif. 
  
  -Craig
  
  
 -Original Message-
 From: Cesar Cordovez [mailto:[EMAIL PROTECTED]
 Sent: January 29, 2004 10:35 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Encoding for uploaded files
 
 
 Hi list!
 
 How can I know the encoding for an uploaded file?
 
 Thanks!
 
 -- 
 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] Conditional code execution

2004-01-26 Thread Craig Jackson
I'm sure how to frame the question. Here's the problem.
I would like to store PHP code in a database. Then I would like to
while-loop through the array executing the code something like this:

?
while($RS=mysql_fetch_array($RR))
{
execute $RS[php_code];
}
?

This would require something like the equivalent of eval in javascript.
Does PHP have that capability?

Thanks
Craig

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



Re: [PHP] Conditional code execution

2004-01-26 Thread Craig Jackson
On Mon, 2004-01-26 at 10:09, John W. Holmes wrote:
 From: Craig Jackson [EMAIL PROTECTED]
 
  This would require something like the equivalent of eval in javascript.
  Does PHP have that capability?
 
 Yes. Oddly enough it's called eval(). Imagine that...
 
 ---John Holmes...

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



Re: [PHP] Conditional code execution

2004-01-26 Thread Craig Jackson
On Mon, 2004-01-26 at 10:11, Chris Hayes wrote:
 At 17:03 26-1-04, you wrote:
 I'm sure how to frame the question. Here's the problem.
 I would like to store PHP code in a database. Then I would like to
 while-loop through the array executing the code something like this:
 
 ?
 while($RS=mysql_fetch_array($RR))
 {
 execute $RS[php_code];
 }
 ?
 
 This would require something like the equivalent of eval in javascript.
 Does PHP have that capability?
 
 yeah it's called. eval ! LOL

Haha, buddies. Joke's on me. Sorry for the waste of time. %)

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



[PHP] random alphanumeric value generator

2004-01-26 Thread craig
Hi,

I am trying to generate a non-sequential random alphanumeric value. 
Just to make things fun, I need to guarantee that each value is unique.

I have a working solution, but it seems retarded to me because there
is a small chance that 2 people might hit the same page at the same 
time, do separate inserts, but both get the same MAX(uiIndex) value.
Is there a  better way to do this?

TIA,
Craig

table defn:
create table randomKey (
   uiIndex int unsigned auto_increment not null primary key,
   cKeychar(20) unique
);

function getKey() {
   //get random number into db. it is guaranteed 
   //unique from db once result = true because 
   //cKey is unique
   $query = 'INSERT INTO randomKey (cKey) VALUES (RAND())';
   while (!$result = mysql_query($query, dbConnect($errorMsg))) { 
  //do nothing, just loop until result = true
   }  

   //now get the random number, and MD5 it to get it alphanumeric
   $query = 'SELECT MAX(uiIndex), cKey FROM randomKey GROUP BY cKey';
   $result = mysql_query($query, dbConnect($errorMsg));
   $row = mysql_fetch_object($result);
   return md5($row-cKey);
}

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



[PHP] SOLVED: [PHP] random alphanumeric value generator

2004-01-26 Thread craig
I love this list!

That's perfect! I was able to simplify the function down even more.

Thanks a lot,
Craig

 -Original Message-
 From: Matt Matijevich [mailto:[EMAIL PROTECTED]
 Sent: January 26, 2004 4:01 PM
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Subject: Re: [PHP] random alphanumeric value generator
 
 
 because it is MySQL, couldn't you just use mysql_insert_id
 http://www.php.net/manual/en/function.mysql-insert-id.php instead of
 this:
 
//now get the random number, and MD5 it to get it alphanumeric
$query = 'SELECT MAX(uiIndex), cKey FROM randomKey GROUP BY cKey';
$result = mysql_query($query, dbConnect($errorMsg));
$row = mysql_fetch_object($result);
 
 use this
 
   return md5(mysql_insert_id());
 
 
 

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



[PHP] textfields showing php tags code

2004-01-21 Thread craig
Hi All,
This one has me stumped, it worked yesterday, but not today,
and I didn't change anything (as far as I know).

This is some of the code from a function which is now showing the
?php echo $quantity; ? code inside the textareas, rather than
the passed value from the function call.

any ideas are greatly appreciated.

Craig

function showForm($quantity='', $fname='', $lname='') {
 ?
   form action='orderX.php' method='post' name='orderForm'
 table border='0'
  tr
   td align='right'Quantity:/td
   tdinput name='quantity' type='text' size='3'  value='?php
echo $quantity; ?'*/td
/tr
  tr
   td align='right'First Name:/td
   tdinput name='fname'type='text' size='25' value='?php
echo $fname; ?'*/td
/tr
  tr
   td align='right'Last Name:/td
   tdinput name='lname'type='text' size='25' value='?php
echo $lname; ?'*/td
/tr
  /table
   /form
 ?php
}

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



RE: [PHP] preg_replce ' for use with mysql

2004-01-20 Thread craig
 How do I replace all ' with \' in php so that I'm able to use 
 the mysql
 queries. Note that simply using: preg_replace(/'/, \', 
 -1) is not what
 I'm looking for, for this does not help me. Let's say I take 
 the address
 from a form and want to enter it into the database as it is. 
 Now, if the
 user enters ' the above preg_replace will work but if the 
 user himself
 enters \' , during replacing, the '\' introduced is nulled 
 by the effect
 of the preceeding back-slash, and the mysql query becomes 
 somthing like:
 mysq_insert (insert into students (id, address) values (3, '\\''));
 
 How do I get around this problem? Is there any function which helps
 to insert everything into the mysql database as it is (does 
 auto-escaping).

Couldn't be simpler, just use mysql_escape_string. It escapes a string 
for use in a mysql_query.

-craig 

 Nirnimesh.
 IIIT-Hyd.
 India.
 
 -- 
 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] Flash .swf outside webroot: width and height problems

2004-01-20 Thread craig
Thx for the fast response.

 Yes, I am doing that with the images... works fine. I also
 thought about
 using either an iframe or a div to control the size of the
 movie. It would
 have been nicer to be able to use a regular object tag, as it
 gives you more
 control over how the movie displayed.

 But I guess you can't write the tag and just do a PARAM NAME=movie
 VALUE=show.php?id=xy etc. and have the show.php output the header...

 May have to go for the div/iframe solution. If anyone can
 think of another
 way, I'd be happy to try it.

I have a couple of pages that are sprinkled with flash, this is how I
got it to
work (from the macromedia site)
-sorry for the bad word wrapping

object classid=clsid:D27CDB6E-AE6D-11cf-96B8-44455354
codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflas
h.cab#version=6,0,29,0 width=200 height=640
   param name=movie value=menu.swf?index=3
   param name=quality value=high
   embed src=menu.swf?index=3 quality=high
pluginspage=http://www.macromedia.com/go/getflashplayer;
type=application/x-shockwave-flash width=200 height=640/embed
/object

hope that helps,
Craig

 Thank you, John.

 toby

 - Original Message -
 From: CPT John W. Holmes [EMAIL PROTECTED]
 To: Toby Irmer [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Sent: Tuesday, January 20, 2004 7:12 PM
 Subject: Re: [PHP] Flash .swf outside webroot: width and
 height problems


  From: Toby Irmer [EMAIL PROTECTED]
 
   I am trying to display an .swf-file that is stored
 outside the webroot.
  
   Just sending the header and doing a readfile on the swf
 results in the
 swf
   being displayed with the maximum available width and height.
  
   Does anyone know a way of displaying Flash with its
 correct dimensions
 if
  it
   is stored outside the webroot?
 
  Do you just have a flash.php file that sends the flash
 headers and data?
  If so, then there's probably not a way just using that method.
 
  You can embed it within a HTML page, though, maybe inside a
 div to control
  the size?
 
  div style=width:50%;height:50%
  embed src=flash.php?id=xx
  /div
 
  Obviously not the correct syntax b/c I don't know it, but
 you get the
 idea,
  I hope... This is the same method you'd control the height
 and width of a
  PHP generated image
 
  img src=pic.php?id=xx width=50 height=50
 
  ---John Holmes...
 
  --
  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



[PHP] not sure why regex is doing this

2004-01-09 Thread craig
Hi,

I have a text file that I have to parse and insert into a db.
these are a couple of sample lines (they are part of the 
variable $query)

(4536,'golf tournament management',430,0,0),
(1434,'Premium golf balls',,,0),

I have to replace the blank entries (,,) with NULLs,
and I am using this regex:
$query = preg_replace('/,\s*,/',',NULL,', $query, -1);

after this line, only ONE of the ,, sets is replaced
by ,NULL, like this:
(4536,'golf tournament management',430,0,0),
(1434,'Premium golf balls',NULL,,0),

So, my problem is that I have to run the regex twice to
replace both sets of ,, with ,NULL, and I really don't 
want to do that. Why isn't it getting them both with the 
first regex, and how should I modify it to catch them 
both?

TIA,
Craig

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



RE: [PHP] Form validation: client- or server-side?

2004-01-09 Thread craig
 Is there a distinct advantage to doing form validation /
 error checking on
 the server side using PHP?
The actual code you use to validate remains hidden from a potential
malicious user, while javascript code can be seen, so if there is a
hole in your error checking, it can be found easier.

The big advantage to javascript is that it is fast, since a request
isn't sent back to the server, processed, and then sent back. It also
reduces network traffic, and reduces server load.

 That's how I've always done it
 because I know
 PHP better than JavaScript, but wouldn't it make sense to
 validate as much
 of your form as possible using JavaScript before the form was
 ever posted?
 I'm just talking about the basics, like empty required fields, illegal
 characters, string lengths, etc.
even if you partially validate on the client, you still have to validate
on the client side, which seems redundant to me.

 What are your preferred methods?  I do an awful lot of
 content management
 with HTML forms, so it's not an entirely spurious question.

I only use javascript for things that I can't do with php, and I can
validate with php.

that's my 2 cents worth,
Craig


 --
 Matt Grimm
 Web Developer
 The Health TV Channel, Inc.
 (a non - profit organization)
 3820 Lake Otis Parkway
 Anchorage, AK 99508
 907.770.6200 ext. 686
 907.336.6205 (fax)
 E-mail: [EMAIL PROTECTED]
 Web: www.healthtvchannel.org

 --
 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] not sure why regex is doing this

2004-01-09 Thread craig
Thanks Kelly.

That works just like I wanted, only starting the regex engine
once. Guess I'll have to figure out lookahead.

-Craig

 -Original Message-
 From: Kelly Hallman [mailto:[EMAIL PROTECTED]
 Sent: January 9, 2004 11:24 AM
 To: craig
 Cc: Php
 Subject: Re: [PHP] not sure why regex is doing this


 On Fri, 9 Jan 2004, craig wrote:
  (4536,'golf tournament management',430,0,0),
  (1434,'Premium golf balls',,,0),
 
  I have to replace the blank entries (,,) with NULLs, using
 this regex:
  $query = preg_replace('/,\s*,/',',NULL,', $query, -1);
  after this line, only ONE of the ,, sets is replaced by ,NULL, like:
  (1434,'Premium golf balls',NULL,,0)

 The regex does continue trying to make matches, but the point
 at which it
 continues is just past your replacement. In other words, the trailing
 comma in ,NULL, is not considered part of the string to match/replace.

 This should do the trick:
 preg_replace('/,\s*(?=[,\)])/', ',NULL', $input);

 (?=pattern) is a positive lookahead. It evaluates true if the next
 characters match the pattern, but those characters are not consumed.

 So that regex is equivalent to match a pattern starting with a comma
 followed by any existing spaces, ONLY IF the next character is , or )

 The most robust way you could write this regex is:
 preg_replace('/([,\(])\s*(?=[,\)])/', '\1NULL', $input);

 I know you'll probably never have input like (),
 but it would work as expected.

 Many tricky regex problems can be solved by lookaheads. There
 is also a
 negative lookahead (?!pattern) ... also note that this is an advanced
 regex feature and won't it work on many regex engines not
 based on PCRE.

 --
 Kelly Hallman
 // Ultrafancy

 --
 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] (OT?) form question

2004-01-07 Thread craig
Hi All,

This may be more of an HTML question - can't find anything 
in the php manual, but I may not know where to look.

Is it possible to put the cursor into a form element  
when a page loads without using javascript?

Thanks,
Craig

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



RE: [PHP] Re: High bandwidth application tips

2003-11-07 Thread Craig Lonsbury
another small tweak is to limit or remove html comments.
this doesn't directly speed up code, but makes for less
strain on your outbound pipe (good for you) and smaller
downloads for the users (think dial-up).

i usually try to put my comments in the php code. this 
reduces the bytes sent, maintains code readablity, and 
doesn't adversely affect script execution time.


Craig




 -Original Message-
 From: felix zaslavskiy [mailto:[EMAIL PROTECTED]
 Sent: November 5, 2003 8:35 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Re: High bandwidth application tips
 
 
 Take a look here:
 http://phplens.com/lens/php-book/optimizing-debugging-php.php
 
 I also recommend X-debug extention for profiling.
 
 
 On Wed, 5 Nov 2003 13:36:01 -0600 
 [EMAIL PROTECTED] (Luis Lebron) wrote:
 
  I have been coding php for a few years now, but I haven't 
 build a high
  bandwidth application. I am currently working on an 
 application for a
  customer that may have a very large amount of users (10,000 or more
  according to the customer).  Are there any good reference 
 books, articles
  and general information on building such a site. I have 
 been googling for
  a while but have found anything on this particular topic.
  
  thanks,
  
  Luis R. Lebron
  Sigmatech, Inc
  
 
 -- 
 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]{so far OT it boggles} BTML 2.0 released!!!

2003-11-07 Thread Craig Lonsbury

 Personally, these emails don't help me at all in my search
 for help, or
 helping people with php problems. Could I suggest that you guys maybe
 put a forum up for anybody who wants to bitch about this
 topic? OR maybe
 someone could setup a php-arguments list for topics such as these!


I couldn't agree more.

Craig

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



RE: [PHP] dictionary

2003-11-05 Thread Craig Lonsbury
are you using windows or *nix?

There is a good dictionary (I think it is called dict)
built into most *nix distros,and have yet to find a
good dictionary for windows.

maybe someone else knows a good one =)

Craig

 -Original Message-
 From: pete M [mailto:[EMAIL PROTECTED]
 Sent: November 5, 2003 8:40 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] dictionary


 Got a bit of a peculiar problem.

 I'm recovering a hard disk which has got corrupted (work for a data
 recovery business).

 I've got a whole stack of text files which I need to clean up
 to try and
 get back some of the text information
 here's an example snippet


 YuR(I\aQMKNXe17lq~Pr?Xhb^~{ikiF..CIC1(P(}fzrEfxi45TSQhzMVhloi
 }vNHDfQkT%B3R|*ADt?'6T+?k%,^N{
 2wjObU=/[EMAIL PROTECTED]@WG8.AH9Y6IZDi:)L{y*TTpnBHxdz\\ilqvjT
 rldhBi(bTAAXAoB%}%l
 [EMAIL PROTECTED])[EMAIL PROTECTED]Ol4~Y//
 /7;{;e$zwv?xj)(8kkOg(61[EMAIL PROTECTED]`g|[EMAIL PROTECTED]
 pZw|04-7]I^n
 [EMAIL PROTECTED]'FCWL[w)fwe#5B^C`$PlW
 rcGSrVL _DlVM7KNnvOmp=
 Jk3]cqXR]{Qp;Y23`GPDjnP,Y6M}z`7NA(%Q!YTLvh4.o*{XQ$A'sm\/W{Nj
 s:x3)GP;uFreD]N3GQQbb+X`kN[Product0]
 LANGUAGE=English
 MONIKER={DE907F20-A4A0-11d2-A985-00104B70545A}
 PRODUCT=LiveUpdate
 PRODUCTNAME=LiveUpdate

 The way I'm processing is by reading eacho file line by line, keeping
 all charachters ascii =32 = 127

 What I want is a dictinary of some sort to try and eliminate
 the lines
 where and english word does not exist !!

 Anyone got any ideas ... greatly appreciated

 pete

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



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



RE: [PHP] How can i print out the files in a directory?

2003-10-17 Thread Craig Lonsbury
This has been working for me...
just pass the function the path to the directory you
want the listing for.

function getDirFiles($dirPath){ 
   if ($handle = opendir($dirPath))  {
  while (false !== ($file = readdir($handle))) {
   if ($file != .  $file != ..) {
  $filesArr[] = trim($file);
   } 
  }   
closedir($handle);
   }  
   return $filesArr; 
} 

hth,
Craig

-Original Message-
From: Bas [mailto:[EMAIL PROTECTED]
Sent: October 17, 2003 6:42 AM
To: [EMAIL PROTECTED]
Subject: [PHP] How can i print out the files in a directory?


How can i print out all of the files in a directory?

I want some output as this:

index.php
login.php
image1.gif
image2.jpg



-- 
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] nested require_once

2003-10-16 Thread Craig Lonsbury
Hi All,
I just wanted to confirm that require_once works as I think it should,
but
the manual isn't too clear about nesting scripts (or i'm just thick =).

What I think is/should be happening is that dbLib.ink is only included
in
index.php once, but when I run helperLib.php on its own, it has
dbLib.php.

In index.php, i have
   require_once(includes/outputLib.php);
   require_once(includes/dbLib.php);
   require_once(includes/helperLib.php);

and then within helperLib.php, i have
   require_once(dbLib.php);

I know this seems to be exactly what the whole 'once' part is about, but
better safe than sorry.

thank you,
Craig

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



RE: [PHP] Credit Card Validation

2003-10-08 Thread Craig Lonsbury
this is a good explanation of the validation you can do.
http://www.beachnet.com/~hstiles/cardtype.html

if you are trying to validate client-side you'll need javascript,
which is why there may not be anything on phpbuilder

i have no idea about the bank side, but post any info you find out
back here, it is coming up soon for me =)

hth,
Craig

-Original Message-
From: Nathan Taylor [mailto:[EMAIL PROTECTED]
Sent: October 8, 2003 2:04 PM
To: php-general
Subject: [PHP] Credit Card Validation


Hey guys (and gals),

I am sure this has been asked many times before, but I couldn't seem to
find a recent PHP4-based thread in the logs at phpbuilder.com; so either
I'm incompetent or it doesn't exist.

My question is pretty obvious, I was wondering what the process for
validating a credit cards with both preprocessing by the form to
determine the pattern validity and post processing by a bank to confirm
the actual card validity.

Your help would be greatly appreciated.

Best Wishes,
Nathan Taylor

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



  1   2   3   4   >