Re: [PHP] PHP vs JAVA

2013-08-20 Thread David OBrien
On Tue, Aug 20, 2013 at 10:43 AM, Tedd Sperling t...@sperling.com wrote:

 On Aug 20, 2013, at 10:36 AM, Liam l...@3sharpltd.com wrote:
  You do realise you are on a PHP based user subscription, so the vast
  majority will go with PHP, so you will get a one sided argument.
 
  Regards,
  Liam


 I realize that many, maybe the majority, will be bias. HOWEVER -- there
 are professionals on this list that do know and it is to them I am asking.
 Remember, I am also asking for supporting documentation of their view. The
 people who respond with just their opinion are doing just that -- there is
 no support.

 My nature is to seek the truth regardless of my bias.

 Cheers,

 tedd


 ___
 tedd sperling
 t...@sperling.com



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




Re: [PHP] PHP vs JAVA

2013-08-20 Thread David OBrien
On Tue, Aug 20, 2013 at 10:56 AM, David OBrien dgobr...@gmail.com wrote:




 On Tue, Aug 20, 2013 at 10:43 AM, Tedd Sperling t...@sperling.com wrote:

 On Aug 20, 2013, at 10:36 AM, Liam l...@3sharpltd.com wrote:
  You do realise you are on a PHP based user subscription, so the vast
  majority will go with PHP, so you will get a one sided argument.
 
  Regards,
  Liam


 I realize that many, maybe the majority, will be bias. HOWEVER -- there
 are professionals on this list that do know and it is to them I am asking.
 Remember, I am also asking for supporting documentation of their view. The
 people who respond with just their opinion are doing just that -- there is
 no support.

 My nature is to seek the truth regardless of my bias.

 Cheers,

 tedd


 ___
 tedd sperling
 t...@sperling.com



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





If your looking for popularity...
http://w3techs.com/technologies/overview/programming_language/all


Re: [PHP] Question about session_id() and session_start()

2013-05-20 Thread David OBrien
On Mon, May 20, 2013 at 4:14 PM, Tim Schofield t...@weberpafrica.com wrote:

 Matijn

 There are well over half a million lines of source code in PHP. It seems a
 little unhelpful to tell someone to go and read half a million lines of C
 when you could just tell them the answer?

 Thanks
 Tim

 Course View Towers,
 Plot 21 Yusuf Lule Road,
 Kampala
 T +256 (0) 312 314 418
 M +256 (0) 752 963 325
 www.weberpafrica.com
 Twitter: @TimSchofield2
 Blog: http://weberpafrica.blogspot.co.uk
 On May 20, 2013 6:24 PM, Matijn Woudt tijn...@gmail.com wrote:

  On Mon, May 20, 2013 at 5:33 AM, 孟远涛 yuantao.m...@gmail.com wrote:
 
   I find the Note in PHP document.
   http://www.php.net/manual/en/function.session-id.php
  
   Note: When using session cookies, specifying an id for session_id()
 will
   always send a new cookie when session_start() is called, regardless if
  the
   current session id is identical to the one being set.
  
   I feel puzzled about this feature. Even if the current session id is
   identical to the one one being set, session_start will send a new
  cookie. I
   want to know why session_start behave in this way.
  
   Forgive my poor English. Thanks in advance.
  
 
  You will find the answer in the PHP source code.
  If you don't want this to happen, check if the current session id matches
  with the value you want to set it to, and don't set if they match.
 
  - Matijn
 


I guess it would be to help prevent session hijacks like explained here

http://stackoverflow.com/questions/12233406/preventing-session-hijacking


Re: [PHP] Question about session_id() and session_start()

2013-05-20 Thread David OBrien
On May 20, 2013 8:45 PM, Matijn Woudt tijn...@gmail.com wrote:


 On Mon, May 20, 2013 at 10:46 PM, David OBrien dgobr...@gmail.com wrote:

 On Mon, May 20, 2013 at 4:14 PM, Tim Schofield t...@weberpafrica.com
wrote:

  Matijn
 
  There are well over half a million lines of source code in PHP. It
seems a
  little unhelpful to tell someone to go and read half a million lines
of C
  when you could just tell them the answer?
 
  Thanks
  Tim
 
  Course View Towers,
  Plot 21 Yusuf Lule Road,
  Kampala
  T +256 (0) 312 314 418
  M +256 (0) 752 963 325
  www.weberpafrica.com
  Twitter: @TimSchofield2
  Blog: http://weberpafrica.blogspot.co.uk
  On May 20, 2013 6:24 PM, Matijn Woudt tijn...@gmail.com wrote:
 
   On Mon, May 20, 2013 at 5:33 AM, 孟远涛 yuantao.m...@gmail.com wrote:
  
I find the Note in PHP document.
http://www.php.net/manual/en/function.session-id.php
   
Note: When using session cookies, specifying an id for
session_id()
  will
always send a new cookie when session_start() is called,
regardless if
   the
current session id is identical to the one being set.
   
I feel puzzled about this feature. Even if the current session id
is
identical to the one one being set, session_start will send a new
   cookie. I
want to know why session_start behave in this way.
   
Forgive my poor English. Thanks in advance.
   
  
   You will find the answer in the PHP source code.
   If you don't want this to happen, check if the current session id
matches
   with the value you want to set it to, and don't set if they match.
  
   - Matijn
  
 

 I guess it would be to help prevent session hijacks like explained here

 http://stackoverflow.com/questions/12233406/preventing-session-hijacking


 How would it help preventing session hijacking if it was sending the a
new cookie with the same session id?

 - Matijn


I was thinking if I was sitting in a cafe and someone was sniffing and
tried to use my session info they would get a new session id where I would
still have my original one so they wouldn't be able to hijack mine trying
to reuse the same id I have since php would generate a new one

No?


Re: [PHP]

2013-05-08 Thread David OBrien
On Wed, May 8, 2013 at 1:22 PM, Daniel Brown danbr...@php.net wrote:

 On Wed, May 8, 2013 at 1:14 PM, Tedd Sperling tedd.sperl...@gmail.com
 wrote:
 
  PS: PHP +  Produced by Horses  Ponies. ? You got too much time on
 your hands Daniel.

 And yes, I just made up the word acronymize.


That would be reverse acronymization :)


Re: [PHP] ODBC

2013-05-06 Thread David OBrien
On Mon, May 6, 2013 at 3:32 PM, georg georg.chamb...@telia.com wrote:

 Hi,

 Id like to get ODBC connection to SQL from PHP going. Ive done that on XP,
 but now Im switching
 to Linux (Fedora).

 My impression in that the connecting part is per the DB designers
 responsibility. Im using Mimer-SQL,
 but cant find any information on how to set up ODBC for that. Any advice
 welcome.

 BR georg


http://developer.mimer.com/howto/howto_57.htm


Re: [PHP] Updated PHP breaks processing-intense Procedure

2013-04-24 Thread David OBrien
On Wed, Apr 24, 2013 at 5:09 PM, Ken Kixmoeller phph...@comcast.net wrote:

 Hey - --

 I have a huge screen -- to make it simple for the user, it does 100s of
 calls to MySQL and has 1,000s (literally) of POST variables.

 We have done extensive research and see that upgrading from php 5.1.6-27 to
 5.1.6-39 is the thing that caused it to break. All other issues (Apache,
 PHP and MySQL configuration and Versions) have been methodically ruled out.


 Anybody experience this? Heard of it? Suggest a repair (other than changing
 my screen)?

 *** Please don't tell me to redesign the screen -- this may come, but now
 is an urgent situation.***

 Worked fine in prior versions for the last 3 years.

 Thanks,

 Ken


Looks like they fixed the bug that allowed that to work...
php-common-5.1.6-32.el5.x86_64http://linuxsoft.cern.ch/cern/slc5X/x86_64/yum/updates/php-common-5.1.6-32.el5.x86_64.rpm
 [153 KiB]*Changelog* by Joe Orton (2012-02-02): - add security fix for
CVE-2012-0830 (#786756)
http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2012-0830


Re: [PHP] Updated PHP breaks processing-intense Procedure

2013-04-24 Thread David OBrien
On Wed, Apr 24, 2013 at 5:14 PM, David OBrien dgobr...@gmail.com wrote:

 On Wed, Apr 24, 2013 at 5:09 PM, Ken Kixmoeller phph...@comcast.netwrote:

 Hey - --

 I have a huge screen -- to make it simple for the user, it does 100s of
 calls to MySQL and has 1,000s (literally) of POST variables.

 We have done extensive research and see that upgrading from php 5.1.6-27
 to
 5.1.6-39 is the thing that caused it to break. All other issues (Apache,
 PHP and MySQL configuration and Versions) have been methodically ruled
 out.


 Anybody experience this? Heard of it? Suggest a repair (other than
 changing
 my screen)?

 *** Please don't tell me to redesign the screen -- this may come, but now
 is an urgent situation.***

 Worked fine in prior versions for the last 3 years.

 Thanks,

 Ken


 Looks like they fixed the bug that allowed that to work...
 php-common-5.1.6-32.el5.x86_64http://linuxsoft.cern.ch/cern/slc5X/x86_64/yum/updates/php-common-5.1.6-32.el5.x86_64.rpm
  [153 KiB] *Changelog* by Joe Orton (2012-02-02): - add security fix for
 CVE-2012-0830 (#786756)
 http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2012-0830




*I looked around google some more and found there is a hard limit of 1000
post variables in 5.1.6*

After weeks of using it, a problem was reported about just one function of
the app that would sometimes return a blank screen. It took me hours of
debugging (read: echo) to figure out what's going on, digging through some
old PHP code (fun!): It appeared that only 1000 post variables arrived on
the server. (Well, 1006 actually, but 2 were added by PHP, and that sounded
like a PHP-style limitation of 1000.) A quick google lookup revealed that
PHP introduced a new feature where it would limit the number of post
variables. For safety reasons.

The variable is called max_input_vars with a default of 1000. PHP states
that this feature was introduced in 5.3.9, but I'm running 5.1.6 and the
limit is enforced.

Because the server is for production, it was running with on-screen
warnings turned off. PHP says that it prints a warning and cuts. For me,
that's a real WTF. A post request should be processed as all-or-nothing.
It should instead refuse the request completely. But for a technology named
personal home page the priorities are different.


Re: [PHP] mysql_connect noob question

2013-04-21 Thread David OBrien
Not meaning to beat the proverbial dead horse

I am developing a web portal that has to display the tables in the DB via a
 form/script. The web page has a login with user and password. Right now I
 am just trying to connect.
 This for a commercial app - the client wants both an API connect via PHP
 and a web portal in which they can login from a web page and view the
 tables in the DB. Right now I am just trying to get the form/PHP
 interaction to work.


This sounds like a very good use statement for
http://www.phpmyadmin.net/http://www.phpmyadmin.net/home_page/

You can set it for http auth in the config ... they enter a mysql username
and password and they only see the databases and tables you want them to see

Might be easier than reinventing the wheel and stressing all of us :)


Re: [PHP] mysql_connect noob question

2013-04-21 Thread David OBrien
On Sun, Apr 21, 2013 at 6:01 PM, Glob Design Info i...@globdesign.comwrote:

 One other thing I noted in the FAQ was this:

 Dots in incoming variable names
 Typically, PHP does not alter the names of variables when they are passed
 into a script. However, it should be noted that the dot (period, full stop)
 is not a valid character in a PHP variable name. For the reason, look at it:

 ?php



 $varname.ext;  /* invalid variable name */



 ?
 Now, what the parser sees is a variable named $varname, followed by the
 string concatenation operator, followed by the barestring (i.e. unquoted
 string which doesn't match any known key or reserved words) 'ext'.
 Obviously, this doesn't have the intended result.
 For this reason, it is important to note that PHP will automatically
 replace any dots in incoming variable names with underscores.

 I should note my user name in this case *is* an email address, however the
 dots in that address are *not* being converted to underscores as mentioned
 (at least not visibly).



it's says variable NAMES not variable contents


Re: [PHP] mysql_connect noob question

2013-04-21 Thread David OBrien
 I should note my user name in this case *is* an email address, however
the dots in that address are *not* being converted to underscores as
mentioned (at least not visibly).


I just created a free account there and the email says my username is
dgobr...@gmail.com
but I connected to it from sqlyog and a php page by using JUST dgobrien

?php
$host = instance44364.db.xeround.com:3924;

if ( $_REQUEST['Submit'] ) {
$conn = mysql_connect( $host, $_REQUEST['username'], $_REQUEST['password']
) or die( mysql_error() );
if ($conn) {
mysql_select_db(uwharrie)  or die( mysql_error() );
echo Connectedbr;
}
}

?form id='login' action='index.php' method='post' accept-charset='UTF-8'
legendLogin/legend
input type='hidden' name='submitted' id='submitted' value='1'/
label for='username' UserName*:/label
input type='text' name='username' id='username' value='dgobrien'
 maxlength=50 /
label for='password' Password*:/label
input type='password' name='password' id='password' maxlength=50
value='mm' /
input type='submit' name='Submit' value='Submit' /
/form


Re: [PHP] mysql_connect noob question

2013-04-21 Thread David OBrien
In fact using the @gmail.com part added on gives me the same error as the OP
I think their welcome email needs tweaking.. try it without the domain
added on


On Sun, Apr 21, 2013 at 6:56 PM, David OBrien dgobr...@gmail.com wrote:

  I should note my user name in this case *is* an email address, however
 the dots in that address are *not* being converted to underscores as
 mentioned (at least not visibly).


 I just created a free account there and the email says my username is
 dgobr...@gmail.com
 but I connected to it from sqlyog and a php page by using JUST dgobrien

 ?php
 $host = instance44364.db.xeround.com:3924;

 if ( $_REQUEST['Submit'] ) {
 $conn = mysql_connect( $host, $_REQUEST['username'], $_REQUEST['password']
 ) or die( mysql_error() );
  if ($conn) {
 mysql_select_db(uwharrie)  or die( mysql_error() );
  echo Connectedbr;
 }
 }

 ?form id='login' action='index.php' method='post' accept-charset='UTF-8'
 legendLogin/legend
 input type='hidden' name='submitted' id='submitted' value='1'/
 label for='username' UserName*:/label
 input type='text' name='username' id='username' value='dgobrien'
  maxlength=50 /
 label for='password' Password*:/label
 input type='password' name='password' id='password' maxlength=50
 value='mm' /
 input type='submit' name='Submit' value='Submit' /
 /form



Re: [PHP] mysql_connect noob question

2013-04-20 Thread David OBrien

  $form_user = $_POST[ 'user' ];
  $form_pass = $_POST[ 'password' ];
 
  # Connect to remote DB
 
  $LINK = mysql_connect( $host, $form_user, $form_pass );
 
  And yes, my $host param is correct.


Have you tried

$LINK = mysql_connect( $host, $form_user, $form_pass );

just for the heck of it?


Re: [PHP] Need a tool to minimize HTML before storing in memecache

2013-04-17 Thread David OBrien
On Wed, Apr 17, 2013 at 5:52 PM, Daevid Vincent dae...@daevid.com wrote:

 We do a lot with caching and storing in memecached as well as local copies
 so as to not hit the cache pool over the network and we have found some
 great tools to minimize our javascript and our css, and now we'd like to
 compress our HTML in these cache slabs.



 Anyone know of a good tool or even regex magic that I can call from PHP to
 compress/minimize the giant string web page before I store it in the cache?



 It's not quite as simple as stripping white space b/c obviously there are
 spaces between attributes in tags that need to be preserved, but also in
 the
 words/text on the page. I could strip out newlines I suppose, but then do I
 run into any issues in other ways? In any event, it seems like someone
 would
 have solved this by now before I go re-inventing the wheel.



 d.


I used this a while ago to do what you are asking... I modified it to my
needs

https://github.com/stevenvachon/html-minify/


Re: [PHP] Is there a PHP based authentication library?

2013-04-01 Thread David OBrien
On Mon, Apr 1, 2013 at 5:26 PM, Mark mark...@gmail.com wrote:

 Hi,

 I stumbled upon this payment library: http://ci-merchant.org/ which
 abstracts the different payment backends away and exposes a new easy
 to use interface for the app developer to use. Thus making it very
 easy to use different payment providers.

 I was wondering if something like that is also existing for
 authentication? For example, in authentication you have quite a few
 different ones:
 - Mozilla Persona
 - openid
 - facebook connect
 - google (openid?)
 - use/pass based authentication (a.k.a. the self made version that
 every dev begins with)
 - oauth
 - twitter connect
 - etc...

 Is there such a library in existence? I'm especially looking for one
 with mozilla persona implemented.

 Kind regards,
 Mark

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

 https://github.com/openid/php-openid


Re: [PHP] application level variable file

2013-03-22 Thread David OBrien
On Fri, Mar 22, 2013 at 10:26 AM, Stuart Dallas stu...@3ft9.com wrote:

 On 22 Mar 2013, at 14:22, inu...@gmail.com wrote:

  I am very new to the PHP application and would like to create a new
 project.
  I would like to have a file to save my application level variable and
  functions.
 
  I would like to know does PHP have any default file name and file path
 for
  this file like Web.config file for ASP.Net and Application.cfm for
  ColdFusion?

 You can in the php.ini file use this

http://php.net/manual/en/ini.core.php#ini.auto-prepend-file

*auto_prepend_file*
stringhttp://www.php.net/manual/en/language.types.string.php

Specifies the name of a file that is automatically parsed before the main
file. The file is included as if it was called with the
requirehttp://www.php.net/manual/en/function.require.php function,
so include_path http://www.php.net/manual/en/ini.core.php#ini.include-path is
used.
The special value *none* disables auto-prepending.


Re: [PHP] actually HTML again; resizeing images

2013-03-17 Thread David OBrien
On Mar 17, 2013 12:28 PM, Stuart Dallas stu...@3ft9.com wrote:

 On 17 Mar 2013, at 13:22, georg georg.chamb...@telia.com wrote:

  Anyone knows a good reading about how and when images displayd with
HTML tags are
  re-sized ?

 Not entirely sure what you mean, but a downloaded image will be resized
when it needs to be shown in different dimensions to the actual image,
whether that's due to width and height attributes on an img tag, or CSS
styles, or whatever.

 The specific algorithm used (which I'm guessing is what you mean by how
is up to the browser and cannot be controlled.

 -Stuart

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

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

Unless you use something like treesaver


Re: [PHP] Boolean type forced on string assignment inside if statement

2013-01-03 Thread David OBrien
On Thu, Jan 3, 2013 at 11:49 AM, Marc Guay marc.g...@gmail.com wrote:

 Hi John,

 I just ran this:

 if (($a = foo) || ($b = bar)){
 echo $a.br /.$b;
 }

 and it only spat out foo so I'm guessing things have changed.  :)

 Marc

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


From what I understood about || is once it sees a true the whole statement
is regarded as true so nothing else following matters so PHP ignores
everything in the conditional after it evaluates as true...
and once it sees a false the whole statement is regarded as false so
nothing else following matters again

even the docs say short circuiting is used :)

http://php.net/manual/en/language.operators.logical.php


Re: [PHP] Noobie starting to learn OOP for databases needs help

2012-12-16 Thread David OBrien
On Sun, Dec 16, 2012 at 2:08 PM, Matijn Woudt tijn...@gmail.com wrote:

 On Sun, Dec 16, 2012 at 4:38 PM, dealTek deal...@gmail.com wrote:

  Hi all,
 
  Noobie starting to learn oop for databases from here:
 
 
 
 https://github.com/JeffreyWay/PHP-MySQL-Database-Class/blob/master/MysqlDb.php
 
  I've got lots working but have a few issues:
 
  1 - after an insert I'd like to get the id of the new record and I'm not
  sure how to get that...
 
  mysql_insert_id (depricated?) or mysqli_insert_id() (I am using mySql
 5.3)
 
  not sure where to add this... (most likely in MysqlDb.php but I don't
 know
  where or how...)
 
  http://de.php.net/manual/en/function.mysql-insert-id.php



 try SELECT LAST_INSERT_ID();
 it should give you the id of the last inserted row (on a connection basis).



 
 
  2 - how does one do aggrigate select queries like SELECT SUM(price) FROM
  mytable ... what I tried seemed to fail...
 
 
 Please show is exact query that failes, and give the error it returns.


 
  And if anyone can point to some good OOP training URL's I'd appreciate
 it.
 
  Thanks in advance for any assistance...
 
 
 Note sure what OOP has to do with MySQL, but I'd say google for PHP OOP and
 there's plenty of good stuff available.

 - Matijn


I'd do

select sum(price) as price

that way the column name returned is price and not a derived column name


Re: [PHP] Session ?

2012-12-08 Thread David OBrien
On Sat, Dec 8, 2012 at 12:10 PM, Jim Giner jim.gi...@albanyhandball.comwrote:

 On 12/8/2012 11:41 AM, Jim Giner wrote:

 On 12/8/2012 11:04 AM, Daniel Brown wrote:

  You can pass the session ID and reactivate the session that way,
 sure.  Not pretty, and it does lead to security considerations, but it
 would work.

  OK - I've done this in script 1:

 if (isset($_REQUEST['sess']))
  $sess_id = $_REQUEST['sess'];
 else
  $sess_id = '';
 if ($sess_id  '')
 {
  session_start($sess_id);
  $errmsg .= started sess id is: $sess_id ;
 }
 else
 {
  session_start();
  $errmsg .= started new sess ;
 }


 Then my process creates a Session array and calls script 2
 In script 2 I have:

 if (isset($_GET['sess'])  $_GET['sess']  '')
 {
  $sess_id = $_GET['sess'];
  session_start($sess_id);
  $errmsg .= started sess $sess_id ;
 }
 else
 {
  session_start();
  $sess_id = session_id();
  $errmsg = started NEW sess with id of $sess_id ;
 }

 My $errmsg shows me the same sess id in both scripts, and it would
 appear that I have managed to pass my session across the sub-domains.
 But when script 2 attempts to access the contents of the Session array
 created in script 1 it doesn't find it.  What am I not doing?

  Forgot to mention that when I do header(...) to go to script 2 that I do
 append the session id to my url
 Same on the return from script 2 back to script 1.


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


I know i'm late to the party here but I had to do something similar

I used something similar to
http://www.nczonline.net/blog/2010/09/07/learning-from-xauth-cross-domain-localstorage/

ie storing the session state in html localstorage objects then using the
methods in that link to read them thru iframes on the other domain...


Re: [PHP] cron job problem

2012-10-23 Thread David OBrien
On Tue, Oct 23, 2012 at 5:31 PM, Daniel Brown danbr...@php.net wrote:

 On Tue, Oct 23, 2012 at 5:34 PM, Ashley Sheridan
 a...@ashleysheridan.co.uk wrote:
 
 
  Crontab is the daemon which runs cron jobs, and some distros have set up
  special files called cron.daily (or daily.cron I don't recall),
  cron.hourly, etc to make it easier to schedule jobs.

 Quick clarification and correction here:

 The cron *daemon* is crond, while the *script* that is
 batch-processed by cron is called the crontab.  When it is executed,
 it is referred to as a cron job.

 That said, Ash is right about the rest.  Different OS flavors
 (BSD, Linux, UNIX, SunOS/Solaris, HP-UX, et cetera) often use
 different path and file standards.  Linux, in general, uses a command
 `crontab` which opens the local user's environment-configured editor
 to modify the user's crontab in the spool.

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

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


script runs
ntp updates server time
script runs again?


Re: [PHP] Wrong time being displayed by PHP!

2012-10-16 Thread David OBrien
On Tue, Oct 16, 2012 at 2:02 PM, Richard S. Crawford
rich...@underpope.comwrote:

 The value of date.timezone in php.ini is set to America/Los_Angeles.

 The local time is 11:02 a.m. Yet the output of date(h:i a e) is:

 02:02 pm America/Los_Angeles

 which is three hours ahead of the real time.

 Why is this? What's going on?

 --
 Sláinte,
 Richard S. Crawford (rich...@underpope.com) http://www.underpope.com
 Twitter: http://twitter.com/underpope
 Facebook: http://www.facebook.com/underpope
 Google+: http://gplus.to/underpope


the clock on the server is wrong?


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

2012-09-24 Thread David OBrien
On Mon, Sep 24, 2012 at 3:06 PM, Daevid Vincent dae...@daevid.com wrote:


 And for the love of [insert deity of your choice here] not EVERYTHING has
 to be OOP. Use the best tool for the job!! Nothing pisses me off more than
 having to instantiate a new class just to do some simple method that a
 standard function would do. If you want to be organized, use static methods
 then where appropriate, but don't avoid functions just because some book
 told you that OOP is the king $hit.


I'll never forget my first experience with a full blown Zend framework
application.
There were about 13 files and around 15k lines of code included to display
one line of text in the header where just a simple echo would have
sufficed.


Re: [PHP] Highlight Search Results

2012-09-18 Thread David OBrien
On Tue, Sep 18, 2012 at 8:36 AM, Floyd Resler fres...@adex-intl.com wrote:

 I want to highlight the word searched in search results.  I know I can
use str_ireplace to do a case insensitive search and replace.  However, is
there an easy way to maintain the case of the word found when I do the
replace?

 Thanks!
 Floyd



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

function highlight($haystack,$needle)
{
$haystack=preg_replace(/($needle)/i,span
style='font-weight:bold'\${1}/span,$haystack);
return $haystack;
}


Re: [PHP] array.sorting.php

2012-09-04 Thread David OBrien
On Tue, Sep 4, 2012 at 1:15 PM, John Taylor-Johnston 
jt.johns...@usherbrooke.ca wrote:

 Hi,
 Sorting question. 
 http://www.php.net/manual/en/**array.sorting.phphttp://www.php.net/manual/en/array.sorting.php
 I'm using ksort, which sorts like this.
 I don't want to use strolower.
 Is there a function/switch in one of the sort functions where I could get
 another aphabetical sort?

 http://www.php.net/manual/en/**array.sorting.phphttp://www.php.net/manual/en/array.sorting.phphas
  a lot of options. I,m not sure which one I should choose.

 This is what I get:

 LABRADOR CITY
 LACOSTA
 LARGE
 Labrador
 Labrador City
 Labrador Sea
 Lacosta
 Large
 labrador
 labrador sea
 lacosta
 large


 This is what I want:

 LABRADOR
 Labrador
 labrador
 LABRADOR CITY
 Labrador City
 Labrador Sea
 labrador sea
 LACOSTA
 Lacosta
 lacosta
 LARGE
 Large
 large

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


natsort
natcasesort


Re: [PHP] load rtf file

2012-09-03 Thread David OBrien
On Mon, Sep 3, 2012 at 12:56 PM, Matijn Woudt tijn...@gmail.com wrote:

 On Mon, Sep 3, 2012 at 5:24 PM, Tedd Sperling t...@sperling.com wrote:
  On Sep 3, 2012, at 1:23 AM, John Taylor-Johnston
 jt.johns...@usherbrooke.ca wrote:
 
  I have a big giant RTF file. I could convert it to plain text. BUT can
 PHP do it for me?
 
  Hell, even M$ can't do it!
 
  I have tons of old Word RFT files that were orphaned by the installation
 of a newer of M$ Word. The upgrade actually deleted older versions of Word
 and then would not open the older files because of security concerns (they
 were create by an older version, duh). It was a nightmare -- as a result, I
 lost years of business correspondence. Now I make z text version of every
 document I write.
 
  If I wanted to get those old files back, I will have to set up an older
 computer, reinstall the older version of Word and then transfer those
 files, convert them to text, and bring them back. That's a lot of work
 because I trusted M$ to respect older files, but they don't. In short,
 don't trust M$.
 
  Cheers,
 
  tedd
 

 Either they don't have respect to the older files, or they just don't
 understand how the format works..
 The same goes for opening '97-'03 files in Word 2010 version,
 sometimes it's also all messed up.

 Just a side note tedd, couldn't you just open those RTF files with
 wordpad? IIRC it supports RTF and plain text (even in Win7)

 - Matijn

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


I found this
http://webcheatsheet.com/php/reading_the_clean_text_from_rtf.php


Re: [PHP] templeting

2012-09-03 Thread David OBrien
On Sep 3, 2012 9:15 PM, David McGlone da...@dmcentral.net wrote:

 Does anyone use any templeting system for any projects? If so what would
 anyone recommend? I looked at Code Ignitor, but it seems the templeting
system
 is optional and left out by default.

 --
 Regards
 David M.

I use smarty


Re: [PHP] Dynamic Content thoughts

2012-08-24 Thread David OBrien
On Fri, Aug 24, 2012 at 11:16 AM, Jim Lucas li...@cmsws.com wrote:

 On 08/24/2012 08:01 AM, tamouse mailing lists wrote:

 OT Reply -- just frustrated with the way email screws up program
 listings. It's a royal pain to have to strip out code and then put it
 in an editor and tidy it up just to be able to make heads or tails out
 of something. There are lots of code pasting sites around, but that
 breaks up the continuity of the list archive. No solution, just
 frustrated


 This list does allow attachments, but that breaks things too, because they
 are not shown on archive web sites.

 --
 Jim Lucas

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

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


In gmail if I see something is totally screwed up visually I click the
little dropdown where you'd select reply to all and then choose show
original...
It shows the source of the email in monospaced font so if looks like it was
meant to


Re: [PHP] mysqlnd and mysqli as shared extensions?

2012-08-20 Thread David OBrien
On Mon, Aug 20, 2012 at 10:20 AM, Lester Caine les...@lsces.co.uk wrote:

 Can mysqlnd be built as a shared module?

 make test is telling me the resulting .so is not a valid
 Warning: PHP Startup: Invalid library (maybe not a PHP library)
 'mysqlnd.so' in Unknown on line 0

 I'm still on PHP5.4.3 on that machine as I've not had time to upgrade as
 yet. It's running my own PHP sites without a problem via Firebird.

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


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


there was a bugfix in the 5.3 changelog

mysqlnd:
Fixed bug #55609 http://bugs.php.net/55609 (mysqlnd cannot be built
shared). (Johannes)

and I see this in the 5.4.0

ext/mysql, mysqli and pdo_mysql now use mysqlnd by default.


Re: [PHP] Display Array Tree as Menu - Can't figure out how to find depth with something over 2 levels

2012-08-16 Thread David OBrien
On Thu, Aug 16, 2012 at 12:40 PM, Tristan sunnrun...@gmail.com wrote:

 I can't for the life of me figure out how to find the depth of the array
 that I'm looping through to output tabs or indentations to the display for
 each depth. The entries also have section postition if you can figure out
 how to include that within each depth of the results I will buy you a case
 of beer.

 I was hoping to do something like...

 foreach($trees as $tree){
 if($tree['current_depth'] == 0){
 echo $tree['menu_item'];
 } else if($tree['current_depth'] == 1){
 echo 'indentation'.$tree['menu_item'];
 } else if($tree['current_depth'] == 2){
 echo 'indentation - indentation'.$tree['menu_item'];
 }
 }


 Or maybe even like this...

 foreach($trees as $tree){
 // output nbsp; the amount of times current_depth equals
 echo str_repeat(nbsp;, $tree['current_depth'])
 }

 I have my $tree structure as:

 [16] = Array
 (
 [section_id] = 21
 [section_parent_id] = 0
 [section_pos] = 30
 [section_name] = Resource Center
 [has_order] = 1
 [section_has_hierarchy] = 1
 [total_entries] = 35
 [children] = Array
 (
 [0] = Array
 (
 [section_id] = 38
 [section_parent_id] = 21
 [section_pos] = 31
 [section_name] = Resource Center
 [has_order] = 1
 [section_has_hierarchy] = 1
 [total_entries] = 35
 [children] = Array

 (
 [0] = Array
 (
 [section_id] = 39
 [section_parent_id] = 38
 [section_pos] = 32
 [section_name] = Resource Center
 [has_order] = 1
 [section_has_hierarchy] = 1
 [total_entries] = 35
 )

 [1] = Array
 (
 [section_id] = 40
 [section_parent_id] = 38
 [section_pos] = 33
 [section_name] = Resource Center
 [has_order] = 1
 [section_has_hierarchy] = 1
 [total_entries] = 35
 )
 )




 [19] = Array
 (
 [section_id] = 26
 [section_parent_id] = 0
 [section_pos] = 45
 [section_name] = Resource Center
 [has_order] = 1
 [section_has_hierarchy] = 1
 [total_entries] = 55
 [children] = Array
 (
 [0] = Array
 (
 [section_id] = 27
 [section_parent_id] = 26
 [section_pos] = 46
 [section_name] = Newsletters Intro
 [has_order] = 0
 [section_has_hierarchy] = 1
 [total_entries] = 1
 )

 )

 )



maybe something like this

in the foreach
if parent = 0 then level = 0;
if haschilden is true increment level;


Re: [PHP] Mac 10.7 Install/Copy fresh PHP over Pre-Installed PHP

2012-07-30 Thread David OBrien
On Mon, Jul 30, 2012 at 10:21 AM, JeffPGMT jeffp...@gmail.com wrote:

 Tamara, I said dll, but that was only my ignorant/windows reference to a
 system lib/bin file. I followed a blog post (bitly'ed below); I got as far
 as un-tar'ing and make was not available.

 I have other stacks Xampp (beta for Mac not for production) and is used by
 many folks w/out issue, however this is a production system, hence my
 wonderment  frustration as to why IMAP was removed by Apple and not a
 dev
 box for me to install 3rd party tools and have an issue with our IT.  I
 also
 considered MAMP or FastStack, however that meant there are two installs of
 both Apache  PHP. I did a test and put the preinstalled stuff on port
 8080.
 But, I thought, It's a server OS, why not use what came installed? And that
 was one of my original questions alluding to perhaps IMAP was installed but
 turned off at some not so obvious point just waiting to be restored.

 I originally sent the following as a PM to TR Shaw... The OS is 10.7 Lion
 Server! (I'm really emphisising server, because when I presented my
 situation to our IT and a call to Apple I was told that it was there!  By
 the end of the call Apple said, sorry (after a nearly 20min hold, suppose
 he
 asked someone more experienced) and my IT said, hey let's just try the new
 10.8 maybe that will fix it? I realized I was dealing with an very
 experienced Mac IT person who really didn't know.

 I read the instructions on adding c-client 2007, but make is an invalid
 cmd, apparently that's pulled by Apple too; is there a way to add php_IMAP
 w/out?  I got as far as downloading  un-tar, but failed at make
 osx...filename...
 http://bit.ly/JWre51

 TRShaw: What/Where/Why is the path /etc/intl ?

 I'm not familiar w/Mac, what are steps 3  4?

 And lastly I'm reluctant to install XCode or MacPorts because, I'm not IT
 and this is not a dev box. I think that these are the responsibility of IT,
 who manages the server desktops  network. I really just want to drop my
 program in and run away :)

 JeffPGMT

 TR Shaw ts...@oitc.com wrote in message
 news:c512aca8-a6ed-45e9-873f-c0e72dd9e...@oitc.com...
 Actually, adding extensions (even normally bundled ones) to the stock Snow
 Leopard PHP is quite easy:

 1) Download the source tarball of php and unpack it

 2) cd into ext/name_of_the_extension (like ext/intl in your case)

 3) run phpize

 4) run ./configure with appropriate flags

 5) make install

 Then you just enable the freshly built .so file in your php.ini and you are
 done.

 On Jul 28, 2012, at 12:25 AM, Tamara Temple wrote:

  JeffPGMT jeffp...@gmail.com wrote:
  Please correct me if I'm wrong and IMAP is available (maybe a known
  config
  issue?)
 
  Mac OSX 10.7, Using the pre-installed Apache  Php, IMAP is not
  installed,
  pulled out my Apple for this server OS.
 
  I don't know if it is, but something below seems very odd to me:
 
  $ php -v
  PHP Warning:  PHP Startup: Unable to load dynamic library
  '/usr/lib/php/extensions/no-debug-non-zts-20090626/php_imap.dll' -
  dlopen(/usr/lib/php/extensions/no-debug-non-zts-20090626/php_imap.dll,
  9):
  image not found in Unknown on line 0
 
  I might be wrong here on 10.7, as I haven't even migrated off 10.5, but,
  I've never seen a .dll file on a mac -- they're windows dynamic link
  libraries. I think somehow things are little messed up there...
 
  Someone has suggested installing MAMP, which is a much better solution
  in general that what Apple supplies. The issue is knowing which you're
  running at any point in time, which for most things, MAMP will handle
  correctly. But it may not be the case for command line execution as
  you've shown above.
 
  --
  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


I just installed the latest MAMP on my MacMini running Mt. Lion ... imap is
installed and enabled by default
It also includes 3 versions of php out of the box

Davids-Mac-mini:~ dgobrien$ ls /Applications/MAMP/bin/php/
php5.2.17/ php5.3.14/ php5.4.4/

Davids-Mac-mini:~ dgobrien$ /Applications/MAMP/bin/php/php5.4.4/bin/php-cgi
-m
[PHP Modules]
bcmath
bz2
calendar
cgi-fcgi
Core
ctype
curl
date
dom
ereg
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
imap
json
ldap
libxml
mbstring
mcrypt
mysql
mysqli
openssl
pcre
PDO
pdo_mysql
pdo_pgsql
pdo_sqlite
pgsql
Phar
posix
Reflection
session
SimpleXML
soap
sockets
SPL
sqlite3
standard
tokenizer
XCache
xml
xmlreader
xmlwriter
xsl
yaz
zip
zlib

[Zend Modules]
XCache

Should be trivial to add that executable to your path for command line stuff


Re: [PHP] Reverse DNS testing

2012-07-12 Thread David OBrien

On Jul 12, 2012, at 2:17 PM, Al wrote:

 I want to do a rDNS check on a admin entered host name to insure in-coming 
 mail servers don't reject mail, sent by my app, because the rDNS doesn't 
 exist or doesn't match.
 
 Here is the fundamental code:
 
 $host = $_SERVER['SERVER_NAME']; //site name shared or not
 $ip = gethostbyname($host);
 
 $hostName = gethostbyaddr($ip); //May be different on a shared host
 $ip2 = gethostbyname($hostName);
 
 The $ip works fine.
 
 However, one of the shared hosts I'm working with returns this instead of the 
 original $host
 
 gethostbyaddr($ip)= 93.247.128.148-static.foo.com [foo is subs for actual]
 
 gethostbyname($hostName)= 93.247.128.148-static.foo.com  It appears
 gethostbyname() is just returning $hostName because it is not legit.
 Using just the foo.com in gethostbyname() returns the host's server IP.
 
 Thus, the typical rDNS check fails for this site. Several online checks also 
 report rDNS fails.
 
 Any suggestions how I can handle this?
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

It appears the RDNS for that ip has not been mapped to the server name

do you have control of the DNS servers?

can you check the dns config?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Is there a way to customize the 'Username' and 'Password' strings in a 401 auth dialog box?

2012-06-28 Thread David OBrien
On Thu, Jun 28, 2012 at 7:23 PM, Daevid Vincent dae...@daevid.com wrote:

 Is there a way to customize the 'Username' and 'Password' strings in a 401
 auth dialog box?

 I want to change mine to say Webmaster ID and Authentication Key.

 http://php.net/manual/en/features.http-auth.php


This  http://www.ietf.org/rfc/rfc2617.txt says the browser actually
controls the prompts all you get to set is the realm.


Re: [PHP] passing /n into query ERROR

2012-05-31 Thread David OBrien
On Thu, May 31, 2012 at 12:46 PM, Don Wieland d...@pointmade.net wrote:

 I have a query below. When I try to run it with PHP it errors:

 DATABASE_ERROR: You have an error in your SQL syntax; check the manual
 that corresponds to your MySQL server version for the right syntax to use
 near 'LINES TERMINATED BY '\n'' at line 38 IN

 BUT where I copy the echoed query and paste into into my Sequel Pro query
 editor and run it - works perfectly. Can someone shone some light on this?
 Frustrating - to say the least.

 Don

 $csv = SELECT u.user_id,
u.first_name AS
 u_first_name,
u.last_name AS
 u_last_name,
c.client_id AS
 c_client_id,
c.first_name AS
 c_first_name,
c.middle_name AS
 c_middle_name,
c.last_name AS
 c_last_name,
c.address AS
 c_address,
c.city AS c_city,
c.state AS c_state,
c.zip AS c_zip,
c.dob AS dob_ymd,
c.phone_home AS
 c_phone_home,
c.phone_cell AS
 c_phone_cell,
c.phone_work AS
 c_phone_work,
c.email AS c_email,
c.other_contacts AS
 c_other_contacts,
count(*) as apt_qty

FROM tl_appt apt

JOIN tl_clients c
 on c.client_id = apt.client_id
JOIN tl_rooms r on
 r.room_id = apt.room_id
JOIN tl_users u on
 u.user_id = apt.user_id

WHERE


  apt.time_start between '.$sd.' and '.$ed.'

  .$where_sql.

GROUP BY u.user_id,
 c.client_id
having count(*)
 .$aoper. .$aqty.

ORDER BY
 u.first_name, u.last_name, c.last_name, c.first_name
INTO OUTFILE
 '/tmp/.$csv_file..csv'
FIELDS TERMINATED
 BY ','
ENCLOSED BY '\';
LINES TERMINATED BY
 '.\\n.';

echo $csv;



$csv_query = $db-db_query($csv);

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

 if you DO NOT specify a LINES TERMINATED BY command it defaults to \n


Re: [PHP] passing /n into query ERROR

2012-05-31 Thread David OBrien
On Thu, May 31, 2012 at 12:55 PM, David OBrien dgobr...@gmail.com wrote:

 On Thu, May 31, 2012 at 12:46 PM, Don Wieland d...@pointmade.net wrote:

 I have a query below. When I try to run it with PHP it errors:

 DATABASE_ERROR: You have an error in your SQL syntax; check the manual
 that corresponds to your MySQL server version for the right syntax to use
 near 'LINES TERMINATED BY '\n'' at line 38 IN

 BUT where I copy the echoed query and paste into into my Sequel Pro query
 editor and run it - works perfectly. Can someone shone some light on this?
 Frustrating - to say the least.

 Don

 $csv = SELECT u.user_id,
u.first_name AS
 u_first_name,
u.last_name AS
 u_last_name,
c.client_id AS
 c_client_id,
c.first_name AS
 c_first_name,
c.middle_name AS
 c_middle_name,
c.last_name AS
 c_last_name,
c.address AS
 c_address,
c.city AS c_city,
c.state AS c_state,
c.zip AS c_zip,
c.dob AS dob_ymd,
c.phone_home AS
 c_phone_home,
c.phone_cell AS
 c_phone_cell,
c.phone_work AS
 c_phone_work,
c.email AS c_email,
c.other_contacts
 AS c_other_contacts,
count(*) as apt_qty

FROM tl_appt apt

JOIN tl_clients c
 on c.client_id = apt.client_id
JOIN tl_rooms r on
 r.room_id = apt.room_id
JOIN tl_users u on
 u.user_id = apt.user_id

WHERE


  apt.time_start between '.$sd.' and '.$ed.'

  .$where_sql.

GROUP BY
 u.user_id, c.client_id
having count(*)
 .$aoper. .$aqty.

ORDER BY
 u.first_name, u.last_name, c.last_name, c.first_name
INTO OUTFILE
 '/tmp/.$csv_file..csv'
FIELDS TERMINATED
 BY ','
ENCLOSED BY '\';
LINES TERMINATED
 BY '.\\n.';

echo $csv;



$csv_query = $db-db_query($csv);

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

 if you DO NOT specify a LINES TERMINATED BY command it defaults to \n


 Good gracious ... note the extra ; after ENCLOSED BY


Re: [PHP] Calculating driving distance between UK postcodes

2012-05-04 Thread David OBrien
Google is still your friend

On Fri, May 4, 2012 at 9:36 AM, Terry Ally (Gmail) terrya...@gmail.comwrote:

 Does anyone have a working/example PHP script that calculates driving
 distances between UK postcodes that they can share?

 Thanks

 --
 *Terry Ally*
 Twitter.com/terryally
 Facebook.com/terryally
 ~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~
 To print or not to print this email is the environmentally-searching
 question!
 Which has the highest ecological cost? A sheet of paper or constantly
 switching on your computer and connecting to the Internet to read your
 email?


http://stackoverflow.com/questions/2296087/using-php-and-google-maps-api-to-work-out-distance-between-2-post-codes-uk


Re: [PHP] howto get pgUp, pgDn, delete, home and end keycodes in CLI PHP script

2012-05-04 Thread David OBrien


On Fri, May 4, 2012 at 10:48 AM, Andres Gonzalez and...@packetstorm.comwrote:

 I am trying to code a CLI PHP script that will give me the keycodes for
 these (and other) keyboard keys. I want to basically block until the user
 presses a single key, then I want to process that event without the user
 having to press the Enter key after pressing a single key.

 I have tried several approaches but with no success.  Using fopen() to
 open stdin, and fgetc() will give me the regular keys but requires the user
 to press the Enter key after the initial key is pressed. When I press the
 the PgDw key for example, those routines return a single character string
 even though the stty echos a 5 character string (using PgDw echos ^[[6~)

 I have tried other approaches using bash read commands to get a single
 character but will little success also.

 Anybody here know how to do this?

 Thanks,

 -Andres

 |
 |

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


I think something like this would work

$running = true;
$fp = fopen(php://stdin,r);//open direct input stream for reading
stream_set_blocking($fp,0);//set non-blocking mode

while ($running) {
  while (($buf = fgets($fp, 4096)) != false) {
 $buffer .= $buf;
  }
  if ($buffer != ) {
 switch ($buffer) {
   case  : {//exit on space key
exit;
   }
   default: {
 //space not pressed
   }
 }
$buffer = ; //empty buffer
   }


Re: [PHP] PDF Form Field

2012-05-03 Thread David OBrien
On May 3, 2012 9:08 PM, David OBrien dgobr...@gmail.com wrote:


 On May 3, 2012 8:53 PM, Dan Joseph dmjos...@gmail.com wrote:
 
  Hi,
 
  I've spent hours researching this with no luck.  I have a PDF with a
form
  field that I want to populate and output the PDF.  Can someone point me
in
  the right direction?  Can FPDF do this natively, or I need something
else?
   My host doesn't have PDFLib installed, so that's not an option.
 Thanks.
 
  --
  -Dan Joseph
 
  http://www.danjoseph.me

 Yeah you can load the pdf and overlay the text on top of it with fpdf
there should be an example of that on the fpdf site

I just found fpdfi using Google. It looks like what you need


Re: [PHP] PDF Form Field

2012-05-03 Thread David OBrien
On May 3, 2012 8:53 PM, Dan Joseph dmjos...@gmail.com wrote:

 Hi,

 I've spent hours researching this with no luck.  I have a PDF with a form
 field that I want to populate and output the PDF.  Can someone point me in
 the right direction?  Can FPDF do this natively, or I need something else?
  My host doesn't have PDFLib installed, so that's not an option.  Thanks.

 --
 -Dan Joseph

 http://www.danjoseph.me

Yeah you can load the pdf and overlay the text on top of it with fpdf there
should be an example of that on the fpdf site


Re: [PHP] case-insensitive $_REQUEST,$_GET,$_POST keys?

2012-04-13 Thread David OBrien
On Fri, Apr 13, 2012 at 1:13 PM, tamouse mailing lists 
tamouse.li...@gmail.com wrote:

 Anyone have a quick-and-dirty way to check $_REQUEST keys that is
 case-insensitive?

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


this what you asking?

foreach ( $_REQUEST as $key = $value ) {
  if ( strtolower($key) in array('name','username','password')) $data[
strtolower($key) ] = $value;
}


Re: [PHP] mssql_bind question

2012-04-09 Thread David OBrien
On Mon, Apr 9, 2012 at 1:42 PM, David Stoltz dsto...@shh.org wrote:

 Folks,

 Having a difficult time using mssql_bind with characters greater than
 8000...the database field is set to ntext, and I've also tried
 varchar(max), both seem to produce the same results:

 If I use:
 mssql_bind($stmt, '@mgrnotes',$mgrnotes,SQLVARCHAR,false,false,8000);

 I get the error:
 Warning: mssql_bind() [function.mssql-bind]: Unable to set parameter in
 D:\Inetpub\wwwroot\folder\mypage.php on line 105

 I discovered changing SQLVARCHAR to SQLTXT, and dropping the length of
 8000 helps:
 mssql_bind($stmt, '@mgrnotes',$mgrnotes,SQLTEXT,false,false);

 I get no error, but the field is truncated to 8000 characters
 regardless.

 What is the correct way to use mssql_bind with strings of greater than
 8000 characters?

 Thanks!
 Dave

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


this is a limit in SQL itself not the drivers

http://msdn.microsoft.com/en-us/library/aa258848(v=SQL.80).aspx

Using EXECUTE with a Character String

Use the string concatenation operator (+) to create large strings for
dynamic execution. Each string expression can be a mixture of Unicode and
non-Unicode data types.

Although each [N] '*tsql_string*' or *@string_variable* must be less than
8,000 bytes, the concatenation is performed logically in the SQL Server
parser and never materializes in memory. For example, this statement never
produces the expected 16,000 concatenated character string:

EXEC('name_of_8000_char_string' + 'another_name_of_8000_char_string')

Statement(s) inside the EXECUTE statement are not compiled until the
EXECUTE statement is executed.

Changes in database context last only until the end of the EXECUTE
statement. For example, after the EXEC in this example, the database
context is *master*:

USE master EXEC (USE pubs) SELECT * FROM authors


Re: [PHP] image inventoryer

2012-04-06 Thread David OBrien
On Fri, Apr 6, 2012 at 8:34 AM, Jim Giner jim.gi...@albanyhandball.comwrote:

 Kirk Bailey kbai...@howlermonkey.net wrote in message
 news:4f7e5d2f.3050...@howlermonkey.net...
  jim, I am a novice at this language as I said.
 

 Then you are taking on too big of a task.

 When I decided to pick up some web programming skills I bought a $50
 book/manual on learning PHP and another on MySQL.  I read them - cover to
 cover.  Then I made up simple tasks to develop in order to LEARN how it's
 actually done.  Sounds like you not only want someone to program it for
 you,
 but probably help you implement it too.  Sure - I or someone with time on
 their hands - could reply back with a couple hundred lines of code and give
 you your answer.  Then what would you have gained?

 Hey - I gave you the outline of how this goal of yours could be
 accomplished.  No need for your own pseudo-code at this point.  Take mine
 and go do some research!  Have fun!  Then come back for clarification on
 what you're doing wrong once you have some actual code written.

 
  And were people this nice to you when YOU asked beginner questions?
 
 When I asked beginner questions, it was AFTER I had written something and
 ran into a roadblock.  NOT before I had set pen to paper.  You're asking
 how
 to get to California without having consulted a map yet.  This site will be
 there for you when you have a problem - don't worry.  Me included, not that
 my input is that worthy.



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


I googled php show images in folder and lo and behold  the first was was
a script almost exactly what you are wanting to do


Re: [PHP] image inventoryer

2012-04-06 Thread David OBrien
On Apr 6, 2012 9:51 AM, Jim Giner jim.gi...@albanyhandball.com wrote:

 David OBrien dgobr...@gmail.com wrote in message
 news:CAF=yD_06vDEHLP-nyEJxUNt6nHexA42X90U5-6+MBzc0=tc...@mail.gmail.com...
 
  I googled php show images in folder and lo and behold  the first was
was
  a script almost exactly what you are wanting to do
 
 Damn - now the OP missed a golden opportunity to do some research!  :)



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


It's been my experience if they haven't even used google to see what
premade scripts are available to do something similar then the research
ain't gonna happen.

They'd just post on ee or another forum where they could get the answer
easier


Re: [PHP] Command line has no network access

2012-04-01 Thread David OBrien
On Apr 1, 2012 12:11 PM, Lester Caine les...@lsces.co.uk wrote:

 OK I probably know how to do this 10 years ago, but I'm not finding any
prompts to remind me.

 Windows 2000, PHP5.2.10 cli ...
 I'm trying to set up a simple dump to run from scheduler. The code runs
perfectly via the browser so I'm manually having to log in each day to run
it. I've got an entry in the scheduler to run it, but I simply can't get it
running from the command line prompt. It can't find even 'localhost' so
will not connect to the database :(

 It's picking up the same ini file, and the same modules are loading, so
it is just the network access from the command prompt ...

 ( changes from W2k are simply not possible since the main text to speech
engine used on the site will not run on anything later and the supplier no
longer exists :( )

 --
 Lester Caine - G8HFL
 -
 Contact - http://lsces.co.uk/wiki/?page=contact
 L.S.Caine Electronic Services - http://lsces.co.uk
 EnquirySolve - http://enquirysolve.com/
 Model Engineers Digital Workshop - http://medw.co.uk//
 Firebird - http://www.firebirdsql.org/index.php

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


Find wget for windows and call that with the script in a batch file

wget http://localhost/script.php

Will be like a browser hit it


Re: [PHP] securing a script that exec()s

2012-03-30 Thread David OBrien
Find a way to do it using PHP's imagemagick extensions

http://php.net/manual/en/book.imagick.php

On Fri, Mar 30, 2012 at 5:56 AM, rene7705 rene7...@gmail.com wrote:

 Hi.

 I have a script that uses imagemagick's convert command on the commandline
 to get it's work done.
 These calls to exec('convert [params]') take params from the end-user via a
 html form, so is very unsecure.

 The intention is that the end-user only runs this script on localhost, from
 localhost.

 So now i'm checking $_SERVER['REMOTE_ADDR']===$_SERVER['SERVER_ADDR'] to
 see if I can allow the script to be used.

 But unfortunately, $_SERVER['REMOTE_ADDR'] is my external IP, and
 $_SERVER['SERVER_ADDR'] is my internal IP.

 How would I best fix this?



Re: [PHP] securing a script that exec()s

2012-03-30 Thread David OBrien
Sender: dgobr...@gmail.com
Subject: Re: [PHP] securing a script that exec()s
Message-Id: CAF=yD_3efQkA_kz169ooYQ2z7g=g75sjghadnvw+irjzp8q...@mail.gmail.com
Recipient: adam.nicho...@hl.co.uk


__
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
__---BeginMessage---
Find a way to do it using PHP's imagemagick extensions

http://php.net/manual/en/book.imagick.php

On Fri, Mar 30, 2012 at 5:56 AM, rene7705 rene7...@gmail.com wrote:

 Hi.

 I have a script that uses imagemagick's convert command on the commandline
 to get it's work done.
 These calls to exec('convert [params]') take params from the end-user via a
 html form, so is very unsecure.

 The intention is that the end-user only runs this script on localhost, from
 localhost.

 So now i'm checking $_SERVER['REMOTE_ADDR']===$_SERVER['SERVER_ADDR'] to
 see if I can allow the script to be used.

 But unfortunately, $_SERVER['REMOTE_ADDR'] is my external IP, and
 $_SERVER['SERVER_ADDR'] is my internal IP.

 How would I best fix this?

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

Re: [PHP] DateTime wierdness

2012-03-29 Thread David OBrien
echo date(m-d-y,mktime(0, 0, 0, 14, 14, 2012));

this outputs 02-14-13 also so my guess is that it is being interpreted
the same as  12/14/2012 +2 months

echo date(m-d-y,mktime(0, 0, 0, 1, 45, 2012)); outputs
02-14-12

which is 1/1/12 +45 days



2012/3/29 Martín Marqués martin.marq...@gmail.com

 Can someone explain to me this weierdness I see when using the
 DateTime module of PHP.

 Here I send 14/14/2012 which is not a valid date, and I would expect
 to recieve false, but instead, it looks like it wrapping to the next
 year, as if 14 monthas are 1 year and 2 months. That isn't what's
 supposed to happen, or is it?

 $ echo ?php var_dump(DateTime::createFromFormat('j/n/Y',
 '14/14/2012')); ? |php
 object(DateTime)#1 (3) {
  [date]=
  string(19) 2013-02-14 13:20:22
  [timezone_type]=
  int(3)
  [timezone]=
  string(20) America/Buenos_Aires
 }


 --
 Martín Marqués
 select 'martin.marques' || '@' || 'gmail.com'
 DBA, Programador, Administrador

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




Re: [PHP] DateTime wierdness

2012-03-29 Thread David OBrien
http://www.php.net/manual/en/function.checkdate.php

2012/3/29 Martín Marqués martin.marq...@gmail.com

 OK. So what would be a good way to validate a date?

 El día 29 de marzo de 2012 14:04, David OBrien dgobr...@gmail.com
 escribió:
 
  echo date(m-d-y,mktime(0, 0, 0, 14, 14, 2012));
 
  this outputs 02-14-13 also so my guess is that it is being interpreted
 the
  same as  12/14/2012 +2 months
 
  echo date(m-d-y,mktime(0, 0, 0, 1, 45, 2012)); outputs
  02-14-12
 
  which is 1/1/12 +45 days
 
 
 
  2012/3/29 Martín Marqués martin.marq...@gmail.com
 
  Can someone explain to me this weierdness I see when using the
  DateTime module of PHP.
 
  Here I send 14/14/2012 which is not a valid date, and I would expect
  to recieve false, but instead, it looks like it wrapping to the next
  year, as if 14 monthas are 1 year and 2 months. That isn't what's
  supposed to happen, or is it?
 
  $ echo ?php var_dump(DateTime::createFromFormat('j/n/Y',
  '14/14/2012')); ? |php
  object(DateTime)#1 (3) {
   [date]=
   string(19) 2013-02-14 13:20:22
   [timezone_type]=
   int(3)
   [timezone]=
   string(20) America/Buenos_Aires
  }
 
 
  --
  Martín Marqués
  select 'martin.marques' || '@' || 'gmail.com'
  DBA, Programador, Administrador
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 



 --
 Martín Marqués
 select 'martin.marques' || '@' || 'gmail.com'
 DBA, Programador, Administrador



Re: [PHP] DateTime wierdness

2012-03-29 Thread David OBrien
actually this would work well ... compare what they send with the output of
the formatdate

function checkDateTime($data) {
if (date('Y-m-d H:i:s', strtotime($data)) == $data) {
return true;
} else {
return false;
}
}

2012/3/29 David OBrien dgobr...@gmail.com

 http://www.php.net/manual/en/function.checkdate.php


 2012/3/29 Martín Marqués martin.marq...@gmail.com

 OK. So what would be a good way to validate a date?

 El día 29 de marzo de 2012 14:04, David OBrien dgobr...@gmail.com
 escribió:
 
  echo date(m-d-y,mktime(0, 0, 0, 14, 14, 2012));
 
  this outputs 02-14-13 also so my guess is that it is being
 interpreted the
  same as  12/14/2012 +2 months
 
  echo date(m-d-y,mktime(0, 0, 0, 1, 45, 2012)); outputs
  02-14-12
 
  which is 1/1/12 +45 days
 
 
 
  2012/3/29 Martín Marqués martin.marq...@gmail.com
 
  Can someone explain to me this weierdness I see when using the
  DateTime module of PHP.
 
  Here I send 14/14/2012 which is not a valid date, and I would expect
  to recieve false, but instead, it looks like it wrapping to the next
  year, as if 14 monthas are 1 year and 2 months. That isn't what's
  supposed to happen, or is it?
 
  $ echo ?php var_dump(DateTime::createFromFormat('j/n/Y',
  '14/14/2012')); ? |php
  object(DateTime)#1 (3) {
   [date]=
   string(19) 2013-02-14 13:20:22
   [timezone_type]=
   int(3)
   [timezone]=
   string(20) America/Buenos_Aires
  }
 
 
  --
  Martín Marqués
  select 'martin.marques' || '@' || 'gmail.com'
  DBA, Programador, Administrador
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 



 --
 Martín Marqués
 select 'martin.marques' || '@' || 'gmail.com'
 DBA, Programador, Administrador





[PHP] How can I convert these to hex or strings?

2012-03-21 Thread David OBrien
I'm running snmp against a huge list of printers and certain HP models
return

Model:
stdClass Object
(
[type] = 4
[value] = ☺§HP LaserJet P3010 Series
)

Serial:
stdClass Object
(
[type] = 4
[value] = ☺§VNBCC1917W
)

MacAddress:
stdClass Object
(
[type] = 4
[value] = ⌠╬F╒'
)

I just strip the weird ones off the model and serial entries but I've been
pulling my hair out trying to convert the macaddress one to a hex string or
just a string
Can some one educate me or point me in the right direction?

David OBrien


Re: [PHP] Re: How can I convert these to hex or strings?

2012-03-21 Thread David OBrien
Damn I'm an idiot... sorry :\

On Wed, Mar 21, 2012 at 9:34 AM, Jim Giner jim.gi...@albanyhandball.comwrote:

 Did you do a search of the php manual?  I did one on hex and found
 function bin2hex.  Not sure how you mac address is actually built, but I
 would try converting it char by char and see what the function returns.
 Or maybe just pass the whole string to it.
 Just a guess.



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




Re: [PHP] Graphing

2012-03-18 Thread David OBrien
Highcharts.com

On Mar 18, 2012 9:34 AM, Ross Hansen hansen.r...@live.com.au wrote:

 Hey all,

 I have been working with php for a few years but mostly simple stuff. I'm
now looking at doing some graphing but have no experience with dynamic
images.

 I have never used imagecreate but have seen one example of it and not
sure if it is really what i'm after.
 It needs to graph changing data from a mysql db.
 I also understand php might not be the best option due to the server load.

 Just want to get peoples thoughts and suggestions.
 Was so looking at jquery.

 Looking forward your responses.

 Regards
 Ross


Highcharts.com


[PHP] Any SNMP Guru's?

2012-03-15 Thread David OBrien
Using command line snmpget you can set an option to append leading 0's to
hex values -o0
So instead of

 $macaddress = 0:1a:4b:c:8d:fb;

it would be

 $macaddress = 00:1a:4b:0c:8d:fb;

is there any option using the extremely well documented php snmp extension
to do the same?


Re: [PHP] can't pull products from DB with REGEXP?

2005-03-14 Thread David OBrien
At 04:53 PM 3/14/2005, [EMAIL PROTECTED] wrote:
I have table with products. In column categories are listed numbers of 
categories a product belongs, like:
1. 21,
2. 35, 8, 72, 1, 4,
3. 23, 11, 48,
4. 65,
5. 11,
6. 23,
7. ...
(somebody else created the table this way and I have to keep it for the 
moment)
Now, I have to list all products that belongs to category with cat. 
number, e.g. 11.

If I use query:
select * from products where categories like '11, '
product no. 5 will be listed but not product no. 3
select * from products where categories like '%11,% '
will list products 3 and 5 but
select * from products where categories like '%1,% '
will list products 2, 3 and 5 too - and, 3  5 are wrong.
I got from friend this solution:
select * from products where categories REGEXP '(^.$cat_num.|, 
.$cat_num.)'
it works just fine if I use 2 digit cat number. e.g. 11 or 26 or 62. But 
if I select for cat. num. 2 it will list all products from categories 2 
and everything between 20 and 29. 32 or 62 will not be listed.

Confusing, ha?
Thanks for any help!
-afan
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
get the categories in a variable. like
?
$cat = 35, 8, 72, 1, 4,;
$cat = str_replace(, , | , $cat);
$cat = str_replace(  , \\  , $cat);
// this will get you $cat = 35|\ 8|\ 72|\ 1|\ 4|;
$cat = rtrim($cat, |);
// this will get you $cat = 35|\ 8|\ 72|\ 1|\ 4;
$sql = SELECT * FROM products WHERE categories REGEXP '( . $cat . )';
echo $sql;
?
produces
SELECT * FROM products WHERE categories REGEXP '(35|\ 8|\ 72|\ 1|\ 4)'
which matches the correct items in my test data
-Dave
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Sessions and Objects using PHP4

2005-01-15 Thread David OBrien
I have RTFM and TTFE and still am having a heck of a time getting my 
objects to play well between pages
The only real examples are in the notes for classes  objects
http://us2.php.net/manual/en/language.oop.php

Basic usage
?
include_once(config.inc);
include_once(class.php);
$songbook = new songbook(); // defined in the class.php
session_register('songbook');
$songbook-get_stats();
$songbook-populate_manu();
$songbook-populate_series();
if (!isset($songbook-userid) || $songbook-userid == ) {
header(Location: login.php);
}
Now the login.php is basically the same but if the login correctly it 
should set $songbook-userid to the username

require('common.php');
session_start();
include_once(class.php);
$songbook = new songbook();
session_register('songbook');
include(newheader.php);
if ( isset($_POST['submitit'])) {
	$link = dbconnector();
	$sql = select * from userinfo where 
lower(username)=lower('.$_POST['user'].') and 
lower(password)=lower('.$_POST['pass'].');
	$result = mysql_query($sql);
	if( mysql_num_rows($result)  0 ) {
		$songbook-userid = strtolower($_POST['user']);
		header(Location: green.php);
	} else {
		$errormsg = font size=3Invalid Username or Password.br\nPlease Try 
Again./font;
	}
}

So I guess what I am asking is how DO you make objects work across pages?
-Dave
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Replacing whole words only

2004-12-22 Thread David OBrien
The case is what's stopping it from working
a str_replace(strtolower($exceptionphrase) , '' , strtolower($stringtoparse)) 
would take the case out of the equation

and for php5 theres always the case insensitive version
str_ireplace()
-David


 
 From: Chris Boget [EMAIL PROTECTED]
 Date: 2004/12/22 Wed AM 10:27:50 EST
 To: PHP General php-general@lists.php.net
 Subject: [PHP] Replacing whole words only
 
 Is there a way to replace/remove *whole* words from a
 phrase?  For example:
 
 ?
   $exceptionsList = array( 'the', 'other', 'that', 'a' );
   $stringToParse = 'The other lady that laughed';
 
   if( count( $exceptionsList )  0 ) {
 foreach( $exceptionsList as $exceptionPhrase ) {
   $stringToParse = str_replace( $exceptionPhrase, '', trim(
 $stringToParse ));
 
 }
 $retval = trim( $stringToParse );
 
   }
   echo 'Retval: ' . $retval . 'br';
 ?
 
 results in The or ldy lughed and not lady laughed.  Using
 the other *_replace() functions give the same results.  So is
 what I'm looking to do even possible?
 
 thnx,
 Chris
 
 -- 
 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] Replacing whole words only

2004-12-22 Thread David OBrien
I'm also an idiot ...
Something else, the or output is occurring because the exception the 
matches other  first so other becomes or minus the the...

So heres what I did ...

$search = array( '/\bthe\b/', '/\bother\b/', '/\bthat\b/', '/\ba\b/' );
$string = 'The other lady that laughed';

if( count( $search )  0 ) {
foreach( $search as $exceptionPhrase ) {
  $string = preg_replace( strtolower($exceptionPhrase), '', 
strtolower($string)); 

}
$retval = trim( $string );

}
echo 'Retval: ' . $retval . 'br';

And got 
lady laughed
In the matches ex. /\bthe\b/ the \b mean word boundry so 
it matches only the whole word...
-David

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



Re: [PHP] Methods for creating HTML with PHP

2004-03-24 Thread David OBrien
At 08:20 PM 3/24/2004, Jason Giangrande wrote:
Raditha Dissanayake wrote:
How about just escaping out of php :-) and embedding the html direct?
Jason Giangrande wrote:
I'm looking for an easy way to write all my HTML using PHP.  I could do 
this with a bunch of print statements or the like, but that doesn't seem 
like a real good solution.  I noticed that PEAR has several packages for 
creating HTML.  Has anyone used any of these packages?
I'm particularly interested in the HTML_Common, HTML_Page, and HTML_CSS 
packages.  The HTML_Page package, which to me seems like the one package 
that actually outputs HTML, is marked as beta.  Anyone know if there 
are any alternative packages that do a similar thing?

Also, is it possible to download a package marked beta with PEAR, or 
does it need to be downloaded manually?

Thanks,
That's the thing.  I'm looking for an alternative way of writing HTML into 
PHP pages.  I did a few simple pages a while ago just using print 
statements instead of closing the PHP tag and then writing HTML.  It made 
the code a little easier to follow.  The problem is that print statements 
can add up fast, so using to many of them in one page is probably just as 
hard to follow as closing a PHP block, so you can write some HTML.  That 
was why I was looking for an alternative way to write HTML in PHP pages.

I tried the HTML_Page class from PEAR, but it seems to have some issues 
still.  I guess that's why it's still in beta.  I've decided I'll try and 
write something on my own for now that incorporates a few things I've seen 
in other classes (mainly HTML_Common, and HTML_Page).
Jason
I have done this before and it worked for me not sure how much you need it 
though
?
include(header.htm)
some code
include(body.htm)
include(left_menu.htm)
more code
include(footer.htm)
?

this way just php is in the main document and all the html is pulled from 
smaller html files elsewhere.
This will also allow you to reuse the html on every page kinda like a 
template system

you could also functionize the html

include(functions.php);
print_header();
and in functions.php
?
function print_header () {
?
html here
?
}
?
This will also just let the code be in the main file and call the html from 
the functions.

-Dave

--
Jason Giangrande [EMAIL PROTECTED]
http://www.giangrande.org
http://www.dogsiview.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Why are my style sheets all listed on one line?

2004-01-30 Thread David OBrien
At 03:16 AM 1/30/2004, Freedomware wrote:
I'm still fairly new to PHP, so there may be a simple fix for my 
relatively trivial complaint.

I'm using an included page as a head section. It works fine, except that 
when preview a page and view the source, all the style sheets are 
displayed on one long line, like this:

/scriptlink href=../../css/ref.css rel=stylesheet 
type=text/csslink href=../../css/na/a1.css rel=stylesheet 
type=text/css /link href=.css rel=stylesheet type=text/css 
/link href=../../css/nations.css rel=alternate stylesheet 
type=text/css title=Nations /

It looks like they won't scroll across THIS page, so here's a more clear 
example:

stylesheet1stylesheet2stylesheet3stylesheet4
You need a \n at the end of each line inside the quote
like
echo stylesheet\n;
\n is newline
-Dave
What I want is a normal style sheet display, like this:

stylesheet1
stylesheet2
stylesheet3
stylesheet4
Do you know what causes this and if there's a fix? I posted some code from 
the head section and main page below.

Thanks!

* * * * * * * * * *

HEAD SECTION (included page; ../../includes/ref/head.php)

?php
$todayDate = date(m-d-Y);
echo 'titleFreedomware gt; ' . $myname . '/title';
echo 'meta name=description content=' . $myname . ' versus Microsoft /';
echo 'meta name=keywords content=' . $myname . ' versus Microsoft /';
echo 'meta name=mssmarttagspreventparsing content=true /';
echo 'meta http-equiv=content-Type content=text/html; 
charset=iso-8859-1 /';
echo 'meta name=author content=David Blomstrom /';
echo 'script src=' . $periods . 'js/swapclass.js 
type=text/javascript/script';
echo 'script language=JavaScript src=' . $periods . 
'js/sort.js/script';
echo 'script language=JavaScript src=' . $periods . 'js/ss.js/script';
echo 'script language=JavaScript type=text/JavaScript
!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//--
/script';
echo 'link href=' . $periods . 'css/ref.css rel=stylesheet 
type=text/css';
if($includea1 == TRUE){
echo 'link href=' . $periods . 'css/' . $continentcode . '/a1.css 
rel=stylesheet type=text/css /';
}
echo 'link href=' . $mycss . '.css rel=stylesheet type=text/css /';
echo 'link href=' . $periods . 'css/nations.css rel=alternate 
stylesheet type=text/css title=Nations /';
echo 'link href=' . $periods . 'css/themes/peace.css rel=alternate 
stylesheet type=text/css title=Peace /';
echo 'link href=' . $periods . 'css/themes/war.css rel=alternate 
stylesheet type=text/css title=War /';
echo 'link href=' . $periods . 'css/themes/pat' . $countrycode . '.css 
rel=alternate stylesheet type=text/css title=Patriotism /';
echo 'link href=' . $periods . 'css/themes/nationalism.css 
rel=alternate stylesheet type=text/css title=Nationalism /';
echo 'link href=' . $periods . 'css/themes/corporate.css rel=alternate 
stylesheet type=text/css title=Corporate /';
echo 'link href=' . $periods . 'css/themes/conspiracy.css 
rel=alternate stylesheet type=text/css title=Conspiracy /';
echo 'link href=' . $periods . 'css/themes/media.css rel=alternate 
stylesheet type=text/css title=Media /';
echo 'link href=' . $periods . 'css/themes/atlantic.css rel=alternate 
stylesheet type=text/css title=Atlantic /';
echo 'link href=' . $periods . 'css/themes/indian.css rel=alternate 
stylesheet type=text/css title=Indian /';
echo 'link rel=SHORTCUT ICON href=../../../../us/aaa/favicon.ico /';
?

* * * * * * * * * *
MAIN PAGE
!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN 
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
?php $myname = 'Alaska'; $mynickname = 'Land of the Midnight Sun'; 
$mycode = 'ak'; $mywebring = '/world/na/us/ak/'; $myregion = 'north'; 
$mycountry = 'United States'; $mycontinent = 'North America'; $countrycode 
= 'us'; $continentcode = 'na'; $periods = '../../'; $tlperiods = '../'; 
$includea1 = TRUE; include (../../includes/ref/head.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


Re: [PHP] Still error messages!!

2004-01-28 Thread David OBrien
At 12:08 PM 1/28/2004, Radwan Aladdin wrote:
Hello all..

This is the PHP code :

?php

include(Config.php);

$link = mysql_connect($user_hostname, $user_username, $user_password);
mysql_select_db($user_database, $link);
$UserName = $_GET['UserName'];
$Password = $_GET['Password'];
$LogoutTime = date(U);
$query1 = UPDATE accounts SET LogoutTime=$LogoutTime;
$query2 = SELECT LoginTime,Distance,LessonNumber FROM accounts WHERE 
UserName='$UserName' AND Password='$Password';
$query3 = UPDATE accounts SET LessonNumber=LessonNumber + 1;


right here do a

? pre ?
echo $query1;
echo $query2;
echo $query3;
? /pre ?
and make sure the queries are what you want them to be...

$result = mysql_query($query1) or die(Query error:  . mysql_error());

$RightLoginTime = 'LoginTime';
$Distance = 'Distance';
$LessonNumber = 'LessonNumber';
$LessonsTimeLimit = 30;
$query4 = UPDATE accounts SET (Distance=' . $LogoutTime - 
$RightLoginTime . ') WHERE UserName= . $UserName .  AND Password= . 
$Password . );
Do the same here for query4

$result2 = mysql_query($query4) or die(Query error:  . mysql_error());

if($Distance == $LessonsTimeLimit){
$result3 = mysql_query($query3) or die(Query error:  . mysql_error());
}else{
echo Not yet!;
}
?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Still error messages!!

2004-01-28 Thread David OBrien
I assume you are using another page with a form to  enter the username and 
password?
If so:
add as the first line of your script right after the ?PHP

phpinfo();

Run your application, scroll to the bottom and look at the php variables 
and make sure that your are asking for $_GET[Username] and 
$_GET[Password] are what the script sees

If not:
You may have to run just that page 
with  http://whatever/whatever.php?Username=whateverPassword=whatever to 
see if the problem is in the form or not

-Dave

At 01:08 PM 1/28/2004, Radwan Aladdin wrote:
I made that.. but there is something strange!!

I SELECTED field from the database.. but it is not showing what it contains!!

This is what is shown on the screen :

 UPDATE accounts SET LogoutTime=1075313199SELECT 
LoginTime,Distance,LessonNumber FROM accounts WHERE UserName='' AND 
Password=''UPDATE accounts SET LessonNumber=LessonNumber + 1
Query error: You have an error in your SQL syntax near '0') WHERE 
UserName= AND Password=)' at line 1

So what is wrong!!!??

Everything is inserted and updated correctly in the database.. but the 
distance is the same.. no changes.. no updates!!

Regards..

- Original Message -
From: Damon Hill [EMAIL PROTECTED]
To: 'Radwan Aladdin' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Wednesday, January 28, 2004 9:56 PM
Subject: RE: [PHP] Still error messages!!
 Correct Radwan, you are NOT trying to echo the queries to the screen.
 However, what David is trying to teach you is simply debugging
 techniques.
 By echoing the actual query that the PHP pareser is using, you can see
 if it is indeed what you want it to be.
 This way, you can debug the code yourself, instead of posting it to a
 list for help.
 That way you cut down on the number of email messages I receive and also
 learn something in the process.

 Now, echo it to the screen and see what it says :-)

 M Damon Hill
 Senior Technical Lead
 IFWorld, Inc.
 www.ifworld.com
 Go Hogs!
 People demand freedom of speech to make up for the freedom of thought
 which they avoid.
 - Soren Aabye Kierkegaard


 -Original Message-
 From: Radwan Aladdin [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, January 28, 2004 11:50 AM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] Still error messages!!


 Thank for your reply..

 But I'm not trying to echo these queries.. What I'm trying to do is :

 To UPDATE  a value in the database (Login_Time and Logout_Time) and then
 caculate the distance between them and put it in (Distance) field.. then
 after that program the PHP file and put in it a LessonLimit value.. if
 the LessonLimit is the same of the Distance.. then make a value in that
 row
 (LessonNumber) = Its currently value + 1 (So for example : is
 LessonNumber = 2 then it must be 3...Etc..)

 Hope you got my meaning..

 The error that is displayed always is : Query error: You have an error
 in your SQL syntax near '0') WHERE UserName= AND Password=)' at line 1

 Also when I put the right UserName and Password.. the same error!!

 So also there are some other errors.. please see the whole script..

 Waiting your help..
 Regards..

 - Original Message -
 From: David OBrien [EMAIL PROTECTED]
 To: Radwan Aladdin [EMAIL PROTECTED];
 [EMAIL PROTECTED]
 Sent: Wednesday, January 28, 2004 9:35 PM
 Subject: Re: [PHP] Still error messages!!


  At 12:08 PM 1/28/2004, Radwan Aladdin wrote:
  Hello all..
  
  This is the PHP code :
  
  ?php
  
  include(Config.php);
  
  $link = mysql_connect($user_hostname, $user_username,
 $user_password);
  mysql_select_db($user_database, $link);
  
  $UserName = $_GET['UserName'];
  $Password = $_GET['Password'];
  $LogoutTime = date(U);
  
  $query1 = UPDATE accounts SET LogoutTime=$LogoutTime; $query2 =
  SELECT LoginTime,Distance,LessonNumber FROM accounts WHERE
  UserName='$UserName' AND Password='$Password'; $query3 = UPDATE
  accounts SET LessonNumber=LessonNumber + 1;
 
 
  right here do a
 
  ? pre ?
  echo $query1;
  echo $query2;
  echo $query3;
  ? /pre ?
 
  and make sure the queries are what you want them to be...
 
  $result = mysql_query($query1) or die(Query error:  .
  mysql_error());
  
  
  $RightLoginTime = 'LoginTime';
  $Distance = 'Distance';
  $LessonNumber = 'LessonNumber';
  $LessonsTimeLimit = 30;
  
  $query4 = UPDATE accounts SET (Distance=' . $LogoutTime -
  $RightLoginTime . ') WHERE UserName= . $UserName .  AND Password=

  . $Password . );
 
  Do the same here for query4
 
  $result2 = mysql_query($query4) or die(Query error:  .
  mysql_error());
  
  if($Distance == $LessonsTimeLimit){
   $result3 = mysql_query($query3) or die(Query error:  .
 mysql_error());
  }else{
   echo Not yet!;
  }
  
  ?
 
  --
  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

Re: [PHP] Still error messages!!

2004-01-28 Thread David OBrien
In your script you have

$RightLoginTime = 'LoginTime';
$Distance = 'Distance';
$LessonNumber = 'LessonNumber';
$LessonsTimeLimit = 30;
So $Distance is a string equaling Distance and $LessonNumber = LessonNumber
How are you performing math on a string?
-Dave
At 01:42 PM 1/28/2004, Radwan Aladdin wrote:
I'm using the GET method..

And it is right.. it shows the correct GET method.. the problem in is in 
the Destance value.. it is not updating this value to the database.. or it 
is wrong.. every time = 0

So what is the error?

Regards..
- Original Message -
From: David OBrien [EMAIL PROTECTED]
To: Radwan Aladdin [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Wednesday, January 28, 2004 10:34 PM
Subject: Re: [PHP] Still error messages!!
 I assume you are using another page with a form to  enter the username and
 password?
 If so:
 add as the first line of your script right after the ?PHP

 phpinfo();

 Run your application, scroll to the bottom and look at the php variables
 and make sure that your are asking for $_GET[Username] and
 $_GET[Password] are what the script sees

 If not:
 You may have to run just that page
 with  http://whatever/whatever.php?Username=whateverPassword=whatever to
 see if the problem is in the form or not

 -Dave


 At 01:08 PM 1/28/2004, Radwan Aladdin wrote:
 I made that.. but there is something strange!!
 
 I SELECTED field from the database.. but it is not showing what it 
contains!!
 
 This is what is shown on the screen :
 
   UPDATE accounts SET LogoutTime=1075313199SELECT
  LoginTime,Distance,LessonNumber FROM accounts WHERE UserName='' AND
  Password=''UPDATE accounts SET LessonNumber=LessonNumber + 1
 Query error: You have an error in your SQL syntax near '0') WHERE
 UserName= AND Password=)' at line 1
 
 So what is wrong!!!??
 
 Everything is inserted and updated correctly in the database.. but the
 distance is the same.. no changes.. no updates!!
 
 Regards..
 
 - Original Message -
 From: Damon Hill [EMAIL PROTECTED]
 To: 'Radwan Aladdin' [EMAIL PROTECTED]; 
[EMAIL PROTECTED]
 Sent: Wednesday, January 28, 2004 9:56 PM
 Subject: RE: [PHP] Still error messages!!
 
 
   Correct Radwan, you are NOT trying to echo the queries to the screen.
   However, what David is trying to teach you is simply debugging
   techniques.
   By echoing the actual query that the PHP pareser is using, you can see
   if it is indeed what you want it to be.
   This way, you can debug the code yourself, instead of posting it to a
   list for help.
   That way you cut down on the number of email messages I receive and 
also
   learn something in the process.
  
   Now, echo it to the screen and see what it says :-)
  
   M Damon Hill
   Senior Technical Lead
   IFWorld, Inc.
   www.ifworld.com
   Go Hogs!
   People demand freedom of speech to make up for the freedom of thought
   which they avoid.
   - Soren Aabye Kierkegaard
  
  
   -Original Message-
   From: Radwan Aladdin [mailto:[EMAIL PROTECTED]
   Sent: Wednesday, January 28, 2004 11:50 AM
   To: [EMAIL PROTECTED]
   Subject: Re: [PHP] Still error messages!!
  
  
   Thank for your reply..
  
   But I'm not trying to echo these queries.. What I'm trying to do is :
  
   To UPDATE  a value in the database (Login_Time and Logout_Time) and 
then
   caculate the distance between them and put it in (Distance) field.. 
then
   after that program the PHP file and put in it a LessonLimit value.. if
   the LessonLimit is the same of the Distance.. then make a value in that
   row
   (LessonNumber) = Its currently value + 1 (So for example : is
   LessonNumber = 2 then it must be 3...Etc..)
  
   Hope you got my meaning..
  
   The error that is displayed always is : Query error: You have an error
   in your SQL syntax near '0') WHERE UserName= AND Password=)' at line 1
  
   Also when I put the right UserName and Password.. the same error!!
  
   So also there are some other errors.. please see the whole script..
  
   Waiting your help..
   Regards..
  
   - Original Message -
   From: David OBrien [EMAIL PROTECTED]
   To: Radwan Aladdin [EMAIL PROTECTED];
   [EMAIL PROTECTED]
   Sent: Wednesday, January 28, 2004 9:35 PM
   Subject: Re: [PHP] Still error messages!!
  
  
At 12:08 PM 1/28/2004, Radwan Aladdin wrote:
Hello all..

This is the PHP code :

?php

include(Config.php);

$link = mysql_connect($user_hostname, $user_username,
   $user_password);
mysql_select_db($user_database, $link);

$UserName = $_GET['UserName'];
$Password = $_GET['Password'];
$LogoutTime = date(U);

$query1 = UPDATE accounts SET LogoutTime=$LogoutTime; $query2 =
SELECT LoginTime,Distance,LessonNumber FROM accounts WHERE
UserName='$UserName' AND Password='$Password'; $query3 = UPDATE
accounts SET LessonNumber=LessonNumber + 1;
   
   
right here do a
   
? pre ?
echo $query1;
echo $query2;
echo $query3;
? /pre ?
   
and make sure

Re: [PHP] Still error messages!!

2004-01-28 Thread David OBrien
I believe I'd start here

http://www.php.net/manual/en/function.mssql-fetch-row.php

You get the db result from your script but you do nothing with it in your 
script
A whole lot more reading and coding you need to accomplish.
Good Luck

-Dave

At 01:54 PM 1/28/2004, Radwan Aladdin wrote:
But I mean by $RightLoginTime = 'LoginTime';
the selected field from the database (LoginTime).. First I selected the
LoginTime from the database and now I'm trying to name a variable for it to
use it..
So what is the correct code?

Regards..
--
SASSINC Internet Solutions - Arabic Department
[EMAIL PROTECTED]
http://www.SASSINC.Net
- Original Message -
From: John W. Holmes [EMAIL PROTECTED]
To: Radwan Aladdin [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Wednesday, January 28, 2004 10:46 PM
Subject: Re: [PHP] Still error messages!!
 From: Radwan Aladdin [EMAIL PROTECTED]

  I made that.. but there is something strange!!

 It's strange you can't follow instructions...

  I SELECTED field from the database.. but it is not showing what it
 contains!!
 
  This is what is shown on the screen :
 
   UPDATE accounts SET LogoutTime=1075313199SELECT
 LoginTime,Distance,LessonNumber FROM accounts WHERE UserName='' AND
 Password=''UPDATE accounts SET LessonNumber=LessonNumber + 1
  Query error: You have an error in your SQL syntax near '0') WHERE
 UserName= AND Password=)' at line 1

 If you had printed out all the queries, you'd realize that error is coming
 from $query4.

 $query4 = UPDATE accounts SET (Distance=' . $LogoutTime -
 $RightLoginTime . ') WHERE UserName= . $UserName .  AND
 Password=
. $Password . );

 $UserName and $Password have no value. Your distance calculation doesn't
 make any sense, either, as you're subtracting a string from an integer...

$LogoutTime = date(U);
$RightLoginTime = 'LoginTime';

 So you're setting distance equal to 1034566 - LoginTime (for example),
 which is just going to come out to $LogoutTime (since a string converted
to
 an integer is zero in this case).

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


Re: [PHP] sending a hex string as it is?

2004-01-28 Thread David OBrien
At 02:03 PM 1/28/2004, Khoa Nguyen wrote:

$var = 0x8180;

How do I send $var to the browser as it is? In other words, if sniffing on
the wire, I should see 8180, not 38 31 38 30.


I think
http://www.php.net/manual/en/function.strval.php
would work here
-Dave
Thanks for your help.
Khoa
--
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] Still error messages!!

2004-01-28 Thread David OBrien
At 02:45 PM 1/28/2004, Radwan Aladdin wrote:
Now I fixed the error message.. but the problem is in Distance = 0
always.. because the LoginTime is a string.. I fetch it but the same thing!!
This is the new script :

?php

phpinfo();
include(Config.php);
$link = mysql_connect($user_hostname, $user_username, $user_password);
mysql_select_db($user_database, $link);
$UserName = $_GET['UserName'];
$Password = $_GET['Password'];
$LogoutTime = date(U);
$query1 = UPDATE accounts SET LogoutTime=$LogoutTime;
You are not executing this query anywhere in the script

$query2 = SELECT LoginTime,Distance,LessonNumber FROM accounts WHERE
UserName='$UserName' AND Password='$Password';
$result2 = mysql_query($query2) or die(Query error:  . mysql_error());
$row2 = mysql_fetch_row($result2);
Great that you used this to get the results in a row but you need to 
reference the row in your script

$query3 = UPDATE accounts SET LessonNumber=LessonNumber + 1;
Instead of

$RightLoginTime = 'LoginTime';
use
$RightLoginTime = $row2[LoginTime];
but you need to do a mysql_query for the $query1 and get that value frst

Instead of

$Distance = 'Distance';
use
$Distance = $row2[Distance];
Instead of

$LessonNumber = 'LessonNumber';
use
$LessonNumber = $row2[LessonNumber];
The user comments on the online manual are a very good starting
point for basic programming steps needed to accomplish a task
If  you would have taken the example on that page you would have
seen the steps needed:
set your query string
execute the query
get the resultset into a variable
This is the norm for all mysql php programming just putting a 
$Distance='Distance'
does not tell php that what you really want it do read the database and 
place the value of
Distance into $Distance

-Dave

$LessonsTimeLimit = 30;

? pre ?
echo $query1;
echo $query2;
echo $query3;
? /pre ?


$query4 = UPDATE accounts SET Distance= . $LogoutTime - $RightLoginTime .
 - LoginTime WHERE UserName= . $UserName .  AND Password= . $Password .
);
$result4 = mysql_query($query4) or die(Query error:  . mysql_error());
$row4 = mysql_fetch_row($result4);
? pre ?
echo $query4;
? /pre ?
if($Distance == $LessonsTimeLimit){
$result3 = mysql_query($query3) or die(Query error:  . mysql_error());
}else{
echo Not yet!;
}
?

So why it is making the Distance value = 0 and it doen't update the value in
the database. (Because it must update the value in the database by it)
Regards..
- Original Message -
From: John Nichel [EMAIL PROTECTED]
To: Radwan Aladdin [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Wednesday, January 28, 2004 11:37 PM
Subject: Re: [PHP] Still error messages!!
 Radwan Aladdin wrote:
 snip
  So where are the errors?
 
  Waiting your help please..
 
  Regards..
 

 What's the error message???

 --
 By-Tor.com
 It's all about the Rush
 http://www.by-tor.com

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

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


RE: [PHP] sending a hex string as it is?

2004-01-28 Thread David OBrien
At 02:17 PM 1/28/2004, Khoa Nguyen wrote:
Thanks for the info Dave, but I still can't make it work:

?php
$var = 0x10; // decimal 16
echo $var;  // case 1
echo strval($var);  // case 2
$var = 0x . dechex(strval($var));

is about the only way I could get it to show 0x10 instead of 16
-Dave

?

In both cases, I see 3136 (ASCII encoded of string 16) on the wire :-(

Any ideas?

Khoa

-Original Message-
From: David OBrien [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 28, 2004 2:08 PM
To: Khoa Nguyen; [EMAIL PROTECTED]
Subject: Re: [PHP] sending a hex string as it is?
At 02:03 PM 1/28/2004, Khoa Nguyen wrote:

$var = 0x8180;

How do I send $var to the browser as it is? In other words, if sniffing
on the wire, I should see 8180, not 38 31 38 30.

I think
http://www.php.net/manual/en/function.strval.php
would work here
-Dave
Thanks for your help.
Khoa

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


Re: [PHP] unexpected include parse error

2004-01-26 Thread David OBrien
the \ has to be slashed

.\\;

-Dave

At 11:27 PM 1/26/2004, Paul Furman wrote:
I'm new so probably missing something easy or doing something terribly 
wrong but I have spent a lot of time experimenting...

?php
  $dirstr= ./
  include 'scandir.php';
  scandir('$dirstr');
?
parse error, unexpected T_INCLUDE in [the above file]

if I comment out the
  $dirstr= ./
above that error goes away and the scandir.php include runs (that's a php5 
function that needs to be defined manually in PHP 4.3.4)

#scandir.php
?php
#$dirstr=.\;
  function scandir($dirstr) {
 $files = array();
 $fh = opendir($dirstr);
 while (false !== ($filename = readdir($fh))) {
 array_push($files, $filename);
 }
 closedir($fh);
 return $files;
  }
?


If I set $dirstr=.\; in the function it gives these errors:

Parse error: unexpected $end in scandir.php at? last line
Fatal error: Call to undefined function: scandir() in showdir.php


If I don't set $dirstr at all, it runs the scandir function and fouls up 
in expected ways:

Warning: opendir($dirstr): failed to open dir: Invalid argument in scandir.php

Warning: readdir(): supplied argument is not a valid Directory resource in 
scandir.php

Warning: closedir(): supplied argument is not a valid Directory resource 
in scandir.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


Re: [PHP] How do you set up table columns for numerals?

2004-01-23 Thread David OBrien
normally auto_increment fields need to be of a number type  not varchar
-Dave
At 11:30 PM 1/23/2004, Freedomware wrote:
Giz wrote:

I looked at your page.  First off, you should add a primary key column that
has no information in it.  Just make this a number(4) called state_id.
OK, I gave it another try, but I don't see where I type in 4.

When I clicked Save, I got an error message: This is not a number! but 
it didn't specify what it was referring to.

I put a screenshot online at http://geowebworks.geobop.org/mysql/3.php - 
the last picture on the page. 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] Having a bit of regex troubles

2004-01-14 Thread David OBrien
I just ran this on this line...

for ($x=0; $xstrlen($field);$x++) {
echo ( .ord($field{$x}) . ) ;
}
to see the ascii values to make sure nothing funky was there and it still 
stopped after the @@ (169)(169)

-Dave

At 12:50 AM 1/15/2004, David OBrien wrote:
Let's say i have a mysqldump type export script I wrote that someone 
screwed up (me) and I quoted every field even the
numeric ones. In this dump I have rows upon rows of this kind of data

INSERT INTO chd VALUES ( '80607fe5-00eb-f5c9-4d38-00ac10050a00' , 
'014d7fcd-00eb-f5c9-4d38-00ac10050a00' ,
 'Kenderick' , '1991-02-10' , 'Male' , '2002-02-28' , '576' , '' , '' , 
'Full-Time' , 'Summer Only' , '©After School©' ,
 '©Child Care Center©©(CCC) Summer Camp©' , '©Non-Smoking©' , '©English©' 
, '' , ''
 , '' , '' , '' , '' , '©CMS - Tuckaseegee©' , '©Transportation 
Provided©' , ''  );

The java programmer used @@ as internal field seperators (can't be changed)

I am reading this dump a line at a time stripping the data into an array 
and then writing back out to a new file
with the proper fields quoted or not quoted depending on the table and the 
db schema
ccncc would be char char num char char in the switch statement to tell 
the loop which ones to quote
or which ones not to.

ACTUAL SCRIPT AT THE END (kind of large)

In the example row above You see the @@(CCC) value?

Whenever It gets to a line with this combination it stops processing the 
rest of that line and terminates the field at the @@

Dump of the below program for the above row ( I put the *** before and 
after each field to see where it was dieing)

INSERT INTO chd VALUES  (
***80607fe5-00eb-f5c9-4d38-00ac10050a00***
***014d7fcd-00eb-f5c9-4d38-00ac10050a00***
***Kenderick***
***1991-02-10***
***Male***
***2002-02-28***
**
**
***Full-Time***
***Summer Only***
***©After School©***
***©Child Care Center©©***
Then it just skips to the next record when it hits the (CCC). I could just 
use a text editor to replace all the @@( to
something and then write them back out at the end of the script but it's 
really bugging me and I thought a fresh pair
of eyes looking over it would help.

I know I have trims out the wazoo but I just rushed to post this before it 
got real late.

Anyone know of a way I can replace the (CCC) or the @@ using str_replace 
I've tried \'ing it, not slashing just about
every combination
-Dave







SCRIPT

[EMAIL PROTECTED] bin]# cat escape_sql.php
#!/bin/php
?
if ($argc != 2 ) {
?
  Usage:
  ?php echo $argv[0]; ? filename
?
exit;
} else {
$handle = fopen( $argv[1] , r);
while (!feof($handle)) {
$count ++;
$start = 0;
$buffer = chop(fgets($handle, 100));
list($sql,$rest) = explode((,$buffer);
if (substr($sql , 0 , 2) == --) {
echo $sql .\n;
} else {
echo $sql ( ;
$rest = str_replace();, , $rest);
$rest = str_replace(\(CCC\),ZZZ,$rest);
$fields = explode(' , ' , $rest);
foreach ($fields as $field) {
$field = trim($field, ' );
$field = trim($field, \' );
$table = str_replace(INSERT INTO ,, 
$sql );
$table = str_replace(VALUES ,  , $table);
$table = trim($table);
switch ($table) {
case 'agc':
$schema = 
;
break;
case 'chd':
$schema = 
ccnc;
break;
case 'cli':
$schema = 
cncnncnncncn;
break;
case 'cliactionlog':
$schema = cc;
break;
case 'cliaddress':
$schema = nn;
break;
case 'clicensus':
$schema = c;
break;
case 'clifollow':
$schema = 
nn;
break;
case

Re: [PHP] CRON throws error, but no command line problems

2003-12-19 Thread David OBrien
This is usually a DNS error. It's telling you it can't find an IP address 
for the given hostname
-Dave

At 08:57 AM 12/19/2003, Jay Blanchard wrote:
Good morning group!

I am running PHP 4.3.4RC1 on a FreeBSD sevrer that recently came online
as an upgrade from another server. (previous PHP version was 4.1.n) Via
a CRON job I am running a script that was working fine to ftp another
server, download some files, and then process those files. Here is the
code snippet where the failure occurs...
// ftp variables
$ftp_server = rc.foo.com;
$ftp_user = foo;
$ftp_pass = foopass;
// connect to ftp server
$ftpc = ftp_connect($ftp_server); --LINE 36
if(!ftp_login($ftpc, $ftp_user, $ftp_pass)){
echo Could not login to $ftp_server;
exit();
}
The CRON reports this

PHP Warning:  ftp_connect(): php_network_getaddresses: getaddrinfo
failed: No address associated with hostname in
/usr/local/www/data.default/crm/parsecdr.php on line 36
The only reference I could find to this problem was in
http://www.php.net/fopen which said that Apache should be restarted. I
have done the restart and I am for the CRON job to run again in the next
few minutes. While I am waiting has anyone ever seen this error? If so,
can you give me an idea of what I may need to do to fix the problem? I
would be so appreciative and will put in a good word with Santa for you.
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] strlen

2001-07-25 Thread David OBrien

I'm having a heck of a time getting something to work like it should

I have a script which reads a list of words one per line
I want it to display the length of the word a tab then the word. No matter
how I code it it still only shows the word alone on strlen. Any ideas?

?
$handle = fopen (./ospd3.txt, r);
while (!feof($handle)) {
$wordlist[]=fread($handle,4096);
}
fclose($handle);
uasort($wordlist, sortbylength);
foreach ($wordlist as $word) {
$lent = strlen($word);
print $lent.\t.$word.\n;
}
exit;


function sortbylength($arr,$brr) {
$alen = strlen($arr);
$blen = strlen($brr);
if ($alen == $blen) {
return 0;
}
return ($alen  $blen) ?  -1 : 1;
}
?

sample of the ospd3.txt

megacities
memorising
nitpickier
outpowered
outslicked
pinwheeled
prebooking
ratcheting
rebreeding
redialling
reexposing
repatching
romanising
showbizzes
sparkliest
suctioning
sunporches
vitreouses
whatnesses
windsurfed
zombifying
backdropped
backfitting
beglamoring
chainsawing
coanchoring
deadlifting

Thanks





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Something weird

2001-07-06 Thread David OBrien

I just installed a fresh RH 7.1 server with compiled apache and php 4.0.6


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Something weird

2001-07-06 Thread David OBrien

Sorry...

I just installed a fresh RH 7.1 server with compiled apache 1.3.16 and php 
4.0.6
if I make a change on a page it doesn't show


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Something weird

2001-07-06 Thread David OBrien

Half the message didn't get sent ...

If I manually do a apachectl restart the page updates with the correct 
changes on it
the other 3 apache / php servers I have all work correctly just this one on 
7.1 the rest are 6.2 redhat installs.
-Dave


At 02:04 PM 7/6/2001 -0400, David OBrien wrote:
Sorry...

I just installed a fresh RH 7.1 server with compiled apache 1.3.16 and php 
4.0.6
if I make a change on a page it doesn't show


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Having a heck of a time installing

2001-02-16 Thread David OBrien

I just build a new redhat 6.2 server (intel) to install php4 and apache on

I'm trying to compile php as an dso module.

Apache compiled and installed just great. WHen I try to build php4 woth the 
following

./configure --with-apxs=/www/bin/apxs --with-imap --with-gd 
--with-jpeg=/usr/lib --with-xpm-dir=/usr/X11R6/lib --with-png=dir=/usr/lib

I get the follow when I configure:
checking whether to enable truetype string function in gd... no
checking for libjpeg (needed by gd-1.8+)... no
configure: warning: If configure fails try --with-jpeg-dir=DIR
checking for libXpm (needed by gd-1.8+)... yes
checking for XpmFreeXpmImage in -lXpm... (cached) no
no
checking whether to include GD support... yes (static)
checking for gdImageString16 in -lgd... (cached) no
checking for gdImagePaletteCopy in -lgd... (cached) no
checking for gdImageColorClosestHWB in -lgd... (cached) no
checking for compress in -lz... (cached) no
checking for png_info_init in -lpng... (cached) no
checking for gdImageColorResolve in -lgd... (cached) no
checking for gdImageCreateFromPng in -lgd... (cached) no
checking for gdImageCreateFromGif in -lgd... (cached) no
checking for gdImageWBMP in -lgd... (cached) no
checking for gdImageCreateFromJpeg in -lgd... (cached) no
checking for gdImageCreateFromXpm in -lgd... (cached) no
checking whether to include FreeType 1.x support... yes
checking for T1lib support... no


I get this when I compile:

/usr/bin/ld: cannot find -lgd
collect2: ld returned 1 exit status
make[1]: *** [libphp4.la] Error 1
make[1]: Leaving directory `/tmp/apache/Apachetoolbox-1.5.2/src/php-4.0.4pl1'
make: *** [all-recursive] Error 1

these dirs are where the libs live. I can't see whats wrong. I added the 
above dirs to the path also
-Dave


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]