Re: [PHP] Updating a single line in a file

2006-03-19 Thread smr78
OK, I take a look on sqlite

Many thanks


""Manuel Amador (Rudd-O)"" <[EMAIL PROTECTED]> a écrit dans le message de 
news: [EMAIL PROTECTED]
> Replies inlined.
>
>>>Why dont you use a database for this?  You will run into race
>>>conditions at some point.
>>>
>>>If you need a file based database take a look at sqlite.
>>>
>>>Curt.
>>>-- 
>>>
>>About the race conditions, I didn't mentionned I had some extras code to 
>>care about concurrent writing on the file
>>About database, I know that will be the best, but on this small site, I 
>>can't use full database!
>>
> That's why they suggested a sqlite database, which uses a single file.
>
>>Thank you for your answer
>>SR
>> 

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



Re: [PHP] PHP, SQL, AJAX, JS and populating a SelectBox?

2006-03-19 Thread tedd

sry bout that it seems i was logged in :) try this on
"http://www.ajaxfreaks.com/tutorials/6/0.php"; it's called "Making a
Google Suggest-like application"



Dave:

A most excellent example, but a horrible place to put it. The links 
are all screwed up and confusing. The pages are not designed well 
(i.e., way off right for me) and errors on their statistics. Link to 
your site is broke.


But, I was able to salvage your code to produce my own example.

http://www.xn--ovg.com/ajax_pop-down

This ajax stuff is pretty neat.

Would you permit me to post this example elsewhere? I'll provide credit to you.

tedd


--

http://sperling.com

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



[PHP] Re: Updating a single line in a file

2006-03-19 Thread Al

For small DBs and where I don't expect very heavy traffic, I simply put 
everything in an array, where the keys are unique.

Arrays are quite easy to work with for your type of application

Here is a snip I wrote recently

function write_data_file($courses_array){   

$file_str= base64_encode(serialize($courses_array));
//base64 required because of special chars

$fh = fopen(DATA_FILE_FP, "wb");
if(!$fh) die("Code error in update_data_file(), 
\"DATA_FILE\" could not be opened. Check file system.");

	if (flock($fh, LOCK_EX)) { 		// do exclusive lock 
		

fwrite($fh, $file_str);
	   
	   	flock($fh, LOCK_UN); 		// release lock 
	} 
	else die("Code error, could not lock \"DATA_FILE\". Contact tech support."); 
	

fclose($fh);

//No need to restore data dir and file to 755 and 644.
return;
}//end function 


To get your array back just like it was.


function get_all_courses(){

$file_str= base64_decode(file_get_contents(DATA_FILE_FP));  
//base64 required

return  unserialize($file_str); 
//returns data array
}//end function








smr78 wrote:

Hi,
What is the best method to update a single line in a text file?
I have a file made of identifiers, that is pointed on by a htaccess file and 
used by a server to give access to a web site.

The file content is like this :
login1:pass1\r\n
login2:pass2\r\n

loginn:passn\r\n
loginn1:passn1\r\n

lastlogin:lastpass\r\n

This file can be modified in three ways
update a single line when a user updates its profile
delete a single line when the webmaster makes a user inactive
append a line when the webmaster makes a user active

the difficulties are :
there is not the same number of users and lines in this file,
we dont know at which line are the identifiers of a user,
when updating identifiers, we must keep new line characters at the end.

So what are the best functions to use to read and rewrite the file?

file() which puts all the content in an array, including the new line 
characters? (if so, we need to use array_search() or array_keys() to find 
where are the identifiers


fread() or file_get_contents() which puts all the content in a string? I 
tried this way and use eregi_replace() to find where are the identifiers, 
replace them by new value. But sometimes, I get errors where the new line 
characters are suppressed between two users identifiers or where an 
identifier is repeated like this :


loginx:passx\r\n
loginx:passx\r\n
loginn:passnloginn1:passn1\r\n
loginn2:passn2\r\n

Here is my code :

I know in "deleting" case, the eregi_replace pattern is so that the new line 
characters will not be removed, but this is not a problem


I'll try to use file() function and array_keys() and let you know.
Thanks


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



[PHP] Paypal IPN and PHP

2006-03-19 Thread Leonard Burton
HI All,

I am putting together an site and will accept payments via Paypal's
IPN.  I have came across many classes for this so I am curious if
anyone has any recommendations?

Does anyone know if the IPN framework has changed since 2003 as it
seems that the latest information I have on it is from 2003.  I have
looked around the Paypal site and it does not indicate when or if any
changes have been made.  I mainly need to know so if I use a 3rd pty
class I will not have to pull my hair out.

Thanks,

--
Leonard Burton, N9URK
[EMAIL PROTECTED]

"The prolonged evacuation would have dramatically affected the
survivability of the occupants."

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



Re: [PHP] showing any mysql query in a table, help!

2006-03-19 Thread Curt Zirzow
On Sun, Mar 19, 2006 at 05:12:06AM +, [EMAIL PROTECTED] wrote:
> Ok...
> it has to be a way to do such a thing.
> I do i get the column names?
> I can get the number of columns using mysql_num_fields() right?
> but what if i want to get the columns name? Wich functtion and how should i 
> use?

  http://php.net/mysql_fetch_field

Something like:

$result = mysql_query($sql);

$j = mysql_num_fields($result);
for($i = 0; $i < $j; $j++ ) {
  $field = mysql_fetch_field($result, $i);
  echo $field->name;
}


Curt.
-- 
cat .signature: No such file or directory

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



Re: [PHP] Paypal IPN and PHP

2006-03-19 Thread Richard Davey

On 19 Mar 2006, at 18:32, Leonard Burton wrote:


I am putting together an site and will accept payments via Paypal's
IPN.  I have came across many classes for this so I am curious if
anyone has any recommendations?


Isn't there a full proper PayPal API now? IPN hasn't changed in ages,  
but I don't think it is their preferred way of accessing PayPal any  
more, and certainly isn't the most streamlined.


Cheers,

Rich
--
http://www.corephp.co.uk
Zend Certified Engineer
PHP Development Services

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



Re: [PHP] Paypal IPN and PHP

2006-03-19 Thread Stan Busk

Hi,

You can look at my script. It is available here:
http://www.maxprog.com/scripts/paypal_ipn/index.html

I made it to sale software licenses, it generates and sends receipts  
by e-mail to the customers with a copy to you, formats and sends the  
customer data as XML to you by e-mail, saves the sales to Excel  
sheets, one per month and currency, handles refunds, reversed  
payments and e-checks and handles all kind of errors including  
sending e-mails.


~/Stan


HI All,

I am putting together an site and will accept payments via Paypal's
IPN.  I have came across many classes for this so I am curious if
anyone has any recommendations?

Does anyone know if the IPN framework has changed since 2003 as it
seems that the latest information I have on it is from 2003.  I have
looked around the Paypal site and it does not indicate when or if any
changes have been made.  I mainly need to know so if I use a 3rd pty
class I will not have to pull my hair out.

Thanks,

--
Leonard Burton, N9URK
[EMAIL PROTECTED]

"The prolonged evacuation would have dramatically affected the
survivability of the occupants."

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

2006-03-19 Thread Leonard Burton
HI All,

What do you all use for keeping track of invoices?

I looked at a few open source projects (including
http://billing-software.us/) and it seems that there is not really a
good Open Source Project out there for invoices.  Am I wrong?

What would be nice is a project with a good API that would allow other
projects to use its invoice handling capabilities.  It would be nice
if it weren't designed for one specific situation.

Have I missed the boat here?  Is there a nice OS Invoice program that
will do all this?  Has anyone considered starting one?

Thanks,

--
Leonard Burton, N9URK
[EMAIL PROTECTED]

"The prolonged evacuation would have dramatically affected the
survivability of the occupants."

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



Re: [PHP] PHP, SQL, AJAX, JS and populating a SelectBox?

2006-03-19 Thread dave
as u wish :)

tedd wrote:
>> sry bout that it seems i was logged in :) try this on
>> "http://www.ajaxfreaks.com/tutorials/6/0.php"; it's called "Making a
>> Google Suggest-like application"
> 
> 
> Dave:
> 
> A most excellent example, but a horrible place to put it. The links are
> all screwed up and confusing. The pages are not designed well (i.e., way
> off right for me) and errors on their statistics. Link to your site is
> broke.
> 
> But, I was able to salvage your code to produce my own example.
> 
> http://www.xn--ovg.com/ajax_pop-down
> 
> This ajax stuff is pretty neat.
> 
> Would you permit me to post this example elsewhere? I'll provide credit
> to you.
> 
> tedd
> 
> 

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



Re: [PHP] PHP, SQL, AJAX, JS and populating a SelectBox?

2006-03-19 Thread paulm
oh, just realized smth :) the tutorial is not mine i have used with
success and also posted there but the credit for the tutorial is of:
NickName:   Gast
Member Since:   03/26/2005
Location:   Surrey, England
Website:http://www.nmcmahon.co.uk
he must have the credit for it :)

dave wrote:
> as u wish :)
> 
> tedd wrote:
>>> sry bout that it seems i was logged in :) try this on
>>> "http://www.ajaxfreaks.com/tutorials/6/0.php"; it's called "Making a
>>> Google Suggest-like application"
>>
>> Dave:
>>
>> A most excellent example, but a horrible place to put it. The links are
>> all screwed up and confusing. The pages are not designed well (i.e., way
>> off right for me) and errors on their statistics. Link to your site is
>> broke.
>>
>> But, I was able to salvage your code to produce my own example.
>>
>> http://www.xn--ovg.com/ajax_pop-down
>>
>> This ajax stuff is pretty neat.
>>
>> Would you permit me to post this example elsewhere? I'll provide credit
>> to you.
>>
>> tedd
>>
>>
> 

-- 
Paul Marinas, netadm @ RDS Craiova.
GnuPG Key http://pgp.rdscv.ro

RCS&RDS  Craiova
Tel.: +40351.400.444
Fax : +40351.400.445
http://www.rcs-rds.ro

Privileged/Confidential Information may be contained in this message.
If you are not in the addresses indicated in this message (or
responsible fordelivery of the message to such person), you may not
copy or deliver this message to anyone. In such a case, you should
destroy this message and kindly notify the sender by reply e-mail.



signature.asc
Description: OpenPGP digital signature


Re: [PHP] Invoices

2006-03-19 Thread Kevin Kinsey

Leonard Burton wrote:


HI All,

What do you all use for keeping track of invoices?

I looked at a few open source projects (including
http://billing-software.us/) and it seems that there is not really a
good Open Source Project out there for invoices.  Am I wrong?

What would be nice is a project with a good API that would allow other
projects to use its invoice handling capabilities.  It would be nice
if it weren't designed for one specific situation.

Have I missed the boat here?  Is there a nice OS Invoice program that
will do all this?  Has anyone considered starting one?

Thanks,

--
Leonard Burton, N9URK
 



PHP has become a bit of a breeze for me to use, thanks
to its authors (who came up with a nice syntax and great
docs) and its community (who didn't flame me too much
when I was a newbie, less than 5 years ago).

As a result, my business is managed by a "home grown"
app --- calendar, checkbook management, invoicing,
task list, local messaging, some accounting computations,
mileage computation, expense records, etc.

ATM, I'm adding "trouble tickets" to the mix, and a few
other ditties.

Now, if there's nothing else out there, I can imagine
it would be nice to release it, but, as I mention, I'm
a relative "newbie", and started coding it 4 years ago
and much of it is have never been updated.  Much is from
before I learned that web standards existed (I learned
HTML from reading the source created by MS FrontPage
Express in the late 1990s, [ugh!!!]), and I'm not a geek
by training (so, I've a shelf of books on OOP and still
haven't a great handle on it, but there again comes PHP
to the rescue), so "open sourcing" it might well take
so much cleaning up that it would kill me.  And if it's
not cleaned up, it'd probably be as traumatic as appearing
on American Idol in a Speedo (at my age, not very pretty
at all; or you can sub in "hosting a Tupperware party in the
nude" if you wish, but who would?).

Anyway, I guess my point was, "rolling your own isn't the
end of the world" (unless you want the world to see it).

All that said, have you looked at Hermes, CentraView (not
PHP, IIRC) or NOLA?  ATM, I can't even recall what NOLA
does, but I seem to recall that it was fairly generic (may
have been more of a retail-frontend).

Also, a quick Googling turns up a rather long list at:

 http://cbbrowne.com/info/financefreesoft.html

Good luck, HTH,

Kevin Kinsey

--
Stability itself is nothing else than a more sluggish motion.

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



[PHP] Mail function problems

2006-03-19 Thread Paul Goepfert
Hi all,

Has anyone had this problem before?  I have a web server that resides
on a windows platform (According to phpinfo()).  I used the php mail
function to send out a test message to make sure that the mail
function would work when needed.  I sent out the test message and I
didn't get an email sent to me.  This is what I did, I created the
following variables:

$to = "[EMAIL PROTECTED]";
$subject ="Test";
$message ="This is a test"
$headers = "From: Paul " .
  "<[EMAIL PROTECTED]>\r\n";
$headers .= "X-Sender:  <[EMAIL PROTECTED]>\r\n";
$headers .="X-Mailer: PHP\r\n";
$headers .="Return-Path: <[EMAIL PROTECTED]>\r\n";

I put them in the mail function as parameters
mail($to,$subject,$message,$headers).


Ok now this is what is found in phpinfo():

sendmail_from no value no value
sendmail_path no value no value
SMTP no value no value
smtp_port25   25

Do these values need to be set?  if so, how do that on a remote
server?  I don't think I have access to the httpd config file or
php.ini file.

Thanks
Paul

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



[PHP] SNMP problem is TCP

2006-03-19 Thread wood-gd
Hello
// I sorry my english
//my script is control TCP protocol 

$ip=83.190.177.45;  // IP
$community=public; //community (password)
echo $stan = '12'; // deletetcb - del connect

 $LocalAddress =
snmpwalk("$ip","$community","tcp.tcpConnTable.tcpConnEntry.tcpConnLocalAddre
ss");
 $LocalPort =
snmpwalk("$ip","$community","tcp.tcpConnTable.tcpConnEntry.tcpConnLocalPort"
);
 $RemAddress =
snmpwalk("$ip","$community","tcp.tcpConnTable.tcpConnEntry.tcpConnRemAddress
");
 $RemPort =
snmpwalk("$ip","$community","tcp.tcpConnTable.tcpConnEntry.tcpConnRemPort");

 echo $wynik='1.3.6.1.2.1.6.13.1.'.zamiana($LocalAddress[$id],"IpAddress:
").'.'.$LocalPort[$id].'.'.zamiana($RemAddress[$id], "IpAddress:
").'.'.$RemPort[$id];

 snmpset($ip, $community, $wynik, i, $stan);

//-- zamiana($LocalAddress[$id],"IpAddress: ") this is function
//-- Is error

12
1.3.6.1.2.1.6.13.1.0.0.0.0.135.0.0.0.0.0
Warning: snmpset(): Could not add variable:
system.sysUpTime.6.1.2.1.6.13.1.0.0.0.0.135.0.0.0.0.0 i 12 in e:\program
files\apache group\apache\users\snmp\pliki\porty_set.php on line 70

//-- hellp Me. My e-mail [EMAIL PROTECTED]

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



[PHP] array_search function bugged?

2006-03-19 Thread je killen
The following code does not produce the correct results (for my 
purposes):


function code($str, $match, $formula)
 {
for($i = 0; $i < count($str); $i++)
 {
$formula[$i] = array_search($str[$i], $str);// <<==|| no bueno
  //print $formula[$i]; not right
 if($formula[$i] < $i)
  {$str[$i] = '';}
  }
 //print''; //- etc (lots more code)--->

The code takes a string of ascii letters forming a word and is supposed 
to create a list of indexes
in the proper sequence for reconstructing the word. The object of the 
code in context is to take
any word and create an array of unique letters with no repeats so that 
gd can be used to produce
images of each letter. The letters are then reassembled in the browser 
to form the word. The
$formula above is supposed to tell the browser in what sequence to 
display each letter, including
using the same letter image in repeat locations. For this it fails 
miserably.


These are the results of test steps:

dissatisfaction (the test word)
Processed input string:   dissatisfaction (code output at key step to 
verify)
at creation of formula:    012245128410511314 (formula sampled at ' no 
bueno' line in code)
from browser source array:    012245128410511314 (formula pasted from 
browser javascript source)


The letter images spell out:
disstfisntidfiiait  which is in accordance with the formula as far as I 
can tell.


Is this a bug or am I misusing this function?
server platform: FreeBSD v6.0
Apache version: 1.3.34
php version: 5.1.2

There is one other weakness I've discovered, if arrays are created in 
one code sequence and are called
to print in loops more than once or processed in different code 
sections. The second time the same array
is called it has significantly degraded, loosing values from index 
positions.


the seems to be no bug report accommodation in the php.net site so I'm 
posting here.

Thanks in advance,
JK

Re: [PHP] array_search function bugged?

2006-03-19 Thread Richard Davey

On 19 Mar 2006, at 22:46, je killen wrote:

The code takes a string of ascii letters forming a word and is  
supposed to create a list of indexes
in the proper sequence for reconstructing the word. The object of  
the code in context is to take


Ignoring your code (and the supposed 'bug') for a second - why don't  
you just use the count_chars() function? After all, it is designed to  
do almost exactly what you are trying to recreate here.


http://uk2.php.net/manual/en/function.count-chars.php

the seems to be no bug report accommodation in the php.net site so  
I'm posting here.


I'm not sure you looked very hard. There is a link that says  
'reporting bugs' in the top nav, which takes you here: http:// 
bugs.php.net/


Cheers,

Rich
--
http://www.corephp.co.uk
Zend Certified Engineer
PHP Development Services

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



RE: [PHP] Invoices

2006-03-19 Thread Weber Sites LTD
Check out : http://www.sugarcrm.com/crm/

Sincerely 
 
berber 
 
Visit the Weber Sites Today, 
To see where PHP might take you tomorrow. 
PHP code examples : http://www.weberdev.com 
PHP & MySQL Forums : http://www.weberforums.com
Search for PHP Code from your browser http://toolbar.weberdev.com 
Free Uptime Monitor : http://uptime.weberdev.com
SEO Data Monitor http://seo.weberdev.com
 

-Original Message-
From: Kevin Kinsey [mailto:[EMAIL PROTECTED] 
Sent: Sunday, March 19, 2006 10:40 PM
To: Leonard Burton
Cc: PHP-General
Subject: Re: [PHP] Invoices

Leonard Burton wrote:

>HI All,
>
>What do you all use for keeping track of invoices?
>
>I looked at a few open source projects (including
>http://billing-software.us/) and it seems that there is not really a 
>good Open Source Project out there for invoices.  Am I wrong?
>
>What would be nice is a project with a good API that would allow other 
>projects to use its invoice handling capabilities.  It would be nice if 
>it weren't designed for one specific situation.
>
>Have I missed the boat here?  Is there a nice OS Invoice program that 
>will do all this?  Has anyone considered starting one?
>
>Thanks,
>
>--
>Leonard Burton, N9URK
>  
>

PHP has become a bit of a breeze for me to use, thanks to its authors (who
came up with a nice syntax and great
docs) and its community (who didn't flame me too much when I was a newbie,
less than 5 years ago).

As a result, my business is managed by a "home grown"
app --- calendar, checkbook management, invoicing, task list, local
messaging, some accounting computations, mileage computation, expense
records, etc.

ATM, I'm adding "trouble tickets" to the mix, and a few other ditties.

Now, if there's nothing else out there, I can imagine it would be nice to
release it, but, as I mention, I'm a relative "newbie", and started coding
it 4 years ago and much of it is have never been updated.  Much is from
before I learned that web standards existed (I learned HTML from reading the
source created by MS FrontPage Express in the late 1990s, [ugh!!!]), and I'm
not a geek by training (so, I've a shelf of books on OOP and still haven't a
great handle on it, but there again comes PHP to the rescue), so "open
sourcing" it might well take so much cleaning up that it would kill me.  And
if it's not cleaned up, it'd probably be as traumatic as appearing on
American Idol in a Speedo (at my age, not very pretty at all; or you can sub
in "hosting a Tupperware party in the nude" if you wish, but who would?).

Anyway, I guess my point was, "rolling your own isn't the end of the world"
(unless you want the world to see it).

All that said, have you looked at Hermes, CentraView (not PHP, IIRC) or
NOLA?  ATM, I can't even recall what NOLA does, but I seem to recall that it
was fairly generic (may have been more of a retail-frontend).

Also, a quick Googling turns up a rather long list at:

  http://cbbrowne.com/info/financefreesoft.html

Good luck, HTH,

Kevin Kinsey

--
Stability itself is nothing else than a more sluggish motion.

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