Re: [PHP] test for associative or numerically indexed array

2003-03-20 Thread Ernest E Vogelsinger
At 08:52 20.03.2003, cpaul said:
[snip]
ok thanks - that makes sense.  sort of doesn't solve my problem, because
if my function receives an enumerated array, i want it to treat it as an
associative array, using the value as the key.
[snip] 

What would be the value then?

If I get you correctly, you would treat an array that comes like
[0] = entry 0
[1] = entry 1
[2] = entry 2
as
[entry 0] = ??
[entry 1] = ??
[entry 2] = ??

What happens when there are duplicate values in the source array? You will
loose entries on duplicate values.

If I got you right here have a look at array_flip()
(http://www.php.net/manual/en/function.array-flip.php) to exchange array sides.

You can't tell with absolute certainty if an array is enumerated, or built
as associative array. Take this example:
$a = array('one','two','three');
$b = array(); $b[0] = 'one'; $b[1] = 'two'; $b[2] = 'three';
$c = array(0 = 'one', 1 = 'two', 2 = 'three');

Which one would you believe is enumerated, and which one is associative?

What you can do is walk the array keys and check if there is at least a
single non-numeric key. If you found one the array is associative. If you
found none it may be likely that the array is enumerated, but you can't be
sure in a general way, except your application is designed in a way that
uses always non-numeric keys for associative arrays.



-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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



[PHP] Favor from gurus

2003-03-20 Thread Dennis Gearon
If one of you are a guru and on the php-dev list, would you please
either look at the code or ask others on that list if it's possible to
use:

'requiressl=1'

in the connection string for pg_connect/pg_pconnect and it will actually
work in PHP ver = 4.2.2 ?

I am already on so many lists, I don't want to join another for one
question.

Please cc me because I'm on digest for php-general.

Thank you in advance.

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



Re: [PHP] test for associative or numerically indexed array

2003-03-20 Thread cpaul



 At 08:52 20.03.2003, cpaul said:
 [snip]
 ok thanks - that makes sense.  sort of doesn't solve my problem, because
 if my function receives an enumerated array, i want it to treat it as an
 associative array, using the value as the key.
 [snip] 


ernest wrote:

 What would be the value then?
 
 If I get you correctly, you would treat an array that comes like
 [0] = entry 0
 [1] = entry 1
 [2] = entry 2

like this:

  'entry 0' = 'entry 0'
  'entry 1' = 'entry 1'
  'entry 2' = 'entry 2'


 What happens when there are duplicate values in the source array? You will
 loose entries on duplicate values.

the source array is based on a directory listing, so i don't think there's
a possibility of that happening?



 You can't tell with absolute certainty if an array is enumerated, or built
 as associative array. Take this example:
 $a = array('one','two','three');
 $b = array(); $b[0] = 'one'; $b[1] = 'two'; $b[2] = 'three';
 $c = array(0 = 'one', 1 = 'two', 2 = 'three');
 
 Which one would you believe is enumerated, and which one is associative?

they'd all be enumerated, except perhaps $c -- but i've grown :) and now
understand that $c winds up being an enumerated array.. or is it?

in my code

 $q = mysql_query ( SELECT production_id, title FROM productions ORDER BY title; 
);
 $this-all_productions[] = ;
 while ( $row = mysql_fetch_array( $q ) ) {  
   $this-all_productions[$row[production_id]] = $row[title];
 }

the array is kept in order when i foreach the array - wouldn't they sort
themselves into 0,1,2,3,4,5,etc if my while loop was populating an 
enumerated array?   or are all arrays in php actually a keyed hash?



 What you can do is walk the array keys and check if there is at least a
 single non-numeric key. If you found one the array is associative. If you
 found none it may be likely that the array is enumerated, but you can't be
 sure in a general way, except your application is designed in a way that
 uses always non-numeric keys for associative arrays.

thanks so much for all your input on this.





regards



-- 
chris paul

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



Re: [PHP] PHP and file extensions

2003-03-20 Thread Chris Hewitt
Beauford.2002 wrote:

accessed unless you log in - is there a way to have this line in an html
file without changing the extension to .php?
Yes, but you need to tell Apache (in the AddType line in httpd.conf) to 
parse all .html files with php. This has a performance implication for 
ordinary .html files.

HTH
Chris


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


Re: [PHP] Apache + PHP - when using as module, can one have PHPs run as

2003-03-20 Thread Chris Hewitt
ADFH wrote:

Would it be true to say that the current Apache PHP module doesn't
support running PHP scripts as their owners, and that one has to use PHP
in CGI mode for this?
PHP as an Apache module runs as the user that Apache runs as. Typically 
nobody or apache.

I use a well known PHP based messageboard on a website I run, and I want
to prevent non-root, non-me access to the file containing my database
password.
I suggest if a file then put it outside Apache's document root or use an 
environment variable.

For a perl script, I'd just chmod it 700 with directory given perms 711
- but in PHP 4.3.2rc1, it seems that to reference a file by way of a
relative path, the script must be at least 644 and the directory it's in
755.
My older version of php is quite happy with 700 permissions, unless I've 
got this wrong.  The owner is the Apache user.

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


Re: [PHP] Cleaning user data

2003-03-20 Thread rotsky
That's useful stuff, thanks - and thanks to other respondents.

My main concerns are to avoid junk in the database (and on-screen messages)
and to avoid dangerous and malicious postings, like the one Justin outlined
below (so I guess strip_tags is a major step there). What I have in mind,
then, is:

Use a foreach loop to run through all posted data and perform the following
on each item:
- strip_tags()
- trim()

I'll be saving this stuff to a database, so I'll keep htmlentities for the
display stage.

Also, on a field-by-field basis (depending on what it holds):
- check not empty
- check length
- check against allowable characters  formats

I'm still battling with the whole escaped characters business. My hosting
supplier has magic quotes turned on, so on the page that receives the data
from the form, I run the $_POST variables through stripslashes(). And yet
the slashes are still there - eg, in front of apostrophes. Perhaps they've
been escaped twice for some reason. I take them out because the data is
going to be POSTed again before being written to the database. I guess I
need to experiment more.

Justin French [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
snip
 BTW: Allowing some tags with striptags() offers are great security risk:

 let's say you allow b tags -- then I can go:

 b onmouseover'javascript:window.close();'hahahaha/b  --  not good!!
snip



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



Re: [PHP] test for associative or numerically indexed array

2003-03-20 Thread Ernest E Vogelsinger
At 09:57 20.03.2003, cpaul said:
[snip]
 as associative array. Take this example:
 $a = array('one','two','three');
 $b = array(); $b[0] = 'one'; $b[1] = 'two'; $b[2] = 'three';
 $c = array(0 = 'one', 1 = 'two', 2 = 'three');
 
 Which one would you believe is enumerated, and which one is associative?

they'd all be enumerated, except perhaps $c -- but i've grown :) and now
understand that $c winds up being an enumerated array.. or is it?

Well, all these 3 arrays are _exactly_ the same. If you print_r() them
you'd see
Array {
0 = one
1 = two
2 = three
}
The key to this issue seems to be understanding that it makes no difference
how the array keys are constructed... an array is an association of key to
value, being a hash  always if you want to see it that way.

in my code

 $q = mysql_query ( SELECT production_id, title FROM productions ORDER 
BY title; );
 $this-all_productions[] = ;
 while ( $row = mysql_fetch_array( $q ) ) {  
   $this-all_productions[$row[production_id]] = $row[title];
 }

the array is kept in order when i foreach the array - wouldn't they sort
themselves into 0,1,2,3,4,5,etc if my while loop was populating an 
enumerated array?   or are all arrays in php actually a keyed hash?

You're chosing your own keys here - so this makes a perfect associative
array, even if the keys ($row['production_id']) would be a sequenced
number. If you would just add the titles up ($this-all_productions[] =
$row['title']), PHP would choose an index key for you - the most general
thing it can do is to enumerate it. Basically what it does is
 array[count(array)] = new_element

So much for the theory - what are you really trying to achieve? Maybe
there's something you can redesign so you're not relying on the fact if an
array is enumerated or not.


-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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



[PHP] Srange error

2003-03-20 Thread shaun
Hi,

I would be very grateful if someone could explain to me why this is
happening. I am trying to convert a date sent from a textfield. The
textfield is initially populated by a JavaScript calendar control. Using the
following code I am attempting to read in the date sent from the textfeild:

 //initialise dates for header of table
 if(isset($goto_date) == true){
  //use dates sent from form
  $full_date = date(dS of F, strtotime($_POST[input1]));
  $day = date(d, strtotime($_POST[input1]));
  echo full_date: $full_datebr;
  echo day: $daybr;
 } else {
  //use todays date
  $full_date = date(dS of F);
  $day = date(d);
 }

but i keep getting this output:

full_date: 24th of August
day: 24

the javascript populates the textfield in the form off dd-mm-.

Thanks in advance for any advice offered



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



Re: [PHP] test for associative or numerically indexed array

2003-03-20 Thread cpaul

 So much for the theory - what are you really trying to achieve? Maybe
 there's something you can redesign so you're not relying on the fact if an
 array is enumerated or not.

thanks very much for your help - i understand now that no matter what
kind of array i think i'm making, it is being morphed into an associative
array.  i half-understood this from the docs, but was puzzled.. i expected
the behaviour of an array in other languages, which even if i were to
define an array in this sequence:

$arr[2] = z;
$arr[0] = x;
$arr[1] = y;

would shuffle itself internally into a sequence like: x, y, z.

but in php this obviously isn't the case, and it remains: z, x, y.

thanks again for your time.




-- 
chris paul


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



Re: [PHP] Passing variable from webpage to php (newbie?)

2003-03-20 Thread Bobby Rahman
Hiya

It could need setting register_globals =on in your php.ini

if after that still problems then you may need to look into sessions and in 
particular session_start() and $_SESSION['varname'] and make sure the 
variables are global so that more than one script can use them.

Hope this steers you in right direction
*warning im a newbie too so you may wait for some more replies to confirm 
what im saying*

Bobster











From: Joe Kupiszewski [EMAIL PROTECTED]
Reply-To: Joe Kupiszewski [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [PHP] Passing variable from webpage to php (newbie?)
Date: Wed, 19 Mar 2003 10:57:11 -0500
I think I already tried to post once, so sorry if this is a duplicate, but 
I
don't see my first attempt.  I am trying to do what should be a relatively
simple and basic task.  I've got a php script/page that has a switch/case
selection statement in it.  Obviously, depending on what value a particular
variable takes when passed to the script, the script SHOULD :) do different
things.  However, when I invoke the script using
www.somedomain.com/somephpscript.php?action=1  (substitute one with, 2, 3, 
4
or whatever) and then do a check whether any value is passed to my script,
it always tells me the value is empty ( if (empty ($action)) - it just
always thinks its empty.  I'm copying this script from a book, so I do not
have any reason to believe there is an error in the code, but obviously
something is not happening properly.  My thought is that perhaps something
needs to be turned on in the php.ini or in the apache httpd.conf file to
allow this variable passing to work.  Is there some other way to do this?

Sorry for the long paragraph sentence.  I'll be happy to post the code if
needed or provide any additional information or give the actual URL so you
can see what is happening.
Thanks for any thoughts



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


_
Overloaded with spam? With MSN 8, you can filter it out 
http://join.msn.com/?page=features/junkmailpgmarket=en-gbXAPID=32DI=1059

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


php-general Digest 20 Mar 2003 11:16:47 -0000 Issue 1949

2003-03-20 Thread php-general-digest-help

php-general Digest 20 Mar 2003 11:16:47 - Issue 1949

Topics (messages 140359 through 140415):

Re: Zero Fill - Number Format
140359 by: Mike Brum
140360 by: Kevin Waterson

Re: Anybody have any thoughts on Smarty?
140361 by: Dennis Gearon

imap trouble
140362 by: Niklas Saers Mailinglistaccount

Mac IE File download problem - any solutions?
140363 by: Daniel Leighton

Re: Zip Way of life.
140364 by: David T-G

Dynamic variables (with method=post)
140365 by: Fabio Bot
140391 by: John W. Holmes

Re: PHP and IIS - More info
140366 by: Beauford.2002

Eliminating space between HR and Image
140367 by: Andre Dubuc
140369 by: Leif K-Brooks
140370 by: Michiel van Heusden
140371 by: Richard Whitney
140372 by: Andre Dubuc
140373 by: Andre Dubuc
140375 by: Leif K-Brooks

Cleaning user data
140368 by: rotsky
140377 by: Pete James
140390 by: John W. Holmes
140394 by: olinux
140395 by: Justin French
140396 by: John W. Holmes
140397 by: Justin French
140398 by: Chris Shiflett
140411 by: rotsky

convert VARCHAR 10 to DATETIME
140374 by: freaky deaky
140378 by: Pete James
140387 by: John W. Holmes
140393 by: freaky deaky

imap problem
140376 by: Niklas Saers Mailinglistaccount

session variables
140379 by: Pag
140381 by: daniel

Re: - IIS  - More info
140380 by: Beauford.2002

dynamically splitting a paragraph for a preview of content
140382 by: daniel

PHP and file extensions
140383 by: Beauford.2002
140409 by: Chris Hewitt

Help with sum of items
140384 by: Jim Greene

Apache + PHP - when using as module, can one have PHPs run as
140385 by: ADFH
140410 by: Chris Hewitt

strip single quotes
140386 by: Daniel McCullough
140388 by: Martin Towell
140389 by: John W. Holmes

Re: Date Conversion
140392 by: John W. Holmes

test for associative or numerically indexed array
140399 by: cpaul
140400 by: Chris Shiflett
140404 by: cpaul
140405 by: Ernest E Vogelsinger
140408 by: cpaul
140412 by: Ernest E Vogelsinger
140414 by: cpaul

Re: Parse Error
140401 by: Manjunath H N

persistent of LDAP connections across invocations?
140402 by: Scott McDermott

Making tree menu
140403 by: Daniel Harik

Re: [PHP-DB] Making tree menu
140406 by: olinux

Favor from gurus
140407 by: Dennis Gearon

Srange error
140413 by: shaun

Re: Passing variable from webpage to php (newbie?)
140415 by: Bobby Rahman

Administrivia:

To subscribe to the digest, e-mail:
[EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]

To post to the list, e-mail:
[EMAIL PROTECTED]


--
---BeginMessage---
This is what I did for a dynamic zero-fill for renaming batches of files:

// Get Zero Padding For New Image Names
$zero_padding = strlen(count($image_array));

  foreach($image_array as $temp){
$n++;
$n_length = strlen($n);
for($i = 0; $i  ($zero_padding - $n_length); $i++){
$n = 0 . $n;
  }
$new_name = $image_inbox . / . $newName . - . $n . .jpg;
rename($image_inbox/$temp, $new_name);
  }


I'm not sure if this will be applicable to your situation, but it works
perfectly for me since it will zero-fill for any length of numbers and pad
the shorter numbers appropriately.

-M

-Original Message-
From: Harry.de [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 19, 2003 6:09 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Zero Fill - Number Format


How can I put out a Zero Fill for numbers
The result should be

$something=26;
echo $something;

e.g.
026

I didn't found a solution with number format. Is there any other way?



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




---End Message---
---BeginMessage---
This one time, at band camp,
Harry.de [EMAIL PROTECTED] wrote:

 How can I put out a Zero Fill for numbers
 The result should be
 
 $something=26;
print str_pad($something, 7, 0, STR_PAD_LEFT);

Kevin
 __  
(_ \ 
 _) )            
|  /  / _  ) / _  | / ___) / _  )
| |  ( (/ / ( ( | |( (___ ( (/ / 
|_|   \) \_||_| \) \)
Kevin Waterson
Port Macquarie, Australia
---End Message---
---BeginMessage---
Smarty is very wonderful. If both the coder and the designer work 
together, layout and code logic can be completely separate.

I am doing a form for entering in about 25 fields. As long as the 
template the designer comes up with has:

The required form variables,
and template variables to put 

[PHP] Reading from file on local disk to server

2003-03-20 Thread Jan Meiring
Hi everyone

 This is what I want to do:

 I have a file on each workstation that gets created each time the pc is
 rebooted - the file save the pc configuration plus the current user logged
 onto the machine, I want to read from that file variables so that I can
save
 it to my mySQL database and run queries on the data. - I have no problem
 reading from a file if it is on the web server, but am experiencing
problems
 reading from the file on the remote client pc. - any suggestions?

 This is what I can do:

 Read from file on web server, set it to variables and write it to a mySQL
 database.






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



[PHP] Changing pages on another PC remotely?

2003-03-20 Thread Denis L. Menezes
Hello friends.

This is a difficult one, but I need to try for my project.

Can I have make a script where, pressing a button on one page in one PC causes a 
webpage change on another PC which is also on the internet?

Thanks
Denis

Re: [PHP] Changing pages on another PC remotely?

2003-03-20 Thread Ernest E Vogelsinger
At 12:49 20.03.2003, Denis L. Menezes spoke out and said:
[snip]
This is a difficult one, but I need to try for my project.

Can I have make a script where, pressing a button on one page in one PC 
causes a webpage change on another PC which is also on the internet?
[snip] 

This dependes primarily on the application the _other_ PC has running.

Basically the answer to your question is yes if you are in control of the
website the _other_ PC just visits. This website needs some JavaScript to
refresh its content - that's where you can come in.

I've answered a similar question a week ago that you might find in the
archives - look for OT Inactivity Timeout. Should give you a starter.


-- 
   O Ernest E. Vogelsinger 
   (\) ICQ #13394035 
^ http://www.vogelsinger.at/


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



[PHP] Error on mysql_num_rows

2003-03-20 Thread ed

 I've been trying to count records that match my query in MySQL using the
examples given in the on-line manual as well as the user comments and I'm
still getting the error:

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result
resource.

Here's the code.

mysql_connect ($local_host, $local_user, $local_pass);
mysql_select_db ($local_db);   
$result = mysql_query (SELECT count(id) FROM listings WHERE agent = 
'$agent' AND child = '0');
$rc = mysql_num_rows($result);
mysql_close();

 Is there something I'm missing here? I've tried using just about every
example in the on-line manual and get the same error. I can run other
queries just fine though.

Thanks,

Ed



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



Re: [PHP] Error on mysql_num_rows

2003-03-20 Thread Tom Rogers
Hi,

Thursday, March 20, 2003, 10:44:33 PM, you wrote:

ehhc  I've been trying to count records that match my query in MySQL using the
ehhc examples given in the on-line manual as well as the user comments and I'm
ehhc still getting the error:

ehhc Warning: mysql_num_rows(): supplied argument is not a valid MySQL result
ehhc resource.

ehhc Here's the code.

ehhc mysql_connect ($local_host, $local_user, $local_pass);
ehhc mysql_select_db ($local_db);   
ehhc $result = mysql_query (SELECT count(id) FROM listings WHERE agent = 
ehhc '$agent' AND child = '0');
ehhc $rc = mysql_num_rows($result);
ehhc mysql_close();

ehhc  Is there something I'm missing here? I've tried using just about every
ehhc example in the on-line manual and get the same error. I can run other
ehhc queries just fine though.

ehhc Thanks,

ehhc Ed


I would be guessing that there is a mysql error so put in some checking and echo 
mysql_error()
Also count(id) will ever only return 1 row so you have to retrieve that to get the 
actual count.
An easy way is like this

if(!$result = mysql_query (SELECT count(id) AS id_count FROM listings WHERE agent = 
'$agent' AND child = '0')){
   echo 'Oops : '.mysql_error();
}else{
   $row = mysql_fetch_array($result);
   echo 'count = '.$row['id_count'];
}
-- 
regards,
Tom


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



RE: [PHP] strip single quotes

2003-03-20 Thread Daniel McCullough
I have this code in to try and strip single quotes out.  But it does it to 
one but not the rest.

$address = str_replace(\\\///, , $store['address']);
$address = str_replace(', , $address);
$address = str_replace(', \', $address);
$address = addslashes($address);
$sql2 = SELECT * FROM store_name WHERE name = '.$store['name'].';
//$build_sql .= $sql2.br;
$result2 = mysql_query($sql2) or die(mysql_error());
$store_name = mysql_fetch_array($result2);
$sql3 = SELECT * FROM store_address WHERE address = '.$address.';
any thoughts




From: John W. Holmes [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
To: 'Daniel McCullough' 
[EMAIL PROTECTED],[EMAIL PROTECTED]
Subject: RE: [PHP] strip single quotes
Date: Wed, 19 Mar 2003 21:49:10 -0500
MIME-Version: 1.0
Received: from dc-mx03.cluster1.charter.net ([209.225.8.13]) by 
mc10-f34.bay6.hotmail.com with Microsoft SMTPSVC(5.0.2195.5600); Wed, 19 
Mar 2003 19:04:29 -0800
Received: from [68.117.196.146] (HELO coconut)  by 
dc-mx03.cluster1.charter.net (CommuniGate Pro SMTP 3.5.9)  with ESMTP id 
107067803; Wed, 19 Mar 2003 21:51:20 -0500
X-Message-Info: JGTYoYF78jEHjJx36Oi8+Q1OJDRSDidP
Organization: U.S. Army
Message-ID: [EMAIL PROTECTED]
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook, Build 10.0.3416
Importance: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
In-Reply-To: [EMAIL PROTECTED]
Return-Path: [EMAIL PROTECTED]
X-OriginalArrivalTime: 20 Mar 2003 03:04:29.0882 (UTC) 
FILETIME=[6C8DB1A0:01C2EE8D]

 I'm trying to query the database using a string pulled out of the
database
 and compare and get the id.  I can do it to a certain point and what
kills
 my query is single quotes.  I CANNOT figure out how to escape it.

 I DID THIS:
 $address2 = str_replace(', , $address);

 that worked on some, but not all.
 $address = stripslashes($store['address']);
 $address = str_replace(', , $address);
 $address = htmlspecialchars($address);
 $address = addslashes($address);

 anyone

 Some errors I have gotten back
 You have an error in your SQL syntax near 's Linen  Home'' at line
1
 and
 You have an error in your SQL syntax near 's 800 number.'' at line 1
You need to use addslashes() on any string you insert into your query.

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



_
Add photos to your e-mail with MSN 8. Get 2 months FREE*.  
http://join.msn.com/?page=features/featuredemail

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


[PHP] Creating graphs with PHP?

2003-03-20 Thread Denis L. Menezes
hello friends,

Is there a possibility to create graphs on a web page using PHP?

I have loooked through the PHP manual but cannot find anything.

Thanks very much.
Denis

[PHP] Re: Creating graphs with PHP?

2003-03-20 Thread Joseph Szobody
Dennis,

Try this:

http://www.aditus.nu/jpgraph/

Joseph

Denis L. Menezes [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]
hello friends,

Is there a possibility to create graphs on a web page using PHP?

I have loooked through the PHP manual but cannot find anything.

Thanks very much.
Denis


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



[PHP] Re: Creating graphs with PHP?

2003-03-20 Thread Christopher J. Crane
JPGRAPH is the best I have found so far. Good documentation and great
results. I use it for a lot of graphing purposes, the most being stock
market charts and graphs.
Joseph Szobody [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Dennis,

Try this:

http://www.aditus.nu/jpgraph/

Joseph

Denis L. Menezes [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
hello friends,

Is there a possibility to create graphs on a web page using PHP?

I have loooked through the PHP manual but cannot find anything.

Thanks very much.
Denis



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



[PHP] Random Number Generation

2003-03-20 Thread Christopher J. Crane
I have a script that loads 13 or more file names into an array. Then at
random I select one of the names out of the array. This files are background
songs used on my webpage. Streaming a different song each time the page is
refreshed or loaded. My issue is I do not want the same song to ever be
played back to back. How can I check for that and if the random file chosen
is the currently played file then pick another..

Here is what I have so far.
?PHP
$Music =
array(bk1.swf,bk2.swf,bk3.swf,bk4.swf,bk5.swf,bk6.swf,bk7.swf
,bk8.swf,bk9.swf,bk10.swf,bk11.swf,bk12.swf,bk13.swf);
srand((float) microtime() * 1000);
$rand_keys = array_rand ($Music, 2);
$MusicToPlay = $Music[$rand_keys[0]];
?

How do I pass the variable to the next page easily so that PHP will know
what is currently being played?



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



[PHP] Re: Anybody have any thoughts on Smarty?

2003-03-20 Thread David Eisenhart
Smarty is a fantastic tool.

One of it's really great features (compared with a couple of other
templating engines that I have looked at) is the inherent ability to include
logic (using smary syntax) in the templates. This'll sound a bit odd - after
all, a point of templates is to separate logic and presentation. However, it
is really handy to be able to include 'presentation logic' in the
presentation layer. For example, contained in a template a very simple eg
in pseudo terms:

if form validated then
show success message
else
show failure message

From your code you pass this template the form validated variable value and
it shows the appropriate message. Without the ability to do this (as in
other
templating engines) you find that your logic code becomes cluttered with
presentation issues. Hence Smarty facilitates a much cleaner separation of
logic and presentation.

However, this does mean that either your page designer has to get to grips
with introducing smarty code into his/her templates or you must add such
code to his/her templates. Though for the reason above (and others) it is
well
worth giving it a try.

David



Charles Kline [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Was reading this and it sounds really cool. I do work as a consultant
 to designers and thought this may be a good way to improve work flow? I
 have read mixed thoughts on this, but was wondering what this list
 thought? Anyone using it? Real world?

 http://www.zend.com/zend/tut/tutorial-cezar.php

 Thanks,
 Charles






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



Re: [PHP] Re: Creating graphs with PHP?

2003-03-20 Thread Denis L. Menezes
Thanks guys for the help.
I went to see JP graph. But what I cannot find out is how I can install
jpgraph and GD libraries if I am hosting my site on a shared server with an
ISP(one of those USD 24.95 per month with 200Mb space kind of thing).

Please help.

Denis

- Original Message -
From: Joseph Szobody [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, March 20, 2003 9:24 PM
Subject: [PHP] Re: Creating graphs with PHP?


 Dennis,

 Try this:

 http://www.aditus.nu/jpgraph/

 Joseph

 Denis L. Menezes [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 hello friends,

 Is there a possibility to create graphs on a web page using PHP?

 I have loooked through the PHP manual but cannot find anything.

 Thanks very much.
 Denis


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



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



Re: [PHP] Cleaning user data

2003-03-20 Thread CPT John W. Holmes
 --- John W. Holmes [EMAIL PROTECTED] wrote:
  I disagree. I think stripping HTML from my text is a horrible thing. If
  I want to put a b in my text, then use htmlentities() and show me a
  b when I look at it. Obviously you don't want to evaluate HTML, but
  the end result should be that I should see exactly what I typed into the
  text box.

The real problem I have with strip_tags is that if I want to type smile or
grin, it's going to be stripped out and now I have to go back and edit my
code and change it to something else... If you just use htmlentities(), the
user is none the wiser.

  If you need to allow formatted text, then use something like BBcode
  where you can specify exactly what is allowed.

 Maybe there is something I'm missing, but I have always hated these
alternative
 markup languages like BBcode that seem to offer no benefit over HTML. If
you
 want to allow the b tag to be evaluated, you can do something like this
after
 you use htmlentities():

 $blah = str_replace('lt;bgt;', 'b', $blah);
 $blah = str_replace('lt;/bgt;', '/b', $blah);

 Of course, if people want the b to appear exactly as they type it, they
would
 either have to use lt;bgt;, or you would have to let them choose an
option as
 to whether they want to use HTML (much like slash code does).

That would work, too, I guess. If the user actually typed in lt; it would
be encoded as amplt; and not match something similar to a replacement like
you've shown.

You don't want to do matching like you've shown, though. If I put a b on
my page with no /b, then it's going to make everything on the entire page
following my post bold. When cleaning the data, you want to make sure you
match a pattern that includes both the start and end tag. You can use
regular expressions or go through character by character.

---John Holmes...


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



Re: [PHP] Re: Creating graphs with PHP?

2003-03-20 Thread Christopher J. Crane
If PHP is install the GD modules are already there.
Write a should script ?PHP phpinfo() ? and put it on your server and
access it through your web browser. It will tell you if GD is installed and
what version. I do a lot of work with these and would be willing to help you
get started.

By the way, most people here are using a shared hosting environment, myself
included.

Denis L. Menezes [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Thanks guys for the help.
 I went to see JP graph. But what I cannot find out is how I can install
 jpgraph and GD libraries if I am hosting my site on a shared server with
an
 ISP(one of those USD 24.95 per month with 200Mb space kind of thing).

 Please help.

 Denis

 - Original Message -
 From: Joseph Szobody [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Thursday, March 20, 2003 9:24 PM
 Subject: [PHP] Re: Creating graphs with PHP?


  Dennis,
 
  Try this:
 
  http://www.aditus.nu/jpgraph/
 
  Joseph
 
  Denis L. Menezes [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  hello friends,
 
  Is there a possibility to create graphs on a web page using PHP?
 
  I have loooked through the PHP manual but cannot find anything.
 
  Thanks very much.
  Denis
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 




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



[PHP] Increase a month

2003-03-20 Thread shaun
Hi,

could someone tell me why this:

?php
   $month = date(m);
   echo \$month: .date(F,strtotime($month)).br;
   $month = $month + 1;
   echo \$month: .date(F,strtotime($month)).br;
?

outputs this:

$month: March
$month: March

surely it should be:

$month: March
$month: April

Thanks in advance for your help.



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



Re: [PHP] Increase a month

2003-03-20 Thread Joshua Moore-Oliva
date() returns a unix timestamp, which is in seconds.  You are only adding one 
second.

Try using mktime, and increment hte month argument there.

Josh.

On March 20, 2003 09:00 am, shaun wrote:
 Hi,

 could someone tell me why this:

 ?php
$month = date(m);
echo \$month: .date(F,strtotime($month)).br;
$month = $month + 1;
echo \$month: .date(F,strtotime($month)).br;
 ?

 outputs this:

 $month: March
 $month: March

 surely it should be:

 $month: March
 $month: April

 Thanks in advance for your help.


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



[PHP] Re: Increase a month

2003-03-20 Thread Christopher J. Crane
echo \$month: .date(F,strtotime($month)).br;
you have escaped the $ by placing the \ in front of it. Remove it.
Shaun [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi,

 could someone tell me why this:

 ?php
$month = date(m);
echo \$month: .date(F,strtotime($month)).br;
$month = $month + 1;
echo \$month: .date(F,strtotime($month)).br;
 ?

 outputs this:

 $month: March
 $month: March

 surely it should be:

 $month: March
 $month: April

 Thanks in advance for your help.





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



[PHP] sorting an array

2003-03-20 Thread Steve Buehler
I am having problems sorting a multi-dimensional array.  I am hoping that 
somebody can help me figure out what I am doing wrong.  It should sort on 
the field than on the fac.  Here is my code:
-start code-
$sortterm;
get_locations();

function cmp ($a, $b) {
GLOBAL $sortterm;
return strcmp($a[$sortterm], $b[$sortterm]);
}
function get_locations(){
GLOBAL $sortterm;
$i=1;
while(($row=mysql_fetch_object($result))){
$locs[$i][loc_id]=$row-loc_id;
$locs[$i][fac]=$row-fac;
$locs[$i++][field]=$row-field;
}
	reset($locs);
	$sortterm=field;
	usort($locs, cmp);
	reset($locs);
	$sortterm=fac;
	usort($locs, cmp);
	reset($locs);
	while (list ($key, $value) = each ($locs)) {
		echo $locs[$key][loc_id]., .$locs[$key][fac]., 
.$locs[$key][field].br\n;
	}
}
-end code-

Here is how it comes out when run:
12, Johnson County Community College, C
11, Johnson County Community College, B
13, Johnson County Community College, D
14, Johnson County Community College, E
10, Johnson County Community College, A
8, Johnson County Girls Athletic Assoc, D
6, Johnson County Girls Athletic Assoc, B
7, Johnson County Girls Athletic Assoc, C
5, Johnson County Girls Athletic Assoc, A
9, Shawnee Civic Center, 1
1, Tomahawk Sports Dome, 1
2, Tomahawk Sports Dome, 2
3, Tomahawk Sports Dome, 3
4, Tomahawk Sports Dome, 4
As you can see, the fac is sorted correctly, but the field isn't.

Thanks
Steve


--
This message has been scanned for viruses and
dangerous content by the MailScanner at ow5, and is
believed to be clean.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Error on mysql_num_rows

2003-03-20 Thread ed

I think I've found my problem. The query does work if I place the exact
same code directly into my script but I had previously been calling it as
a function from an include file. It's working just great now.

Thanks,

Ed



On Thu, 20 Mar 2003, Tom Rogers wrote:

 Hi,
 
 Thursday, March 20, 2003, 10:44:33 PM, you wrote:
 
 ehhc  I've been trying to count records that match my query in MySQL using the
 ehhc examples given in the on-line manual as well as the user comments and I'm
 ehhc still getting the error:
 
 ehhc Warning: mysql_num_rows(): supplied argument is not a valid MySQL result
 ehhc resource.
 
 ehhc Here's the code.
 
 ehhc mysql_connect ($local_host, $local_user, $local_pass);
 ehhc mysql_select_db ($local_db);   
 ehhc $result = mysql_query (SELECT count(id) FROM listings WHERE agent = 
 ehhc '$agent' AND child = '0');
 ehhc $rc = mysql_num_rows($result);
 ehhc mysql_close();
 
 ehhc  Is there something I'm missing here? I've tried using just about every
 ehhc example in the on-line manual and get the same error. I can run other
 ehhc queries just fine though.
 
 ehhc Thanks,
 
 ehhc Ed
 
 
 I would be guessing that there is a mysql error so put in some checking and echo 
 mysql_error()
 Also count(id) will ever only return 1 row so you have to retrieve that to get the 
 actual count.
 An easy way is like this
 
 if(!$result = mysql_query (SELECT count(id) AS id_count FROM listings WHERE agent = 
 '$agent' AND child = '0')){
echo 'Oops : '.mysql_error();
 }else{
$row = mysql_fetch_array($result);
echo 'count = '.$row['id_count'];
 }
 -- 
 regards,
 Tom
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


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



[PHP] multiple php.ini files

2003-03-20 Thread Cemal Dalar
Hi all,

I need to use 2 php.ini files at the same time in Windows.. Can I do
that.? Because one software is need session.auto_start = 1 and the other
needs session.auto_start = 0..

Have a nice day.
Cemal



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



[PHP] internally stored binary image

2003-03-20 Thread speedfreak
In order to distribute a single script I would like to store a small
image internally. Is this at all possible with PHP? How would I go about
it? Please feel free to rtfm me to the relevant sections.

Thx in advance,
[EMAIL PROTECTED]

PS: CC me please, as I'm on the digest...


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



Re: [PHP] List tables

2003-03-20 Thread Alin
On Thu, 2003-03-20 at 17:09, Alin wrote:
 if you are using mysql try:
 
 $query=show tables;
 $result=mysql_db_query(database-name,$query) or die(Query error);
 whlie(list($table-name)=mysql_fetch_row($result)){
   echo Columns from $table-name: br;
   $query=show columns from $table-name;;
   $result=mysql_db_query(database-name,$query) or die(Query error);
   while($columns[]=mysql_fetch_row($result)){
echo $columns[0]br;
   } 
 }  
 Alin Brindusescu 
 CareNer Romania
 [EMAIL PROTECTED]
 
 
 
 
 On Wed, 2003-03-26 at 19:37, shaun wrote:
  Hi,
  
  i would like to list all of the tables and field names in my database
  
  e.g.
  
  table 1
field 1
field 2
field 3
  table 2
field 1
field 2
field 3
  table 3
field 1
field 2
field 3
  etc
  
  is there a simple way to do this?
  
  thanks for your help
  
  
  
  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
  
  
 



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



RE: [PHP] strip single quotes

2003-03-20 Thread Daniel McCullough
another question is could this becoming from the table I am comparing it 
too?

SELECT * FROM store_address WHERE address = '.$address.'

where $address is fine but the other table is causing the error.  how do I 
strip that result as well?


I have this code in to try and strip single quotes out.  But it does it to 
one but not the rest.

$address = str_replace(\\\///, , $store['address']);
$address = str_replace(', , $address);
$address = str_replace(', \', $address);
$address = addslashes($address);
$sql2 = SELECT * FROM store_name WHERE name = '.$store['name'].';
//$build_sql .= $sql2.br;
$result2 = mysql_query($sql2) or die(mysql_error());
$store_name = mysql_fetch_array($result2);
$sql3 = SELECT * FROM store_address WHERE address = '.$address.';
any thoughts




From: John W. Holmes [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
To: 'Daniel McCullough' 
[EMAIL PROTECTED],[EMAIL PROTECTED]
Subject: RE: [PHP] strip single quotes
Date: Wed, 19 Mar 2003 21:49:10 -0500
MIME-Version: 1.0
Received: from dc-mx03.cluster1.charter.net ([209.225.8.13]) by 
mc10-f34.bay6.hotmail.com with Microsoft SMTPSVC(5.0.2195.5600); Wed, 19 
Mar 2003 19:04:29 -0800
Received: from [68.117.196.146] (HELO coconut)  by 
dc-mx03.cluster1.charter.net (CommuniGate Pro SMTP 3.5.9)  with ESMTP id 
107067803; Wed, 19 Mar 2003 21:51:20 -0500
X-Message-Info: JGTYoYF78jEHjJx36Oi8+Q1OJDRSDidP
Organization: U.S. Army
Message-ID: [EMAIL PROTECTED]
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook, Build 10.0.3416
Importance: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
In-Reply-To: [EMAIL PROTECTED]
Return-Path: [EMAIL PROTECTED]
X-OriginalArrivalTime: 20 Mar 2003 03:04:29.0882 (UTC) 
FILETIME=[6C8DB1A0:01C2EE8D]

 I'm trying to query the database using a string pulled out of the
database
 and compare and get the id.  I can do it to a certain point and what
kills
 my query is single quotes.  I CANNOT figure out how to escape it.

 I DID THIS:
 $address2 = str_replace(', , $address);

 that worked on some, but not all.
 $address = stripslashes($store['address']);
 $address = str_replace(', , $address);
 $address = htmlspecialchars($address);
 $address = addslashes($address);

 anyone

 Some errors I have gotten back
 You have an error in your SQL syntax near 's Linen  Home'' at line
1
 and
 You have an error in your SQL syntax near 's 800 number.'' at line 1
You need to use addslashes() on any string you insert into your query.

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



_
Add photos to your e-mail with MSN 8. Get 2 months FREE*.  
http://join.msn.com/?page=features/featuredemail

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


_
Tired of spam? Get advanced junk mail protection with MSN 8. 
http://join.msn.com/?page=features/junkmail

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


[PHP] File management system

2003-03-20 Thread J J
Anyone have a good recommendation for a file
management system that would allow the average person
to browse certain files/directory on a web server and
possibly make edits.

Then the front-end would sort of catalog those files
and index them so the web user could browse/search and
open the files?

Something like:
Category1:
  file1 --- this file contains blah blah blah
  file2 --- this article talks about blah
Category2
  

So maybe if there was a way to tack on categories and
descriptions to files, that would be nice.



I found phpCommander or something like that after
looking through tons of applications on hotscripts,
most were junk.  It's fine for looking at
folders/files and editing, but there's nothing to
catalog or display the files on a front-end.

So I'm looking for good recommendations.  Thanks in advance!

__
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com

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



Re: [PHP] Re: Creating graphs with PHP?

2003-03-20 Thread Alberto Brea
If all you need is a simple bar graph, you can:
1. make a 1-pixel gif
2. make a table with fixed-width tds on the same row (e.g. width 10 pixels)
3. in each td you put one gif with img src=xx width=10 height=xxx wherein the 
height is queried from your data source.
4. on the row below you put the day, month or whatever corresponding to the relevant 
gif
You can make it horizontal too.
If you want a line graph, you make a second transparent gif, make this the 
variable-height image, and put the visible gif at the top, so you make the line.
Hope this helps

Alberto Brea
http://estudiobrea.com 


Re: [PHP] PHP and file extensions

2003-03-20 Thread Beauford.2002
What about IIS. This is what the customer is usingand I know d*** about
IIS. I would assume that there is a similar thing for IIS, but have no idea
where to even look.


- Original Message -
From: Chris Hewitt [EMAIL PROTECTED]
To: Beauford.2002 [EMAIL PROTECTED]
Cc: PHP General [EMAIL PROTECTED]
Sent: Thursday, March 20, 2003 4:28 AM
Subject: Re: [PHP] PHP and file extensions


 Beauford.2002 wrote:

 accessed unless you log in - is there a way to have this line in an html
 file without changing the extension to .php?
 
 Yes, but you need to tell Apache (in the AddType line in httpd.conf) to
 parse all .html files with php. This has a performance implication for
 ordinary .html files.

 HTH
 Chris



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





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



[PHP] Shared Memory

2003-03-20 Thread Adam Voigt
Is the Shared Memory allocated with the SHMOP functions
persistent? Like when a script ends, on the next call
of a script, can you read the same memory block and have
the data be there?

-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc


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



[PHP] Addslashes problem (MSSQL)

2003-03-20 Thread Poon, Kelvin (Infomart)
Hi,

I have a problem that lets you add a record to a database.  THere is a
problem with it, and the following is the area of the program where it has
problem.



$created_date = date('m, d, Y');

$title = strip_tags($title);
$keywords = strip_tags($keywords);
$content = strip_tags($content);
$product = strip_tags($product);


if (!get_magic_quotes_gpc()) {
$title = addslashes($title);
$keywords = addslashes($keywords);
$product = addslashes($product);
$content = addslashes($content);
}

$query = SELECT * FROM knowledgeBase;
$result = mssql_query($query);

$ID = mssql_num_rows($result);
$ID += 1;

$query2 = INSERT INTO knowledgeBase(
ID,
Title,
Keywords,
Content,
[Created Date],
[Updated Date],
Product)
   VALUES(
'.$ID.',
'.$title.',
'.$keywords.',
'.$content.',
'.$created_date.',
'Never',
'.$product.');
$result2 = mssql_query($query2);



where my $content value is osmethign like this.

Step 1: Access the homepage
Step 2: type in your username under the field 'username' 

and after the addslashes funciton there would be \ around the 'username'
like this..
\'username\'and now after running this program I got an error message:

Warning: MS SQL message: Line 14: Incorrect syntax near 'username'.
(severity 15) in d:\apache_docroots\internal.infomart.ca\infodesk\kb_add.php
on line 119

Warning: MS SQL: Query failed in
d:\apache_docroots\internal.infomart.ca\infodesk\kb_add.php on line 119



does any body have any idea?  I did the same thing with another problem but
it worked fine.  I have no idea what the problem is.  I know I need to
addslashes to the string since I am putting it in the valuable
$query2..please advise..

THanks!.
 

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



Re: [PHP] Addslashes problem (MSSQL)

2003-03-20 Thread Lowell Allen
MS-SQL doesn't escape with slashes. It escapes single quotes with single
quotes.

--
Lowell Allen

 From: Poon, Kelvin (Infomart) [EMAIL PROTECTED]
 Date: Thu, 20 Mar 2003 10:58:02 -0500
 To: '[EMAIL PROTECTED]' [EMAIL PROTECTED]
 Subject: [PHP] Addslashes problem (MSSQL)
 
 Hi,
 
 I have a problem that lets you add a record to a database.  THere is a
 problem with it, and the following is the area of the program where it has
 problem.
 
 
 
 $created_date = date('m, d, Y');
 
 $title = strip_tags($title);
 $keywords = strip_tags($keywords);
 $content = strip_tags($content);
 $product = strip_tags($product);
 
 
 if (!get_magic_quotes_gpc()) {
 $title = addslashes($title);
 $keywords = addslashes($keywords);
 $product = addslashes($product);
 $content = addslashes($content);
 }
 
 $query = SELECT * FROM knowledgeBase;
 $result = mssql_query($query);
 
 $ID = mssql_num_rows($result);
 $ID += 1;
 
 $query2 = INSERT INTO knowledgeBase(
 ID,
 Title,
 Keywords,
 Content,
 [Created Date],
 [Updated Date],
 Product)
 VALUES(
 '.$ID.',
 '.$title.',
 '.$keywords.',
 '.$content.',
 '.$created_date.',
 'Never',
 '.$product.');
 $result2 = mssql_query($query2);
 
 
 
 where my $content value is osmethign like this.
 
 Step 1: Access the homepage
 Step 2: type in your username under the field 'username' 
 
 and after the addslashes funciton there would be \ around the 'username'
 like this..
 \'username\'and now after running this program I got an error message:
 
 Warning: MS SQL message: Line 14: Incorrect syntax near 'username'.
 (severity 15) in d:\apache_docroots\internal.infomart.ca\infodesk\kb_add.php
 on line 119
 
 Warning: MS SQL: Query failed in
 d:\apache_docroots\internal.infomart.ca\infodesk\kb_add.php on line 119
 
 
 
 does any body have any idea?  I did the same thing with another problem but
 it worked fine.  I have no idea what the problem is.  I know I need to
 addslashes to the string since I am putting it in the valuable
 $query2..please advise..
 
 THanks!.
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


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



RE: [PHP] Addslashes problem (MSSQL)

2003-03-20 Thread Poon, Kelvin (Infomart)

What do you mean by It escapes single quotes with single quotes.?

so let's say my $content is 

lalal 'lalalal' lalala


then what do I have to do to $content in order to insert to my MSSQL table?
-Original Message-
From: Lowell Allen [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 20, 2003 11:20 AM
To: PHP
Subject: Re: [PHP] Addslashes problem (MSSQL)


MS-SQL doesn't escape with slashes. It escapes single quotes with single
quotes.

--
Lowell Allen

 From: Poon, Kelvin (Infomart) [EMAIL PROTECTED]
 Date: Thu, 20 Mar 2003 10:58:02 -0500
 To: '[EMAIL PROTECTED]' [EMAIL PROTECTED]
 Subject: [PHP] Addslashes problem (MSSQL)
 
 Hi,
 
 I have a problem that lets you add a record to a database.  THere is a
 problem with it, and the following is the area of the program where it has
 problem.
 
 
 
 $created_date = date('m, d, Y');
 
 $title = strip_tags($title);
 $keywords = strip_tags($keywords);
 $content = strip_tags($content);
 $product = strip_tags($product);
 
 
 if (!get_magic_quotes_gpc()) {
 $title = addslashes($title);
 $keywords = addslashes($keywords);
 $product = addslashes($product);
 $content = addslashes($content);
 }
 
 $query = SELECT * FROM knowledgeBase;
 $result = mssql_query($query);
 
 $ID = mssql_num_rows($result);
 $ID += 1;
 
 $query2 = INSERT INTO knowledgeBase(
 ID,
 Title,
 Keywords,
 Content,
 [Created Date],
 [Updated Date],
 Product)
 VALUES(
 '.$ID.',
 '.$title.',
 '.$keywords.',
 '.$content.',
 '.$created_date.',
 'Never',
 '.$product.');
 $result2 = mssql_query($query2);
 
 
 
 where my $content value is osmethign like this.
 
 Step 1: Access the homepage
 Step 2: type in your username under the field 'username' 
 
 and after the addslashes funciton there would be \ around the 'username'
 like this..
 \'username\'and now after running this program I got an error message:
 
 Warning: MS SQL message: Line 14: Incorrect syntax near 'username'.
 (severity 15) in
d:\apache_docroots\internal.infomart.ca\infodesk\kb_add.php
 on line 119
 
 Warning: MS SQL: Query failed in
 d:\apache_docroots\internal.infomart.ca\infodesk\kb_add.php on line 119
 
 
 
 does any body have any idea?  I did the same thing with another problem
but
 it worked fine.  I have no idea what the problem is.  I know I need to
 addslashes to the string since I am putting it in the valuable
 $query2..please advise..
 
 THanks!.
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


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

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



RE: [PHP] Addslashes problem (MSSQL)[Scanned]

2003-03-20 Thread Michael Egan
Kelvin,

This link should be helpful:

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

Regards,

Michael Egan

-Original Message-
From: Poon, Kelvin (Infomart) [mailto:[EMAIL PROTECTED]
Sent: 20 March 2003 16:21
To: 'Lowell Allen'
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP] Addslashes problem (MSSQL)[Scanned]



What do you mean by It escapes single quotes with single quotes.?

so let's say my $content is 

lalal 'lalalal' lalala


then what do I have to do to $content in order to insert to my MSSQL table?
-Original Message-
From: Lowell Allen [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 20, 2003 11:20 AM
To: PHP
Subject: Re: [PHP] Addslashes problem (MSSQL)


MS-SQL doesn't escape with slashes. It escapes single quotes with single
quotes.

--
Lowell Allen

 From: Poon, Kelvin (Infomart) [EMAIL PROTECTED]
 Date: Thu, 20 Mar 2003 10:58:02 -0500
 To: '[EMAIL PROTECTED]' [EMAIL PROTECTED]
 Subject: [PHP] Addslashes problem (MSSQL)
 
 Hi,
 
 I have a problem that lets you add a record to a database.  THere is a
 problem with it, and the following is the area of the program where it has
 problem.
 
 
 
 $created_date = date('m, d, Y');
 
 $title = strip_tags($title);
 $keywords = strip_tags($keywords);
 $content = strip_tags($content);
 $product = strip_tags($product);
 
 
 if (!get_magic_quotes_gpc()) {
 $title = addslashes($title);
 $keywords = addslashes($keywords);
 $product = addslashes($product);
 $content = addslashes($content);
 }
 
 $query = SELECT * FROM knowledgeBase;
 $result = mssql_query($query);
 
 $ID = mssql_num_rows($result);
 $ID += 1;
 
 $query2 = INSERT INTO knowledgeBase(
 ID,
 Title,
 Keywords,
 Content,
 [Created Date],
 [Updated Date],
 Product)
 VALUES(
 '.$ID.',
 '.$title.',
 '.$keywords.',
 '.$content.',
 '.$created_date.',
 'Never',
 '.$product.');
 $result2 = mssql_query($query2);
 
 
 
 where my $content value is osmethign like this.
 
 Step 1: Access the homepage
 Step 2: type in your username under the field 'username' 
 
 and after the addslashes funciton there would be \ around the 'username'
 like this..
 \'username\'and now after running this program I got an error message:
 
 Warning: MS SQL message: Line 14: Incorrect syntax near 'username'.
 (severity 15) in
d:\apache_docroots\internal.infomart.ca\infodesk\kb_add.php
 on line 119
 
 Warning: MS SQL: Query failed in
 d:\apache_docroots\internal.infomart.ca\infodesk\kb_add.php on line 119
 
 
 
 does any body have any idea?  I did the same thing with another problem
but
 it worked fine.  I have no idea what the problem is.  I know I need to
 addslashes to the string since I am putting it in the valuable
 $query2..please advise..
 
 THanks!.
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


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

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


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



Re: [PHP] Addslashes problem (MSSQL)

2003-03-20 Thread Lowell Allen
Read the user-contributed notes following the online manual info on
addslashes: http://www.php.net/manual/en/function.addslashes.php

--
Lowell Allen

 From: Poon, Kelvin (Infomart) [EMAIL PROTECTED]
 Date: Thu, 20 Mar 2003 11:20:51 -0500
 To: 'Lowell Allen' [EMAIL PROTECTED]
 Cc: '[EMAIL PROTECTED]' [EMAIL PROTECTED]
 Subject: RE: [PHP] Addslashes problem (MSSQL)
 
 
 What do you mean by It escapes single quotes with single quotes.?
 
 so let's say my $content is
 
 lalal 'lalalal' lalala
 
 
 then what do I have to do to $content in order to insert to my MSSQL table?
 -Original Message-
 From: Lowell Allen [mailto:[EMAIL PROTECTED]
 Sent: Thursday, March 20, 2003 11:20 AM
 To: PHP
 Subject: Re: [PHP] Addslashes problem (MSSQL)
 
 
 MS-SQL doesn't escape with slashes. It escapes single quotes with single
 quotes.
 
 --
 Lowell Allen
 
 From: Poon, Kelvin (Infomart) [EMAIL PROTECTED]
 Date: Thu, 20 Mar 2003 10:58:02 -0500
 To: '[EMAIL PROTECTED]' [EMAIL PROTECTED]
 Subject: [PHP] Addslashes problem (MSSQL)
 
 Hi,
 
 I have a problem that lets you add a record to a database.  THere is a
 problem with it, and the following is the area of the program where it has
 problem.
 
 
 
 $created_date = date('m, d, Y');
 
 $title = strip_tags($title);
 $keywords = strip_tags($keywords);
 $content = strip_tags($content);
 $product = strip_tags($product);
 
 
 if (!get_magic_quotes_gpc()) {
 $title = addslashes($title);
 $keywords = addslashes($keywords);
 $product = addslashes($product);
 $content = addslashes($content);
 }
 
 $query = SELECT * FROM knowledgeBase;
 $result = mssql_query($query);
 
 $ID = mssql_num_rows($result);
 $ID += 1;
 
 $query2 = INSERT INTO knowledgeBase(
 ID,
 Title,
 Keywords,
 Content,
 [Created Date],
 [Updated Date],
 Product)
 VALUES(
 '.$ID.',
 '.$title.',
 '.$keywords.',
 '.$content.',
 '.$created_date.',
 'Never',
 '.$product.');
 $result2 = mssql_query($query2);
 
 
 
 where my $content value is osmethign like this.
 
 Step 1: Access the homepage
 Step 2: type in your username under the field 'username' 
 
 and after the addslashes funciton there would be \ around the 'username'
 like this..
 \'username\'and now after running this program I got an error message:
 
 Warning: MS SQL message: Line 14: Incorrect syntax near 'username'.
 (severity 15) in
 d:\apache_docroots\internal.infomart.ca\infodesk\kb_add.php
 on line 119
 
 Warning: MS SQL: Query failed in
 d:\apache_docroots\internal.infomart.ca\infodesk\kb_add.php on line 119
 
 
 
 does any body have any idea?  I did the same thing with another problem
 but
 it worked fine.  I have no idea what the problem is.  I know I need to
 addslashes to the string since I am putting it in the valuable
 $query2..please advise..
 
 THanks!.
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


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



Re: [PHP] File management system

2003-03-20 Thread Mike
Webmin has some good stuff. (it's a java applet though...)

On Thu, 2003-03-20 at 06:14, J J wrote:
 Anyone have a good recommendation for a file
 management system that would allow the average person
 to browse certain files/directory on a web server and
 possibly make edits.
 
 Then the front-end would sort of catalog those files
 and index them so the web user could browse/search and
 open the files?
 
 Something like:
 Category1:
   file1 --- this file contains blah blah blah
   file2 --- this article talks about blah
 Category2
   
 
 So maybe if there was a way to tack on categories and
 descriptions to files, that would be nice.
 
 
 
 I found phpCommander or something like that after
 looking through tons of applications on hotscripts,
 most were junk.  It's fine for looking at
 folders/files and editing, but there's nothing to
 catalog or display the files on a front-end.
 
 So I'm looking for good recommendations.  Thanks in advance!
 
 __
 Do you Yahoo!?
 Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
 http://platinum.yahoo.com


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



Re: [PHP] File management system

2003-03-20 Thread J J
Yeah I think I've seen that one... looking for a
php/mysql solution if possible.

Thanks!


--- Mike [EMAIL PROTECTED] wrote:
 Webmin has some good stuff. (it's a java applet
 though...)
 
 On Thu, 2003-03-20 at 06:14, J J wrote:
  Anyone have a good recommendation for a file
  management system that would allow the average
 person
  to browse certain files/directory on a web server
 and
  possibly make edits.
  
  Then the front-end would sort of catalog those
 files
  and index them so the web user could browse/search
 and
  open the files?
  
  Something like:
  Category1:
file1 --- this file contains blah blah blah
file2 --- this article talks about blah
  Category2

  
  So maybe if there was a way to tack on categories
 and
  descriptions to files, that would be nice.
  
  
  
  I found phpCommander or something like that after
  looking through tons of applications on
 hotscripts,
  most were junk.  It's fine for looking at
  folders/files and editing, but there's nothing to
  catalog or display the files on a front-end.
  
  So I'm looking for good recommendations.  Thanks
 in advance!
  

__
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com

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



[PHP] Banner ad solution?

2003-03-20 Thread MIKE YRABEDRA


Can someone suggest a 'good' banner ad solution that is done in php.

Please do not suggest phpAdNews since it has proven very unstable for me and
others.


-- 
Mike Yrabedra
President

 323, Inc.
 Home of The MacDock and The MacSurfshop
 [http://macdock.com] : [http://macsurfshop.com]
 VOICE: 770.382.1195
 FAX:   734-448-5164
 iChat/AIM: ichatmacdock
___
Whatever you do, work at it with all your heart,
as working for the Lord, not for men.
~Colossians 3:23 {{{
--



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



Re: [PHP] Shared Memory

2003-03-20 Thread Mincu Alexandru
nope!
of course not there are two different procs.

On Thu, 2003-03-20 at 17:19, Adam Voigt wrote:
 Is the Shared Memory allocated with the SHMOP functions
 persistent? Like when a script ends, on the next call
 of a script, can you read the same memory block and have
 the data be there?
 
 -- 
 Adam Voigt ([EMAIL PROTECTED])
 The Cryptocomm Group
 My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc
-- 
Mincu Alexandru intelinet.ro
Tel:+4 0745 369719  +4 021 3140021
www.intelinet.ro[EMAIL PROTECTED]



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



Re: [PHP] Dynamic variables (with method=post)

2003-03-20 Thread Fabio Bot
Thanks John,

Now it's running right.  :)

[]'s

Fabio.


John W. Holmes [EMAIL PROTECTED] escreveu na mensagem
news:[EMAIL PROTECTED]
  How do i receive dynamic variables with POST ?
  Please, see the code fragment.
 
  $ped_item = mysql_result($result, $j, 0);
 
  form name=form_$ped_item method=post action=pedido.php
  input type=hidden name=upd_item value='$ped_item'
  input type=text size=7 maxlength=7 value=$ped_qtde
  name=quantidade$ped_item
  /form
 
 
  upd_item was usually received.
  How do i receive quantidade$ped_item  ?
 
  I have tried:
 
  $p1 = $_POST['upd_item'];// this is OK !
  $p2 = $_POST['quantidade$upd_item'];// this doesn't work !

 I guess it would be

 $p2 = $_POST['quantidade'.$p1];

 if I'm reading correctly...

 ---John W. Holmes...

 PHP Architect - A monthly magazine for PHP Professionals. Get your copy
 today. http://www.phparch.com/





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



Re: [PHP] internally stored binary image

2003-03-20 Thread Ernest E Vogelsinger
At 15:57 20.03.2003, [EMAIL PROTECTED] spoke out and said:
[snip]
In order to distribute a single script I would like to store a small
image internally. Is this at all possible with PHP? How would I go about
it? Please feel free to rtfm me to the relevant sections.
[snip] 

You could make some script to retrieve the hex values of the image byte by
byte, then create a source file like
$imgdata = '\xff\x19\x00\x12   etc...;

Then when you're about to send the image simply transmit the correct
header() and echo out the data.

This little sample works just perfectly:


// use one of your files here, of course...
$file = 'images/dart.gif';
$hf = fopen($file, 'r') or die(Can't open $file for reading);
$bin = fread($hf, filesize($file));
fclose($hf);
$asc = '$img_data = ';
for ($i = 0, $len = strlen($bin); $i  $len; ++$i) {
if ($i  !($i % 16))
$asc .= \ .\n\t\;
$asc .= '\\x' . bin2hex(substr($bin, $i, 1));
}
$asc .= ';';

// $asc now contains the hex-coded binary file.
// Example (a real gif - try it)
$img_data =
\x47\x49\x46\x38\x39\x61\x20\x00\x20\x00\xa2\xff\x00\x00\x00\x00 .
\xff\x00\x00\xff\xff\x00\x00\x00\xff\xc0\xc0\xc0\x00\x00\x00\x00 .
\x00\x00\x00\x00\x00\x21\xf9\x04\x01\x00\x00\x04\x00\x2c\x00\x00 .
\x00\x00\x20\x00\x20\x00\x40\x03\xae\x48\xba\xac\xf0\x10\x34\x36 .
\x06\x83\x21\x87\xc8\xa3\xd0\xd0\x82\x65\xe3\xd6\x81\x0f\x2a\x89 .
\x25\x79\x6a\xe6\x33\xb1\x29\x6c\xab\x80\xd0\x94\x11\x8c\x7d\x31 .
\x80\xca\x51\x0b\xde\x70\xc3\x19\xa1\xc3\x8c\x28\x67\xcd\xe8\xa2 .
\x52\xb9\xb4\x82\x57\x41\xc8\x2a\x74\x15\x6f\xda\xe2\x96\x27\x7e .
\x0c\x04\x5a\xd5\x90\xfc\x6d\xf5\xbc\x34\x5f\xd4\x2d\x83\x5e\x8f .
\xc1\xe7\x93\xa9\xef\x2f\xe7\x75\x53\x54\x76\x6f\x36\x1d\x0a\x02 .
\x55\x3b\x77\x78\x26\x5a\x84\x5d\x5e\x4d\x19\x1f\x4e\x71\x38\x91 .
\x5e\x69\x49\x7f\x91\x8c\x94\x31\x49\x6c\x72\x39\x40\x5e\x6b\x65 .
\x9e\x66\x03\xa9\xa8\xaa\x99\x1c\xa4\xa2\xad\x8d\xa1\x70\x44\xb0 .
\x85\x92\xb9\x2b\xb8\xbc\x93\x38\x90\xb5\x86\x5b\x7b\xb1\x37\x87 .
\x7e\x34\x73\xca\xcd\xce\x09\x00\x3b; 

// Now write the stuff to a file
$hf = fopen($file.asc, 'w') or die(Can't open $file.asc for writing);
fwrite($hf, $asc);
fclose($hf);

// Here you may either include the file, or copy/paste its contents into
your own code.
// The next lines are just to test the stuff - adjust the Content-Type
header to your needs:

header('Content-Type: image/gif');
eval($asc);  // this will render the binary content into $img_data
echo $img_data;  // send it
exit;// and voila


Note that reading the file is only needed once as a tool to create the
ascii version of the binary file.


-- 
   O Ernest E. Vogelsinger 
   (\) ICQ #13394035 
^ http://www.vogelsinger.at/


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



Re: [PHP] multiple php.ini files

2003-03-20 Thread Jason Wong
On Thursday 20 March 2003 22:53, Cemal Dalar wrote:

 I need to use 2 php.ini files at the same time in Windows.. Can I do
 that.? Because one software is need session.auto_start = 1 and the other
 needs session.auto_start = 0..

If you're using apache you can have per domain or per directory settings in 
either the httpd.conf file or in .htaccess files. And according to the manual 
you can even set session.auto_start dynamically from within php.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
This is the first age that's paid much attention to the future, which is a
little ironic since we may not have one.
-- Arthur Clarke
*/


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



[PHP] Session Question

2003-03-20 Thread PHP List
Hi All,
I have a question about sessions.
I need to pass session data from one domain to a secure domain. (www.mydomain.com to 
www.securedomain.com).
I would like to preserve the session data in case the visitor goes back to 
www.mydomain.com. I thought about just passing the session ID to www.securedomain.com, 
but if I need to destroy the session while the visitor is in www.securedomain.com, I 
am hoping this will also include destroying data from www.mydomain.com.
Basically, I am talking about a shopping cart system. If the user decides to stop half 
way through the checkout on the secure site and continue shopping in the store, I want 
the cart to remain. But if the user completes the checkout process on the secure 
domain, their cart should be empty when going back to the original domain.

Thanks for any help.

Chris


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.461 / Virus Database: 260 - Release Date: 3/11/2003

[PHP] credit card validations..

2003-03-20 Thread Edward Peloke
The owner of the php site I am working on just told me he want to do credit
card validations on the site.  Currently, we aren't doing anything with
credit cards.  I have no idea as to where to even start with this.  Should I
simply go the paypal route?

Thanks,
Eddie


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



Re: [PHP] credit card validations..

2003-03-20 Thread Kevin Stone

- Original Message -
From: Edward Peloke [EMAIL PROTECTED]
To: [EMAIL PROTECTED] Php. Net [EMAIL PROTECTED]
Sent: Thursday, March 20, 2003 11:50 AM
Subject: [PHP] credit card validations..


 The owner of the php site I am working on just told me he want to do
credit
 card validations on the site.  Currently, we aren't doing anything with
 credit cards.  I have no idea as to where to even start with this.  Should
I
 simply go the paypal route?

 Thanks,
 Eddie

Credit card validation is somewhat involved but not terribly difficult.
There are several good tutorials (such as the one below) and many classes
and functions already written if you don't feel like reinventing the wheel.
Good luck.

http://www.sitepoint.com/article/728

-Kevin



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



RE: [PHP] credit card validations..

2003-03-20 Thread Edward Peloke

Thanks Kevin!

Forgive my ignorance of the subject but would this just say the card was
valid?  How do you go about actually charging the users card and get the
funds?

Thanks,
Eddie
-Original Message-
From: Kevin Stone [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 20, 2003 1:58 PM
To: Edward Peloke; [EMAIL PROTECTED] Php. Net
Subject: Re: [PHP] credit card validations..



- Original Message -
From: Edward Peloke [EMAIL PROTECTED]
To: [EMAIL PROTECTED] Php. Net [EMAIL PROTECTED]
Sent: Thursday, March 20, 2003 11:50 AM
Subject: [PHP] credit card validations..


 The owner of the php site I am working on just told me he want to do
credit
 card validations on the site.  Currently, we aren't doing anything with
 credit cards.  I have no idea as to where to even start with this.  Should
I
 simply go the paypal route?

 Thanks,
 Eddie

Credit card validation is somewhat involved but not terribly difficult.
There are several good tutorials (such as the one below) and many classes
and functions already written if you don't feel like reinventing the wheel.
Good luck.

http://www.sitepoint.com/article/728

-Kevin




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



[PHP] Running DB on different server

2003-03-20 Thread Todd Cary




Can the DB be on a different server than the page server?

Todd
-- 
 

  
 
 
 




[PHP] php, mysql, and method question

2003-03-20 Thread Charles Kline
hi all,

i have a question about a good method of handling this challenge.

i have a table that contains articles. i have another table which 
contains  the order 1 - 9 that i would like to display them in.

this part is done, and is not a problem. here is where I am not sure 
how to proceed.

1. tbl_display_order - can only have 9 records in it (or do i just 
ignore anything beyond 9?)
2. when a new article is added to tbl_display_order - it needs to get 
the field that contains it's order set to 1 so it shows up first when I 
display the articles, and all the other articles need to have their 
order number incremented.

Maybe there is a better way to do this? Just not sure. Maybe not with a 
database at all?

Thanks for suggestions.
Charles 

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


Re: [PHP] Running DB on different server

2003-03-20 Thread Larry E. Ullman
Can the DB be on a different server than the page server?
Yes. For example, with MySQL, you just need to create a user with 
permission to connect from a remote computer by setting the appropriate 
host value.

Larry

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


Re: [PHP] Running DB on different server

2003-03-20 Thread Leif K-Brooks




Yes.

Todd Cary wrote:

  
   Can the DB be on a different server than the page server?
 
 Todd
 
  -- 
   
  

   
  
  
 

-- 
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.





RE: [PHP] credit card validations..

2003-03-20 Thread Ernest E Vogelsinger
At 20:00 20.03.2003, Edward Peloke spoke out and said:
[snip]
Forgive my ignorance of the subject but would this just say the card was
valid?  How do you go about actually charging the users card and get the
funds?
[snip] 

To be able to actually charge a CC you need a contract with a clearing
house (FirePay,  for example). There's no standard to it; every
clearinghouse I've ever dealt with uses its own protocol.

Generally this involves transmitting data via POST and receiving
(asynchronously) transaction data via SSL. You might consider using cURL
for this kind of stuff; most of them have working examples in Java, PHP,
ASP, etc.


-- 
   O Ernest E. Vogelsinger 
   (\) ICQ #13394035 
^ http://www.vogelsinger.at/


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



[PHP] Re: Running DB on different server

2003-03-20 Thread pinnockio
Hello,

I wrote everything down for later scenario's.  Hope it'll help you ;).

A belgian guy

Todd Cary wrote:
Can the DB be on a different server than the page server?

Todd
--


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

[PHP] To use PEAR::DB or the PHP database functions

2003-03-20 Thread Merritt, Dave
All,

I've always used MySQL databases and the MySQL functions in PHP for my code
in the past.  However, I'm now working on a project that I want the project
to be able to be database independent so that the user of the project can
use whatever database he/she wishes.  I'm looking primarily at providing
support for MySQL, PostgreSQL, Oracle,  SQL Server databases.  What's the
general consensus on how to handle this?  Do I need to look at using
PEAR::DB so that the type of database is hidden from my code or would I
look at writing different include files for each database type and each of
the include files use the relevant PHP functions?  Or some other totally
different way?

Thanks

Dave Merritt
[EMAIL PROTECTED]

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



[PHP] PHP Devel Environments???

2003-03-20 Thread Henrik Hudson
Hey List-

Any one have some input on some good GUI WYSIWYG devel enviroments for 
creating PHP scriptlets. The boss wants to lose the dependancy on the 2 
programmers (myself and another person) for every little piece of PHP code. 
Of course, the graphic designers have no desire to learn source code, so we 
have to see if there are any WYSIWYG's out there that will allow them to 
create code chunks to either do webforms or handle simple variable passing 
between pages?

My argument is that it is to wide open and there are too many variables that 
need to be taken into account for this to happen.

We did look at Dreamweaver MX, but it's PHP support is limited to syntax 
highlighting and being able to insert if and else clauses. I'd tell'em to use 
gvim, but I don't think that would fly :) The boss says there are some 
Dreamweaver extensions for doing some of this stuff, but I still question 
their quality for open ended stuff like writing PHP.

Thanks.

Henrik

-- 

Henrik Hudson
[EMAIL PROTECTED]

You know, Hobbes, some days even my lucky
rocket ship underpants don't help.  Calvin

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



Re: [PHP] To use PEAR::DB or the PHP database functions

2003-03-20 Thread Charles Kline
Pear is really nice. I am very happy with it.

- Charles

On Thursday, March 20, 2003, at 02:56 PM, Merritt, Dave wrote:

All,

I've always used MySQL databases and the MySQL functions in PHP for my 
code
in the past.  However, I'm now working on a project that I want the 
project
to be able to be database independent so that the user of the project 
can
use whatever database he/she wishes.  I'm looking primarily at 
providing
support for MySQL, PostgreSQL, Oracle,  SQL Server databases.  What's 
the
general consensus on how to handle this?  Do I need to look at using
PEAR::DB so that the type of database is hidden from my code or 
would I
look at writing different include files for each database type and 
each of
the include files use the relevant PHP functions?  Or some other 
totally
different way?

Thanks

Dave Merritt
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


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


Re: [PHP] PHP Devel Environments???

2003-03-20 Thread John Wells
Henrik,

Why not use Smarty and create your own functions for your designers to
use?  That's one of it's purposes, after all.

John

Henrik Hudson said:
 Hey List-

 Any one have some input on some good GUI WYSIWYG devel enviroments for
 creating PHP scriptlets. The boss wants to lose the dependancy on the
 2  programmers (myself and another person) for every little piece of
 PHP code.  Of course, the graphic designers have no desire to learn
 source code, so we  have to see if there are any WYSIWYG's out there
 that will allow them to  create code chunks to either do webforms or
 handle simple variable passing  between pages?

 My argument is that it is to wide open and there are too many
 variables that  need to be taken into account for this to happen.

 We did look at Dreamweaver MX, but it's PHP support is limited to syntax
  highlighting and being able to insert if and else clauses. I'd tell'em
 to use  gvim, but I don't think that would fly :) The boss says there
 are some  Dreamweaver extensions for doing some of this stuff, but I
 still question  their quality for open ended stuff like writing PHP.

 Thanks.

 Henrik

 --

 Henrik Hudson
 [EMAIL PROTECTED]

 You know, Hobbes, some days even my lucky
 rocket ship underpants don't help.  Calvin

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




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



RE: [PHP] Zip Way of life.

2003-03-20 Thread Daevid Vincent
 zip file and unzip is not installed by on Unix servers. :-(

So either install it on the servers that need it, or distribute the un/zip
exe with your package in your projects local directory -- this also saves
you having to deal with different versions on different servers that may not
always do what you expect. At least this way it's a controlled environment. 


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



RE: [PHP] Zero Fill - Number Format

2003-03-20 Thread Daevid Vincent
Just an observer, but I love how you each had a different way of
accomplishing this task! ;-)

And Mike, looks like you have some re-writing to do now that Martin and
Kevin showed you a WAY simpler (and faster) way to accomplish what you did.
LOL.

http://daevid.com

 -Original Message-
 From: Martin Towell [mailto:[EMAIL PROTECTED] 
 
 sprintf/printf(%7d, $num)


-Original Message-
From: Kevin Waterson [mailto:[EMAIL PROTECTED] 

print str_pad($something, 7, 0, STR_PAD_LEFT);


-Original Message-
From: Mike Brum [mailto:[EMAIL PROTECTED] 

This is what I did for a dynamic zero-fill for renaming batches of files:

// Get Zero Padding For New Image Names
$zero_padding = strlen(count($image_array));

  foreach($image_array as $temp){
$n++;
$n_length = strlen($n);
for($i = 0; $i  ($zero_padding - $n_length); $i++){
$n = 0 . $n;
  }
$new_name = $image_inbox . / . $newName . - . $n . .jpg;
rename($image_inbox/$temp, $new_name);
  }


I'm not sure if this will be applicable to your situation, but it works
perfectly for me since it will zero-fill for any length of numbers and pad
the shorter numbers appropriately.


 -Original Message-
 From: Harry.de [mailto:[EMAIL PROTECTED]
 Sent: Thursday, March 20, 2003 10:09 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Zero Fill - Number Format
 
 
 How can I put out a Zero Fill for numbers
 The result should be
 
 $something=26;
 echo $something;
 
 e.g.
 026


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



Re: [PHP] PHP Devel Environments???

2003-03-20 Thread Larry E. Ullman
The only product I know of that fits your description (I think) is 
JaneBuilder (http://www.seejanecode.com). It's currently available for 
Mac and will be on Windows soon. Never used it myself...

Larry

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


Re: [PHP] php, mysql, and method question

2003-03-20 Thread Hugh Danaher
Charles, it sounds like you want the most recent 9 articles (...order set
to 1 so it shows up first when ...), so why not something like select *
from article_table order by id desc, limit 9 [assumes id is int not null
auto_incremented].
You could also increment the value in the field something like:
$result=mysql_query(select article_order from article table);
while ($array_result=mysql_fetch($result))
{
$article_order=$array_result[article_order]+1;
mysql_query(update article_table set article_order=$article_order where
id=$array_result[id] );
}
hugh
- Original Message -
From: Charles Kline [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, March 20, 2003 11:10 AM
Subject: [PHP] php, mysql, and method question


 hi all,

 i have a question about a good method of handling this challenge.

 i have a table that contains articles. i have another table which
 contains  the order 1 - 9 that i would like to display them in.

 this part is done, and is not a problem. here is where I am not sure
 how to proceed.

 1. tbl_display_order - can only have 9 records in it (or do i just
 ignore anything beyond 9?)
 2. when a new article is added to tbl_display_order - it needs to get
 the field that contains it's order set to 1 so it shows up first when I
 display the articles, and all the other articles need to have their
 order number incremented.

 Maybe there is a better way to do this? Just not sure. Maybe not with a
 database at all?

 Thanks for suggestions.
 Charles


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



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



[PHP] Q. How to remove new line/CrLf in string??

2003-03-20 Thread Jack Schroeder

Hello:
I am trying to use an ASCII/Txt database for a 'for sale by owner' site. 
I need to figure out a way to remove any carriage returns entered into a
Comments string because \n is the record delimiter. I have tried the
nl2br() fundtion but that seems to ad the BR but doesn't remove the
\n. Any help any one. 

Thanks

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



Re: [PHP] Q. How to remove new line/CrLf in string??

2003-03-20 Thread André Cupini
Jack,
I replace the \n char by nothing in my scripts of the following form:

?
$string = str_replace(\n, , $string);
?

--
André Cupini - Programador
--
[EMAIL PROTECTED]
--
NeoBiz - fábrica de internet
http://www.neobiz.com.br
--

  - Original Message - 
  From: Jack Schroeder 
  To: [EMAIL PROTECTED] 
  Sent: Thursday, March 20, 2003 5:19 PM
  Subject: [PHP] Q. How to remove new line/CrLf in string??



  Hello:
  I am trying to use an ASCII/Txt database for a 'for sale by owner' site. 
  I need to figure out a way to remove any carriage returns entered into a
  Comments string because \n is the record delimiter. I have tried the
  nl2br() fundtion but that seems to ad the BR but doesn't remove the
  \n. Any help any one. 

  Thanks

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


[PHP] Is there a way to access all the variables in my script?

2003-03-20 Thread Daevid Vincent
Is there some global array or something that contains all the variable names
(not even values per se) that are used in my script.

Here's the scenario. Like most of you, I do a lot of mySQL db work. So I
tend to use this:

if (mysql_num_rows($result)  0) { 
  $row = mysql_fetch_array($result,MYSQL_ASSOC);
  while(list($myVariableName,$sqlFieldName)=each($row)) 
{ $$myVariableName = $sqlFieldName; }
}

So now I have a bunch of variables all named say, $company_name,
$company_id, $company_phone, etc...

What I want to do is make a function that can step through all the $company_
variables and unset them all.
(I imagine I'll just string compare to company_ and then prefix the result
with $$, then set = , etc. you get the idea)

I suppose I could re-write all my code and use the $row['company_id'] method
instead then clear $row[] but it would be nice to know if there is a way to
do this 'my way' as well...


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



[PHP] php and forms

2003-03-20 Thread b b


 
Hi,
 This could be a silly mistake or it could be a sign
of configuratin problems. Simply put, my submitted
form variables are not reaching the recieving end:

 A form:

   form method=post action=testForm.php
input type=text name=testVar
input type=submit name=submit value=submit
/form

A recieving file testForm.php:
 html
body ?php
printf(brtestVar is : %s, $testVar);
?
/body
/html


When entering value like testtest in the form element
I still get the following in the recieving file:
  
testVar is : 


 i.e. the form variable is not submitted or not
recieved. I also tried doing it through the url
.../testForm.php?testVar=whatever  and still the
testVar is empty. 

 Is there a configuration problem I should be aware of
as clearly it is not a code issue? Also want to add
that php has been functioning otherwise including
using database connectivity ... So do I have to set a
variable in the configuration files of Apache to
enable  forms and url variables to be processed? 

 If anybody could shed a light on this I would be most
greatful

 Thanks,
b.

__
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com

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



[PHP] Finding UserName of HTTP Server

2003-03-20 Thread Michael Smith
Hi,

Is there an environment variable for the user (like apache or nobody)
that is used by the server for http serving?

-Michael
-- 
Michael Smith [EMAIL PROTECTED]
Custom87.net


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



[PHP] Anyone connect to a FileMaker DB?

2003-03-20 Thread Joshua Groboski
I know, FileMaker is not a real database.  I have taken over some legacy
systems and while I am redesigning the system, I need to be able to connect
to a FileMaker DB.  If you've done it, or know how I can do it, please let
me know.

Joshua Groboski
Programmer Analyst / Webmaster
SAVVIS Communications
http://www.savvis.net



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



RE: [PHP] credit card validations..

2003-03-20 Thread Chris Shiflett
--- Edward Peloke [EMAIL PROTECTED] wrote:
 Forgive my ignorance of the subject but would this just say the card was
 valid?  How do you go about actually charging the users card and get the
 funds?

I think (without looking) Kevin's advice was to help you determine whether a
credit card number was of the valid format. Charging a credit card is not too
different online than it is at a physical cash register - you need a merchant
account, etc. Many banks provide some sort of API for you to use if you
establish a merchant account with them, especially since online transactions
have become more important.

Things like PayPal charge you a bit of money in exchange for them being the
merchant (as I understand it anyway).

So, there is no magic PHP code that is going to set this up for you. You need
to fill out some paperwork somewhere.

Chris

=
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/

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



Re: [PHP] Cleaning user data

2003-03-20 Thread Chris Shiflett
--- CPT John W. Holmes [EMAIL PROTECTED] wrote:
 You don't want to do matching like you've shown, though. If I put a b on
 my page with no /b, then it's going to make everything on the entire page
 following my post bold.

Well, my example was simplified. If the user's data is contained in a table
cell, they would only screw up the formatting of their own post. For tags that
you really need to make sure are closed, you can check for that prior to making
any replacements.

I still fail to see how BB code helps in any way, since you have to make these
same considerations. But, like I said, maybe I'm missing something. :-)

Chris

=
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/

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



Re: [PHP] php and forms

2003-03-20 Thread Chris Shiflett
--- b b [EMAIL PROTECTED] wrote:
 This could be a silly mistake or it could be a sign
 of configuratin problems.

Is register_globals on? If not, your code assumes it is, so that is your
problem.

Chris

=
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/

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



[PHP] HPUX 11 and PHP4 build - Unresolved symbol __udivdi3 (NIGTHMARE)

2003-03-20 Thread Harring Figueiredo

 I am trying -- for the past day - to build php4.3.1 against apache1.3.27 as a
DSO module on HPUX11 using gcc.

  I build everythigng and I can get apache running without the php module. Once
I add the php module, I get the following errors:

/usr/lib/dld.sl: Unresolved symbol: __udivdi3 (code)  from
/home/harring/install/apache1_3_27_dso_aCC/libexec/libphp4.so
/usr/lib/dld.sl: Unresolved symbol: __umoddi3 (code)  from
/home/harring/install/apache1_3_27_dso_aCC/libexec/libphp4.so
Syntax error on line 206 of
/home/harring/install/apache1_3_27_dso_aCC/conf/httpd.conf:
Cannot load /home/harring/install/apache1_3_27_dso_aCC/libexec/libphp4.so into
server: Unresolved external
./apachectl start: httpd could not be started


  I have googled and could not find a solution for this. Can anyone help ?


Thanks.

Harring

__
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com

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



[PHP] Visitor Counter

2003-03-20 Thread Ludi Sasnita
I want to make a Visitor Counter on my page. Not a Hit Counter.
How to make it? Give me a sample script with PHP. Especially with command SESSION_ID
Thanks,



 Ikuti polling TELKOM Memo 166 di www.plasa.com dan menangkan hadiah masing-masing Rp 
250.000 tunai
 

RE: [PHP] Zero Fill - Number Format

2003-03-20 Thread Boaz Yahav
wouldn't this just print empty spaces before the number instead of the
needed Zeros?

-Original Message-
From: Martin Towell [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 20, 2003 1:11 AM
To: 'Harry.de'; [EMAIL PROTECTED]
Subject: RE: [PHP] Zero Fill - Number Format


sprintf/printf(%7d, $num)

-Original Message-
From: Harry.de [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 20, 2003 10:09 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Zero Fill - Number Format


How can I put out a Zero Fill for numbers
The result should be

$something=26;
echo $something;

e.g.
026

I didn't found a solution with number format. Is there any other way?



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

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


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



RE: [PHP] Banner ad solution?

2003-03-20 Thread Boaz Yahav
Proved to be very stable for me :)

-Original Message-
From: MIKE YRABEDRA [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 20, 2003 7:00 PM
To: PHP List
Subject: [PHP] Banner ad solution?




Can someone suggest a 'good' banner ad solution that is done in php.

Please do not suggest phpAdNews since it has proven very unstable for me
and others.


-- 
Mike Yrabedra
President

 323, Inc.
 Home of The MacDock and The MacSurfshop
 [http://macdock.com] : [http://macsurfshop.com]
 VOICE: 770.382.1195
 FAX:   734-448-5164
 iChat/AIM: ichatmacdock
___
Whatever you do, work at it with all your heart,
as working for the Lord, not for men.
~Colossians 3:23 {{{
--



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


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



RE: [PHP] Zero Fill - Number Format

2003-03-20 Thread Chris Shiflett
--- Boaz Yahav [EMAIL PROTECTED] wrote:
 wouldn't this just print empty spaces before the number instead of the
 needed Zeros?

Yes, you are correct.

 -Original Message-
 From: Martin Towell [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, March 20, 2003 1:11 AM
 To: 'Harry.de'; [EMAIL PROTECTED]
 Subject: RE: [PHP] Zero Fill - Number Format
 
 sprintf/printf(%7d, $num)
 
 -Original Message-
 From: Harry.de [mailto:[EMAIL PROTECTED]
 Sent: Thursday, March 20, 2003 10:09 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Zero Fill - Number Format
 
 How can I put out a Zero Fill for numbers
 The result should be
 
 $something=26;
 echo $something;
 
 e.g.
 026

I'm sure there is a better way, but I can add two lines of code between yours
above to accomplish what you want, resulting in this:

$something = 26;
$something = sprintf('%7d', $something);
$something = str_replace(' ', '0', $something);
echo $something;

Chris

=
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/

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



RE: [PHP] Zero Fill - Number Format

2003-03-20 Thread Chris Shiflett
 $something = 26;
 $something = sprintf('%7d', $something);
 $something = str_replace(' ', '0', $something);
 echo $something;

This is a bit more direct:

$something = 26;
echo str_pad($something, 7, '0', STR_PAD_LEFT);

Chris

=
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/

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



Re: [PHP] Banner ad solution?

2003-03-20 Thread Jason k Larson
I use phpAdsNew in a production environment and it has been rock solid stable.  I am hugely 
impressed with phpAdsNew and would recommend it to anyone for a real banner ad solution.

But then again, I'm only serving maybe 5 million views in a month with it.

--
Jason k Larson
Boaz Yahav wrote:
Proved to be very stable for me :)

-Original Message-
From: MIKE YRABEDRA [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 20, 2003 7:00 PM
To: PHP List
Subject: [PHP] Banner ad solution?



Can someone suggest a 'good' banner ad solution that is done in php.

Please do not suggest phpAdNews since it has proven very unstable for me
and others.



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


Re: [PHP] Cleaning user data

2003-03-20 Thread Leif K-Brooks
My BBCode class takes care of unended tags, and much more.  Have a look 
at http://www.phpclasses.org/browse.html/package/951.html.

Chris Shiflett wrote:

I still fail to see how BB code helps in any way, since you have to make these
same considerations. But, like I said, maybe I'm missing something. :-)
--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt 
to decrypt it will be prosecuted to the full extent of the law.



Re: [PHP] internally stored binary image

2003-03-20 Thread speedfreak
Ernest E Vogelsinger wrote:

 At 15:57 20.03.2003, [EMAIL PROTECTED] spoke out and said:
 [snip]
 In order to distribute a single script I would like to store a small
 image internally. Is this at all possible with PHP? How would I go about
 it? Please feel free to rtfm me to the relevant sections.
 [snip]

 You could make some script to retrieve the hex values of the image byte by
 byte, then create a source file like
 $imgdata = '\xff\x19\x00\x12   etc...;

 Then when you're about to send the image simply transmit the correct
 header() and echo out the data.

 This little sample works just perfectly:

 
 // use one of your files here, of course...
 $file = 'images/dart.gif';
 $hf = fopen($file, 'r') or die(Can't open $file for reading);
 $bin = fread($hf, filesize($file));
 fclose($hf);
 $asc = '$img_data = ';
 for ($i = 0, $len = strlen($bin); $i  $len; ++$i) {
 if ($i  !($i % 16))
 $asc .= \ .\n\t\;
 $asc .= '\\x' . bin2hex(substr($bin, $i, 1));
 }
 $asc .= ';';

 // $asc now contains the hex-coded binary file.
 // Example (a real gif - try it)
 $img_data =
 \x47\x49\x46\x38\x39\x61\x20\x00\x20\x00\xa2\xff\x00\x00\x00\x00 .
 \xff\x00\x00\xff\xff\x00\x00\x00\xff\xc0\xc0\xc0\x00\x00\x00\x00 .
 \x00\x00\x00\x00\x00\x21\xf9\x04\x01\x00\x00\x04\x00\x2c\x00\x00 .
 \x00\x00\x20\x00\x20\x00\x40\x03\xae\x48\xba\xac\xf0\x10\x34\x36 .
 \x06\x83\x21\x87\xc8\xa3\xd0\xd0\x82\x65\xe3\xd6\x81\x0f\x2a\x89 .
 \x25\x79\x6a\xe6\x33\xb1\x29\x6c\xab\x80\xd0\x94\x11\x8c\x7d\x31 .
 \x80\xca\x51\x0b\xde\x70\xc3\x19\xa1\xc3\x8c\x28\x67\xcd\xe8\xa2 .
 \x52\xb9\xb4\x82\x57\x41\xc8\x2a\x74\x15\x6f\xda\xe2\x96\x27\x7e .
 \x0c\x04\x5a\xd5\x90\xfc\x6d\xf5\xbc\x34\x5f\xd4\x2d\x83\x5e\x8f .
 \xc1\xe7\x93\xa9\xef\x2f\xe7\x75\x53\x54\x76\x6f\x36\x1d\x0a\x02 .
 \x55\x3b\x77\x78\x26\x5a\x84\x5d\x5e\x4d\x19\x1f\x4e\x71\x38\x91 .
 \x5e\x69\x49\x7f\x91\x8c\x94\x31\x49\x6c\x72\x39\x40\x5e\x6b\x65 .
 \x9e\x66\x03\xa9\xa8\xaa\x99\x1c\xa4\xa2\xad\x8d\xa1\x70\x44\xb0 .
 \x85\x92\xb9\x2b\xb8\xbc\x93\x38\x90\xb5\x86\x5b\x7b\xb1\x37\x87 .
 \x7e\x34\x73\xca\xcd\xce\x09\x00\x3b;

 // Now write the stuff to a file
 $hf = fopen($file.asc, 'w') or die(Can't open $file.asc for writing);
 fwrite($hf, $asc);
 fclose($hf);

 // Here you may either include the file, or copy/paste its contents into
 your own code.
 // The next lines are just to test the stuff - adjust the Content-Type
 header to your needs:

 header('Content-Type: image/gif');
 eval($asc);  // this will render the binary content into $img_data
 echo $img_data;  // send it
 exit;// and voila
 

 Note that reading the file is only needed once as a tool to create the
 ascii version of the binary file.

 --
O Ernest E. Vogelsinger
(\) ICQ #13394035
 ^ http://www.vogelsinger.at/

BullsEye indeed! After adjusting for win32 (added 'b' to fopen's) this script
is a little gem. You really saved me quite some headaches. Thanks!
-speedfreak


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



RE: [PHP] To use PEAR::DB or the PHP database functions

2003-03-20 Thread Dan Rossi
i have been using the pear db for a long time , although , portability
=slower abstraction , aparantly the DB is not continuing, and MDB is its
predecessor, anyway i've had a bit of trouble getting the MDB to work , in
fact i got DB to work pretty much straight away thanks to thoms howto page,
MDB is a bit of a rewrite obviously to make it faster than DB therefore if u
are intergrating abstraction code from DB to MDB is a bit of a pain i'm
still trying to get the right answer out of luke on how to get rows out in a
while loop, not as easy as i thought. i have written my own abstraction
class , not as hard as u think , but work needed fast access , and we only
use mysql so i made it as light as possible with error handling included
check it out :D

http://electroteque.dyndns.org:1023/benchmark/DB.phps

-Original Message-
From: Charles Kline [mailto:[EMAIL PROTECTED]
Sent: Friday, March 21, 2003 7:04 AM
To: Merritt, Dave
Cc: PHP General (E-mail)
Subject: Re: [PHP] To use PEAR::DB or the PHP database functions


Pear is really nice. I am very happy with it.

- Charles

On Thursday, March 20, 2003, at 02:56 PM, Merritt, Dave wrote:

 All,

 I've always used MySQL databases and the MySQL functions in PHP for my
 code
 in the past.  However, I'm now working on a project that I want the
 project
 to be able to be database independent so that the user of the project
 can
 use whatever database he/she wishes.  I'm looking primarily at
 providing
 support for MySQL, PostgreSQL, Oracle,  SQL Server databases.  What's
 the
 general consensus on how to handle this?  Do I need to look at using
 PEAR::DB so that the type of database is hidden from my code or
 would I
 look at writing different include files for each database type and
 each of
 the include files use the relevant PHP functions?  Or some other
 totally
 different way?

 Thanks

 Dave Merritt
 [EMAIL PROTECTED]

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



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


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



RE: [PHP] PHP Devel Environments???

2003-03-20 Thread Dan Rossi
The boss wants to lose the dependancy on the 2
programmers (myself and another person) for every little piece of PHP
code.

does that mean your job ? why look into it for them  dont do it man !

-Original Message-
From: Henrik Hudson [mailto:[EMAIL PROTECTED]
Sent: Friday, March 21, 2003 7:03 AM
To: [EMAIL PROTECTED]
Subject: [PHP] PHP Devel Environments???


Hey List-

Any one have some input on some good GUI WYSIWYG devel enviroments for
creating PHP scriptlets. The boss wants to lose the dependancy on the 2
programmers (myself and another person) for every little piece of PHP
code.
Of course, the graphic designers have no desire to learn source code, so we
have to see if there are any WYSIWYG's out there that will allow them to
create code chunks to either do webforms or handle simple variable passing
between pages?

My argument is that it is to wide open and there are too many variables
that
need to be taken into account for this to happen.

We did look at Dreamweaver MX, but it's PHP support is limited to syntax
highlighting and being able to insert if and else clauses. I'd tell'em to
use
gvim, but I don't think that would fly :) The boss says there are some
Dreamweaver extensions for doing some of this stuff, but I still question
their quality for open ended stuff like writing PHP.

Thanks.

Henrik

--

Henrik Hudson
[EMAIL PROTECTED]

You know, Hobbes, some days even my lucky
rocket ship underpants don't help.  Calvin

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


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



[PHP] web services

2003-03-20 Thread Merlin
Hi everybody,

I am currently trying to understand how to place content on a different site
without giving away my code. SOAP seems to be the solution. I am absolutly
new to web services. What I did understand so far is that it is basicly
pritty simple to transfer some data like a currency exchange rate over the
web service. But how about a complete web portal? Connected to the same DB,
the php files hosted on my server, but the application served by a different
server. Like co branding the portal. Is this possible as well?

Maybe someone can point me into the right direction.

Thanx a lot,

Merlin



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



[PHP] number function

2003-03-20 Thread pei_world
anyone how to write a good number valid function?
regonise numbers like: real int





--
Sincerely your;

pei_world ( .::IT::. )








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



[PHP] RE: [SOAP] web services

2003-03-20 Thread Paul Miller
You could also check into a RSS implementation. Take the standardized
approach to XML-RPC.

http://backend.userland.com/rss

- Paul

-Original Message-
From: Tony Bibbs [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 20, 2003 4:23 PM
To: Merlin
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [SOAP] web services


That seems network intensive to me.  Offering web services for some basic
tasks makes sense but not making an entire application that does all
functionality over the web will be slow and impractical.

Also, consider XML-RPC.  Some people insist on hammering a nail with a
sledgehammer (soap) when a XML-RPC implementation (the hammer) is better
suited.

That said, I use both raw XML, XML-RPC and SOAP for various tasks.

It doesn't have to be all or the other (not that you implied that)...

--Tony

 On Fri, 21 Mar
2003, Merlin wrote:

 Hi everybody,

 I am currently trying to understand how to place content on a different
site
 without giving away my code. SOAP seems to be the solution. I am absolutly
 new to web services. What I did understand so far is that it is basicly
 pritty simple to transfer some data like a currency exchange rate over the
 web service. But how about a complete web portal? Connected to the same
DB,
 the php files hosted on my server, but the application served by a
different
 server. Like co branding the portal. Is this possible as well?

 Maybe someone can point me into the right direction.

 Thanx a lot,

 Merlin





--
Tony Bibbs  I guess you have to remember that those who don't
[EMAIL PROTECTED]  hunt or fish often see those of us who do as
harmlessly strange and sort of amusing. When you
think about it, that might be a fair assessment.
--Unknown



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



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



[PHP] Re: [SOAP] web services

2003-03-20 Thread Tony Bibbs
That seems network intensive to me.  Offering web services for some basic 
tasks makes sense but not making an entire application that does all 
functionality over the web will be slow and impractical.

Also, consider XML-RPC.  Some people insist on hammering a nail with a 
sledgehammer (soap) when a XML-RPC implementation (the hammer) is better 
suited.

That said, I use both raw XML, XML-RPC and SOAP for various tasks.

It doesn't have to be all or the other (not that you implied that)...

--Tony

 On Fri, 21 Mar 
2003, Merlin wrote:

 Hi everybody,
 
 I am currently trying to understand how to place content on a different site
 without giving away my code. SOAP seems to be the solution. I am absolutly
 new to web services. What I did understand so far is that it is basicly
 pritty simple to transfer some data like a currency exchange rate over the
 web service. But how about a complete web portal? Connected to the same DB,
 the php files hosted on my server, but the application served by a different
 server. Like co branding the portal. Is this possible as well?
 
 Maybe someone can point me into the right direction.
 
 Thanx a lot,
 
 Merlin
 
 
 
 

-- 
Tony Bibbs  I guess you have to remember that those who don't
[EMAIL PROTECTED]  hunt or fish often see those of us who do as  
harmlessly strange and sort of amusing. When you  
think about it, that might be a fair assessment. 
--Unknown



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



[PHP] lurker awakes

2003-03-20 Thread steve
Hi guys,
we have been silent observers to this list over the last few weeks. 
most of our web-app development is done in cold fusion, and i am still coming to terms 
with php, our involvement with the language to date has been via phpnuke.

a while ago one of our tech guys showed me the output of a php page which showed our 
system passwords - 
since then he has subsequently moved on, we have changed all our passwords etc..

my q: 
does anyone have any knowlege about this type of script?
does anyone have a copy of it, so i can make sure there are no copies of it on my 
system - it would be a hell of a backdoor to leave on our server.
Steve Soars




www.i-redlands.net

Interactive Redlands
Shop 2 Cleveland Town Square
Cnr Queen  Bloomfield Sts
Cleveland QLD 4163

[p] 07 3821-5800
[f] 07 3821-5811 

what we do in life
echoes an eternity







RE: [PHP] Zero Fill - Number Format

2003-03-20 Thread Martin Towell
oops, sorry - try this instead

sprintf/printf(%07d, $num)

-Original Message-
From: Boaz Yahav [mailto:[EMAIL PROTECTED]
Sent: Friday, March 21, 2003 8:23 AM
To: Martin Towell; Harry.de; [EMAIL PROTECTED]
Subject: RE: [PHP] Zero Fill - Number Format


wouldn't this just print empty spaces before the number instead of the
needed Zeros?

-Original Message-
From: Martin Towell [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 20, 2003 1:11 AM
To: 'Harry.de'; [EMAIL PROTECTED]
Subject: RE: [PHP] Zero Fill - Number Format


sprintf/printf(%7d, $num)

-Original Message-
From: Harry.de [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 20, 2003 10:09 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Zero Fill - Number Format


How can I put out a Zero Fill for numbers
The result should be

$something=26;
echo $something;

e.g.
026

I didn't found a solution with number format. Is there any other way?



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

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

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



Re: [PHP] Cleaning user data

2003-03-20 Thread Chris Shiflett
--- Leif K-Brooks [EMAIL PROTECTED] wrote:
 My BBCode class takes care of unended tags, and much more.  Have a look 
 at http://www.phpclasses.org/browse.html/package/951.html.

You have to log in to view any source on that site (or so it seems), so no
thanks.

Unended tags are easy enough to handle with HTML, so what benefit does BBcode
offer in that regard? The only conversation regarding BBcode in this thread was
to question its purpose, since it seems to have none.

Chris

=
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/

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



Re: [PHP] number function

2003-03-20 Thread Leif K-Brooks
http://www.php.net/manual/en/function.is-numeric.php

pei_world wrote:

anyone how to write a good number valid function?
regonise numbers like: real int




--
Sincerely your;
pei_world ( .::IT::. )







 

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt 
to decrypt it will be prosecuted to the full extent of the law.


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


[PHP] Re: number function

2003-03-20 Thread pei_world
hi
thx for the last question
I have following function, I use it the check all the elements in the array
whether numeric or not. but I get the output : ++l++* and ++0++, the first
char in the string
===
 function check_int_float($array){
  $result=true;

   for($i=0; $isizeof($array); $i++){
 echo ++.$array[strlen($array)].++;
if($array[$i]!=){
  if(isdigit($array[$i])  $array[$i]!=.){
  $result=true;
 }else{
  $result=false;
   break;
  }//if
}//if
}//foreach
 return $result;
 }



--
Sincerely your;

pei_world ( .::IT::. )



Pei_world [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 anyone how to write a good number valid function?
 regonise numbers like: real int





 --
 Sincerely your;

 pei_world ( .::IT::. )










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



Re: [PHP] number function

2003-03-20 Thread Chris Shiflett
--- Leif K-Brooks [EMAIL PROTECTED] wrote:
 http://www.php.net/manual/en/function.is-numeric.php

Also, make sure you read that manual page Leif is giving. Some people are
confused at the outcome of tests like these:

is_numeric('3,333.33')
is_numeric('3e3')
is_numeric(' -3e-3')

Chris

=
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/

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



Re: [PHP] Re: number function

2003-03-20 Thread Kevin Waterson
This one time, at band camp,
pei_world [EMAIL PROTECTED] wrote:

php
$num = '1234';
if(checkNum($num) == 'FALSE')
  {
  echo 'Number is not numeric'
  }
else
  {
  echo 'Its a number';
  }

function checkNum($num){
  return is_numeric($num);
}

 hi
 thx for the last question
 I have following function, I use it the check all the elements in the array
 whether numeric or not. but I get the output : ++l++* and ++0++, the first
 char in the string
 ===
  function check_int_float($array){
   $result=true;
 
for($i=0; $isizeof($array); $i++){
  echo ++.$array[strlen($array)].++;
 if($array[$i]!=){
   if(isdigit($array[$i])  $array[$i]!=.){
   $result=true;
  }else{
   $result=false;
break;
   }//if
 }//if
 }//foreach
  return $result;
  }

-- 
 __  
(_ \ 
 _) )            
|  /  / _  ) / _  | / ___) / _  )
| |  ( (/ / ( ( | |( (___ ( (/ / 
|_|   \) \_||_| \) \)
Kevin Waterson
Port Macquarie, Australia

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



[PHP] Missing session vars when doing var_dump()

2003-03-20 Thread Gavin Jackson
Hi

I have come across a strange problem. I have an application that a user
logs into and when I find the user in the database I load all the custom
info for that use which I store. By the time I'm done, the session array
has 18 key's. When I do a var_dump($_SESSION) I sometimes get
18 variables and sometimes I only get 16. The two fields that are missing
are TEXT fields from a MySQL database and they also appear to be
the last two keys when var_dump() returns all 18 keys.

Does anyone know what is causing this, it's driving me crazy at the
moment with many late nights. The PHP version running is 4.2.3

Regards

Gavin

Auckland, New Zealand


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



  1   2   >