Re: [PHP] os php scheduler?

2007-01-22 Thread David Giragosian

On 1/20/07, blackwater dev <[EMAIL PROTECTED]> wrote:


Does anyone have recommendations for an open source php based,
'lightweight', scheduling app?  I just want something clean that I can use
to schedule trainings within our company.  I need to be able to put in
details for each training and then see a synopsis on a calender.  Just a
basic scheduler but clean and useful.

Thanks!



We've used something called Meeting Room Booking ... "System", I believe
(MRBS). It's been a great help.

David


Re: [PHP] DATE

2007-01-28 Thread David Giragosian


Ron Piggott wrote:
> I have date in the variable $date_reference in the format -MM-DD.
> How do I find out the date before this and the date after this?  Ron
>



Not enough information, Ron. Do you mean: 1. as exists in some data set that
you've created or stored, like in an array or a database; 2. in a general
sense, like a millisecond before and after, as in some increment/decrement
of linear time; 3. some other conceptual understanding of time, before and
after?

David


Re: [PHP] Parsing mail file

2007-01-30 Thread David Giragosian

On 1/30/07, Jay Blanchard <[EMAIL PROTECTED]> wrote:


[snip]
of course people read documentation before asking help
[/snip]

ROFLMMFAO! Sorry, that just made my day!



Wow. I learned a new acronym.

What a great day!

David


Re: [PHP] Re: Text Editor for Windows?

2007-02-09 Thread David Giragosian

I've been using SciTE for many years now.

http://www.scintilla.org/SciTE.html

It's small and lightweight, has code folding and bracket highlighting and a
lot of other nifty features.

I also have Zend Studio IDE Professional but it is slow and bloated compared
with SciTE.

2 more pennies...

David


Re: [PHP] Option Value

2007-02-23 Thread David Giragosian

On 2/23/07, Dan Shirah <[EMAIL PROTECTED]> wrote:


On my form I have several drop down menus.  They all work and display the
corrent values.  However, I would like the initial display of the form to
show each dropdown as blank.


$q_status = "SELECT * FROM status_codes ORDER BY status_description";
$r_status = mssql_query($q_status) or die(mssql_error());
while ($rec_status = mssql_fetch_assoc($r_status)) $status[] =
$rec_status;

foreach ($status as $s)
{
   if ($s['status_code'] == $_POST['status'])
 echo "{$s['status_description']}\n";
   else
 echo "{$s['status_description']}\n";
}

Any suggestions on how to make my initial display of the field blank
without
having to add a blank row to my table?



Meaning: you want the select box to show as a default value a blank line but
have the remaining data items from the db still in the drop-down list?  Then
you want to use the "selected" attribute on a blank line. Plenty of examples
available.

David


Re: [PHP] Magic Quotes

2007-02-23 Thread David Giragosian

On 2/23/07, Liz Kim <[EMAIL PROTECTED]> wrote:


I've got all three Magic Quote directives turned off...
When I use sql query to grab any string from a database, it still spits
out
the \ in front of the special characters..
Any ideas?
thanks



What's it look like in the database?

David


Re: [PHP] Multiple Submit

2007-02-26 Thread David Giragosian

I always use :

onClick=\"this.form.action='SomeOtherPage.php'; \"

inside the button tag.

Seems to work just fine.

David

On 2/26/07, Dan Shirah <[EMAIL PROTECTED]> wrote:


When I click on "save" at the bottom, I want it to check my form and
submit
all the values.  When I click on the "Retrieve" button I want it to submit
my order number to another page, and also carry over the $_POST value of
any
field that may have had info entered into it.

However, since I have a form within a form, it is giving me problems.


On 2/26/07, tedd <[EMAIL PROTECTED]> wrote:
>
> At 11:23 AM -0500 2/26/07, Dan Shirah wrote:
> >Hello all,
> >
> >I have a page that has multiple submits on it.  One submit is within my
> >javascriptfor form checking, the other submit is a button used to
> populate
> >all customer information if an order ID is entered.
> >
> >Problem:  I cannot get the two to coincide at the same time.  They both
> use
> >the submit function to send the data to the same page instead of their
> >unique individual pages.
>
> Nothing wrong with putting two forms on the same page and each with
> their own action and submit button.
>
> You can always add an attribute value (value=1) with each submit
> button so that you can determine later which page to redirect your
> attention.
>
> tedd
> --
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
>



Re: [PHP] Help with a within week function

2007-03-05 Thread David Giragosian

On 3/5/07, Jim Moseby <[EMAIL PROTECTED]> wrote:


>
> I have been trying to find a way to search a DB and match a
> range within a
> week ( php & mysql ).
>
> This doesn't make sense, so I will describe it in more detail.
>
>
>
> Hi everyone,
>
> I need help with a search, lets say a record has a date of
> 2/5/2007 and if
> someone visits the website between 2/5/07 and 2/11/07 I want
> to display the
> record with 2/5/2007.
>
> If it's within the week so to speak.
>
>
>
> Does anyone know how I can accomplish this?
>

(You might get better answers from the MySQL list when asking MySQL
questions.)

SELECT * from table where record_date between '$begin_date' and
'$end_date';

JM



There's probably a solution in here as well:

$queryLocation1 = "SELECT `mrem_per_hour` as `Loc1`,
 if((date_time >= DATE_SUB(now(), interval 2 minute)),
 'display', 'noDisplay') as `test`
 FROM   `location1`
 ORDER
 BY `date_time`
 DESC
 LIMIT 1";

David


Re: [PHP] Creating variable names from values

2007-03-08 Thread David Giragosian

On 3/8/07, Otto Wyss <[EMAIL PROTECTED]> wrote:


Satyam wrote:
>
> $key = 'K' . $key;
>if ($$key) {
>
> notice double dollar sign, it means, not the value of $key but the value
of
> the variable $key says.
>
Thanks, any idea where this is described in the PHP manual? Searching
for "$$" produces no results.

O. Wyss



This code fragment will produce a variable such as $yellow_7, for example,
where $aNumber is equal to 7. Then use it as any other variable.

${'yellow_' . $aNumber} = "assign something";

I've posted this example before, however, and the general consensus seems to
be to just use an array.

David


Re: [PHP] Posting variable outside of the post form

2007-03-12 Thread David Giragosian

On 3/12/07, Otto Wyss <[EMAIL PROTECTED]> wrote:


I submit a form back to itself with

  action="" methode="get"

yet I've a large PHP variable which I'd like to access afterwards as
well. Is this possible somehow?

O. Wyss



Cookie, session variable, session cookie, database layer...

David


Re: [PHP] "register_argc_argv" directive

2007-04-19 Thread David Giragosian

On 4/18/07, Richard Lynch <[EMAIL PROTECTED]> wrote:


On Wed, April 18, 2007 9:04 am, Bagus Nugroho wrote:
> I'm confuse about usage of php.ini directive "register_argc_argv".
> Is used for command line purpose only?

I suspect that in CGI (and possibly even FCGI) $argv and $argc may
also end up being populated, due to the way CGI works.

But, yes, essentially you'd be using those in CLI in most circumstances.

I'm not sure why you'd want to not fill in argv/argc in CLI...

But I suppose if you've got a fancy GetOPTS package of some sort
going, you might need that turned off or something...

Or maybe there's some sort of big time savings to turn them off...

There may even be Security Considerations for some people/cases where
having those off is "better"...

I'm just making up answers as I go here for why that setting might
even exist, but I guess somebody needed it sometime in the past.

--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



$argv and $argc came in way handy when I wrote several php-gtk apps a few
years ago, which uses the CLI exe version...

David


Re: [PHP] [X-POST] Fastest way to dump this huge table

2007-05-02 Thread David Giragosian

On 5/2/07, Richard Davey <[EMAIL PROTECTED]> wrote:


Brian Dunning wrote:

> I have a huge MySQL table, 2.1 million records, 200MB. Once a week I
> need to dump it in CSV format and zip the file.
>
> This is not on my server, and it's in production, so I don't want to
> risk testing different methods and possibly hanging up their server for
> a period of time, so I wanted to seek advice here first to find what's
> the best way to proceed.
>
> I can easily use PHP to query the table for the results I want and write
> a file line by line and then zip it, but I'm worried that might take too
> long and hang up the machine. The other way to go is some kind of sql
> dump command, which I guess would be faster, but not sure how much
> control I'd have over the exact format of the file. Any suggestions
> which way I should proceed? Not hanging up their server is my prime
> concern.

If hogging their server is of prime concern then ideally you either need
to (a) schedule down time for the site while the back-up happens, or (b)
replicate the data to another MySQL server, and back-up that.

I can't see any reason why you need to bring PHP into the equation here,
MySQL has more than enough native tools to do exactly what you need -
and probably a butt-load faster too.

Cheers,

Rich




Brian,

As a comparison, on a *nix master/slave configuration, I'm mysqldumping
nightly a database that's always growing and now is over a 1GB in size. The
dump takes about 20 seconds to finish. Assuming a linear relationship, your
200MB backup should only tie up the db server for around 5 seconds.

Bzipping the .sql file takes infinitiely longer, almost an hour, but a lower
compression ratio should take only 1/4 to 1/3 as long.

I'd say give some attention to the zip method you use.

HTH,

David


Re: [PHP] INSERT Array Values into mySQL Table

2007-05-02 Thread David Giragosian

On 5/2/07, Rahul S. Johari <[EMAIL PROTECTED]> wrote:



Ave,

Here¹s the thing, I¹ve got an Array which has it¹s own set of Keys =>
Values. I¹m using foreach() to read the Keys => Values like this:

   function pr1($var) {
   foreach ($var as $k => $v) {
   echo ³$k => $v²;
   }

I need to INSERT the Values from this array into a  mySQL table. The
problem
is, There is other data that is going into the same row of that mySQL
Table
as well.

So I have to basically insert 3 fields and then the rest of values I have
to
insert using this Array. In other words, this is what I have to do:

INSERT into table  (f1, f2, f3, f4, f5) VALUES (Œ$1¹, Œ$2¹, Œ$3¹, //and
the
rest of the values from from the $v Values from that Array $var.

I¹m not able to formulate a code to do this. Any help would be really
appreciated.




Either gather all the data together first, and then do an insert, or do an
insert on the 1st part, then update the record with the remaining data with
a where clause (Use last_insert_id() to track a primary key, or pass some
unique identifier from the insert to the update query). Personally, I'd find
a way to gather all the data first and do it all with one insert.

David


Re: [PHP] Cannot access file on Network Drive (Windows 2003)

2007-05-24 Thread David Giragosian

On 5/24/07, Richard Lynch <[EMAIL PROTECTED]> wrote:


On Wed, May 23, 2007 1:46 pm, Rahul Sitaram Johari wrote:
> Apache 2.2, PHP5 & mySQL 5 on Windows 2003.
> I have some files sitting on a Network Drive accessible on the Windows
> 2003
> Server. But my php script is not able to open the files.
>
> Let¹s say there¹s a database on X:\Transfer\test.dbf
> If I use:
>
> $db = dbase_open(³X:\Transfer\test.dbf², 0);
>
> It is not able to open the database. The X: Drive is a network drive.
> Any clues on how to make this happen?

Check permissions on that drive/share/file/directory?...

Google for "PHP Network Drive" and see if others have the same problem.

For all I know, the dang thing is just broken.  It is Windows, after
all. :-)



I had a similar problem with a mysqldump file that I was trying to copy
over, via a script, to a networked drive. The networked drive was on
a Novell share, and I could see it and copy just fine using windows explorer
but nothing I did ever allowed me to copy via the script. I even had Apache
installed as a service on the windows box and had all permissions as open as
possible on all directories just to test. I finally gave up and did it from
a Linux server using ncpfs to mount the Novell drive.

FWIT,

David


Re: [PHP] Because you guys/gals/girls/women/insert pc term here are a smart lot

2009-01-07 Thread David Giragosian
On 1/7/09, Jim Lyons  wrote:
>
> There are other factors.  If a table is completely fixed in size it makes
> for a faster lookup time since the offset is easier to compute.  This is
> true, at least, for myisam tables.  All books on tuning that I have read
> have said the CHAR makes for more efficient lookup and comparison that
> VARCHAR.
>
> Also, I was told by the instructor at a MySQL class that all VARCHAR
> columns
> are converted to CHAR when stored in memory.  Can anyone else confirm this?


That's my recollection, also, derived from a MySQL class. IIRC, the char
length is equal to the longest varchar record in the column.

David


Re: [PHP] IDE

2007-11-15 Thread David Giragosian
On 11/15/07, Jammer <[EMAIL PROTECTED]> wrote:
>
> Børge Holen wrote:
> > On Thursday 15 November 2007 21:35:04 Jammer wrote:
> >> Hi All,
> >>
> >> This is my first post here ... I'm very much a newbie to php but work
> >> during the day using SQL Server, VS2005 and Foxpro.  Looking to gen up
> >> on my PHP.
> >>
> >> Are there any IDE's for PHP worth checking out.  Particularly free
> ones!
> >>
> >> TIA,
> >>
> >> --
> >> jammer
> >> www.jammer.biz
> >
> > I LOVE this IDE quiz'
> > the same answers everytime.
>
> duh!
>
> look, i'm really sorry everyone ... we all make mistakes!
>
> if this is a question that comes up as often as it appears from the
> responses this thread has generated maybe the FAQ needs to *really*
> address that?
>
> http://uk3.php.net/FAQ.php
>
> --
> jammer
>
It's OK. I think there's been a long thread on the subject each of the last
two weeks. The folks who are really passionate about their IDE's jump in
first, then those less motivated or less interested add theirs, then it
seems to die for a day or so before it rises from the ashes to sputter and
hiccup a time or two. And then it starts all over, again.

If you stick around long enough on this list, you'll be fussin' at the
question, too.

David


Re: [PHP] tell me :which book is good for newman??

2007-11-17 Thread David Giragosian
On 11/17/07, joychen <[EMAIL PROTECTED]> wrote:
>
> tell me :which book is good for newman??


You mean paul?


Re: [PHP] two small issues with php mail

2007-11-19 Thread David Giragosian
On 11/19/07, Philip Thompson <[EMAIL PROTECTED]> wrote:
>
> On Nov 19, 2007 5:52 PM, Brad <[EMAIL PROTECTED]> wrote:
>
> > Why are you being to belligerent?
> > English 101-104 I have aced.
> > Top secret security clearance I maintain.
> > Concatenate I know well (why would I combine the from, and the bcc?)
>
>
> I will refrain from the rest of the posts/slams and stick to your question
> in the (...).
>
> "From" and "Bcc" are *BOTH* part of the headers - that's why you want to
> concatenate them. By not using the . (dot), you are over-writing the
> "From"
> line.
>
> Bad/Pointless assignment:
> $headers = "From: ...";
> $headers = "Bcc: ...";
>
> Good/Useful assignment:
> $headers = "From: ...";
> $headers .= "Bcc: ...";
>
> Good luck.
> ~Philip
>

Brad,

If Philip's suggestion doesn't fix the problem, please post the relevant
code, again.

I've lost track of your original question.

David


[PHP] Dynamic Display of Images Stored in DB

2007-11-28 Thread David Giragosian
Good Afternoon All,

The recent threads about images got me to finally experiment with storing
into and retrieving/displaying images from a database.
Uploading and retrieval is fine, I'm just a bit uncertain about creating the
dynamic display part.

// getting the data out of the db
$imageCountinDB = 0;
$selectedData = @mysql_query("select title, imagedata from pictures order by
pid desc");
while ( $row = @mysql_fetch_assoc($selectedData )) {
$title[] = htmlentities( $row['title'] );
$imageBytes[] = htmlentities( $row['imagedata'] );
$imageCountinDB++;
}

// creating the an html table with one img tag per cell
if ( IsSet( $_GET['im'] ) && $imageCountInDB > 0 ) {
$imageOutputStr = "";
for ( $i = 0; $i < $imageCountinDB; $i++ ) {
$setID = $i + 1;
$imageOutputStr .= "";
if ( $setID % 3 == 0 && $imageCountinDB > $setID ) {
$imageOutputStr .= "\n";
}
}
 $imageOutputStr .= "";
}

// associating the image data with the img tags
switch ($_GET['im']) {
   case 1: header("Content-type: image/jpeg");
   print $bytes[0];
   exit ();
   break;
   case 2: header("Content-type: image/jpeg");
   print $bytes[1];
   exit ();
   break;

 (snip)
}










The question is, with all this happening in one page, is it possible to do
the last bit dynamically?

BTW, the core of the above was nicked from
http://www.wellho.net/solutions/php-example-php-form-image-upload-store-in-mysql-database-retreive.html

Thanks very much for reading this long post.

David


Re: [PHP] Dynamic Display of Images Stored in DB

2007-11-28 Thread David Giragosian
On 11/28/07, Jochem Maas <[EMAIL PROTECTED]> wrote:
>
> you need a *seperate* script that outputs the image data only (+ relevant
> headers)
> and then you refer to that script (passing it a suitable parameter so it
> knows
> which image to output) in the src attribute of an IMG tag.
>
> you seem to be trying to output image data and html in a single request,
> which
> won't work (well actually there is a way to embed the raw image data
> directly in
> the html but AFAICR, but that's somewhat too tricky to cover right now
> given that
> your still trying to grok the basics of this - no offence intended)
>
> or have I misunderstood your question?
>
> David Giragosian wrote:
> > Good Afternoon All,
> >
> > The recent threads about images got me to finally experiment with
> storing
> > into and retrieving/displaying images from a database.
> > Uploading and retrieval is fine, I'm just a bit uncertain about creating
> the
> > dynamic display part.
> >
> > // getting the data out of the db
> > $imageCountinDB = 0;
> > $selectedData = @mysql_query("select title, imagedata from pictures
> order by
> > pid desc");
> > while ( $row = @mysql_fetch_assoc($selectedData )) {
> > $title[] = htmlentities( $row['title'] );
> > $imageBytes[] = htmlentities( $row['imagedata'] );
> > $imageCountinDB++;
> > }
> >
> > // creating the an html table with one img tag per cell
> > if ( IsSet( $_GET['im'] ) && $imageCountInDB > 0 ) {
> > $imageOutputStr = "";
> > for ( $i = 0; $i < $imageCountinDB; $i++ ) {
> > $setID = $i + 1;
> > $imageOutputStr .= " > width=300>";
> > if ( $setID % 3 == 0 && $imageCountinDB > $setID ) {
> > $imageOutputStr .= "\n";
> > }
> > }
> >  $imageOutputStr .= "";
> > }
> >
> > // associating the image data with the img tags
> > switch ($_GET['im']) {
> >case 1: header("Content-type: image/jpeg");
> >print $bytes[0];
> >exit ();
> >break;
> >case 2: header("Content-type: image/jpeg");
> >print $bytes[1];
> >exit ();
> >break;
> >
> >  (snip)
> > }
> >
> > 
> > 
> >
> > 
> >
> > 
> > 
> >
> >
> > The question is, with all this happening in one page, is it possible to
> do
> > the last bit dynamically?
> >
> > BTW, the core of the above was nicked from
> >
> http://www.wellho.net/solutions/php-example-php-form-image-upload-store-in-mysql-database-retreive.html
> >
> > Thanks very much for reading this long post.
> >
> > David
> >
>
>
Thing is, the above works just fine as long as I hard code a switch case for
every image file pulled from the db. What I can't seem to do is dynamically
extend it to include newly uploaded images, i.e., for an image count greater
than what I've hard coded. I thought maybe something like 'eval' might be
used (I know, if eval is the answer, I'm asking the wrong question). To be
honest, I don't even know _why_ the above works because it seems that stuff
is happening as if in a while loop when there isn't one (the switch case
part).

For the moment, I'd be happy to just understand how it works as it does.
Maybe as you suggest, there is raw image data somehow being embedded in the
html.

On a peripherally related note, I did learn that syntax like  looks like this in the page source:
http://www.mypage.php?im=6>.

Never liked the short-hand stuff...

Thanks, Jochem, for responding.

David


Re: [PHP] Dynamic Display of Images Stored in DB

2007-11-29 Thread David Giragosian
On 11/28/07, Chris <[EMAIL PROTECTED]> wrote:
>
>
> > In my solution, I use two scripts. One for showing the image true size
> > and another for generating a thumbnail -- I may be wrong, but I think
> > it's better to generate a thumbnail as needed on the fly than it is to
> > store both images (large and thumbnail) in the dB.
>
> Cache it on the filesystem even if it's for a short time (of course if
> the image is updated elsewhere the cache needs to be cleared as well..).
>
>
> 
> $file = '/path/to/cache/file.jpg';
> if (file_exists($file)) {
>   if (filemtime($file) > strtotime('-30 minutes')) {
> $fp = fopen($file, 'rb');
> fpassthru($fp);
> exit;
>   }
>
>   // the file is older than 30 minutes, kill it and start again.
>   unlink($file);
> }
>
> // continue creating your thumbnail.
>
> $fp = fopen('/path/to/cache/' . $filename, 'wb');
> fputs($fp, $imagecontents);
> fclose($fp);
>
> // display image
>
> --


Thanks for all the suggestions, guys. I was really trying to understand,
through extending it, the code from the reference (
http://www.wellho.net/solutions/php-example-php-form-image-upload-store-in-mysql-database-retreive.html
 ).

David


Re: [PHP] Maps

2007-12-06 Thread David Giragosian
On 12/6/07, Richard Lynch <[EMAIL PROTECTED]> wrote:
>
> Yes, you can do that, and look at Yahoo! maps as an alternative.
>
> Same smell. :-)
>
> On Wed, December 5, 2007 12:27 pm, Robert Fitzpatrick wrote:
> > Well, I have two clients that both want mapping for their sales
> > people.
> > I have been looking at the Google API and Phoogle
> > (www.systemsevendesigns.com/phoogle). I assume with these examples I
> > will be able to produce what they need? Which is to select several
> > addresses and produce a fastest route map with directions to those
> > addresses from a start address. Not clear from my reading yet, but can
> > someone with some experience tell me if this is possible with the
> > Google
> > API or some hints that might speed up my process of the best way to go
> > for this...
> >
> > Thanks in advance!
> >
> > --
> > Robert
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
> --
> Some people have a "gift" link here.
> Know what I want?
> I want you to buy a CD from some indie artist.
> http://cdbaby.com/from/lynch
> Yeah, I get a buck. So?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Welcome back, Richard.

David


Re: [PHP] temp tables mysql OT

2007-12-13 Thread David Giragosian
On 12/13/07, Robert Cummings <[EMAIL PROTECTED]> wrote:
>
> On Thu, 2007-12-13 at 10:14 -0500, tedd wrote:
> > At 12:20 PM +0100 12/13/07, Zoltán Németh wrote:
> > >2007. 12. 12, szerda keltezéssel 20.13-kor tedd ezt írta:
> > >  > I would like to create a temporary table to perform searches.
> > >>
> > >>   From my main table, I need to exclude records that have certain
> > >>  fields that are null or empty; and then sort the final result.
> > >
> > >why do you need a temp table for that?
> > >select * from blah where not isnull(checkfield) and checkfield <> ''
> > >order by someotherfield
> >
> > Zoltán:
> >
> > Ok, here's the problem.
> >
> > I have a table with over 5000 records.
> >
> > There is no index (not my dB) and the records are not complete.
> >
> > There is a numeric product_id field, but in the dB this is not in
> sequence.
> >
> > Some records have a product_id, but no product_name.
> >
> > I need to travel the dB showing each item in
> > order (product _id) and excluding those products
> > that have no product_name.
> >
> > That sounds simple enough, but currently for each
> > step the entire table gets sorted (unless I'm
> > doing it wrong).
> >
> > I was thinking that I could:
> >
> > 1. Create a temporary table.
> > 2. Sort the table once.
> > 3. Remove the records that have no product_name
> > 4. And then just travel the temporary table for the duration of the
> script.
> > 5. Drop the table when done with it.
> >
> > Now, what's wrong with my thinking?
>
> This is what you reeally want IMHO:
>
>ALTER TABLE theTable ADD INDEX( product_id );
>
> Cheers,
> Rob.
> --
> ...
> SwarmBuy.com - http://www.swarmbuy.com
>
>Leveraging the buying power of the masses!
> ...
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
tedd,

I have multiple tables in a mysql db that have over 1.3 million indexed
records, and selecting the latest 60 records is quick as a bunny, so 5000
records should be a piece of cake.

Also, there is no guarantee of record order in a result set without an order
by clause, which obviously affects sorting.

Rob's suggestion should certainly improve performance.

David


[PHP] Multiple File Downloads

2007-12-14 Thread David Giragosian
I've used Richard Lynch's Blog example for forcing the download of an
individual file.

Is there a way to download multiple files in one go, short of zipping them
first into a single file?

Concepts / directional shoves appreciated.

David


Re: [PHP] Multiple File Downloads

2007-12-14 Thread David Giragosian
On 12/14/07, Jason Pruim <[EMAIL PROTECTED]> wrote:
>
>
> On Dec 14, 2007, at 3:37 PM, Daniel Brown wrote:
>
> > On Dec 14, 2007 3:32 PM, David Giragosian <[EMAIL PROTECTED]>
> > wrote:
> >> I've used Richard Lynch's Blog example for forcing the download of an
> >> individual file.
> >>
> >> Is there a way to download multiple files in one go, short of
> >> zipping them
> >> first into a single file?
> >>
> >> Concepts / directional shoves appreciated.
> >
> >I wouldn't think so, Dave, because headers for each file need to
> > be sent at the request for download, and headers cannot be sent after
> > the header buffer has ended (when the data buffer is being sent).
>
>
> I may be showing my ignorance of what can be done... But couldn't you
> write a script in PHP (Or some other language) that would link to a
> bunch of files and send each one individually to the browser as a
> separate file? something like:
>
> 
> $filesArray(file1, file2, file3);
> foreach($filesArray)
> $header ="Blah blah balh"
> $header .="More blah blah blah"
>
> Or am I way off base as usual? :)
>
>
> --
>
> Jason Pruim
> Raoset Inc.
> Technology Manager
> MQC Specialist
> 3251 132nd ave
> Holland, MI, 49424
> www.raoset.com
> [EMAIL PROTECTED]


My original thought was as Daniel suggested, but I had a similar cognitive
storm, Jason, and I gave it a try.

I didn't get any headers already sent error messages, but only the last file
in the array was downloaded.

David


Re: [PHP] Multiple File Downloads

2007-12-14 Thread David Giragosian
On 12/14/07, Daniel Brown <[EMAIL PROTECTED]> wrote:
>
> On Dec 14, 2007 4:24 PM, Daniel Brown <[EMAIL PROTECTED]> wrote:
> > On Dec 14, 2007 3:32 PM, David Giragosian <[EMAIL PROTECTED]> wrote:
> >
> > > I've used Richard Lynch's Blog example for forcing the download of an
> > > individual file.
> > >
> > > Is there a way to download multiple files in one go, short of zipping
> them
> > > first into a single file?
> > >
> > > Concepts / directional shoves appreciated.
> >
> > You could use AJAX, JavaScript, or AJAX to make multiple requests
> > to download various files simultaneously.  That would pop up the
> > different boxes.
>
>TFGIF.  That should read " AJAX, JavaScript, or IFRAMEs"
>
> --
> Daniel P. Brown
> [Phone Numbers Go Here!]
> [They're Hidden From View!]
>
> If at first you don't succeed, stick to what you know best so that you
> can make enough money to pay someone else to do it for you.
>


> TFGIF

Indeed, Daniel.  ;-}

Thanks for the link, Andrew. I saw it earlier myself but didn't look too
closely at it because I don't know ASP at all. Does anyone understand how
the files will be sent to the client? Are they going to end up as links on a
web page?

David


Re: [PHP] Multiple File Downloads

2007-12-14 Thread David Giragosian
On 12/14/07, Benjamin Darwin <[EMAIL PROTECTED]> wrote:
>
> Aww, we have to wait all the way to Monday? It's fun to sit back and
> watch the conversations on here!
>
> And I call third-ed on that... is that the right word?
>
> --Ben
>
> On Dec 14, 2007 4:40 PM, Daniel Brown <[EMAIL PROTECTED]> wrote:
> >
> >
> > You, too, Rob.  And to all else, make that seconded by me.
> >
> >Report back here Monday for another week of droning.
> >
> >
> > --
> > Daniel P. Brown
> > [Phone Numbers Go Here!]
> > [They're Hidden From View!]
> >
> > If at first you don't succeed, stick to what you know best so that you
> > can make enough money to pay someone else to do it for you.
> >
> > --
> >
> >
> >
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
> --
> Benjamin Darwin
>
> President, Crew 99
> (Insert Phone Number Here)
> [EMAIL PROTECTED]
>
> "Dream as if you'll live forever, live as if you'll die today." ~James
> Dean
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Since I'm still at work, I'll pass on the humor ( though "these pretzels are
making me thirsty..." ), but I think creating a page with multple links to
the downloads will work.

Thanks, for the push, guys and gals.

David


Re: [PHP] Re: Multiple File Downloads

2007-12-15 Thread David Giragosian
On 12/15/07, Al <[EMAIL PROTECTED]> wrote:
>
> What are the files and what are you going to do with them at the client?


They are going to be .csv files extracted from a DICOM treatment plan file.



> If they are to be an image mosaic, then compose it first and then send it.
>
> If text docs, compose as a pdf and send it.


That's a good idea.


if just files, bundle them in a compressed file and let the user click on it
> to
> open the file.


Probably the most expedient solution.


Thanks Al, and all.

David


Re: [PHP] First stupid post of the year.

2008-01-02 Thread David Giragosian
On 1/2/08, Nathan Nobbe <[EMAIL PROTECTED]> wrote:
>
> On Jan 2, 2008 1:34 PM, tedd <[EMAIL PROTECTED]> wrote:
>
> > Hi gang:
> >
> > I have a
> >
> > $submit = $_POST['submit'];
> >
> > The string contains:
> >
> >        A       
> >
> > (it's there to make a submit button wider)
> >
> > How can I strip out the " " from the $submit string leaving "A"?
> >
> > I've tried
> >
> >trim($submit);
> >
> > but, that don't work.
> >
> > Neither does:
> >
> >$submit = str_replace(' ','',$submit);
> >
> > or this:
> >
> >$submit = str_replace(' ';','',$submit);
> >
> > I should know what to do, but in this case I don't.
> >
> > Help is always appreciated.
>
>
> why dont you just style the button w/ css?
>
> style="width:200px"
>
> -nathan
>

Parse the string character by character discarding '&' , 'n' , 'b' , 's'
, 'p' , and  ';'. Assuming of course that the part of the label you want to
keep is none of those characters.

-David


Re: [PHP] handling ' with mysql/php insert and select

2008-01-03 Thread David Giragosian
On 1/3/08, Adam Williams <[EMAIL PROTECTED]> wrote:
>
> In my form, I am parsing all the text inputs through
> mysql_real_escape_string() before inserting the data.  however, when I
> look at the SQL query in PHP, when I type the word blah's to my text box
> variable, and then insert it into mysql after being ran through
> mysql_real_escape_string(), it does:
>
> insert into contract (contract_id, responsibility) VALUES (15,
> 'blah\\\'s')
>
> and when I query the in mysql/PHP it shows:
>
> select responsibility from contract where contract_id = 15;
> ++
> | responsibility |
> ++
> | blah\'s|
> ++
> 1 row in set (0.00 sec)
>
> and when I run that select statement in PHP it prints blah\'s on the
> screen.  I want it to print back blah's without the \.  So what are my
> options?  run every variable through stripslashes(); before printing
> them to the screen?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Andy,

The magic quotes directive is likely set to "on" in php.ini.

Set it to 0 (zero) or 'Off'.

David


Re: [PHP] uh oh, I defined a resoruce

2008-01-10 Thread David Giragosian
On 1/10/08, Eric Butera <[EMAIL PROTECTED]> wrote:
>
> On Jan 10, 2008 2:02 PM, Philip Thompson <[EMAIL PROTECTED]> wrote:
> > On Jan 10, 2008, at 12:48 PM, Eric Butera wrote:
> >
> > > On Jan 10, 2008 1:33 PM,  <[EMAIL PROTECTED]> wrote:
> > >> I have been using define to create a constant for the link resource
> > >> returned by mysql
> > >> pconnect like so:
> > >>
> > >> $PL = @mysql_pconnect("localhost", $DBUser, $DBPass);
> > >> define("SITE_DB",$PL);
> > >>
> > >>
> > >> Later I use the constant to select my databases.
> > >>
> > >> mysql_select_db($SrcdbID ,SITE_DB);
> > >>
> > >> This code seems to be working as I expected and I have many
> > >> thousands of llines of code
> > >> done over several years using this construct.
> > >>
> > >> But, I happened to be reading the php doco today and noticed that
> > >> you are not supposed to
> > >> use define for resources, so question is, is what I am doing safe
> > >> or am I going to run into
> > >> problems and if so what is the best way to globally pass resources
> > >> to multiple classes and
> > >> functions, command line scripts etc?
> > >>
> > >>
> > >> Cheers
> > >> Charlie Reese
> > >>
> > >>
> > > Hi Charlie!
> > >
> > > Well a CONSTANT is a value that doesn't change.  I don't think that
> > > makes sense for a DB connection.  The connection command returns a
> > > resource that could be different on each request depending on if
> > > you've worked on different resources.
> > >
> > > You could just do this:
> > > $GLOBALS['SITE_DB'] = @mysql_pconnect("localhost", $DBUser, $DBPass);
> > >
> > > Then inside your function reference it like this:
> > > mysql_query($sql, $GLOBALS['SITE_DB']);
> > >
> > > This would be an easy mass find/replace that you could do.  Global
> > > variables are evil though.
> > >
> > > I personally use the registry pattern to hold an instance of the
> > > database connection that can be lazy loaded whenever I need it.  Then
> > > inside of my gateway objects I pass that instance in the constructor
> > > so they only have to know how to work with its interface.  If you're
> > > okay with using object that might be a nice road to travel.  You could
> > > also use the singleton pattern but I would advise against that because
> > > what if you wanted 2 instances for different databases?  I've never
> > > ran across this myself but you never know.  Plus it makes unit testing
> > > a little tricky since you can't mock it as easily.
> > >
> > > Hopefully something in all this will help you to an answer.
> >
> >
> > I don't agree that "Global variables are evil." If you have a valid
> > purpose for defining a global variable, then go with it. The usual
> > argument is that it could accidentally be changed elsewhere (and there
> > are several more). However, defining a variable that you KNOW you're
> > going to use only for a database connection, IMO, is perfectly fine.
> >
> > $GLOBALS['SITE_DB'] = @mysql_pconnect("localhost", $DBUser, $DBPass);
> >
> > If you accidently change $GLOBALS['SITE_DB'] elsewhere, then I think
> > you have some bigger issues at hand. =P HTH.
> >
> > ~Philip
> >
> > "Personally, most of my web applications do not have to factor 13.7
> > billion years of space drift in to the calculations, so PHP's rand
> > function has been great for me..." ~S. Johnson
> >
> > --
> >
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
> Depending on what project I'm working on sometimes I use specific
> globals on our older procedural code because:
>
> 1) It is our code
> 2) It does not use outside code
> 3) I'm the only developer working on it
> 4) It is very simplistic
>
> By specific globals I mean that I have a "namespaced" entry such as
> $GLOBALS['ericonly']['db'] and put things inside of ericonly.  I
> basically only use this for database connections and a few other very
> specific things.
>
> Aside from that I'm not going to argue the merits of globals.  Someone
> else can do that as I've made up my mind and so have you. :)
>
> But just to prove that I'm right
> http://www.google.com/search?hl=en&q=global+variables+are+evil&btnG=Search
> :D


Well...

Personalized Results *1* - *10* of about *121,000* for
*global
variablesare
evil
*. (*0.10* seconds)

Personalized Results *1* - *10* of about *4,330,000* for
*global

Re: [PHP] uh oh, I defined a resoruce

2008-01-10 Thread David Giragosian
On 1/10/08, Eric Butera <[EMAIL PROTECTED]> wrote:
>
> On Jan 10, 2008 2:28 PM, David Giragosian <[EMAIL PROTECTED]> wrote:
> >
> > On 1/10/08, Eric Butera <[EMAIL PROTECTED]> wrote:
> > >
> > > On Jan 10, 2008 2:02 PM, Philip Thompson <[EMAIL PROTECTED]>
> wrote:
> > > > On Jan 10, 2008, at 12:48 PM, Eric Butera wrote:
> > > >
> > > > > On Jan 10, 2008 1:33 PM,  <[EMAIL PROTECTED]> wrote:
> > > > >> I have been using define to create a constant for the link
> resource
> > > > >> returned by mysql
> > > > >> pconnect like so:
> > > > >>
> > > > >> $PL = @mysql_pconnect("localhost", $DBUser, $DBPass);
> > > > >> define("SITE_DB",$PL);
> > > > >>
> > > > >>
> > > > >> Later I use the constant to select my databases.
> > > > >>
> > > > >> mysql_select_db($SrcdbID ,SITE_DB);
> > > > >>
> > > > >> This code seems to be working as I expected and I have many
> > > > >> thousands of llines of code
> > > > >> done over several years using this construct.
> > > > >>
> > > > >> But, I happened to be reading the php doco today and noticed that
> > > > >> you are not supposed to
> > > > >> use define for resources, so question is, is what I am doing safe
> > > > >> or am I going to run into
> > > > >> problems and if so what is the best way to globally pass
> resources
> > > > >> to multiple classes and
> > > > >> functions, command line scripts etc?
> > > > >>
> > > > >>
> > > > >> Cheers
> > > > >> Charlie Reese
> > > > >>
> > > > >>
> > > > > Hi Charlie!
> > > > >
> > > > > Well a CONSTANT is a value that doesn't change.  I don't think
> that
> > > > > makes sense for a DB connection.  The connection command returns a
> > > > > resource that could be different on each request depending on if
> > > > > you've worked on different resources.
> > > > >
> > > > > You could just do this:
> > > > > $GLOBALS['SITE_DB'] = @mysql_pconnect("localhost", $DBUser,
> $DBPass);
> > > > >
> > > > > Then inside your function reference it like this:
> > > > > mysql_query($sql, $GLOBALS['SITE_DB']);
> > > > >
> > > > > This would be an easy mass find/replace that you could do.  Global
> > > > > variables are evil though.
> > > > >
> > > > > I personally use the registry pattern to hold an instance of the
> > > > > database connection that can be lazy loaded whenever I need
> it.  Then
> > > > > inside of my gateway objects I pass that instance in the
> constructor
> > > > > so they only have to know how to work with its interface.  If
> you're
> > > > > okay with using object that might be a nice road to travel.  You
> could
> > > > > also use the singleton pattern but I would advise against that
> because
> > > > > what if you wanted 2 instances for different databases?  I've
> never
> > > > > ran across this myself but you never know.  Plus it makes unit
> testing
> > > > > a little tricky since you can't mock it as easily.
> > > > >
> > > > > Hopefully something in all this will help you to an answer.
> > > >
> > > >
> > > > I don't agree that "Global variables are evil." If you have a valid
> > > > purpose for defining a global variable, then go with it. The usual
> > > > argument is that it could accidentally be changed elsewhere (and
> there
> > > > are several more). However, defining a variable that you KNOW you're
> > > > going to use only for a database connection, IMO, is perfectly fine.
> > > >
> > > > $GLOBALS['SITE_DB'] = @mysql_pconnect("localhost", $DBUser,
> $DBPass);
> > > >
> > > > If you accidently change $GLOBALS['SITE_DB'] elsewhere, then I think
> > > > you have some bigger issues at hand. =P HTH.
> > > >
> > > > ~Philip
> > > >
> > > > &qu

Re: [PHP] uh oh, I defined a resoruce

2008-01-10 Thread David Giragosian
On 1/10/08, David Giragosian <[EMAIL PROTECTED]> wrote:
>
>  On 1/10/08, Eric Butera <[EMAIL PROTECTED]> wrote:
> >
> > On Jan 10, 2008 2:28 PM, David Giragosian <[EMAIL PROTECTED] >
> > wrote:
> > >
> > > On 1/10/08, Eric Butera <[EMAIL PROTECTED]> wrote:
> > > >
> > > > On Jan 10, 2008 2:02 PM, Philip Thompson < [EMAIL PROTECTED]>
> > wrote:
> > > > > On Jan 10, 2008, at 12:48 PM, Eric Butera wrote:
> > > > >
> > > > > > On Jan 10, 2008 1:33 PM,  <[EMAIL PROTECTED] > wrote:
> > > > > >> I have been using define to create a constant for the link
> > resource
> > > > > >> returned by mysql
> > > > > >> pconnect like so:
> > > > > >>
> > > > > >> $PL = @mysql_pconnect("localhost", $DBUser, $DBPass);
> > > > > >> define("SITE_DB",$PL);
> > > > > >>
> > > > > >>
> > > > > >> Later I use the constant to select my databases.
> > > > > >>
> > > > > >> mysql_select_db($SrcdbID ,SITE_DB);
> > > > > >>
> > > > > >> This code seems to be working as I expected and I have many
> > > > > >> thousands of llines of code
> > > > > >> done over several years using this construct.
> > > > > >>
> > > > > >> But, I happened to be reading the php doco today and noticed
> > that
> > > > > >> you are not supposed to
> > > > > >> use define for resources, so question is, is what I am doing
> > safe
> > > > > >> or am I going to run into
> > > > > >> problems and if so what is the best way to globally pass
> > resources
> > > > > >> to multiple classes and
> > > > > >> functions, command line scripts etc?
> > > > > >>
> > > > > >>
> > > > > >> Cheers
> > > > > >> Charlie Reese
> > > > > >>
> > > > > >>
> > > > > > Hi Charlie!
> > > > > >
> > > > > > Well a CONSTANT is a value that doesn't change.  I don't think
> > that
> > > > > > makes sense for a DB connection.  The connection command returns
> > a
> > > > > > resource that could be different on each request depending on if
> > > > > > you've worked on different resources.
> > > > > >
> > > > > > You could just do this:
> > > > > > $GLOBALS['SITE_DB'] = @mysql_pconnect("localhost", $DBUser,
> > $DBPass);
> > > > > >
> > > > > > Then inside your function reference it like this:
> > > > > > mysql_query($sql, $GLOBALS['SITE_DB']);
> > > > > >
> > > > > > This would be an easy mass find/replace that you could
> > do.  Global
> > > > > > variables are evil though.
> > > > > >
> > > > > > I personally use the registry pattern to hold an instance of the
> >
> > > > > > database connection that can be lazy loaded whenever I need
> > it.  Then
> > > > > > inside of my gateway objects I pass that instance in the
> > constructor
> > > > > > so they only have to know how to work with its interface.  If
> > you're
> > > > > > okay with using object that might be a nice road to travel.  You
> > could
> > > > > > also use the singleton pattern but I would advise against that
> > because
> > > > > > what if you wanted 2 instances for different databases?  I've
> > never
> > > > > > ran across this myself but you never know.  Plus it makes unit
> > testing
> > > > > > a little tricky since you can't mock it as easily.
> > > > > >
> > > > > > Hopefully something in all this will help you to an answer.
> > > > >
> > > > >
> > > > > I don't agree that "Global variables are evil." If you have a
> > valid
> > > > > purpose for defining a global variable, then go with it. The usual
> >
> > > > > argument is that it could accidentally be changed elsewhere (and
> > there
> > >

Re: [PHP] Posting Summary for Week Ending 11 January, 2008: php-general@lists.php.net

2008-01-12 Thread David Giragosian
On 1/12/08, Scott Wilcox <[EMAIL PROTECTED]> wrote:
>
> well thats just no good is it :P
>
> Thats pretty funky, congrats on the concept and implementation :)
>
> Daniel Brown wrote:
> > On Jan 11, 2008 4:11 PM, Jason Pruim <[EMAIL PROTECTED]> wrote:
> >
> >> Hate to shot a hole in your script Dan... But my posts aren't
> >> listed :P and I had a few on Jan 8 :)
> >>
> >> Where should I file a bug report?
> >>
> >
> > Well, that's the other interesting thing.  As Tedd and David from
> > the list know, on the morning of 8 January, there was a total disk
> > failure, which was immediately followed by some sort of
> > miscommunication at the datacenter.  The server just finally had the
> > drive replaced and the server placed back online this afternoon.  So
> > we'll apparently have to wait until next week to see accurate weekly
> > results.
> >
> >
>

It will be interesting to see what effect the statistical reporting of posts
will have on the number of posts, individually and collectively, made to the
list.

"Heisenberg's Uncertainty Principle" anyone?

David


Re: [PHP] uh oh, I defined a resoruce

2008-01-13 Thread David Giragosian
On 1/13/08, Naz Gassiep <[EMAIL PROTECTED]> wrote:
>
>
> >> While "global variables are good" in quotes did not return any results
> >> from Google, "global variables are evil" in quotes only returned a
> result
> >> set of 4:
> >>
> >> Results *1* - *4* of *4* for *" global<
> http://www.google.com/url?sa=X&oi=dict&ei=-nyGR539MKjIgQT1hKC7Bg&sig2=Gorx1ErPpjplcNDVa0qb6g&q=http://www.answers.com/global%26r%3D67&usg=AFQjCNFszs4YfNg7ok3-m08IgyrhO5EAsQ
> >
> >> variable<
> http://www.google.com/url?sa=X&oi=dict&ei=-nyGR539MKjIgQT1hKC7Bg&sig2=vCOY79teeScIcrxuvb6k3g&q=http://www.answers.com/variable%26r%3D67&usg=AFQjCNEzQBZwfNnJ4pr1pnYOXYttJJNkvg
> >are
> >> evil<
> http://www.google.com/url?sa=X&oi=dict&ei=-nyGR539MKjIgQT1hKC7Bg&sig2=eh8-cXxXIwGuHRJhXG2REQ&q=http://www.answers.com/evil%26r%3D67&usg=AFQjCNHcgNJwcVKoYcSB_Ks5OMr4LnAXWw
> >
> >> "*
> >> **
> >> Hardly an overwhelming argument by using search results as a measure.
> >>
> >> David
> >>
> >>
> >
> > Nevermind. I forgot the 's'.
> >
> > Once again:
> >
> > Personalized Results *1* - *8* of *8* for
> > *"global<
> http://www.google.com/url?sa=X&oi=dict&ei=joCGR9SjMp2wgATIv4HWBg&sig2=RNnAskxl87Jpwe85XDzyvg&q=http://www.answers.com/global%26r%3D67&usg=AFQjCNFkKRqMEPNyoEfdOeatXZo5_51d5Q
> >
> > variables<
> http://www.google.com/url?sa=X&oi=dict&ei=joCGR9SjMp2wgATIv4HWBg&sig2=b_YKTOej3C0R3RD0QrZUwA&q=http://www.answers.com/variables%26r%3D67&usg=AFQjCNGXzEwYW9a5HoADskUH1aTT5OIvsg
> >are
> > good<
> http://www.google.com/url?sa=X&oi=dict&ei=joCGR9SjMp2wgATIv4HWBg&sig2=L-Je5IAp1doAPCeTovvqwA&q=http://www.answers.com/good%26r%3D67&usg=AFQjCNG9Bm-38XQxaR5w7aHA_cDvLT1nSw
> >
> > "*. (*0.17* seconds)
> >
> > Personalized Results *1* - *10* of about *136* for
> > *"global<
> http://www.google.com/url?sa=X&oi=dict&ei=xYCGR-TiK4fcgASYpOi2Bg&sig2=ntdSUwxo_P-rplOA3PKNrw&q=http://www.answers.com/global%26r%3D67&usg=AFQjCNE2teAhA638GVYsBxeBxb9z0iYi5A
> >
> > variables<
> http://www.google.com/url?sa=X&oi=dict&ei=xYCGR-TiK4fcgASYpOi2Bg&sig2=zCmKFYtnVoOQlWKrXcLqdw&q=http://www.answers.com/variables%26r%3D67&usg=AFQjCNEEdMRqxKMgkWXftVCWfE4kZr98jg
> >are
> > evil<
> http://www.google.com/url?sa=X&oi=dict&ei=xYCGR-TiK4fcgASYpOi2Bg&sig2=HxVB1-BREdrmjuSHo6E9jQ&q=http://www.answers.com/evil%26r%3D67&usg=AFQjCNErEUXMUFMcXbjo95hRT2t8pzkISg
> >
> > "*. (*0.07* seconds
> >
> > Ok. So those of us who use globals are 17 time more likely to end up in
> > hell.
> >
> > I can live with those odds.
> >
> > David
>
> God, I'm glad you're not in charge of decision-making on any issues that
> affect me :P
> - Naz.
>

How kind of you to clarify your position, Naz. ;~)

David


Re: [PHP] uh oh, I defined a resoruce

2008-01-13 Thread David Giragosian
On 1/13/08, Nathan Nobbe <[EMAIL PROTECTED]> wrote:
>
> the 2 problems that globals introduce are
>
>1. namespace collisions
>2. point of origin problem
>
> where a  namespace collision is the inconsistent use of a global
> variable within an application
> eg.
> // one point in the application
> $GLOBALS['curUser'] = array('username' => 'bob', 'userId' => 5);
>
> // another point in the application
> $GLOBALS['curUser'] = new stdClass();
> $GLOBALS['curUser']->username = 'bob';
> $GLOBALS['curUser']->userId = 5;
>
> and what im calling the 'point of origin' problem, is the ambiguity
> introduced by global variables.  when reading through the code of an
> application and you encounter the use of a global variable, where was
> that variable set?  if not in the same file, then youll have to start
> looking.  you may not even be able to determine where the value is
> getting set by looking through the code, that is, you might have to
> analyze
> the runtime behavior of the application.  and with the $GLOBALS array,
> this
> can be cumbersome because there is no way (that i know of) to add implicit
> logging to setting of values within.
>
> now, whether you or your team or business or w/e will have to deal with
> these
> problems depends on what sort of conventions, if any, are used to work
> with
> globals (or whether theyre used at all ;)).
>
> to make them work in a team environment you should have some external
> documentation
> that establishes clear usage guidelines and outlines the purpose (or
> declares 'namespaces')
> within the $GLOBALS array.  so you might say "$GLOBALS['user'] is
> designated to contain
> user data, which will be a record from the users table in our database".
> it will be an array.
> at that point if someone uses $GLOBALS['user'] for something else, or
> changes its data type
> or something, you can say, well youve violated our convention here so
> youll have to clean that up.
>
> there is the issue of working with code from other parties and this is
> where things
> can still get messy.  say that you have your conventions and everything is
> hunky-dory; then you
> decide to use some third party code, and it uses one of your global
> 'namespaces'.
> so for example you get some third party code and within it, for whatever
> reason $GLOBALS['user']
> (referenced earlier) is being read or set.  well if you want to use that
> code, youll have to refactor
> either yours, or theirs.
>
> object oriented development helps with some of these problems, but it is
> not by itself a silver bullet.
> for example with singleton
> http://www.phppatterns.com/doku.php/design/singleton_pattern
>
> problems 1, and 2 above are still relevant.  php is introducing namespaces
> soon enough, but prior
> to those class name collisions are generally resolved in php by prefixing
> a class name
> eg.
> class User {}
> becomes
> class MyBiz__User {}
>
> problem 2 though is relevant depending on what the singleton is used for.
> suppose it only contains
> 2 values, a reference to itself and one datum, which is set in the private
> constructor (or another private
> method invoked as part of the constructor).  this is the most trivial case
> and it is not really subject to
> the problem.  however, if a singleton were to have getter and setter
> methods problem number 2 above
> can occur.  the good news here is that since singleton is a class you
> write, adding logging is trivial
> so you should be able to track down those spurious cases where a value is
> set in one portion of the
> application and read in another.
>
> i happen to know that facebook uses globals, and i just thought i would
> mention it as a 'successful'
> yet perhaps 'code not so great' example of a large application using
> globals.
>
> if you are to use globals, then establish conventions.
> the worst stuff i have ever seen is use of other superglobal arrays for
> the same purpose as what the
> $GLOBALS array is intended to be.
> eg.
> // one part of the application
> // NOTE: this value did not orginate from the request
> $_POST['someVal'] = 5;
>
> // later in the application
> $myVar = $_POST['someVal'];
>
> that is just plain bad if you ask me (and they didnt even put the note!).
>
> -nathan
>


A very cogent and detailed assessment of the issues, Nathan, and I
appreciate the time and thoughtfulness involved in writing your response.

My stance concerning globals is that, on PHP projects anyway, I work alone,
use longish and very descriptive variable names, and most always only use
globals for static data needed for calculations of some kind. But I
certainly appreciate that in a team environment and when working on very
large projects, the odds of globals usage, especially without documentation
and adherence to a standard, can lead to the problems described above.

In general, I agree with Stut's response delineated earlier in this thread,
that a careful and circumscribed use of globals has a place in PHP
programming.

David


Re: [PHP] Foreach

2008-01-17 Thread David Giragosian
On 1/17/08, mike <[EMAIL PROTECTED]> wrote:

> On 1/17/08, Nathan Nobbe <[EMAIL PROTECTED]> wrote:
>
> > >  $name = $_POST['name'];
> > >  if ($name) {
> > >  foreach ($name as $t) {
> > >
> > >echo "$t";
> > >}
>
> > >$order = $_POST['order'];
> > >if ($order) {
> > >foreach ($order as $i) {
>
> >
> > there are a few different issues here; first of all; are you sure
> > $_POST['name']
> > and $_POST['order'] are even arrays?
>
> hint:
>
> if(isset($_POST['name']) && is_array($_POST['name']))


Steve,

// Do you have several html form elements such as  in your html?
// Mike's suggestion...
if( isset( $_POST['name'] ) && is_array( $_POST['name'] ) ) {

 // you'll never get in here if you don't...
 $name = $_POST['name'];

 // foreach expects an array, as Nathan states. Even if $name is an
array, $t
 // will hold only the last value in the array when the foreach loop
is exited
 // because $t is being overwritten with each iteration.
 foreach ($name as $t) {

 echo "$t";

 } // end foreach ($name)

 $order = $_POST['order'];

 if ($order) {

 // see above about arrays and foreach
 foreach ($order as $i) {

//Update the table in MySQL

$i = mysql_real_escape_string($i, $cnx); // One of
Eric's suggestions

$update_data = "UPDATE sections SET `order` = '$i'
WHERE name = '$t'";

$response = mysql_query( $update_data, $cnx );

if(mysql_error()) die ('database error'.
mysql_error());

echo "$i";

 } //end foreach ($order)

 }

}

 Assuming both $_POST['name'] and $_POST['order'] are arrays, the way your
code is now structured, the table `sections` will have the record(s) where
name equals the last value in the $names array updated multiple times, once
for each value in the $order array, but all you will see is that
the record(s) will have the last value in the $order array.

See if this makes any sense and then ask more questions.

David


Re: [PHP] Resetting drop-downlists in input-fields for texts

2008-01-21 Thread David Giragosian
On 1/21/08, Tor Vidvei <[EMAIL PROTECTED]> wrote:
>
> I'm developing a traning page for basic math.  The answers are entered by
> the user in simple text input fields and the same page is returned (after
> having been processed by php) to the user with indications of correctness
> or error on each answer.  If the AutoComplete feature is turned on a
> droplist with previous entries are displayed in the answer fields, even if
> new exercises are generated.  This is quite distracting.  Is there any way
> I can block this feature from my php-code, even if it is turned on in the
> users browser?
>
> Tor
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
I think this HTML is IE specific,


...


Not sure if you can do it on a tag by tag basis or not, nor what versions it
might be limited by.

David


Re: [PHP] Search function not working...

2008-02-01 Thread David Giragosian
On 2/1/08, Jason Pruim <[EMAIL PROTECTED]> wrote:
>
> So I said in another thread that I would be asking another question
> about functions... So here it goes, I am attempting to write a
> function to search the database, which used to work just fine when I
> wrote it without using a function (Would that be considered static?)
> Now that I am attempting to rewrite my stuff so I can reuse the code,
> now it's not working... Here is what I used to do and it worked just
> fine:
>
>
> $qstring = "SELECT * FROM ".$table." WHERE FName like '%$search%' or
> LName like '%$search%' or Add1 like '%$search%' or Add2 like '%$search
> %' or City like '%$search%' or State like '%$search%' or Zip like '%
> $search%' or XCode like '%$search%'";
> if ($_SESSION['search'] != NULL){
>echo "The search string is: $search.";
>$qrow[]= mysql_query($qstring) or die(mysql_error());
>$qresult = $qrow[0];
>$num_rows = mysql_num_rows($qresult);
>//display search form
>echo "
>
>Search:
>
>
>
>";
>
>
>
> echo <Total Records found: {$num_rows}
>Export selection to excel
>
>
>
>First Name
>Last Name
>Address Line 1
>Address Line 2
>City
>State
>Zip
>Code
>ID #
>Edit
>Delete
>
>
> HTML;
>echo "Just testing: ".$_SESSION['search'];
> while($qrow = mysql_fetch_assoc($qresult)) {
>//Display the search results using heredoc syntax
> echo <<
>
>
>{$qrow['FName']}
>{$qrow['LName']}
>{$qrow['Add1']}
>{$qrow['Add2']}
>{$qrow['City']}
>{$qrow['State']}
>{$qrow['Zip']}
>{$qrow['XCode']}
>{$qrow['Record']}
>Edit
>Delete
>
>
>
> HTML;
>
> Now, here is what I have as a function and is not working:
>
>  $FName ="";
> $LName ="";
> $Add1 = "";
> $Add2 = "";
> //  $_SESSION['search'] = $_GET['search'];
>


function search($searchvar, $table, $num_rows, $FName, $LName, $Add1, $Add2)
{
   $qstring = "SELECT * FROM ".$table." WHERE FName like '%$searchvar%'
or LName like '%$searchvar%' or Add1 like
'%$searchvar%' or Add2 like
'%$searchvar%' or City like '%$searchvar%' or State
like '%$searchvar%'
or Zip like '%$searchvar%' or XCode like
'%$searchvar%'";

$qrow[]= mysql_query($qstring) or die(mysql_error());
$qresult = $qrow[0];
$num_rows = mysql_num_rows($qresult);
while($qrow = mysql_fetch_assoc($qresult)) {
   $FName = $qrow['FName'];
   $LName = $qrow['LName'];
   $Add1 = $qrow['Add1'];
   $Add2 = $qrow['Add2'];

}

// what do you want to return...?
return;

}

?>

$returnedSomething = search($searchvar, $table, $num_rows, $FName, $LName,
$Add1, $Add2);

Jason,

1. You're missing a closing brace at the end of the while loop.
2. You're not returning anything from the function.

The input parameters are pretty clear but what were you expecting to
accomplish within the function?

All the data returned from the query only have scope within the function, so
unless you return something, like an array or a string, use references, or
write to a global variable, you're not doing anything with the data from the
db.

David


Re: [PHP] Search function not working...

2008-02-01 Thread David Giragosian
On 2/1/08, Jason Pruim <[EMAIL PROTECTED]> wrote:

>
>  On Feb 1, 2008, at 2:20 PM, David Giragosian wrote:
>
>  On 2/1/08, Jason Pruim <[EMAIL PROTECTED]> wrote:
> >
> > [snip long explanation of problem]
>
>
>  function search($searchvar, $table, $num_rows, $FName, $LName, $Add1,
> $Add2) {
>$qstring = "SELECT * FROM ".$table." WHERE FName like
> '%$searchvar%'
> or LName like '%$searchvar%' or Add1 like
> '%$searchvar%' or Add2 like
> '%$searchvar%' or City like '%$searchvar%' or
> State like '%$searchvar%'
> or Zip like '%$searchvar%' or XCode like
> '%$searchvar%'";
>
> $qrow[]= mysql_query($qstring) or die(mysql_error());
> $qresult = $qrow[0];
> $num_rows = mysql_num_rows($qresult);
> while($qrow = mysql_fetch_assoc($qresult)) {
>$FName = $qrow['FName'];
>$LName = $qrow['LName'];
>$Add1 = $qrow['Add1'];
>$Add2 = $qrow['Add2'];
>
> }
>
> // what do you want to return...?
> return;
>
> }
>
> ?>
>
> $returnedSomething = search($searchvar, $table, $num_rows, $FName, $LName,
> $Add1, $Add2);
>
> Jason,
>
> 1. You're missing a closing brace at the end of the while loop.
> 2. You're not returning anything from the function.
>
> The input parameters are pretty clear but what were you expecting to
> accomplish within the function?
>
> All the data returned from the query only have scope within the function,
> so unless you return something, like an array or a string, use references,
> or write to a global variable, you're not doing anything with the data from
> the db.
>
> David
>
>
> Hi David,
>
>
> Thanks for looking. I'm just starting to learn about functions, and
> obviously making a few mistakes along the road...
>
>
> Basically what I am trying to do is allow my customer the ability to
> search the database, display it on the website, and then export it to excel
> if they wish...
>
>
> the missing closing brace was a bad copy/paste job.
>
>
> I have tried to add $searchReturn = search($searchvar, $table, $num_rows,
> $FName, $LName, $Add1, $Add2);
> and then do a vardump on it and it's not returning any thing.
>
>
> I've also changed the return line to return $searchReturn['FName'];
> but it's still not showing through...
>
>
> I think functions will be the death of me... at least until I understand
> how to use them :)
>
>
> I think I'm off to google some more and see if I can get any more info...
>
>
> Thanks again for your help!
>


Jason,

Untested, but try this...

function search($searchvar, $table, $num_rows, $FName, $LName, $Add1, $Add2)
{
   $qstring = "SELECT * FROM ".$table." WHERE FName like '%$searchvar%'
or LName like '%$searchvar%' or Add1 like
'%$searchvar%' or Add2 like
'%$searchvar%' or City like '%$searchvar%' or State
like '%$searchvar%'
or Zip like '%$searchvar%' or XCode like
'%$searchvar%'";

$qrow = mysql_query($qstring) or die(mysql_error());
$qresult = $qrow;
$num_rows = mysql_num_rows($qresult);

   $outputStr = "";

while($qrow = mysql_fetch_assoc($qresult)) {
   $FName = $qrow['FName'];
   $LName = $qrow['LName'];
   $Add1 = $qrow['Add1'];
   $Add2 = $qrow['Add2'];

   $outputStr .=
"$FName$LName$ADD1$ADD2\n";

}

$outputStr .= "";


return $outputStr;

}

$searchReturn = search($searchvar, $table, $num_rows, $FName, $LName, $Add1,
$Add2);

echo $searchReturn;

David


Re: [PHP] Search function not working...

2008-02-01 Thread David Giragosian
>
>  Jason,
>
> Untested, but try this...
>
> function search($searchvar, $table, $num_rows, $FName, $LName, $Add1,
> $Add2) {
>$qstring = "SELECT * FROM ".$table." WHERE FName like
> '%$searchvar%'
> or LName like '%$searchvar%' or Add1 like
> '%$searchvar%' or Add2 like
> '%$searchvar%' or City like '%$searchvar%' or
> State like '%$searchvar%'
> or Zip like '%$searchvar%' or XCode like
> '%$searchvar%'";
>
> $qrow = mysql_query($qstring) or die(mysql_error());
> $qresult = $qrow;
> $num_rows = mysql_num_rows($qresult);
>
>$outputStr = "";
>
> while($qrow = mysql_fetch_assoc($qresult)) {
>$FName = $qrow['FName'];
>$LName = $qrow['LName'];
>$Add1 = $qrow['Add1'];
>$Add2 = $qrow['Add2'];
>
>$outputStr .=
> "$FName$LName$ADD1$ADD2\n";
>
> }
>
> $outputStr .= "";
>
>
> return $outputStr;
>
> }
>
> $searchReturn = search($searchvar, $table, $num_rows, $FName, $LName,
> $Add1, $Add2);
>
> echo $searchReturn;
>
> David
>

Hold on a moment...

function search($searchvar, $table, $num_rows, $FName, $LName, $Add1, $Add2)
{
   $qstring = "SELECT * FROM ".$table." WHERE FName like '%$searchvar%'
or LName like '%$searchvar%' or Add1 like
'%$searchvar%' or Add2 like
'%$searchvar%' or City like '%$searchvar%' or State
like '%$searchvar%'
or Zip like '%$searchvar%' or XCode like
'%$searchvar%'";

$qresult = mysql_query($qstring) or die(mysql_error());

//$qresult = $qrow; // this line is the problem !

$num_rows = mysql_num_rows($qresult);

   $outputStr = "";

while($qrow = mysql_fetch_assoc($qresult)) {
   $FName = $qrow['FName'];
   $LName = $qrow['LName'];
   $Add1 = $qrow['Add1'];
   $Add2 = $qrow['Add2'];

   $outputStr .=
"$FName$LName$ADD1$ADD2\n";

}

$outputStr .= "";


return $outputStr;

}

$searchReturn = search($searchvar, $table, $num_rows, $FName, $LName, $Add1,
$Add2);

echo $searchReturn;

That should work, assuming the query returns at least one row..

David


Re: [PHP] problem with imagefontwidth function, It looks to be unavailable...

2008-02-07 Thread David Giragosian
On 2/7/08, Daniel Brown <[EMAIL PROTECTED]> wrote:
>
> On Feb 7, 2008 8:23 AM, Jochem Maas <[EMAIL PROTECTED]> wrote:
> > Legolas wood schreef:
> > > Hi
> > > Thank you for reading my post
> > > I am trying to run a php based application using php5 and apache.
> > > but I receive an error like:
> > >
> > >
> > > *Fatal error*:  Call to undefined function imagefontwidth() in
> */var/www/v603/includes/functions.php* on line *28*
> >
> > mostly likely you'll have to ask your sys admin to install/activate this
> > extension ... and if you have cheaphosting then likely the answer will
> be
> > "no we don't do that" - in which case find other hosting?
>
>
> PilotPig has GD, ImageMagick, and all kinds of other things
> already installed, and will install any server software (when
> reasonable) upon request at no charge.  Check it out:
> http://www.pilotpig.net/
>
>
>;-P
>
> --
> 


I can attest to what Daniel is saying about PilotPig. I've had a site
hosted there for about 5 months now and have been really happy with
everything: costs are reasonable, lots of modules available, respectful and
timely reponses to questions and/or concerns. Just a great overall
experience.

David


Re: [PHP] date() and wrong timezone (or time)

2008-02-07 Thread David Giragosian
On 2/7/08, Daniel Brown <[EMAIL PROTECTED]> wrote:
>
> On Feb 7, 2008 8:34 AM, Jochem Maas <[EMAIL PROTECTED]> wrote:
> > Martin Marques schreef:
> > >> see what you have as the value for the date.timezone ini setting.
> > >
> > > I've already checked that, and it's not set.
> >
> > it should be set to something, so fix that.
>
>All other points being valid, Jochem, I disagree with this.  I've
> never forced a setting on any of my PHP installations, and so far
> (knock on wood) I've never had a problem.  I think PHP does a fine job
> of reading the server time and zone.
>
> --
> 



But I think Martin said, and my experience has taught me, that PHP 5 uses an
internal database of timezone info and does not reference OS time (I'm
assuming that's what you meant, Daniel, by "I think PHP does a fine job of
reading the server time and zone."). On one of the Linux web servers that I
maintain, I had the need to turn off daylight savings time, which was a
interesting task in itself. But I could never get PHP5 to honor the OS time
as it always changed when in DST. So I had add code to applications that ran
from that web server to test for DST and account for it in certain
displays. This was very different behavior form PHP4 where the same
applications ran just fine.

David


Re: [PHP] Name of variable to string

2008-02-08 Thread David Giragosian
On 2/8/08, Richard Lynch <[EMAIL PROTECTED]> wrote:
>
> On Fri, February 8, 2008 9:14 am, tedd wrote:
> >  From a variable with the name of $this_variable -- how do I get a
> > string 'this_variable' ?
>
> You don't...
>
> Consider this:
>
> function foo($bar){
> //what would your function output?
> }
>
> $baz = 3;
> foo($baz);
>
> --


If you dynamically created the variable:

${ 'something' . '_' . 'somethingElse' };

then you'd have access to it via the variable name parts.

David


Re: [PHP] Name of variable to string

2008-02-08 Thread David Giragosian
On 2/8/08, Eric Butera <[EMAIL PROTECTED]> wrote:
>
> On Feb 8, 2008 1:53 PM, David Giragosian <[EMAIL PROTECTED]> wrote:
> > On 2/8/08, Richard Lynch <[EMAIL PROTECTED]> wrote:
> > >
> > > On Fri, February 8, 2008 9:14 am, tedd wrote:
> > > >  From a variable with the name of $this_variable -- how do I get a
> > > > string 'this_variable' ?
> > >
> > > You don't...
> > >
> > > Consider this:
> > >
> > > function foo($bar){
> > > //what would your function output?
> > > }
> > >
> > > $baz = 3;
> > > foo($baz);
> > >
> > > --
> >
> >
> > If you dynamically created the variable:
> >
> > ${ 'something' . '_' . 'somethingElse' };
> >
> > then you'd have access to it via the variable name parts.
> >
> > David
> >
>
> That is ridiculous.
>


This is what I meant, as was posted just yesterday by someone (Jim Lucas?)

for ( $i = 0 ; $i < 20 ; $i++ )
{

$theVariableAsString = 'something_' . $i;

 ${ 'something' . '_' . $i } = "Assign something here";

}

String value available here -> $theVariableAsString.

I have no idea why tedd wants to have the string value of the variable nor
how he will use it.


David


[PHP] PHP JavaBridge on Windows XP Pro

2008-02-11 Thread David Giragosian
At the request of a supervisor who only programs in Java, I installed
JavaBridge on an intranet web server running Apache 2.0.59 and PHP 5.1.6,
and we've gotten a few PHP/Java applications up and running.

Problem is, unless I'm having a senior moment, they only work if a user is
logged into the server. Some Googling suggests that since Java, or the Java
Virtual Machine, is not a service on Windows, it goes away when you log out,
so there is nothing for the bridge connect to.

Is this a reasonable understanding of the problem? Is there a solution other
than keeping 'some' user logged in and the machine behind a locked door?

I do manage some CentOS web servers here, but the IS guys really want me to
use only RPM installs of PHP, and the Java module is not present as far as I
can see.

-- 

-David.

When the power of love
overcomes the love of power,
the world will know peace.

-Jimi Hendrix


Re: [PHP] help me out with form details converted into pdf file save it one place as well as send mail attactment

2008-02-13 Thread David Giragosian
On 2/13/08, pretty <[EMAIL PROTECTED]> wrote:
>
> hi any one help me out, im using cronofirm, i need to field form details will
> converted into pdf as well as it will go maill attachment doing this in
> joomla, atleast i need this only php with out joomla.

It might be overkill for your purposes, but you might want to explore
pdftex in Tex (or LaTeX), available for both Linux and Windows.

Create a string to write to a file, adding these header calls at the
top, massaged to your needs:

$outputStr = "\\documentclass[10pt,fleqn]{article}\n";
$outputStr .= "\\usepackage[cp850]{inputenc}\n";
$outputStr .= "\\usepackage{textcomp}\n";
$outputStr .= "\\setlength{\textwidth}{19.05cm}\n";
$outputStr .= "\\setlength{\oddsidemargin}{-2.0cm}\n";
$outputStr .= "\\setlength{\textheight}{26.5cm}\n";
$outputStr .= "\\setlength{\topmargin}{-1.9cm}\n";
$outputStr .= "\\setlength{\headheight}{0.0cm}\n";
$outputStr .= "\\setlength{\topskip}{0.0cm}\n";
$outputStr .= "\\begin{document}\n";
$outputStr .= "\\pagestyle{empty}\n";
$outputStr .= "\\begin{verbatim}\n";

$outputStr .=  "Then append to the string whatever you want, including
variables for interpolation, formatted however you want. (Sprintf
works really well for alignment, etc...). The verbatim call above
leaves in place all text placement on the page.";

$outputStr .= "Then close the string with these commands...";

$outputStr .= "\\end{verbatim}\n";
$outputStr .= "\\end{document}\n";

Write to a file:

$fh = fopen("FileName.tex", "w");
fwrite($fh, $outputStr);
fclose($fh);

`pdflatex FileName.tex`; // ( properly escaped, of course...)

and FileName.pdf is created.

You can also do a lot of really fancy formatting, but the learning
curve can be pretty steep.

-- 

-David.

When the power of love
overcomes the love of power,
the world will know peace.

-Jimi Hendrix

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



Re: [PHP] Question about PHP Licence and it's future!

2008-02-26 Thread David Giragosian
On 2/26/08, Robert Cummings <[EMAIL PROTECTED]> wrote:
>
> On Tue, 2008-02-26 at 12:30 -0500, tedd wrote:
> > At 12:53 PM -0500 2/25/08, Andrés Robinet wrote:
> > >*gringos* started calling me Rob long ago. It's shorter, it's easier to
> > >pronounce and it's a short form for my last name (Robinet).
> >
> > Gringos?
> >
> > That brings up another subject, why is it that
> > Caucasians don't have any offensive slang words?
> > We are called by all sorts of slang (i.e.,
> > cracker, white-bread, hunkie, and so on), but we
> > don't have something equivalent to the n-word/
> >
> > No reply is needed -- just a comment.
>
> Whitey and redneck come to mind. Paleface maybe once upon a time :)
> Shrug. I know in other languages there are can be slang words that defer
> to Caucasians. I just can't remember any of them.
>
> Cheers,
> Rob.
> --
>

My black friends here at work tell me that 'cracker' is indeed the
equivalent of the n-word. In fact, they tell me that they were warned
by their parents not to use it and punished severely if they did. I'm
talking about colleagues in their late 30's early 40's, so it may be a
generational artifact.

-- 

-David.

When the power of love
overcomes the love of power,
the world will know peace.

-Jimi Hendrix

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



Re: [PHP] What design patterns do you usually use?

2008-02-27 Thread David Giragosian
On 2/27/08, Daniel Brown <[EMAIL PROTECTED]> wrote:
> On Wed, Feb 27, 2008 at 6:46 AM, skylark <[EMAIL PROTECTED]> wrote:
> > Hi all,
> >
> >  What design patterns do you usually use?
>
>
>This one:
>
>http://www.vam.ac.uk/vastatic/microsites/1486_couture/create.php
>

Somebody been thinking about wedding attire?

-- 

-David.

When the power of love
overcomes the love of power,
the world will know peace.

-Jimi Hendrix

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



Re: [PHP] Are these Truthful Proof about PHP ??

2008-02-27 Thread David Giragosian
On 2/27/08, Zoltán Németh <[EMAIL PROTECTED]> wrote:
> 2008. 02. 27, szerda keltezéssel 10.03-kor Dare Williams ezt írta:
> > Dear Developers,
> >
> >   http://msdn2.microsoft.com/en-us/library/aa479002.aspx
> >   I read an Article on the above Microsoft website stating the reason why 
> > to Migrate from PHP to ASP.NET. So can you please justify this proofs from 
> > Microsoft and let everybody knows if they are all TRUE and MEANIFUL atall 
> > or they are just cheap lies to backup their product. Please advice?
> >
>
> the article is from September 2003. so honestly I did not fully read it,
> just scanned the main titles, because it's talking about the state of
> php in 2003 (which was some v4.1 or so) - and php now is completely
> different.
>
> the other thing is, AFAIK ASP.NET is not just a language but a
> framework, which php in itself is not. if someone wanted a comparison,
> he should compare with php and a php-based framework (symfony, zend,
> etc)
>
> and the third thing is, never believe anything from microsoft ;)
>
> greets,
> Zoltán Németh

Funny, I have the exact same web page opened up from this morning, as
work projects are moving me towards M$$S environments and languages.

The comparisons are fairly biased against PHP, as expected from the
source, and a  number of links are broken, particularly the one
offering 5 full applications with source code.  But I do have an
install of the full Visual Studio .NET, and although the sintax (sic)
is not terrifically foreign to me,  even small pages running locally
take a long time to load.

I'm hoping to convince the powers that be here at work that there are
better alternatives...


-- 

-David.

When the power of love
overcomes the love of power,
the world will know peace.

-Jimi Hendrix

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



Re: [PHP] Are these Truthful Proof about PHP ??

2008-02-27 Thread David Giragosian
On 2/27/08, Stut <[EMAIL PROTECTED]> wrote:
> On 27 Feb 2008, at 18:36, David Giragosian wrote:
> > The comparisons are fairly biased against PHP, as expected from the
> > source, and a  number of links are broken, particularly the one
> > offering 5 full applications with source code.  But I do have an
> > install of the full Visual Studio .NET, and although the sintax (sic)
> > is not terrifically foreign to me,  even small pages running locally
> > take a long time to load.


> I'm going to guess that you were running it through Visual Studio in debug 
> mode > which instruments the code to such a degree that it's several 
> magnitudes slower > than a release build.

Right on both counts!

If I'm forced to use it, I certainly hope it's faster than what I've
seen so far.

-- 

-David.

When the power of love
overcomes the love of power,
the world will know peace.

-Jimi Hendrix

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



Re: [PHP] Are these Truthful Proof about PHP ??

2008-02-27 Thread David Giragosian
On 2/27/08, Robert Cummings <[EMAIL PROTECTED]> wrote:
>
> So is ASP really a framework? Did I get that wrong... I'm not always
> right you know, especially about MS crap.
>

>From the first mentioned article:

ASP.NET is part of the Microsoft .NET Framework. The .NET Framework is
a feature of Windows...

And:

ASP (Active Server Pages) and ASP.NET are both server side
technologies for building web sites and web applications, but ASP.NET
is not simply a new version of ASP. ASP.NET has been entirely
re-architected to provide a highly productive programming experience
based on the .NET Framework, and a robust infrastructure for building
reliable and scalable web applications.


-- 

-David.

When the power of love
overcomes the love of power,
the world will know peace.

-Jimi Hendrix

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



Re: [PHP] auto-wrap on posts

2008-02-28 Thread David Giragosian
On 2/28/08, Nathan Nobbe <[EMAIL PROTECTED]> wrote:
> take a look here on the marc archives.
> http://marc.info/?l=php-general&m=120415418217911&w=2
>
> there are several lines that have 1 word only in them, some of the words
> (for reference) are access, good, patterns, nested.
> when i wrote the post (looking in my gmail client) these words are not on
> their own line..
> does the post look as it does on marc in your mail clients or are the words
> in sentences where they belong ?
>
> thanks,
>
> -nathan
>

Your emails come through to my gmail account as you first described,
Nathan, ie, sometimes with just one word on a line, and just like the
marc archives.

Ray, if I start a thread, I'm fairly sure the list sends the email back to me.

-- 

-David.

When the power of love
overcomes the love of power,
the world will know peace.

-Jimi Hendrix

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



Re: [PHP] auto-wrap on posts

2008-02-28 Thread David Giragosian
On 2/28/08, Jason Pruim <[EMAIL PROTECTED]> wrote:
>
> On Feb 28, 2008, at 10:25 AM, Ray Hauge wrote:
>
> > Nathan Nobbe wrote:
> >> all,
> >> a fellow poster has been kind enough to bring to my attention how
> >> jacked
> >> some of my posts appear.
> >> i was manually formatting my posts, but it appears the list server
> >> must also
> >> be doing some formatting as many of my posts come out all jacked up
> >> looking,
> >> some with only a single word on a line.
> >> ive now resolved to just keep on typing all the way to the end of a
> >> line in
> >> the gmail editor, but then they look like crap in the editor;
> >> though ill do
> >> it to save face for the public postings if i have to ;)
> >> any body else encounter this ?
> >> -nathan
> >
> > I haven't noticed any issues with your posts either.
> >
> > Since we're talking about post issues I'll include this.  I don't
> > seem to receive my own emails.  Does the list not send them back to
> > you?  I haven't been able to find anything yet.  I just like to see
> > all the comments.
>
>
> Hey Ray,
>
> I get a copy of the messages sent to me. I think it's a setting when
> you signup that you can choose but I'm not positive.
>


That rings a bell, Jason. I think you're right.

-- 

-David.

When the power of love
overcomes the love of power,
the world will know peace.

-Jimi Hendrix

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



Re: [PHP] auto-wrap on posts

2008-02-28 Thread David Giragosian
On 2/28/08, Daniel Brown <[EMAIL PROTECTED]> wrote:
> On Thu, Feb 28, 2008 at 10:25 AM, Ray Hauge <[EMAIL PROTECTED]> wrote:
> >  Since we're talking about post issues I'll include this.  I don't seem
> >  to receive my own emails.  Does the list not send them back to you?  I
> >  haven't been able to find anything yet.  I just like to see all the
> >  comments.
>
>It's intelligent design on Gmail's part.  If you send an email to
> a list, Gmail filters the message sent back to you so that it doesn't
> appear in your inbox until someone replies to the thread.  The
> exception is if a bounce is received.
>

Oh no, I sense another topic drift into religious waters... ;-)

-- 

-David.

When the power of love
overcomes the love of power,
the world will know peace.

-Jimi Hendrix

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



Re: [PHP] 2 Questions: Static variables and the nature of the online manual

2008-03-04 Thread David Giragosian
I would hazard a guess that the 'static' keyword and functionality
comes from ANSI C. I just pulled "The C Programming Language" by
Kernighan and Ritchie from the book case and it is described there in
it.

Essential book, by the way, IMHO.

-- 

-David.

When the power of love
overcomes the love of power,
the world will know peace.

-Jimi Hendrix

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



Re: [PHP] regular expressions question

2008-03-04 Thread David Giragosian
On 3/4/08, Adil Drissi <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Is there any way to limit the user to a set of characters for example say i 
> want my user to enter any character between a and z (case insensitive). And 
> if the user enters just one letter not belonging to [a-z], this will not be 
> accepted.
>
> I tried  eregi('[a-z]', $fname) but this allows the user to enter 
> abdg4512kdkdk for example.
>
> Thank you
>

try here:

http://us2.php.net/ctype_alpha

-- 

-David.

When the power of love
overcomes the love of power,
the world will know peace.

-Jimi Hendrix

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



Re: [PHP] save image in database vs folder

2008-03-11 Thread David Giragosian
On 3/11/08, Daniel Brown <[EMAIL PROTECTED]> wrote:
> On Tue, Mar 11, 2008 at 10:15 AM, Robert Cummings <[EMAIL PROTECTED]> wrote:
> >
> >  On Tue, 2008-03-11 at 11:18 +, Richard Heyes wrote:
> >  > > some friend of mine ague about this matter, this morning. they say, 
> > saving
> >  > > image in
> >  > > database is more professional. I am not really agree with that,since i 
> > am
> >  > > just a novice programmer.
> >  >
> >  > Well, bearing in mind I only have experience of MySQL, the general
> >  > consensus is to save it to a file on you hard drive and store the file
> >  > name in the database. If for whatever reason you can't or don't want to
> >  > do that, then at least store it in a separate table that only gets
> >  > touched when the image is requested.
> >
> >  Can you point me to a link where I can read about this so-called
> >  "general consensus"? :)
>
>http://www.gfy.com/  ;-P

Whoa! My institution blocked that URL for 'adult content'. I guess
there are some racy example pictures or something?? lol.

:=)

-David.

When the power of love
overcomes the love of power,
the world will know peace.

-Jimi Hendrix

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



Re: [PHP] strtotime( 'last Sunday' ) and republicans

2008-03-13 Thread David Giragosian
On 3/13/08, tedd <[EMAIL PROTECTED]> wrote:
> At 10:43 AM -0500 3/12/08, Greg Donald wrote:
> >No matter where we draw the borders or put the roads and highways,
> >it's still just the one planet, with the same finite resources we all
> >have to share.  Being mad about globalization is pointless, it's
> >inevitable.
>
> Not if you don't live on this planet.

Tried that. Didn't work. Sent home.

;-{

-- 

-David.

When the power of love
overcomes the love of power,
the world will know peace.

-Jimi Hendrix

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



Re: [PHP] Re: problem with this regex to remove img tag...

2008-03-18 Thread David Giragosian
On 3/16/08, Ryan A <[EMAIL PROTECTED]> wrote:
>
> Now that thats over... can anybody recommend a good starting point to learn 
> regex in baby steps?
>
> Cheers!
> R

Mastering Regular Expressions, by Jeffrey Friedl
ISBN 0-596-00289-0

-- 

-David.

When the power of love
overcomes the love of power,
the world will know peace.

-Jimi Hendrix

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



Re: [PHP] Fastest way to get table records' number

2008-03-19 Thread David Giragosian
Doesn't the 1 in "Select count(1) from table" refer to the first
column in the table, like order by 1 asc?

David

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



Re: [PHP] How to install PHP 5.x on Windows Server 2000 with IIS5and MySQL 5.x

2008-03-29 Thread David Giragosian
On 3/29/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Shawn McKenzie wrote:
>
> >[EMAIL PROTECTED] wrote:
> >
> >
> >>Shawn McKenzie wrote:
> >>
> >>
> >>
> >>>Paul Scott wrote:
> >>>
> >>>
> >>>
> >>>
> On Thu, 2008-03-27 at 10:32 -0400, Wolf wrote:
> 
> 
> 
> 
> >I'd suggest going with a real operating system (linux) which keeps 
> >patches updated quicker...
> >
> >
> >
> >
> >
> As much of a Free Software advocate as I am, that is not the answer to
> the question. That being said, however, I would replace the IIS with
> Apache2 at least...
> 
> I seem to remember someone posting a really good guide to setting this
> all up at some stage, so a quick search through the archives should
> reveal all.
> 
> 
> --Paul
> 
> 
> 
> 
> 
> All Email originating from UWC is covered by disclaimer
> http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm
> 
> 
> 
> 
> >>>Download the zip and read the install.txt.  It doesn't get any easier
> >>>than that. It's very straight forward and has worked for me every time.
> >>>
> >>>-Shawn
> >>>
> >>>
> >>>
> >>>
> >>>
> >>Hello Shawn,
> >>
> >>How to enable php 5.2.5 with MySQL 5.0.51a ?
> >>
> >>Thank for your help !
> >>
> >>Edward.
> >>
> >>
> >>
> >Make sure your extensions path is correct in php.ini and uncomment the
> >extension=mysql.ini line in php.ini.
> >
> >-Shawn
> >
> >
> >
> Hello,
>
> 1, I had edited with extension=php_mysql.dll
> 2, Test the php with mysql by using php page with phpinfo() function,the
> result of mysql is enabled.
> 3, I can edit the db data though the phpmyadmin tools.
> 4, BUT test the connection with mysql as the following code is fail :
>
>  //remember to change the password to whatever you set
> //it to in mysql instance configuration
>
> //first parameter is server name, 2nd username 'root', 3rd is password
> $rst = @mysql_connect("localhost","root","root");
>
> if (!$rst){
> echo( "Unable to connect to database manager.");
> die('Could not connect: ' . mysql_error());
> exit();
> } else {
> echo("Successfully Connected to MySQL Database Manager!");
> }
>
> if (! @mysql_select_db("mysql") ){
> echo( "Unable to connect database...");
> exit();
> } else {
> echo("Successfully Connected to Database 'MYSQL'!");
> }
> ?>
>
> The warning message is "Access denied"
> So, any more help ?

That means that the user "root" with the password "root" does not have
permission to connect to the MySQL server. I'm late to this thread,
but if you have not touched MySQL's user accounts in any way, there
should be a user "root" with an empty password.

Try: $rst = @mysql_connect("localhost","root","");

-- 

-David.

When the power of love
overcomes the love of power,
the world will know peace.

-Jimi Hendrix

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



Re: [PHP] Database abstraction?

2008-04-16 Thread David Giragosian
On 4/16/08, Jason Pruim <[EMAIL PROTECTED]> wrote:
>
> Hi Everyone!
>
> I'm back with yet another question But getting closer to sounding like
> I know what I'm talking about and that's all thanks to all of you. A free
> beer (Or beverage of choice)* for everyone who has helped me over the years!
>
> Here's my question... I have a program, where I want to take out the field
> names in a database table and display them... In other words instead of
> writing:
> $Query ="SELECT First, Last, Middle, Add1 FROM mytable order by $order";
>
> I want to write something more like:
> $Query ="SELECT $FIELDNAMES FROM mytable order by $order";
>
> So I need to know how to get the field names from the database so that I
> can populate $FIELDNAMES. I played a little bit and it looks like I might be
> able to get what I want by doing 2 queries...
>
> $QueryFieldNames = "DESCRIBE $table";
>
> And then some sort of a foreach or maybe a while to populate $FIELDNAMES?
> Maybe an array so I could do $FIELDNAMES['First'] if I needed to later.
>
> then I can use my SELECT $FIELDNAMES FROM $table order by $order query to
> do my query...


mysql_list_fileds came to mind, but this link states mysql_list_fileds is
deprecated and suggests using mysql_query("show columns from table").

http://us.php.net/manual/en/function.mysql-list-fields.php


-- 
>
> -David.
>
> When the power of love
> overcomes the love of power,
> the world will know peace.
>
> -Jimi Hendrix


Re: [PHP] Memory limit of 8 MB not enough

2008-04-16 Thread David Giragosian
On 4/16/08, tedd <[EMAIL PROTECTED]> wrote:
>
> At 10:53 AM -0400 4/16/08, Andrew Ballard wrote:
>
> > On Wed, Apr 16, 2008 at 9:59 AM, tedd <[EMAIL PROTECTED]> wrote:
> >
> >  >  I saw one the other day that caught my eye -- will look into it.
> >
> > >
> > > The first problem I see implementing the approach is the JavaScript
> > sandbox. JavaScript is allowed to read the text of the input file
> > field (and thus know the file name and path once a file has been
> > selected); it cannot access the disk to actually get to the image or
> > do anything with it. From here, I'm thinking there are a couple things
> > you could do with JavaScript. The first would be to embed the image
> > into the web page using an IMG tag, which would allow you to determine
> > the pixel dimensions (but not the actual file size). The second would
> > be what Gmail seems to do, and actually upload the form to their
> > server with some sort of AJAX request, at which time your server could
> > return information on the size of the file. However, if the file is
> > too large, you're back to the original problem of needing to increase
> > the RAM limit in PHP.
> >
> > The second problem is, as I said, I'm not aware of any JavaScript that
> > can manipulate the image. JavaScript can cause the display of an image
> > to be resized within the browser, but that doesn't actually affect the
> > stored file. I don't know, but I guess if you could actually get to
> > the bits, you could probably write an algorithm in JavaScript to
> > resize an image by manipulating the bits, but I think it would be
> > dreadfully slow if it would even run without running out of resources.
> >
> > I think the only pure-client options are either Java (which would
> > require special permissions to get out of its own sandbox) or ActiveX.
> >
> > If you know of some other approach, I'd be interested to see how it
> > works.
> >
> > Andrew
> >
>
>
> Andrew:
>
> I think you are right -- I wasn't able to resize the image. Here's the
> link that caught my eye, but it doesn't work as described:
>
> http://javascript.internet.com/forms/image-upload-preview.html
>
> Cheers,
>
> tedd
> --
>


It worked for me using IE on XP.

David


Re: [PHP] Alter Table newbie help needed ...

2008-04-20 Thread David Giragosian
On 4/20/08, revDAVE <[EMAIL PROTECTED]> wrote:
>
> On 4/19/2008 2:37 PM, "Jason Norwood-Young" <[EMAIL PROTECTED]>
> wrote:
>
> > Might be obvious but you are doing "mysql_query($sql);", right?
>
> Hello Jason,
>
> Thanks - Your idea worked well -  for a while - but then I ran into
> trouble...
>
> I added : mysql_error() and it said:
>
>
> Table 'connect2.ztest' doesn't exist
>
> - so I guess it was not knowing to use the 'try1' connection ( try1.ztest)
> -
> (connect2 was some other one I set up for something else)
>
> I'm using Dreamweaver cs3 - maybe it's confused?
>
> Q: Is there a way to insure that it uses the right connection ( try1 - not
> connect2 )?
>
>
> BTW: I tried `try1.ztest` but it didn't like that:
>
> $sql = 'ALTER TABLE `try1.ztest` ADD `myfield2` VARCHAR(10) NOT NULL;';


Is try1 the name of a database? The SQL syntax is
databasename.tablename.fieldname.

When you issue a query using mysql_query() you can explicitly indicate the
connection (returned by mysql_connect()) to use as the second parameter,
e.g., mysql_query($sql_Statement, $returnedConnectionObject);

HTH,

David


Re: [PHP] file_get_contents and https

2007-05-31 Thread David Giragosian

On 5/31/07, Stut <[EMAIL PROTECTED]> wrote:


Bob Hanson wrote:
> Thanks, Jay.
>
> I tried it first with a simple "http://"; call, and that worked fine. So
> unless "https:..." requires something additional in the way of
> arguments, that doesn't seem to be the issue.
>
> I'm hoping someone who has done this remembers what special installation
> issues there might be. When I look on the web I see lots of discussion,
> but it's pretty hard to figure out how much of it is currently
> applicable and how much of it is ancient history.

Was PHP built with openssl enabled? If not, that's ya problem.



phpinfo() is your friend.

-Stut


> Jay Blanchard wrote:
>
>> [snip]
>> I am new to PHP; using Apache 2.2 and PHP 5/Windows. I'd like to do
>> this:
>>
>> $x = file_get_contents("https://user:[EMAIL PROTECTED]")
>>
>> I get:
>>
>> Warning: file_get_contents(https://...) [function.file-get-contents]:
>> failed to open stream: Invalid argument in ... on line...
>> [/snip]
>>
>> The warning that you get is "Invalid argument..." Have you read
>> http://us2.php.net/file_get_contents to make sure that you are
including
>> all needed arguments?
>>
>>
> The URL for file_get_contents doesn't give many clues to its use with
> https.



David


Re: [PHP] Re: find (matching) person in other table

2007-05-31 Thread David Giragosian

On 5/31/07, Afan Pasalic <[EMAIL PROTECTED]> wrote:




Jared Farrish wrote:
> On 5/30/07, Afan Pasalic <[EMAIL PROTECTED]> wrote:
> email has to match "in total". [EMAIL PROTECTED] and [EMAIL PROTECTED]
>> are NOT the same in my case.
>>
>> thanks jared,
>
> If you can match a person by their email, why not just SELECT by email
> only
> (and return the persons information)?
'cause some members can be added to database by administrator and maybe
they don't have email address at all. or several memebers can use the
same email address ([EMAIL PROTECTED]) and then macthing last name is
kind of "required". that's how it works now and can't change it.

> Consider, as well, that each time you're calling a database, you're
> slowing
> down the response of the page. So, while making a bunch of small calls
> might
> not seem like that much, consider:
>
> ||| x |||
> ||| a |||
> ||| b |||
>
> Versus
>
> ||| x, a, b |||
>
> The letters represent the request/response data (what you're giving to
> get,
> then get back), and the pipes (|) are the overhead to process, send,
> receive
> (on DB), process (on DB), send (on DB), receive, process, return to
code.
>
> The overhead and latency used to complete one request makes it a
quicker,
> less "heavy" operation. If you did the first a couple hundred or
thousand
> times, I would bet your page would drag to a halt while it loads...
agree. now, I have to figure it out HOW? :-)

I was looking at levenshtein, though, I think the richard's solution is
just enough:

select member_id, first_name, last_name, email, ...,
(5*(first_name='$first_name) + 2*(first_name='$first_name')) as score
from members
where score > 0

though, I'm getting error: "Unknown column 'score' in where clause"?!?

thanks jared.




Try using the keyword 'having' rather than 'where'. You can't use  an alias
in a where clause.

David


Re: [PHP] Question on Connecting to Microsoft SQL Server from PHP

2007-06-12 Thread David Giragosian

Tommy,

Since SQL Server may loom on my horizon, I've tried connecting to a SQL
Server 2000 db on my network. I got it to work _without_ any port after
the IP in mssql_connect().
I'm using PHP 5.2.0 from windows XP to a Windows 2000 box running SQL
Server. I used SQL Server Authentication to create the login.

Are you sure your login is working?

David


Re: [PHP] Booking form, please

2007-06-14 Thread David Giragosian

All our folks here love MRBS.
http://webscripts.softpedia.com/script/E-Commerce/MRBS-24375.html

Just substitute 'computers' for locations/rooms...

David

On 6/14/07, Timothy Murphy <[EMAIL PROTECTED]> wrote:


I'm looking for a form to allow people
to book an hour on a computer system.
Is there a standard PHP program for this?
Or can you point me to such a program, please?

--
Timothy Murphy
e-mail (<80k only): tim /at/ birdsnest.maths.tcd.ie
tel: +353-86-2336090, +353-1-2842366
s-mail: School of Mathematics, Trinity College, Dublin 2, Ireland

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




Re: [PHP] UI toolkit

2007-06-25 Thread David Giragosian

On 6/24/07, Nathan Nobbe <[EMAIL PROTECTED]> wrote:


Darren,

I recently discovered php5 bindings to qt4
http://www.php-qt.org

although qt is currently leveraged by kde primarily it has been converted
to
a cmake build system instead of a make build system which supposedly will
enable cross platform capabilities.  kde apps will be running on windows
and
what not.
though im not sure what sort of time line all that stuff is on, i know it
is
in the works; and i personally prefer qt/kde over gtk/gnome :)

afaik there are no bindings available for windows ui scripting w/ php

-nathan



Maybe   -->   http://winbinder.org/

David


[PHP] FreeMovie API

2007-06-27 Thread David Giragosian

Anyone using or know the status of the FreeMovie PHP toolkit?

Seems like development stopped in 2004...

David


[PHP] Flash / Ajax / PHP

2007-06-29 Thread David Giragosian

I've recently been using some limited free time to explore the Freemovie
(Flash-PHP API) and Ajax technologies.

Can anyone help me to understand whether these can be used together? Can I,
for example, pull data from MySQL, dynamically alter Flash function
parameters, then use Ajax to deliver the new content?

Thanks in advance,

David


Re: [PHP] Flash / Ajax / PHP

2007-06-30 Thread David Giragosian

On 6/30/07, tedd <[EMAIL PROTECTED]> wrote:


At 10:30 AM -0500 6/29/07, David Giragosian wrote:
>I've recently been using some limited free time to explore the Freemovie
>(Flash-PHP API) and Ajax technologies.
>
>Can anyone help me to understand whether these can be used together? Can
I,
>for example, pull data from MySQL, dynamically alter Flash function
>parameters, then use Ajax to deliver the new content?
>
>Thanks in advance,
>
>David

David:

Short answer is yes, you can pull all these together to deliver content.

However, you need to understand not only php, but ActionScript. I
don't see why you would need Ajax to do this because you would first
create the Flash segment in the background and then simply bring it
forward and present it in a Flash player..

I think I have an idea of what you are trying to do and I believe it
would be best if you created graphics in the background using php and
then brought it forward with Ajax as data changed, all without the
need for flash.

But, if you want to investigate the Flash-PHP connection try Google
"actionscript and php"

Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com




Thanks tedd and zerof.

tedd, I did as you suggested above with graphics created with PHP/GD and
pulled with Ajax ( http://home.capecod.net/~cape84/Monitor.PNG  for a static
example ) but the image, when updated, is still unstable on IE while still
_perfectly_ stable on FireFox. I'm guessing I'm gonna have to live with
suggesting users view with FireFox but I'll try to mock up a test case with
Flash to satisfy my curiosity.

Thanks,

David


Re: [PHP] Flash / Ajax / PHP

2007-07-01 Thread David Giragosian

On 7/1/07, Ryan A <[EMAIL PROTECTED]> wrote:


> but the image, when updated, is still unstable on IE while still
> _perfectly_ stable on FireFox.



This might be due to cacheing on IE which anyone who has messed with
php online for a little time will be familier with. IE is a bitch at
times... just likes the company that makes the software ;)

Sometimes this gets solved with spitting out some headers telling IE not
to cache while others have (dirty) solved it by adding a hash or something
else unique to the page or the image...

for example:
php_script.php?get_img=img_name&random=something_random_here


HTH.

Cheers!
R


--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)

--
Get the Yahoo! toolbar and be alerted to new email
wherever
you're surfing.



Thanks, Ryan. That gives me something to explore when I get to work on
Monday.

David


Re: [PHP] Another simple question (Probably)

2007-07-10 Thread David Giragosian

On 7/10/07, Jason Pruim <[EMAIL PROTECTED]> wrote:




Currently that is the date I get when I try to submit any date
through the form. I'm sure I just have something messed up in my
mktime, or in the way I'm grabbing the variable





$taskTime=mktime(int 00,int 00,int 00, int $month, int $day, int $year);


I may be coming in late on this but the above should have parens around the
datatype, e.g., (int). Otherwise, works fine with hardcoded values for the
variables.

David


Re: [PHP] Another simple question (Probably)

2007-07-10 Thread David Giragosian

On 7/10/07, Jason Pruim <[EMAIL PROTECTED]> wrote:



On Jul 10, 2007, at 9:52 AM, David Giragosian wrote:

> On 7/10/07, Jason Pruim <[EMAIL PROTECTED]> wrote:
>
>
>
>> Currently that is the date I get when I try to submit any date
>> through the form. I'm sure I just have something messed up in my
>> mktime, or in the way I'm grabbing the variable
>
>
>
>> $taskTime=mktime(int 00,int 00,int 00, int $month, int $day, int
>> $year);
>
> I may be coming in late on this but the above should have parens
> around the
> datatype, e.g., (int). Otherwise, works fine with hardcoded values
> for the
> variables.
>
> David

So mktime((int) 00, (int)$month) etc. etc. etc




Right. Assuming that $month, etc... have valid values.

For example:
$taskTime=mktime((int) 00, (int) 00, (int) 00, (int) 07, (int) 10, (int)
2007);
echo date('Y', $taskTime);

outputs 2007.


Re: [PHP] Numbers, Numbers everywhere! Need some Dollar help.

2007-08-02 Thread David Giragosian
On 8/2/07, Brad Bonkoski <[EMAIL PROTECTED]> wrote:
>
> Dan Shirah wrote:
> > Greetins all,
> >
> > In my form I have an area where the user enters in the payment amount:
> >
> >  name="payment_amount">
> >
> > This is all fine and dandy and works as generically as it can. BUT, the
> > problem is that I need to make sure the user didn't fat finger any of
> the
> > numbers.  For instance, in my generic text field the user types 600 in
> the
> > payment amount and clicks submit.
> >
> > This works and the user is charged $600.  But, come to find out the user
> > meant to enter 6.00 not 600. Can I add a check using PHP to force the
> user
> > to put in the dollar AND cents? This way if a number such as 600 is
> entered
> > and the user hits save, the check will notice there isn't a .00 on the
> end
> > and prompt the user for more information.
> >
> > Could I incorporate something like:
> >
> > if ($payment_amount != number_format($payment_amount, 2)) {
> >   error here
> > }
> >
> > Or, do you think I would be better off using two text areas?  One for
> the
> > dollar value and one for the cents?
> >
> > Or, do you think I would be better off trying to find some kind of
> > javascript function that would check the value upon submit?
> >
> > Any help is appreciated.
> >
> > Dan
> >
> >
> If you want it squarely on the client side, then use javascript.  There
> are easy functions to split a text string (like php's explode).
> Then you can split on the '.' and then do some logical stuff like the
> cents is between 00 and 99, and anything else you think necessary.
> If there are no cents, then you can issue a confirmation box.  So, my
> vote is to handle it within javascript, as it should not be too difficult.
> -B


No ecommerce site I've ever used allowed me to manually enter in what I
owed. I clicked, checked, or somehow selected a product to buy and
everything was calculated behind the scenes and displayed. If you must allow
this behavior, I'd opt for perhaps somewhat unappealing select boxes for all
numerical input, one per field. As Ron White jokes, "You can't fix stupid",
and if you don't expect your users to be stupid, they will surprise you
every time.

Just MHO,

David


Re: [PHP] Numbers, Numbers everywhere! Need some Dollar help.

2007-08-03 Thread David Giragosian
On 8/3/07, tedd <[EMAIL PROTECTED]> wrote:
>
> At 12:57 AM +0200 8/3/07, M. Sokolewicz wrote:
> >Now, as mentioned before: You have to decide for yourself if your
> >application is the correct place to check for the stupidity of your
> >users.
>
> Check for the ignorance of your users -- there's a difference.
>
> Cheers,
>
> tedd
> --


You need to check for both stupidity and ignorance; they are different and
not mutually exclusive. But please, let's not turn this into another
"pirated books" thread. That's the only discussion from this list that I've
ever filtered out.

David


Re: [PHP] OT A public apology to Larry Garfield

2007-08-07 Thread David Giragosian
On 8/7/07, tedd <[EMAIL PROTECTED]> wrote:
>
> At 10:36 AM -0400 8/7/07, Daniel Brown wrote:
> >
> > As a matter of public record, I hereby move that we reject Tedd's
> >formal apology due to grammatical errors in construct.  ;-P
> >
> >--
> >Daniel P. Brown
>
> You know you guys are going to keep this up until I have to apologize
> to everyone for the things I'm going to say.  :-)
>
> What "grammatical errors in construct" did I commit?
>
> Cheers,
>
> tedd


Aw, hell.  Here we go again. Another thread into the trash...

David


Re: [PHP] magic quotes

2007-08-09 Thread David Giragosian
On 8/9/07, Bastien Koert <[EMAIL PROTECTED]> wrote:
>
>
> you could use ini_set at the top of the script to turn the magic quotes
> off...if you add this in a prepend file or a common included file that sits
> at the top of the script, it should take care of the damn magic quotes...


Why might this not work? I tried using ini_set(magic_quotes_gpc, 0 | "0" |
FALSE | "FALSE" ) and none of these worked either locally on my dev system
or on a hosting system I just started using. PHP versions were either 5.2.0or
5.2.1.

failing that ask your host to turn it off


The guy graciously did turn it off when I asked him to.

Bastien


David


Re: [PHP] c++ and php! search for a brigde

2007-08-28 Thread David Giragosian
On 8/28/07, Simon <[EMAIL PROTECTED]> wrote:
>
> you can use sockets in php, they work the same as berkley sockets
> you can use system() in php, to call your C++ program (the program
> could output html)
> in my opinon CGI with C/C++ is obsolete, use php/apache for best results!
>
> another nice way is to have your C++ program independent, outputs its
> results/values into a database (mysql)... and a php page will just
> read what's in the database to display it nicely.


That's what we do here. C/C++ app gathers and inserts the data into the db,
minute by minute, and PHP apps are used for display, reports, graphics,
etc... Our LAMP system has had nary a glitch in over 3 years of continuous
usage.

That would be a clean way of doing it.
>
> Good luck!



David


[PHP] Any way to turn off daylight savings time in PHP5?

2007-09-13 Thread David Giragosian
Is there anyway to get PHP (v5.1.6) to use the OS time for date functions as
PHP4 did?

phpinfo() lists something called  "Timezone Database: internal" under the
date section, so I'm guessing that's where the data is originating.

Here's the background:

We have a LAMP server that has a special rule created that ignores daylight
savings time, and MySQL will 'defer' to system time so that:

shell> date
Thu Sep 13 11:52:43 CST 2007

and

mysql> select now();
+-+
 | now() |
+-+
 | 2007-09-13 11:52:43 |
+-+
1 row in set (0.00 sec)

give the same result.

However, echo date('Y-m-d H:i:s') produces the time in Daylight Savings
time, i.e., an hour ahead.

I've resorted to testing whether we are in DST with date('I'), then
adjusting displays for the hour difference, but PHP4 just pulled the
date/time straight from the OS.

Seems like being able to set date.timezone=system so that PHP will follow
the OS rule would be a good idea. But doing this, or leaving
date.timezone blank
in php.ini,
causes PHP to grab the correct timezone data from the OS, but it adds the
hour for DST.

Just wondering... I've spent half a day trying different approaches and
nothing has worked.

Thanks,

David


Re: [PHP] Extracting text from PDF files

2007-10-10 Thread David Giragosian
On 10/9/07, Jay Blanchard <[EMAIL PROTECTED]> wrote:
>
> [snip]
> I need to extract the text from a PDF file for
> storage in the database.
> [/snip]
>
> It depends. If the PDF is an image file you cannot do it with PHP.
>
> http://www.php.net/pdf read the second user note
>
>
> [snip]
> Madison, WI 53703
> [/snip]
> P.S. Do you know of the Madison Scouts?


We use pdf2text.exe to extract text from PDF's. I don't know of anyway to do
it just using PHP.

David


Re: [PHP] round()

2007-10-10 Thread David Giragosian
On 10/10/07, tedd <[EMAIL PROTECTED]> wrote:
>
> Hi gang:
>
> While we're entertaining algorithms, has anyone else noticed that
> php's round() isn't the most accurate algorithm to round?
>
> Cheers,
>
> tedd
>
> --
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com


Yes. sprintf seems to give more expectable results.

David


Re: [PHP] How to decode the PHP Source Code

2007-10-12 Thread David Giragosian
On 10/12/07, tedd <[EMAIL PROTECTED]> wrote:
>
> At 9:57 AM -0400 10/11/07, Daniel Brown wrote:
> >
> >
> > By the way, Tedd you alright there?  Ya' kinda' got squashed.
> >
> >--
> >Daniel P. Brown
>
> I'm find, but I lost my thought -- it's happening more these days. :-)
>
> Cheers,
>
> tedd
> --
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com


I found a thought when I was drifting off to sleep last night. Maybe it was
yours, tedd.
But it was in a foreign language - looked like perl. Couldn't make heads or
tails of it.

David


Re: [PHP] p-s-e-x-e-c

2007-10-18 Thread David Giragosian
On 10/18/07, Philip Thompson <[EMAIL PROTECTED]> wrote:
>
> On 10/18/07, Instruct ICC <[EMAIL PROTECTED]> wrote:
> >
> >
> > > Hi. I'm wanting to run an executable that generates a text file, and
> I'm
> > > having some issues. When I run the command on the server itself, it
> > works
> > > just fine. When I run the same command via a webpage, the text file
> does
> > not
> > > generate. My first impression was that the permissions were wrong. So,
> I
> > > gave the web user and the user making the call the necessary
> > permissions...
> > > no luck. Here's what I'm doing...
> > >
> > >  $command = "psexec.exe -i -w C:/Folder -u user -p pass -e
> > > C:/Folder/executable.exe 2>&1";
> > > exec ($command);
> > > ?>
> > >
> > > This should generate this file but doesn't: C:/Folder/printer_list.txt
> > >
> > > Again, when this exact statement is run in the terminal on the Win2k3
> > > server, it works fine. Any thoughts?
> > >
> > > Thanks in advance,
> > > ~Philip
> > >
> > > PS... Side note: the list rejected my original email b/c of the
> subject:
> > > 'Psexec'. Odd.
> >
> > Maybe you need the full path to psexec.exe
> >
> > Or the web server isn't allowed to use exec due to safemode
> > http://php.he.net/manual/en/features.safe-mode.functions.php
> > or disable_functions in php.ini.
>
>
> Those are good suggestions. Unfortunately, I did try the full path to
> psexec.exe, safe_mode is NOT enabled and there are no functions listed as
> disabled.
>
> I have Google'd, but haven't been successful finding a solution. Anything
> else? =/


Maybe try the command with the backtick operator instead of exec...

David


Re: [PHP] EMPTY??

2007-10-23 Thread David Giragosian
On 10/23/07, Dan Shirah <[EMAIL PROTECTED]> wrote:
>
> I am having some issues with empty().
>
> On my page I have a text area:
>
>  width="680">
> 
> Comments:
>   wrap="soft">
>   
> 
> 
>
> I then submit my page and on the following page I put the posted value
> into
> two variables.
>
> $comments = strtoupper($_POST['comments']);
> $check_comments = $_POST['comments'];
>
> I made two variables for the same posted value because I believe empty()
> does not work with strtoupper in front of the value. It only works with a
> standalone variable, correct?
>
> So, once I have assigned my comments to a variable I am doing:
>
> if(!empty($check_comments)) {
> echo "Do Something";
> }
>
> However, if the comments textarea is left blank I just get a generic error
>
> "Changed database context to database"
>
> I've tried the below and get the same result:
> if($check_comments != "") {
> echo "Do Something";
> }
>
> When comments is left blank and I echo out the value for $check_comments
> it
> returns nothing at all which is why I think empty() or "" should work, but
> they don't.
>
> Ideas?


I've been tripped up by spaces in text fields/boxes, so I've learned to trim
before testing for strlen == 0.

strtoupper returns a string. If there were a zero-length string in the
textarea, I'd guess it would return a zero-length string.

Are you sure there are no carriage returns, etc... in your textarea ?

David


Re: [PHP] EMPTY??

2007-10-23 Thread David Giragosian
On 10/23/07, Dan Shirah <[EMAIL PROTECTED]> wrote:
>
> I did a simple test like this on my save page:
>
>  $comments = $_POST['comments'];
> echo "".$comments."";
> ?>
>
> And it returns 
>
> So, that should show me that there are no place holders, no characters,
> and no carriage returns for the value of $comments, correct?
>

Does it look the same way if you view source?


Re: [PHP] FINDER

2007-10-24 Thread David Giragosian
On 10/24/07, Emiliano Boragina <[EMAIL PROTECTED]> wrote:
>
> Hi everyone.
>
>
>
> I need to know how do I do a FINDER of clinics for zones.
>
> I am new in PHP, so my knowloge is not much.
>
> The user of this finder select the zone from the list, and click in the
> button, and them show a list of clinic with its data info (name, address,
> phones, etc)
>
>
>
> Thanks a lot!
>
> Emiliano


Emiliano,

Some questions to begin:

1. Do you already have the clinic data?
2. If yes, in what form is it stored ( flat file? database? )
3. How much knowledge of html/javascript, etc... do you have?

David


Re: [PHP] Transfer query result to another script

2007-11-01 Thread David Giragosian
On 11/1/07, C.R.Vegelin <[EMAIL PROTECTED]> wrote:
>
> Hi All,
>
> Q: Is it possible to transfer a query result to another script ?
> For example with (fragments of) the following 2 scripts:
>
> Engine.php
> 
> $result = mysqli_query($connect, $myquery);
> if (!$result) error ...
> if (mysqli_num_rows($result) == 0) error ...
> $_SESSION['result'] = $result;
> header("Location: Report.php");
>
> Report.php
> 
> $result = $_SESSION['result'];
> while ($row = mysqli_fetch_array($result)) ...
>
> This last line gives "Couldn't fetch mysqli_result".
> Is this because the result set is local to Engine.php ?
>
> TIA, Cor


Cor,

Do you have session_start() at the top of Report.php?

The manual shows an example of passing a php created class object using a
session variable, with the caveat of needing to include the class definition
on each page.

It may be different for a mysql result object though.

Why do you need the query on a different page than the result?

David


Re: [PHP] Including GD inside HTML code

2007-11-02 Thread David Giragosian
On 11/1/07, Instruct ICC <[EMAIL PROTECTED]> wrote:
>
>
> > Alberto García Gómez wrote:
> > > I trying to include some image generate for a function that use GD.
> > >
> > > eg.:
> > >
> > > function myfunct(){
> > > [MY_CODE]
> > > }
> > >
> > > but when I call the function it generate me a lot of symbols, letters
> and numbers but no image.
> > >
> > > WHAT CAN I DO?
> > >
> > > PS.: I actually usgin a iframe to create the iomage in another .php
> page and place it using this tag.
> > >
> > > Este correo ha sido enviado desde el Politécnico de Informática
> "Carlos Marx" de Matanzas.
> > > "La gran batalla se librará en el campo de las ideas"
> > >
> >
> > Sounds like you are trying to output the actual file content of the
> image in the HTML.
> >
> > You should have a separate script generate the img and link to it with
> your HTML
> >
> > 
> >
> > Then in the script generate_image.php you create the image and pass it
> back at that point.
>
> Depending on what is in your myfunct(), you may also need to set a header
> to let the browser know what type of content you are outputting.


But the header, say __header("Content-type: image/png");__ would go at the
top of generate_image.php, to stay with the example above,
no? Doesn't direct output from GD function calls, necessarily using a header
call of the correct type, prevent any other html output on that page?

David


Re: [PHP] More info on timeout problem, with code

2007-11-06 Thread David Giragosian
On 11/5/07, Jon Westcot <[EMAIL PROTECTED]> wrote:

> Hi all:
>
>As requested, here's the code:
>
>  if(isset($_POST['process'])){
>$old_session_gc_maxlifetime = "";
>$old_max_execution_time = "";
>$old_max_input_time = "";
>$old_session_gc_maxlifetime = ini_set("session.gc_maxlifetime","1800");
>$old_max_execution_time = ini_set("max_execution_time","1800");   // 30
> minutes
>$old_max_input_time = ini_set("max_input_time","1800");   // 30
> minutes -- doesn't work
>
>echo "Session.gc_maxlifetime: " . ini_get("session.gc_maxlifetime")
> .
> "\n";  // shows 1800
>echo "Max execution time: " . ini_get("max_execution_time") .
> "\n";  // shows 1800
>echo "Max input time: " . ini_get("max_input_time") . "\n";
> // shows -1
>
>ignore_user_abort(TRUE);
>set_time_limit(0);
>
>$query = mysql_query("TRUNCATE evall;");

^
>From The Manual...
**
*mysql_query*

A SQL query

The query string should ___not___ end with a semicolon.



>echo "Results of Truncate: $query\n";
>
>$myfile_replace = "uploads/evall.csv";
>$handle = @fopen($myfile_replace, 'rb');
>$save_handle = @fopen("tmp/sql_calls.txt", "wb");
>
>$process_count = 0;
>if(!$handle) {
>echo "The file ($myfile_replace) could not be opened. />\n";
>flush();
>} else {
>echo "The file ($myfile_replace) opened correctly.\n";
>flush();
>
>$headings = fgetcsv($handle, 1, ",");  // Just ignore the first
> row returned.
>$row = 0;
>while (($data = fgetcsv($handle, 1, ",")) !== FALSE) {
>$row++;
>$num = count($data);
>$insert_query = "INSERT INTO evall VALUES(";
>for ($c=0; $c < $num; $c++) {
>if($c > 0) {
>$insert_query .= ",";
>}
>$insert_query .= '"' . $data[$c] . '"';
>}
>$insert_query .= ");";
>
>if(fwrite($save_handle, $row . "; " . strlen($insert_query) .
> ":
> " . "\n") === FALSE) {
>echo "The query could not be written.\n";
>} else {
>$process_count++;
>}
>if($row % 1000 == 0) {
>echo "$row records processed so far\n";
>flush();
>}
>}
>echo "File import completed. $row records read; $process_count
> records added.\n";
>flush();
>fclose($save_handle);
>fclose($handle);
>}
>
>ini_set("session.gc_maxlifetime",$old_session_gc_maxlifetime);
>ini_set("max_execution_time",$old_max_execution_time);
>ini_set("max_input_time",$old_max_input_time);
>
> }
> ?>
> 
>Version 1.9 -- The file uploading process presupposes that the user
> has uploaded the EVAll.CSV
>file to the "uploads" folder. If this has been done and
> you're
> ready to process
>it, click the  button.
> 
> 


hth,

David


Re: [PHP] Help securing a server : Owned by W4n73d H4ck3r

2007-11-09 Thread David Giragosian
On 11/9/07, Daniel Brown <[EMAIL PROTECTED]> wrote:
>
> On Nov 9, 2007 9:27 AM, robert mena <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > One server that hosts several domains ended up with the message "Owned
> > by W4n73d H4ck3r".While still performing an audit I am very
> > confident that this was caused by a php script (it is a linux server)
> > uploaded via FTP or by a defective site hosted (perhaps vulnerable
> > version of a CMS).
> >
> > The symptons seem clear, files owned by apache are vulnerable and the
> > attacker script scanned the web tree and started running.
> >
> > So, basically two questions:
> > - how to detect where this came from
> > - how to prevent it from happening again
> >
> > Thanks.
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>Robert,
>
>That's really not so much a PHP question, but a general Linux
> security question.  Primarily, my job is computer forensics and
> security, so if you'd like, you can reply to me off-list and I'll be
> glad to offer you a hand.
>
> --
> Daniel P. Brown
> [office] (570-) 587-7080 Ext. 272
> [mobile] (570-) 766-8107
>
> If at first you don't succeed, stick to what you know best so that you
> can make enough money to pay someone else to do it for you.


I'd be interested in reading this thread. OK with me to keep it on the list.

David


Re: [PHP] Local vs Master Configure values

2007-11-09 Thread David Giragosian
On 11/9/07, Nathan Nobbe <[EMAIL PROTECTED]> wrote:
>
> On Nov 9, 2007 5:01 PM, Nathan Nobbe <[EMAIL PROTECTED]> wrote:
> > On Nov 9, 2007 4:24 PM, tedd <[EMAIL PROTECTED]> wrote:
> > > Hi gang:
> > >
> > > I'm confronting a safe_mode problem and have a question.
> > >
> > > My PHP Info states that safe_mode is ON for local and OFF for master
> > > -- what does that mean?
>
> o i forgot about this part.  the global column depicts values in php.ini.
> the local column indicates the value has been overridden in one of the
> various
> allowed locations.
> i.e.
> httpd.conf
> .htaccess
> ini_set()
>
> if its on for local and off for master; most likely it is being
> enabled in http.conf
> or a .htaccess file.  at least thats what i would imagine based on the
> locations
> that are allowed to override it as stated in the manual.
>
> -nathan


safe_mode 's changeability is described as PHP_INI_SYSTEM, so the option can
be set in php.ini or httpd.conf only.

  Constant Value Meaning  PHP_INI_USER 1 Entry can be set in user scripts
PHP_INI_PERDIR 2 Entry can be set in php.ini, .htaccess or httpd.conf
PHP_INI_SYSTEM 4 Entry can be set in php.ini or httpd.conf  PHP_INI_ALL 7 Entry
can be set anywhere


David


Re: [PHP] Question about arrays

2007-11-12 Thread David Giragosian
On 11/12/07, Jason Pruim <[EMAIL PROTECTED]> wrote:
>
> Hi Everyone,
>
> I have a question, and to avoid getting flammed until the morning, I
> waited to ask until the end of my day :) Or near it at least.
>
> I have a small simple script I'm writing so that I can calculate how
> much a certain number of pieces weigh, The page can be seen here:
> HTTP://www.raoset.com/weight/
> and here is the php code:
>
>  //include 'defaults.php';
> include '../../media/debug.php';
> $pieceWeight = $_POST['txtWeight'];
> $pieceWeight = $pieceWeight /100;
> $Pieces = $_POST['txtPieces'];
> $weightOfRoute = $Pieces * $pieceWeight;
> $Route =strtoupper($_POST['txtRoute']);
> $TextBoxes = "2";//$_GET['txtNumber'];
>
> //$Vweight = $pieceWeight * $VtxtPieces;
> //Begin debugging
> echo "";
> var_dump($_POST);
> echo "";
> var_dump($_GET);
> echo "";
>
> //End Debugging
>
> $myArray = Array("Route" => "$Route", "Pieces" => $Pieces);//,
> "Record" =>$Record);
> //echo "myArray: ".$myArray["Route"]."";
>
> echo "";
> print_arr($myArray);
> echo "";
> //$VtxtRoute = strtoupper($_POST['txtRoute[]']);
> //$VtxtPieces1 = $_POST['txtPieces1'];
>
> //var_dump($Pieces, $weightOfRoute);
> //echo "Pieces[0]: $Pieces";
> $i = '0';
>
> echo <<
> size='5'
> name='txtNumber' value='{$TextBoxes}'>
>
>
>
>Weight of 100 pieces:  name='txtWeight'
> value='{$pieceWeight}'>
>
>
>Route #
>Pieces per route
>Weight of route
>
> HTML;
>
>
> while($i < $TextBoxes) {
> //$arrRoute = array(txtRoute$i);
> //echo $arrRoute;
>echo <<
>
>
>
> value="{$myArray['Route']}">
>
>
> name='txtPieces'
> value="{$myArray['Pieces']}">
>
>
>{$weightOfRoute}#
>
>
>
> HTML;
>$i++;
>
> }
> echo <<
>
>
>
> HTML;
>
> /*
>
>
>
>
>
>
>
>
>{$weightOfRoute}
>
>
>
>
>
>
>
>
>
>
>{$weightOfRoute}
>
>
>*/
> ?>
>
> Obviously I have some debugging stuff listed in there, so that's not
> the end result that it WILL be :)
>
> What I'm having issues with is, it only takes the value of the second
> text box, it won't process my array. Anyone care to take a quick look?
> Or tell me other then the php website where to look? I've already
> looked there and just couldn't come up with anything that makes sense
> to me...
>
> Thanks for looking!
>
>
> --
>
> Jason Pruim
> Raoset Inc.
> Technology Manager
> MQC Specialist
> 3251 132nd ave
> Holland, MI, 49424
> www.raoset.com
> [EMAIL PROTECTED]
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Jason,

You've duplicated the names of your text boxes, so the second ones overwrite
the first. I'd guess you want to create arrays using  instead of .

hth,

-David.


Re: [PHP] Frustrated trying to get help from your site

2006-09-18 Thread David Giragosian

On 9/18/06, Howard, Tim <[EMAIL PROTECTED]> wrote:


I am a programmer who is fairly new to PHP, and I had a problem trying
to make changes to existing code.  I tried to look up any existing
documentation on your site, and after an extensive search, I finally
found someone who has the same problem.  The only problem is that he
said something about applying a snapshot that fixed his problem.  I
think I finally found the place on your site where these "snapshots" are
kept, but I am unable to download the .ZIP file because of security here
at our facility.  The thing is, I'm not even sure whether I'm on the
right page, or whether this will actually fix my problem, or what I'm
supposed to do with this "snapshot" once I get it.  You have no
documentation (that I can find) about what a "snapshot" is, or how to
download it, or what to do with it.  I think I'm going to have to submit
a bug report, because I don't know what else to do on your site (even
though I've run across several warnings NOT to submit a bug report if a
problem has already been reported).  Your site is incredibly frustrating
and difficult to navigate.

Tim Howard

Calhoun ISD Dept. of Technology

(269) 789-2465



Tim,

I don't know if you posted to this mailing list with the issues you've been
having, but folks here - IMO - are more than happy to lend a hand when given
a chance.

David


Re: [PHP] php/css and .htaccess [SOLVED]

2006-09-21 Thread David Giragosian

On 9/21/06, tedd <[EMAIL PROTECTED]> wrote:


>  tedd wrote:
>>  I embedded php code inside css and changed my .htaccess to read --
>>
>>  
>>   SetHandler application/x-httpd-php
>>  
>>
>>  -- so that the css file would be processed and executed by php. The
end
>>  result was that everything worked and did what I wanted.
>>
>>  However, FireFox / Mozillia won't accept a css file if a .htaccess
file
>>  reads as indicated above.


Christopher Weldon answered:

>  > That shouldn't be expected. The SetHandler only applies to the Apache
>>  handler side, as browsers should not be able to read those files
>  > (.htaccess). So, are you 100% positive that PHP is in fact processing
>  > the file?

Christopher , this is what I'm sure of:

1. My css file has php code in it.

2. Without the .htaccess as noted above, the php code is not processed.

3. With the .htaccess as above, the php code *is* processed.

4. All (most popular) browsers, except for FF/Mozillia, allow php
inside of css.

Please note that, Kreme and Wind (sounds like a Rock group) provided
the answer, which was to add a header to the css file, like so:

header('Content-Type: text/css; charset=ISO-8859-1');

So, it wasn't that the browsers were reading the .htaccess file, but
rather because of the .htaccess file FireFox/Mozillia required a
header in the css file just to keep things straight (my
understanding).

Now, this header coupled with the above .htaccess allows php code to
be embedded within a css file AND work for all popular browsers,
including FireFox/Mozillia.

This is simply amazing, at least to me, and completes my next step
toward world domination. :->.

Many thanks gang for your most excellent and mondo kewl advice.

tedd

PS: So much talent here wasted on programming. :-)
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com



tedd,

So with this approach you're able to tailor css styles for specific browsers
and their particular implementations of css, rather than employ hacks
directly in the css??

David


[PHP] MySQLDump and master/slave Behavior

2006-10-03 Thread David Giragosian

Howdy Guys,

I have a PHP backup script running as a cronjob that has an exec(mysqldump)
line followed a bit later by an exec(tar -cjf) line. The backup script runs
against a slave db in the wee hours, and the master gets a continuous stream
of inputs at the rate of about 18,720 per day. Obviously as the database
grows in size, the script takes longer and longer to run. Right now, after
about 15 months of operation,  it's taking about 40 minutes to complete. But
I did a test yesterday, and the mysqldump part only takes about 2 minutes to
finish.

Even though I've never lost data, my concern is that since master-slave
syncing is blocked while the script runs, I just might lose something if
there's a buffer overrun or something like that.

So, Question 1 is: does mysqldump's connection to the slave db exist for the
entire script execution time, or just for the length of time of its own
execution? I imagine if I used mysql_connect() in the script that it would
be for the entire length of the script execution, but mysqldump makes its
own connection, so I'm just not sure about this.

Question 2: Should I, just to be on the safe side, break out the mysqldump
code into its own scipt, and run it, say, 30 minutes before the tar script?

Thanks for your time,

David


Re: [PHP] MySQLDump and master/slave Behavior

2006-10-03 Thread David Giragosian

Thank you Jon, Joe, and Richard.

I guess I'll leave things as they are and continue to monitor daily.
Fortunately, only up to 3 years worth of data needs to be kept "live" in the
master-slave db's, so there is a limit to how much data I will have to cope
with.

David


Re: [PHP] PHP Mailer and SMTP = SPAM?

2006-10-10 Thread David Giragosian


How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991


How many Boomer wannabes does it take to pollute a mailing list?
Just one, <[EMAIL PROTECTED]>, MAN!

David


  1   2   >