Re: [PHP] PHP4: calling method on returned object

2006-03-30 Thread Petar Nedyalkov
On Thursday 30 March 2006 14:05, Karl Glennon wrote:
 Hi there,

 I have an object structure, whereby a location object contains a method
 to return it's map object. The map object contains a method to return
 it's URL.

 I expected to have the ability to get the url of a location's map with
 the floowing statement:

 print $this-Location-GetMap()-GetUrl();

 This works in PHP5, but in PHP4 it causes a parse error (the application
 has to run on PHP4 for the moment).

 I'm currently working around this limitation as so:

 $locationMap = $this-Location-GetMap();
 print $locationMap-GetUrl();

 Unfortunatly this senario is occuring in dozens of palces in the
 application, and is quite unsightly compared to the PHP5 syntax.

 Is there any other syntax in PHP4 to allow me to concisely call a method
 on a return object? eg. ($this-Location-GetMap())-GetUrl() .. which
 doens't work.

Try curly brackets.


 Thanks for any help,

 Karl Glennon

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpsCmA7vlSuB.pgp
Description: PGP signature


Re: [PHP] Re: object oriented syntax in php

2006-03-28 Thread Petar Nedyalkov
On Tuesday 28 March 2006 12:54, Barry wrote:
 Merlin wrote:
  Hi there,
 
  I do have problems with object oriented syntax as this is not familar to
  me.
  There is following output:
 
 
  object(net_ping_result)(11) { [_icmp_sequence]=  array(1) {
  [61.117):]= string(1) 7 } [_target_ip]=  string(9) y2.php.ne
  [_bytes_per_request]=  string(2) 64 [_bytes_total]=  int(192)
  [_ttl]=  string(6) _seq=2 [_raw_data]=  array(7) { [0]=
  string(72) PING php.net (66.163.161.117) from 192.168.1.114 : 56(84)
  bytes of data. [1]=  string(72) 64 bytes from y2.php.net
  (66.163.161.117): icmp_seq=1 ttl=47 time=211 ms [2]=  string(72) 64
  bytes from y2.php.net (66.163.161.117): icmp_seq=2 ttl=47 time=206 ms
  [3]=  string(0)  [4]=  string(31) --- php.net ping statistics ---
  [5]= string(55) 2 packets transmitted, 2 received, 0% loss, time
  1008ms [6]= string(55) rtt min/avg/max/mdev =
  206.299/209.139/211.979/2.840 ms } [_sysname]=  string(5) linux
  [_round_trip]=  array(3) { [min]= string(7) 209.139 [avg]=
  string(7) 211.979 [max]=  string(5) 2.840 } [_transmitted]=
  string(1) 2 [_received]=  string(1) 2 [_loss]= int(0) }

 This Block is kinda hard to read. Would you mind to post something more
 formatted?

This is a result of print_r();

It would be better to have the class definition...


 Thanks!

 print_r($net_ping_result);

 or something like that.

 --
 Smileys rule (cX.x)C --o(^_^o)
 Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgphhOZlXEgSu.pgp
Description: PGP signature


Re: [PHP] Apache/PHP/MySQL/OpenSSL upgrade question

2006-03-24 Thread Petar Nedyalkov
On Friday 24 March 2006 17:24, Jason Gerfen wrote:
 I know this might be slightly off topic but I just upgraded
 PHP/MySQL/OpenSSL and Apache to the latest stable release for each
 project and so far so good.  The one problem I am encountering is
 dealing with SSL and apachectl not accepting the command 'apachectl
 startssl' as it is depreciated.  Any idea how I can get this to start
 with SSL enabled on port 443?

LoadModule ssl_module modules/mod_ssl.so

And a VirtualHost definition for :443 maybe?


 --
 Jason Gerfen

 You will never be ready for me.
 ~ Me

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpEjF4LL3ytQ.pgp
Description: PGP signature


Re: [PHP] Run a php script as a separate thread/process

2005-10-11 Thread Petar Nedyalkov
On Tuesday 11 October 2005 14:12, Tommy Jensehaugen wrote:
 Hi,
 Anyone knows how to start a php script as a separate thread/process from
 another php script?

Yes, you can check: http://bg.php.net/manual/en/ref.exec.php for details.


 example.php:

 ?php
 some logic


 execute('separate_script.php');
 more logic


 ?

 The reason why I want to do this is because separate_script.php has to be
 fully executed even if the request for example.php is stopped in the middle
 of more logic.
 I am using PHP Version 4.3.11.

 Thank you very much for your help..

 Cheers,
 Tommy

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpeIeTeZxuzR.pgp
Description: PGP signature


Re: [PHP] How to automate php with crontab?

2005-10-03 Thread Petar Nedyalkov
On Monday 03 October 2005 11:20, Rasim XEN wrote:
 hi,

 Anybody know how to automate php with crontab. I want to generate in every
 5 minute one php file.

crontab -e :-)

Check:
http://www.phpfreaks.com/tutorials/28/0.php
and
http://www.tech-geeks.org/contrib/mdrone/croncrontab-howto.htm


 thanks alot

 rasim

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpaxq4409eJm.pgp
Description: PGP signature


Re: [PHP] Project ZNF: Struts-like MVC framework

2005-06-07 Thread Petar Nedyalkov
On Tuesday 07 June 2005 12:05, Alessandro 'Aronnax' Rossini wrote:
 Hi, my name is Alessandro Rossini and I want to let you know the launch of
 a new project called ZNF.
 The goal of this project is to provide an open source framework for
 building PHP5 enterprise web applications. It's based on the Apache Struts
 project of the Apache Software Foundation, available at
 http://struts.apache.org/. This is not the first attempt to rewrite the
 Struts implementation, or part of it, in PHP, but after spending a lot of
 time studying existing open source frameworks, like Phrame, PHPMVC,
 Struts4PHP, Seagull and Vida we decided to reimplement a brand new
 framework from scratch for many reasons. First of all, all the mentioned
 frameworks, except Vida, are written in PHP4 and we believe that its object
 engine (Zend Engine 1) is too limited for developing enterprise level web
 application. At the same time the code we analyzed is written without a
 rigorous approach (coding standards, compliance to W3C standards, output of
 notice/warnings, lack of documentation/examples). Last but not least
 frameworks claiming to be a porting of Struts have made no code
 optimization during the porting from J2EE to PHP.
 ZNF is free software released under GNU/LGPL license, the official ZNF home
 page is at http://znf.zeronotice.com/. You will find the main package, a
 PEAR compatible package and the developer's guide.
 The project has been developed by me and Graziano Liberati, we're searching
 for comments, feedback, bug signaling and best of all new developers. Any
 kind of contribution will be appreciated, if you find the project
 interesting join us!

Cool, keep up guys.


 Best regards.

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpPDaF6PVTNl.pgp
Description: PGP signature


Re: [PHP] regex question

2005-05-17 Thread Petar Nedyalkov
On Monday 16 May 2005 22:53, Al wrote:
 What pattern can I use to match ONLY single occurrences of a character in a
 string.

 e.g., Some text @ and some mo@@re and [EMAIL PROTECTED], etc @@@.

Use the following:

/(^@)(@{1})(^@)/

This way you'll be sure the regexp will match only single occurences ot hte 
'@' symbol.
Please take in mind that if you have this symbol in the beginning of the 
string or at the end - you have to modify this.


 I only want the two occurrences with a single occurrence of @.

 @{1} doesn't work; there are 4 matches.

 Thanks

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpWSAkSaWAeD.pgp
Description: PGP signature


Re: [PHP] counting ocuring words in a string

2005-05-17 Thread Petar Nedyalkov
On Tuesday 17 May 2005 13:00, Merlin wrote:
 Hi there,

 I am trying to find a way to count the number of times (if any) words are
 inside a string. So I played around with ereg, preg_match_all and so on,
 but could not put together a working code.

 Can anybody help me on that?

 This is the current code:
 function count_words($str, $words) {
if(is_array($words)) {
 foreach($words as $k = $word) {
   $pattern[$k] = /\b($word)\b/is;
 }
}
else {
 $pattern = /\b($words)\b/is;
}
return ereg( $pattern, $str);
 }
 $words = 'php language';
 $str = 'One language which is great is php. PHP works great!';
 $num_hits = count_words($str, $word);
 echo $num_hits;

 I would like to get an case insensitive result. In this example: 3

http://www.php.net/manual/en/function.substr-count.php

Try this.


 I am a bit lost on this one. Thank you for any help.

 Merlin

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpvE9fqC9aji.pgp
Description: PGP signature


Re: [PHP] domxml problem

2005-05-16 Thread Petar Nedyalkov
On Monday 16 May 2005 09:52, Georgi Ivanov wrote:
 On Friday 13 May 2005 20:03, Brian V Bonini wrote:
  On Fri, 2005-05-13 at 10:31, Georgi Ivanov wrote:
   But it gives me error on this line :
   $DomDocument = domxml_open_file($file);
 
  What's the error?

 The error is :
 Call to undefined function
 I tried with the new function (   domxml_open_file) and depricated one
 (xmldocfile)
 There is no dom_xml_file function .

Hello (Zdrasti :-)),

AFAIK the DOM XML extension is not being released with PHP 5. Yes you can 
configure PHP to use it, but will be released ONLY with PHP 4. 

I can advise you to use the DOM extension if you want to have DOM XML support, 
or the much easier SimpleXML extension for XML parsing, generation, etc. 
After PHP 5.1 is being released (chech the schedule) you can use the libxml 
extension which is the best for me.


  Try:
 
  $dom = dom_xml_file($file);
 
 
  --
 
  s/:-[(/]/:-)/g
 
 
  BrianGnuPG - KeyID: 0x04A4F0DC | Key Server: pgp.mit.edu
  ==
  gpg --keyserver pgp.mit.edu --recv-keys 04A4F0DC
  Key Info: http://gfx-design.com/keys
  Linux Registered User #339825 at http://counter.li.org

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpcMDYYFmgPZ.pgp
Description: PGP signature


Re: [PHP] mod_rewirte loses POST data

2005-05-16 Thread Petar Nedyalkov
On Friday 13 May 2005 14:58, Bart Seresia wrote:
 Hi,

 I'm currently developing a webapplication that uses mod_rewrite.

 At some point i have to post data but i't seems to get lost, checking the
 web and some archives i've found that normaly mod_rewrite should preserver
 this data, but apparently it doesn't. Could anyone help me?

Try this.

RewriteCond METHOD POST
RewriteRule   (.*)  http://www.yoursite.com$1  [P,L]


 Im using:
 Apache/2.0.52 (Unix) mod_ssl/2.0.52 OpenSSL/0.9.7b PHP/4.3.11 Server at
 host.mydomain.com Port 80

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpxcshrIZPx8.pgp
Description: PGP signature


Fwd: Re: [PHP] [php] Chrooting php...

2005-05-16 Thread Petar Nedyalkov
On Friday 13 May 2005 19:23, Tony Di Croce wrote:
 I'm trying to fully chroot my server. Right now, I have Apache running
 in a chroot jail, and I need to get php5 working their too... Before I
 dive in, I thought I'd just ask if anyone here has any experience
 doing this...? Are their any known issues?

Try this:
http://penguin.triumf.ca/chroot.html

 Also, I was going to chroot my postgres db, but now I'm not so sure.
 It is not running as an exposed service (IE, its ports are not open to
 the outside world. It's only used over the loopback interface by
 PHP)... Is their any point to jailing it in this case?

 td

--

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpy9c0AP0Y8b.pgp
Description: PGP signature


Fwd: Re: [PHP] lib ssh2 functions

2005-05-16 Thread Petar Nedyalkov
On Saturday 14 May 2005 02:16, Oscar Gosdinski wrote:
 Hello everybody:

 I need my PHP application connects through SSH to other server for
 getting some info to display and i tried the following code to test
 lib ssh2:

 $server = ...;
 $user = ...;
 $passwd = ...;

 $con = ssh2_connect($server, 22);
 if (ssh2_auth_password($con, $user, $passwd)) {
$s = ssh2_exec($con, 'ls -l');
$file = fopen(/tmp/test, w);
while ($line = stream_get_line($s, 1024)) {
fwrite($file, $line);

Comment the following line.

fflush($file);

:-)
:
}
fclose($file);
 } else {
echo Authentication Error;
 }

 The file /tmp/test was created but it does not have any data. I can
 connect to the server using a normal ssh session in my laptop and the
 'ls -l' command returns me information.
 I think that i installed correctly the ssh2 functions because if a put
 an incorrect password i get the Authentication Error message.

 I searched the web for info about similar problems and no results.
 Please, anyone can help me with this problem because i have been
 spending three days with this.

 Thanks in advance for your answers.

 --
 Saludos / Regards
 Oscar

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgp8FWuX7dBPY.pgp
Description: PGP signature


[PHP] Fwd: Re: [PHP-DEV] Function proposal

2005-05-16 Thread Petar Nedyalkov
On Friday 13 May 2005 14:29, AnteD wrote:
 Hi guys...

 Yes I know that this is a small function and yes I know it can be
 copy-paste with every new project you do but from the first day I've
 been using PHP until today this function follows me everywhere and I now
 that everyone is using it one way or the other for debugging..

 the problem is when you want to debug a piece of code separately or use
 it in one script then you have to find the function...copy paste to that
 script or write it again just for that script...and so on...it would be
 great if it could be in the php core

 I have a very basic knowledge of C so implementing this function would
 be a nightmare for me but for someone who knows C and the inner
 mysteries of the Zend Engine :) this is a piece of cake

 Ok...here it is...don't laugh :)

 /**
   * Prints the variable in HTML format...
   *
   * @param mixed $var
   * @param bool $return return or print the var
   * @return string
   */
 function print_pre($var, $return = false) {
   $retval = pre.print_r($var, true)./pre;
   if($return) return $retval;
   print($retval);
 }

I think the Reflection API is enough and works great for me. Such a basic
debugging is not the issue when speaking of serious projects with a large OO
tree.

Just an opinion.

 oklet the shooting begin :)

--

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpVloMcpEEFm.pgp
Description: PGP signature


Re: [PHP] Add to array problem

2005-05-16 Thread Petar Nedyalkov
On Monday 16 May 2005 17:26, mayo wrote:
 I'm having a little problem adding to an array. Each time I add to an
 array it wipes what was previously added. I'm using array_push().

 $items=array();
 $items=array_push($items, $_POST[whatever]);

Don't assign the result of the array_push() function to $items. That's the 
reason for flushing the array.

try:

if (array_push($items, $_POST['whatever'])) {
// something
}


 I'm missing something easy.

 thx

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgp8UxOcbzGmK.pgp
Description: PGP signature


Re: [PHP] Strange characters

2005-05-11 Thread Petar Nedyalkov
On Wednesday 11 May 2005 07:43, Carl Furst wrote:
 I have a question about an odd phenomenon. It doesn't have much to do with
 PHP except that I used strtr to solve it, and it maybe that the problem is
 being caused by a setting in PHP, but I would like to get some more
 background info as to why this is happening.



 On a typical Windows system, most applications use the windows-1252
 character set. Linux uses UTF-8 or Unicode. The former being an 8 bit set
 and the latter being a 16 bit set.



 Well I have a form on a website that has to be able to take in text from
 MSWord and Notepad and the like. If someone has been using Autoformating
 in MS Word, the special characters get translated into a UTF-8
 equivalent. What's odd is that these 8 bit windows characters become 24 bit
 combinations, I think. When I look at the characters in hex they are
 represented by 3 numbers first one always being 0xE2.



 Why is there an 0xE2 beginning the character combination and why does PHP
 translate these characters this way? Is there something you can do to
 minimize them besides writing some kind of character scrubber?

If you check the UTF8 character set table at (http://www.unicode.org/charts/) 
you will see that the section for Basic Latin answers your question.




 Thanks,

 Carl

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgp5rdwJkN92E.pgp
Description: PGP signature


Re: [PHP] Session cookies in firefox

2005-05-11 Thread Petar Nedyalkov
On Wednesday 11 May 2005 05:04, Kirsten wrote:
 I'm using php sessions with cookies.
 I realized that Firefox shared cookies between different instances (unlike
 IE that when someone open a new bank window a new session is created).

 Has anyone found a solution to this problem? Maybe detecting the new
 instance and generating a new session id.

Solution 1: Check the referer to your page and consider a new window all 
requests whose referer is from your domain (or your site, or your site + URI, 
etc. - it's up to you to figure out the exact criteria).

Solution 2: Patch the Firefox browser since it's OSS :-)


 Thanks!

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpmE1f9KIK8T.pgp
Description: PGP signature


Re: [PHP] SQL Date guru in the house?

2005-05-11 Thread Petar Nedyalkov
On Wednesday 11 May 2005 09:17, [EMAIL PROTECTED] wrote:
 Hi All,

 I have a small problem.

 I have a project in which someone has got three integer fields for
 holding the date.   DD, MM,  in an sql database.I now have to
 have a page that inputs two dates and select records between those two
 dates.

 If I had a date field in the table it would be fairly simple, but I'm
 hoping to do this search/comparison without having to rewrite the
 pages/database that has already been designed.


 Start Date:   11/05/2005
 End Date: 11/04/2005
 SELECT * FROM blah WHERE mm BETWEEN 04 AND 05 AND dd BETWEEN 11 AND 11
 AND  BETWEEN 2005 AND 2005


 Doesn't work for obvious reasons.  Is there any way that I can do
 this date comparison I the SQL statement without having a decent date
 field?

Yes there's a way ;-)

But you've mixed the month and day in the query.

The standart textual format is MM/DD/ :-)

SELECT * FROM blah WHERE mm BETWEEN 11 AND 11 AND dd BETWEEN 4 AND 5 AND  
BETWEEN 2005 AND 2005

 My apologies as this is australian date format and this list is in the
 US I think?
 Regards
 Matthew

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpqYbi9Bu88s.pgp
Description: PGP signature


Re: [PHP] Password encryption and password retrieval

2005-05-10 Thread Petar Nedyalkov
On Tuesday 10 May 2005 16:05, Deep wrote:
 Hi evryone,

   I want to implement a site where i would like to
 encrypt the password of the users and store it into
 mysql
 database. My question is that , In case if the user
 has forgotten the password how can he retrieve the
 password(which is already encrypted and stored...the
 user should be able to get the decrypted password).

The user won't be able to retrieve it's password if you want your application 
to be secure.

The best practice is to flush the password and let the user reactivate it's 
account by providing him a temporary password.


 Also which encryption method would you recommend. ie.
 md5,crypt, etc

 Thanx,
 ..Deeps..

 
 Yahoo! India Matrimony: Find your life partner online
 Go to: http://yahoo.shaadi.com/india-matrimony

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpkngZA6f5uq.pgp
Description: PGP signature


Re: [PHP] how to know whether web server of a remote machine is running or not

2005-05-10 Thread Petar Nedyalkov
On Tuesday 10 May 2005 14:59, balwant singh wrote:
 Hi,

 I want to make a page (on a webserver) which will be redirected to
 another page on another webserver and hence i  want to know whether the
 another webserver is running or not so that if the webserver is not
 running it do something else.

Check the remote server's waiting port - if it's opened the server is working, 
if it's not the server is not working.


 is there any method to know whether the other webserver is running or not.

 your help will be appreciated.


 with best wishes
 balwant

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpGrByPxcqlC.pgp
Description: PGP signature


Re: [PHP] text with $

2005-05-09 Thread Petar Nedyalkov
On Monday 09 May 2005 15:23, Martín Marqués wrote:
 I have a text variable that contains $ symbols, that when I pass it out
 PHP thinks that the $ mean that a variable name comes right after.

 I tried escaping the $ put with no luck.

Use single quote.


 Is there something I can do?

 --
  09:21:28 up 37 days, 17:45,  1 user,  load average: 2.54, 2.04, 1.50
 -
 Martín Marqués| select 'mmarques' || '@' || 'unl.edu.ar'
 Centro de Telematica  |  DBA, Programador, Administrador
  Universidad Nacional
   del Litoral
 -

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpjAfU9TNVpW.pgp
Description: PGP signature


Re: [PHP] sort by date

2005-05-06 Thread Petar Nedyalkov
On Friday 06 May 2005 08:42, William Stokes wrote:
 Hello,

 I made a mistake and stored date information to DB as varchar values
 (dd.mm.yyy). When I read the DB is it still possible to sort the data by
 date with SQL query (ORDER BY date ASC)? Or is it nessessary to have the
 date information to be stored as a date in the DB? Will it work or is the
 output going to be sorted randomly?

All RDBMS have date formatting functions. Use them.


 Thanks
 -Will

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpLxsPbcV9bg.pgp
Description: PGP signature


Re: [PHP] sort by date

2005-05-06 Thread Petar Nedyalkov
On Friday 06 May 2005 11:17, William Stokes wrote:
 OK. I found that out from MySQL manual. I just don't know how to insert the
 date formatting function to the query:

 I quessI need to put STR_TO_DATE() in to the following SQL query:

What about DATE_FORMAT()?


 SELECT event_id,name,date,time,place,type,info FROM test_table
 WHERE (group = '$group') AND (type = 'Game' OR type = 'training')
 ORDER BY date ASC

 I dont know how?

 Thanks a lot
 -Will

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpogR2tuhWB3.pgp
Description: PGP signature


Re: [PHP] control-M

2005-05-05 Thread Petar Nedyalkov
On Thursday 05 May 2005 06:13, David Christensen wrote:
 I know I'm missing something, but I can't seem to find it or figure it
 out.  I've done the google search, and I've done a quick scan of the
 list archives, but I can't seem to find the right way to remove
 control-M from a form submission page with textarea fields.

 I have a series of textarea fields that can/and do contain the dreaded
 ^M characters.  For the life of me, I can't figure out how to remove
 them before I save them to the database, and how to remove the ones that
 are all ready stored there when I query them back to the browser from a
 web page.  Also, if I do remove them, how do I make sure I format the
 text correctly when I push it back to the browser as the default values
 of these fields?

There's a tool called dos2unix - use it.


 Point me to the elixir of knowledge and let me bath in the fortitude of
 a master regex expression to rid me once and for all of the dreaded
 ^M!!!

 Thank you, and good night!

 That's why I won't do 2 shows!  I won't do it!

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpBGQAZrmU02.pgp
Description: PGP signature


Re: [PHP] regex

2005-05-05 Thread Petar Nedyalkov
On Wednesday 04 May 2005 21:31, Sebastian wrote:
 very new to regex

 i have a string with bbcode such as [img=XXX]
 (XXX being numeric)

 how do i search the string for the value of the bbcode and compare it to
 another variable?
 so i can take XXX and compare it to $image dynamically.

Try this regex:

/^img=(\d+)$/


 thanks for any help.

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpWwTYi6BflP.pgp
Description: PGP signature


Re: [PHP] form variables

2005-05-05 Thread Petar Nedyalkov
On Thursday 05 May 2005 17:46, Anasta wrote:
 Can anyone tell me how a submit button can be used to send set a variable
 so there is only a button --no textfield.


Use hidden input fields.

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpwgBwu3MgP6.pgp
Description: PGP signature


Re: [PHP] age function

2005-05-04 Thread Petar Nedyalkov
On Tuesday 03 May 2005 22:41, Ryan A wrote:
 Hey,
 Anybody have an age function where i can pass a date object and get back an
 int?

 eg:
 $years_old=get_years(1979-12-07);


Use time and mktime.

$birthday = 1979-12-07;

$birdthday_time = mktime(0, 0, 0, substr($birthday, 5, 2), substr($birthday, 
8, 2), substr($birthday, 0, 4));

$now_time = time();

$years = (int) (($now_time - $birthday_time) / 60*60*24*365.25);

I haven't tested the code - it's just an idea.


 Thanks,
 Ryan



 --
 No virus found in this outgoing message.
 Checked by AVG Anti-Virus.
 Version: 7.0.308 / Virus Database: 266.11.2 - Release Date: 5/2/2005

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpt5iv88Xopj.pgp
Description: PGP signature


Re: [PHP] Downloads stop short

2005-05-04 Thread Petar Nedyalkov
On Tuesday 03 May 2005 21:43, Mike wrote:
 I upgraded to PHP 5.0.4 and now all my downloads cut off at 1.9 MB

downloads or uploads :-)

check:

upload_max_filesize
post_max_size
memory_limit

ini variables.


 Is this a setting I missed somewhere?


 ++
 Mike Yrabedra
 [EMAIL PROTECTED]
 Your Mac Intelligence Resource
 ++
 W: http://www.macagent.com/

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpYBasWN5WnA.pgp
Description: PGP signature


Re: [PHP] to pass session from one websever to another webserver

2005-05-04 Thread Petar Nedyalkov
On Wednesday 04 May 2005 15:54, Balwant Singh wrote:
 hi to all

 i want to pass session variables from  one websever to another
 webserver.  may please help.

Solution 1: Use a custom session handler.
Solution 2: Disable cookies when using sessions (use GET to pass the session 
ID) and use a single session data storage location.
Solution 3: Set a unique domain for both webservers when passing sessions via 
cookies and use a single session data storage location.



 with best wishes
 balwant

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpaEa6mJ3mYR.pgp
Description: PGP signature


Re: [PHP] passing a variable through 2 required files embedded in Javascript

2005-04-29 Thread Petar Nedyalkov
On Friday 29 April 2005 07:08, Mark Cain wrote:
 What a mess this has turned out to be -- But perhaps you can help me.

 I have a dynamic site that pulls headers, navigation, and footers from text
 files.  The content for the pages is pulled from mySQL.

 On each page I have a JavaScript rotating banner that displays Upcoming
 Events.  The banners rotate about every 4 seconds without the need for a
 page refresh.  The names of the individual banners themselves are fed into
 JavaScript from a PHP script that reads a folder of JPG files and makes a
 decision as to which ones to show (i.e. pass to the JavaScript).

 This all works and it's slick seeing that I have the difficulty of dealing
 with a server side script and a client script.  The browser calls a
 JavaScript file which has a php extension.  When the server sees the php
 extension the file is executed before it is delivered to the browser. 
 Since JavaScript complains about PHP functions in that file that file
 merely echo back standard JavaScript and calls another php file via
 require() that does the low level work of reading the folder and reporting
 back the JavaScript arrays.  Graphically it looks like this:

 1) the Page calls the header
  2) the header calls
3) a php generated JavaScript file which calls
 4) a php file that reads the folder on the server and
 builds the JavaScript arrays


 Now I need to add a feature and I am bumping my head on this one.

 How do I report the file name of the file that called the header in # 4 ? 
 In other words, I want the name of #1 to be reported in #4.  If I use
 $_SERVER[PHP_SELF], that variable reports the name of #4.  It gets a
 little tricky because #3 is called from within a JavaScript tag.

 Got any suggestions?

Pass the JavaScript to the client using a new header:

Content-Type: application/x-javascript


 Mark Cain

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpZ4iSMVJTIh.pgp
Description: PGP signature


Re: [PHP] SOLVEDphp Full Page Calendar not date picker

2005-04-29 Thread Petar Nedyalkov
On Friday 29 April 2005 11:43, Angelo Zanetti wrote:
 Dont worry guys i solved it.

And if you name the solution, it'll be a perfect finish for this thread.
Remember, this mailing-list is used as a knowledge base from a lot of people.


 Angelo Zanetti wrote:
 Hi all.
 
 Im looking for a PHP/Javascript calender that is a full page calender.
 IE: for each day there is  quite a big block. Therefore it will be a
 bigger form of a date picker. What I want to do is to be able to assign
 notes for each day. I've seen the smarty calender which is exactly what
 I need but Im not using smarty for this particular project.
 
 thanks in advance.

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgppjeQBrd2Dd.pgp
Description: PGP signature


Re: [PHP] User Logout system advice needed...

2005-04-28 Thread Petar Nedyalkov
On Thursday 28 April 2005 08:48, William Stokes wrote:
 Hello,

 I need to write some sort of  a user logout system for my web application.
 It needs to be a solid system so that if the user presses the Logout button
 there's no way of returning to the password protected area without logging
 in again. At the moment my system only tries to close browser window with
 javascript. This doesn't work if the user has more than one tab open in the
 browser and in Firefox it doesn't even close the active tab :-)

 I use a cookie based session id so this probably needs to be deleted. Is
 there a way to delete all variables stored by the application or do I need
 to unset them one by one?

No, you just need to destroy the session (session_destroy()). This way all 
session associated data will be destroyed.


 Any other things I might be missing here?

 Thanks a Lot
 -Will

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpjRjJhikW4q.pgp
Description: PGP signature


Re: [PHP] Dates problem

2005-04-27 Thread Petar Nedyalkov
On Wednesday 27 April 2005 09:17, Mario de Frutos Dieguez wrote:
 Hi!

 I have a problem with dates. I have a function that sum a duration in
 laboral days to an initial date. The problem come when the function
 reaches the last sunday of October, the data remains in the last sunday
 of October and make an infinite loop. The functions works fine i have
 test in all the cases and only fails in the last sunday of October.

So, let's see the function.


 Can anyone help me?

 Thanks in advance.

 PD: Jochem home english is bad english :P

 --
 Mario de Frutos Dieguez

 División de Ingeniería del Software
 y Comunicaciones

 CARTIF -Parque Tecnológico Boecillo

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpcnojEYuGrX.pgp
Description: PGP signature


Re: [PHP] component template questions

2005-04-27 Thread Petar Nedyalkov
On Wednesday 27 April 2005 08:34, Evert|Rooftop wrote:
 Hi folks,

 I'm working on a component system for php forms and all, and I'm
 wondering about an issue I have. I have a few ideas on how to fix this
 problem, but I would like to hear your oppinions about it.

 These are my classes:

 Component
 FormElement extends Component
 ComboBox extends FormElement
 InteliComboBox extends ComboBox

 The problem is, I want the components to be able to work accross
 different platforms (for example XHTML, WML or XUL) and there should be
 an ability to add new platforms.
 How would you make a template system for this?

I think the different platfoms have to be mapped to different templates for 
each class.

Then you just construct the objects taking in mind the platform you need at 
the moment.

A simple scenario:

You have an aplication that is used via mobile users (WAP for instance), 
regular web users (XHTML), regular users with Mozilla (XUL) - when a user 
comes, you detect his platform, take the template for this platform and 
construct the object using it. Another client comes with different platform, 
you apply a different template, construct the object using it, etc.

Just being abstract enough - don't hardcode such templates in the classes. 
Automatic management of the templates will be easy using a RDBMS.

 Or is there a better way?

 Thanks for your input on this,
 Evert

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpmQr3IMG7dO.pgp
Description: PGP signature


Re: [PHP] Product details not being displayed, based on passed id

2005-04-27 Thread Petar Nedyalkov
On Wednesday 27 April 2005 08:54, Mark Sargent wrote:
 Hi All,

 this page,

 http://webmonkey.wired.com/webmonkey/99/21/index3a_page3.html?tw=programmin
g

 has code that is supposed to pass an id via the url string to the same
 page, and display info of a particular product, based on the id being
 passed. Everything works fine, until I click the link, and instead of
 the proudct's details being displayed, based on that id, I get the
 original page, with the lnks. I've right clicked the links, and viewed
 properties, where I see that the id=n is set. Why doesn't it pull the
 record based on the id being passed..? Cheers.

Are you sure your webserver handles it's rewrite rules correctly? Maybe you 
use apache - check the mod_rewrite settings, rules, etc.

Have in mind that the rewrite engine is being enabled using the RewriteEngine 
on directive.


 Mark Sargent.

 P.S. I've inserted, echo $id  to display the id value. Nothing appears.


 html

 body

 ?php



 $db = mysql_connect(localhost, root, grunger);

 mysql_select_db(status,$db);

 // display individual record

 if ($id) {
 echo $id 
   $result = mysql_query(SELECT * FROM Products WHERE product_id=$id,$db);

$myrow = mysql_fetch_array($result);

printf(Product Name: %s\nbr, $myrow[product_name]);

printf(Product Model Number: %s\nbr,
 $myrow[product_model_number]);

printf(Product Serial Number: %s\nbr,
 $myrow[product_serial_number]);

printf(Product Price: %s\nbr, $myrow[product_price]);

 } else {

 // show employee list

$result = mysql_query(SELECT * FROM Products,$db);

 if ($myrow = mysql_fetch_array($result)) {

   // display list if there are records to display

   do {

 printf(a href=\%s?id=%s\%s/abr\n, $PHP_SELF,
 $myrow[product_id], $myrow[product_name]);

   } while ($myrow = mysql_fetch_array($result));

 } else {

   // no records to display

   echo Sorry, no records were found!;

 }

 }



 ?



 /body



 /html

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpFCCJrtXoI6.pgp
Description: PGP signature


Re: [PHP] Help outputting an array?

2005-04-26 Thread Petar Nedyalkov
On Tuesday 26 April 2005 06:55, Brian Dunning wrote:
 Hi all - it seems the longer I use PHP, the stupider my questions are
 getting. I finally got my XML parsed into an array, but perhaps my
 skills at dealing with the array are not where I thought they were.
 My array print_r's out like this:

 Array
 (
[PARAS] = Array
  (
[PARA] = Array
  (
[__multi] = 1
  [0] = Array
(
  [NOTE] = Here is my first note.
  [TITLE] = Here is my first title.
)
  [1] = Array
(
  [NOTE] = Here is my second note.
  [TITLE] = Here is my second title.
)
  )
  )
 )

 I just want to loop through the array and output it as a table. It
 would look something like this:

 tdHere is my first note./tdtdHere is my first title./td
 tdHere is my second note./tdtdHere is my second title./td

Use 'foreach' (http://www.php.net/foreach) to loop through the arrays and 
check each member of the array with the function 
'is_array' (http://www.php.net/is_array) to see if it's been a XML parameter 
or XML child element.


 What incredibly easy way to do this am I just missing? Thanks!  :)

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpWuEGmW6Scn.pgp
Description: PGP signature


Re: [PHP] array from folder

2005-04-26 Thread Petar Nedyalkov
On Monday 25 April 2005 20:24, Ed Dorsch wrote:
 Can PHP generate an array based on file names in a folder?

 For example, if I have a folder called photos that includes three files
 -- tree.jpg, house.jpg and boat.jpg -- can PHP look at the file and
 generate a variable $photos= array (tree, house,boat). Any ideas for
 how to sniff out a folder to determine how many files are in it and then
 create an array with the file names in it?

Have you tried the Iterator API functionality? It's part of the SPL extension 
and I'm pretty sure it'll help you unless you don't use PHP 5.

Check it, it's very feasible and handy:

http://www.php.net/~helly/php/ext/spl/annotated.html


 Thanks,
 Ed

 Ed Dorsch
 Development Communications
 University of Oregon
 541.346-0605 ?xml:namespace prefix = o ns =
 urn:schemas-microsoft-com:office:office /

 You can't wait for inspiration. You have to go after it with a club.
  -Jack London

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpt8SCtn0CaL.pgp
Description: PGP signature


Re: [PHP] Parse error: parse error, unexpected T_ELSE

2005-04-26 Thread Petar Nedyalkov
On Tuesday 26 April 2005 11:10, Mark Sargent wrote:
 Prathaban Mookiah wrote:
 Mark,
 
 Back to basics budy!!
 
  25 if ($myrow = mysql_fetch_array($result)); {
 
 should be
 
  25 if ($myrow = mysql_fetch_array($result)) {
 
 Note that extra semicolon?
 
 
 Prathap
 
 
 -- Original Message ---
 From: Mark Sargent [EMAIL PROTECTED]
 To: php-general@lists.php.net
 Sent: Tue, 26 Apr 2005 16:01:24 +0900
 Subject: [PHP] Parse error: parse error, unexpected T_ELSE
 
 Hi All,
 
 again, I'm following an example from webmonkey,
 
 http://webmonkey.wired.com/webmonkey/99/21/index3a_page2.html?tw=programm
 ing
 
  and I'm changing only what's relevant to me. I haven't altered the
 code basics, though. But I get the error regarding else. I don't
 see what it is. Anyone..? Cheers.
 
 Mark Sargent.
 
 *Parse error*: parse error, unexpected T_ELSE in
 */var/www/html/phpmysqltable.php* on line *41*
 
  25 if ($myrow = mysql_fetch_array($result)); {
  26
  27 echo table border=1\n;
  28
  29 echo trtdProduct Name/tdtdProduct Model
 Number/tdtdProduct
  30 Serial Number/td/tr\n;
  31
  32 do {
  33
  34 printf(trtd%s/tdtd%s/tdtd%s/td/tr\n,
 $myrow[product_name], $myrow[product_model_number],
  35 $myrow[product_serial_number]);
  36
  37 } while ($myrow = mysql_fetch_array($result));
  38
  39 echo /table\n;
  40
  41 } else {
  42
  43 echo Sorry, no data is available for that request;
  44
  45 }
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 --- End of Original Message ---

 Hi All,

 yep, basics are good, hence my following the tut at webmonkey(so I can
 learn the basics), and I obviously missed that little error. Cheers.

 P.S. Some people are mailig me direct. That's great, but, I'd prefer you
 reply in here, so all can see/comment. Cheers, again.

Some people have intelligent mail agents that rely on mailing list headers. 
And since you use Reply-To header that's not been overwritten by the 
mainling-list daemon, we replied (me too) directly to you. Remove the 
Reply-To and you'll have no worries.


 Mark Sargent.

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpiM6dmv3CQl.pgp
Description: PGP signature


Re: [PHP] step by step learning

2005-04-26 Thread Petar Nedyalkov
On Tuesday 26 April 2005 16:16, Paul Kain wrote:
 Hi there

 are there any sites online that show one how to learn php in a step by
 step fashion?

 I am really lost and would need to start at the very beginning

Get a book, there are thousands LAMP (Linux, Apache, MySQL, PHP) oriented 
books on the market.


 I already know and understand html

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpKimLdelkny.pgp
Description: PGP signature


Re: [PHP] Having a problem

2005-04-25 Thread Petar Nedyalkov
On Monday 25 April 2005 10:46, Rittwick Banerjee wrote:
 Hi friends,
 This is Rittwick Banerjee

 I have a problem with PHP and MySql while i'm trying to give a code into a
 PHP file. The main problem is I can't delete any kinds of records from my
 MySql database using a PHP code .

 Can any help me ?
 If there any code possible please e-mail that to me at [EMAIL PROTECTED]

Check if the user you're using to connect to the MySQL database has DELETE 
permissions over the database or table you want to manipulate.


 Thank you...

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpm1asqhZO0d.pgp
Description: PGP signature


Re: [PHP] Php defense

2005-04-22 Thread Petar Nedyalkov
On Friday 22 April 2005 16:58, Pablo D Marotta wrote:
 Hi there..
 I`m defending the language, but people here want to migrate to asp..
 They just keep on saying php is not used for huge corporation solutions,
 there asp goes better.

 I know it isn´t correct, but I don´t know much about well-known websites
 using php technology. (I just don´t navigate enough time to know it)
 I think that could help a lot, since this people is highly influenced by
 that kind of facts.. (I mean, knowing that other companies trust this
 language to manage critical information).

Let's start with Yahoo ;-)
Google also uses PHP.
Etc.


 Does anybody know/have any web-sites listing using php? If you only know a
 few of those, it could help me too.

 Thanks in advance!!
 Pablo



 American Express made the following
  annotations on 04/22/05 06:58:25
 ---
---
 ***
***

 This message and any attachments are solely for the intended recipient and
 may contain confidential or privileged information. If you are not the
 intended recipient, any disclosure, copying, use, or distribution of the
 information included in this message and any attachments is prohibited. If
 you have received this communication in error, please notify us by reply
 e-mail and immediately and permanently delete this message and any
 attachments. Thank you.

 ***
***
 ===
===

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgp6ZdC0cT5EV.pgp
Description: PGP signature


Re: [PHP] Classe Variable

2005-04-21 Thread Petar Nedyalkov
On Wednesday 20 April 2005 21:04, Jochem Maas wrote:
 Petar Nedyalkov wrote:
  On Wednesday 20 April 2005 13:29, marc serra wrote:
 Hi,
 i got a problem to write automaticaly varibles in classes.
 
 i got a simple object name test like this
 
 classes Test{
 public $id;
 public $text;
 }
 
 i want to affect my value to my variable like this
 $test = new Test

 missing a ';' above

 $champ = id;

 I think this should be:
 $champ = 'id';

 $valeur_champ = 4;
 
 $test-$champ = $valeur_champ;
 
  Just use $test-{$champ}
 
  ;-)

 curlies are not required in this case (although they do allow more complex
 expressions), the following works for me:

 class T{public $id;}$t=new T;
 $a=i;$b=d;$c=id;$v=4;$t-$c=$v;$t-{$b.$a}=5;
 var_dump($c,$v,$t-$c,$t-id,$t-{$a.$b},$t);

Curlies are just a good practice :-)


 my example is stupid i know but its just for an example.
 in fact when i write $test-$champ = $valeur_champ; I want that php
 execute $test-id = 4;
 
 can someone help me plz,
 
 Marc.

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpb8zgdIVaIz.pgp
Description: PGP signature


Re: [PHP] Post shorter code

2005-04-21 Thread Petar Nedyalkov
On Thursday 21 April 2005 17:20, Ryan A wrote:
  You're far more likely to get someone to look at your problem code if
  you can narrow it down to a block of code.  Hell, you didn't
  even state a problem!!!
 
  Sorry, but if you come back with a well defined problem then maybe
  someone can help you.

 It also helps if you quote a bit from the original post so new people to
 the thread
 will know what you are talking about...
 for example: I have no idea about which thread Jason(above) is talking
 about

It's just up to Netiquette ;-)


 :-)

 Cheers,
 Ryan



 --
 No virus found in this outgoing message.
 Checked by AVG Anti-Virus.
 Version: 7.0.308 / Virus Database: 266.9.16 - Release Date: 4/18/2005

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpD3pb0dZj3p.pgp
Description: PGP signature


Re: [PHP] Post shorter code

2005-04-21 Thread Petar Nedyalkov
On Thursday 21 April 2005 18:21, Ryan A wrote:
   It also helps if you quote a bit from the original post so new people
 
  to
 
   the thread
  
   will know what you are talking about...
  
   for example: I have no idea about which thread Jason(above) is talking
  
   about
 
  It's just up to Netiquette ;-)

 I dont think the above qualifies for netiquette all that much, because I
 have never found fault with Jason's netiquette,
 sometimes people just forget and it gets really confusing to the reader who
 comes in late.

OFFTOPIC
Forgetting is also an issue in Netiquette ;-)
A lot of people forget the rules, it's not a problem. I just meant that we 
have to be careful.
/OFFTOPIC


 Cheers,
 Ryan



 --
 No virus found in this outgoing message.
 Checked by AVG Anti-Virus.
 Version: 7.0.308 / Virus Database: 266.10.1 - Release Date: 4/20/2005

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgphHhBMekHeB.pgp
Description: PGP signature


Re: [PHP] Thanks but problem again! Re: [PHP] PHP script problem (with MySQL)

2005-04-20 Thread Petar Nedyalkov
On Wednesday 20 April 2005 06:07, Sugimoto wrote:
(B Thank you, Richard,
(B
(B I simply change this part
(B (select * from openart_table) into
(B (select substring(loc1, 1, 3) as THREE_LETTER_CODE, * from openart_table)
(B but Ive got this error, whats wrong with it?
(B
(B Warning: mysql_num_rows(): supplied argument is not a valid MySQL result
(B resource in c:\apache..\openart\test\openart_search.php on line 98
(B Records Found
(B
(BWhy don't you try the query in the mysql console? You'll see what it returns 
(Band debug the error easily.
(B
(B
(B Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result
(B resource in c:\apache\openart\test\openart_search.php on line 100
(B
(B Cheers
(B
(B-- 
(B
(BCyberly yours,
(BPetar Nedyalkov
(BDevoted Orbitel Fan :-)
(B
(BPGP ID: 7AE45436
(BPGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
(BPGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436

pgpBAtVz6F3Ky.pgp
Description: PGP signature


Re: [PHP] dynamic class loaders

2005-04-20 Thread Petar Nedyalkov
On Wednesday 20 April 2005 06:28, [EMAIL PROTECTED] wrote:
 Hi there i was wondering if there is such an extension available or
 possbility to have a dynamicclass loader extension which would use the
 request_uri as loading the class constructors ? I justthink building such a
 thing in php which is what i am doing too slow for each request and think
 itshould happen in the internals ? Let me know if its an insane idea.

Use the autoload extension. 

http://www.php.net/manual/en/language.oop5.autoload.php

Have in mind the exception case when loading an unexisting class definition.

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgp2lkwjnq0m3.pgp
Description: PGP signature


Re: [PHP] Encoding help!

2005-04-20 Thread Petar Nedyalkov
On Wednesday 20 April 2005 03:05, Brian Dunning wrote:
 I know this is a common question but I have RTFM and STFW until I'm
 blue in the face - I really need some help here.   :)

 I've got some forms into which users are going to enter text that
 frequently contains funny characters (pilcrows, foreign text, etc). So
 I need to encode it before writing it into MySQL, and decode it when
 reading it back out and writing it to the page. I've tried
 base64_encode/base64_decode, rawurlencode/rawurldecode,
 utf8_encode/utf8_decode, combinations, and others. My MySQL table is
 set to use UTF8 and my web pages are all set to UTF8. Most of what I've
 tried takes:

 

 And when I read it from MySQL and output it to the web page, it's
 turned into:

 

What is the default content-type of the webserver you use?
What is the content-type you return to the user through your php scripts?


 I need some help here! Thanks.  :)  :)  :)

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpvr6EmSkXr5.pgp
Description: PGP signature


Re: [PHP] Classe Variable

2005-04-20 Thread Petar Nedyalkov
On Wednesday 20 April 2005 13:29, marc serra wrote:
 Hi,
 i got a problem to write automaticaly varibles in classes.

 i got a simple object name test like this

 classes Test{
 public $id;
 public $text;
 }

 i want to affect my value to my variable like this
 $test = new Test

 $champ = id;
 $valeur_champ = 4;

 $test-$champ = $valeur_champ;

Just use $test-{$champ}

;-)


 my example is stupid i know but its just for an example.
 in fact when i write $test-$champ = $valeur_champ; I want that php
 execute $test-id = 4;

 can someone help me plz,

 Marc.

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpLpqGa7yl5J.pgp
Description: PGP signature


Re: [PHP] delete session cookie?

2005-04-20 Thread Petar Nedyalkov
On Wednesday 20 April 2005 14:51, William Stokes wrote:
 Hello,

 Is it possible to delete a session cookie from browser? If so how?

Just unset it.


 Thanks
 -Will

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpFDNAHh6Dzp.pgp
Description: PGP signature


Re: [PHP] upload automatic execute

2005-04-19 Thread Petar Nedyalkov
On Tuesday 19 April 2005 12:01, Sejati Opreker wrote:
 Hi,
 I'm planning to make and ftp server and using php to
 upload it's files, this file for upload will be
 execute to insert into myslq databases, my problem is
 how do I make php to check if there is new file been
 upload and automaticly insert into mysql.

Use cronjobs if you're using *nix-based OS.


 Txh

 __
 Do You Yahoo!?
 Tired of spam?  Yahoo! Mail has the best spam protection around
 http://mail.yahoo.com

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpZ4br4NruJu.pgp
Description: PGP signature


Re: [PHP] Convert gif to jpg

2005-04-19 Thread Petar Nedyalkov
On Tuesday 19 April 2005 14:40, Roman Duriancik wrote:
 Hello,
 Is it possible to convert pictures in gif format to jpg format in php
 script ?

Yes,

Check http://www.php.net/manual/en/ref.image.php

 Thank you for yours responses.
 Roman

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpBMYSQBr3WH.pgp
Description: PGP signature


Re: [PHP] Last visitors

2005-04-19 Thread Petar Nedyalkov
On Tuesday 19 April 2005 15:57, Ryan A wrote:
 Hey,
 Am a bit puzzled as to how to do this, I am modifying a profiles/dating
 site, the site works like this:
 if you are a guest you can see only limited details of a profile, if you
 have logged in, you see many more details.

 On the profile page there should be last 10 visitors, it will not
 register the guests, but if someone had logged in and visited your profile,
 it should show their usernameif there are 10 enteries in the db and
 when the 11th person comes...then the first person who came should be
 bumped off and the 11th person takes his place and so on

 I hope i have explained it well, I dont think many of you even needed that
 long explanation as you might have already seen this on many sites and knew
 what i was talking about by the second line, but better more infomation
 than less right?

Just store the login time of each identified user and you can filter/sort by 
it.


 Any ideas, links,code or classes on how i can implement this?

 Thanks,
 Ryan




 --
 No virus found in this outgoing message.
 Checked by AVG Anti-Virus.
 Version: 7.0.308 / Virus Database: 266.9.16 - Release Date: 4/18/2005

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpVS4cLnOE2t.pgp
Description: PGP signature


Re: [PHP] Last visitors

2005-04-19 Thread Petar Nedyalkov
On Tuesday 19 April 2005 16:27, Ryan A wrote:
  I am not checking for the last people logged in, I want to see the last
  people who have viewed the profile...
  each profile will have its own last 10 people visited

 /*
 ah! i see. sorry for misunderstanding you.
 perhaps on the script for the profiles page, the logic should be like:

 profile for user: adam

 if the browsing user is logged in: (for example the browsing user is ben)
   insert into the database that ben has seen adam's profile
 end if

 and your table in the database can be:

 user   visitor  time_of_visit
 adam  ben 1290122141 (unix timestamp)

 then you can query it on the database for each user.

 SELECT * FROM profile_visits WHERE user='adam' ORDER by time_of_visit
 DESC LIMIT 10
 As for cleaning up... that's the bit that I can't figure out myself :(.
 */

 Hey,
 Thanks for replying.

  ah! i see. sorry for misunderstanding you.

 No problem, I guess i didnt explain it well enough, and you dont have to
 help me but you are trying, so thank you.

  As for cleaning up... that's the bit that I can't figure out myself :(.

 exactly, I came to the same part as youbut then i would have a LOT of
 wasted records without the cleanup... just cant figure it out.

You can store only 10 records for each user by using the following logic:

mysql show create table profile_log\G
*** 1. row ***
   Table: profile_log
Create Table: CREATE TABLE `profile_log` (
  `profile_id` int(10) default NULL,
  `user_id` int(10) default NULL,
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update 
CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=utf8
1 row in set (0.00 sec)

When you create a profile you fill 10 blank records with timestamp -00-00 
00:00:00.

Then if a user sees a profile:

PSEUDO SQL:

$SQL = UPDATE profile_log SET user_id=.$userId. WHERE profile_id=.
$profileId. ORDER BY timestamp ASC LIMIT 1;

This way you:
1. automatically get the new timestamp
2. have no more than 10 records per user.


 Thanks,
 Ryan




 --
 No virus found in this outgoing message.
 Checked by AVG Anti-Virus.
 Version: 7.0.308 / Virus Database: 266.9.16 - Release Date: 4/18/2005

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpHCU1PRwk7f.pgp
Description: PGP signature


Re: [PHP] Last visitors (SOLVED?)

2005-04-19 Thread Petar Nedyalkov
On Tuesday 19 April 2005 17:03, Ryan A wrote:
 Hey!
 I think I solved this:

 select 11 latest visitors
 count to see if it returned 11 records,

 if (count == 11){
 get the oldest (of the 11) visitors time
 delete everything from that record and older than that
 }
 else{}

 Pros: max 2 queries

Cons: 
0. there are 3 queries: select, insert/update, delete
1. you're using more than 1 query
2. your logic is tough ;-)
3. you've mixed the php and mysql logic together.

Check my reply.


 If i am missing anything or you see any problem in my logic, please point
 it out.

 Thanks,
 Ryan



 --
 No virus found in this outgoing message.
 Checked by AVG Anti-Virus.
 Version: 7.0.308 / Virus Database: 266.9.16 - Release Date: 4/18/2005

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgp3WRVppS0aV.pgp
Description: PGP signature


Re: [PHP] explode a string

2005-04-19 Thread Petar Nedyalkov
On Tuesday 19 April 2005 17:03, Jochem Maas wrote:
 Richard Lynch wrote:
  On Mon, April 18, 2005 4:34 am, Sebastian said:
 $string = '4:gaming,5:hardware,3:software,8:security';
 
  $idcats = explode(',', $string);
  while (list(, $idcat) = each($idcats)){
list($id, $cat) = explode(':', $idcat);
echo \$id = $idbr /\n;
echo \$cat = $catbr /\n;
  }

 The 'other' guy mentioned that while() is faster than foreach,
 is this true?

http://www.sitepoint.com/article/php5-standard-library

Note that the crude benchmarks I've performed suggest that calling the 
methods directly is faster than using foreach, because the latter introduces 
another layer of redirection that must be resolved at runtime by PHP.


 I read a few days ago somewhere on php.net that foreach() is the
 recommended (by php devs) way of iterating over arrays

 also, compare these 2 lines:

 while (list(, $idcat) = each($idcats)){ /* ... */ }
 foreach ($idcats as $idcat){ /* ... */ }

 now its seems to me that the foreach version is 'up' 2 function calls
 on the while loop, all else being equal the foreach loop has to be faster
 (given that calling functions is relatively very expensive)...
 or is foreach() _really_ heavy when compared to while()?

 not that I care too much, I find foreach() more pleasing to the eye and
 there is less to type (in the given example).

 :-)

 rgds,
 Jochem

 what is the best way to explode then loop this string after its taken
 apart.
 
 output should be something like:
 
 $id = 4
 $cat = gaming
 
 etc..
 
 im just looking for the best/fastest way to do this. the string can grow
 to
 200 or so bytes, maybe more.
 
  200 bytes is chump-change.
 
  It really doesn't matter how you do this, within reason.

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpFE7VCEyn7m.pgp
Description: PGP signature


Re: [PHP] Last visitors

2005-04-19 Thread Petar Nedyalkov
On Tuesday 19 April 2005 17:08, John Nichel wrote:
 Petar Nedyalkov wrote:
 snip

  You can store only 10 records for each user by using the following logic:
 
  mysql show create table profile_log\G
  *** 1. row ***
 Table: profile_log
  Create Table: CREATE TABLE `profile_log` (
`profile_id` int(10) default NULL,
`user_id` int(10) default NULL,
`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update
  CURRENT_TIMESTAMP
  ) ENGINE=MyISAM DEFAULT CHARSET=utf8
  1 row in set (0.00 sec)
 
  When you create a profile you fill 10 blank records with timestamp
  -00-00 00:00:00.
 
  Then if a user sees a profile:
 
  PSEUDO SQL:
 
  $SQL = UPDATE profile_log SET user_id=.$userId. WHERE profile_id=.
  $profileId. ORDER BY timestamp ASC LIMIT 1;
 
  This way you:
  1. automatically get the new timestamp
  2. have no more than 10 records per user.

 What version of MySQL does that work in?  I tried pasting that create
 table directly into MySQL and get an error...

MySQL 4.1.8


 #1064 - You have an error in your SQL syntax.  Check the manual that
 corresponds to your MySQL server version for the right syntax to use
 near 'CURRENT_TIMESTAMP on update
 CURRENT_TIMESTAMP
 ) ENGINE=MyISA

 Query used :

   CREATE TABLE `profile_log` (
 `profile_id` int( 10 ) default NULL ,
 `user_id` int( 10 ) default NULL ,
 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP ON UPDATE
 CURRENT_TIMESTAMP
 ) ENGINE = MYISAM DEFAULT CHARSET = utf8

 I can't find a reference to this on MySQL's site...would you have a link
 to the documentation?  Thanks.

 --
 John C. Nichel
 ÜberGeek
 KegWorks.com
 716.856.9675
 [EMAIL PROTECTED]

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpyeprQHJ4Sy.pgp
Description: PGP signature


Re: [PHP] Last visitors

2005-04-19 Thread Petar Nedyalkov
On Tuesday 19 April 2005 17:42, Tom Crimmins wrote:
 On Tuesday, April 19, 2005 09:09, John Nichel wrote:
  Petar Nedyalkov wrote:
  snip
 
  You can store only 10 records for each user by using the following
  logic:
 
  mysql show create table profile_log\G
  *** 1. row ***
  Table: profile_log Create Table: CREATE TABLE `profile_log` (
`profile_id` int(10) default NULL,
`user_id` int(10) default NULL,
`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update
  CURRENT_TIMESTAMP ) ENGINE=MyISAM DEFAULT CHARSET=utf8
  1 row in set (0.00 sec)
 
  When you create a profile you fill 10 blank records with timestamp
  -00-00 00:00:00.
 
  Then if a user sees a profile:
 
  PSEUDO SQL:
 
  $SQL = UPDATE profile_log SET user_id=.$userId. WHERE
  profile_id=. $profileId. ORDER BY timestamp ASC LIMIT 1;
 
  This way you:
  1. automatically get the new timestamp
  2. have no more than 10 records per user.
 
  What version of MySQL does that work in?  I tried pasting that create
  table directly into MySQL and get an error...
 
  #1064 - You have an error in your SQL syntax.  Check the manual that
  corresponds to your MySQL server version for the right syntax to use
  near 'CURRENT_TIMESTAMP on update
  CURRENT_TIMESTAMP
  ) ENGINE=MyISA
 
  Query used :
 
CREATE TABLE `profile_log` (
  `profile_id` int( 10 ) default NULL ,
  `user_id` int( 10 ) default NULL ,
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP ON UPDATE
  CURRENT_TIMESTAMP
  ) ENGINE = MYISAM DEFAULT CHARSET = utf8
 
  I can't find a reference to this on MySQL's site...would you have a
  link to the documentation?  Thanks.

 Try:

 CREATE TABLE `profile_log` (
`profile_id` int(10) default NULL,
`user_id` int(10) default NULL,
`timestamp` timestamp NOT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8

 You do not need to specify the default clause on the timestamp column since
 this is already the default behavior, and as you has seen this isn't valid
 before 4.1 anyway. Also I wouldn't use the name 'timestamp' for a column
 name.

I just demonstrated a concept. The guy has to do this the best way he can ;-)
It's not a do-my-work-while-i'm-taking-a-rest mailing-list ;-)

 It is generally not a good idea to use reserved words for column names.

 --
 Tom Crimmins
 Interface Specialist
 Pottawattamie County, Iowa

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpny01c5V0WE.pgp
Description: PGP signature


Re: [PHP] explode a string

2005-04-18 Thread Petar Nedyalkov
On Monday 18 April 2005 14:34, Sebastian wrote:
 $string = '4:gaming,5:hardware,3:software,8:security';

 what is the best way to explode then loop this string after its taken
 apart.

 output should be something like:

 $id = 4
 $cat = gaming

 etc..

 im just looking for the best/fastest way to do this. the string can grow to
 200 or so bytes, maybe more.

 should i list(), while(), explode it, or should i explode it and foreach
 it? or..?

while is faster than foreach. check the iterator section in SPL for details.


 thanks.

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpa0VNdMvmfC.pgp
Description: PGP signature


Re: [PHP] PHP and Sessions

2005-04-18 Thread Petar Nedyalkov
On Monday 18 April 2005 05:22, Reynier Perez Mira wrote:
 Hi list:

 I have this code that Works perfectly:

 File: index.php

 ?

  session_start();

  echo a href=logout.php?sid=. session_id().Close session/a;

 ?

 File: logout.php

 ?

  session_unset();

  session_destroy();

 ?



 When user click link all works fine but when user close window withouth
 click link the session is not delete and all vars preserve they values. How
 can I fix that? I use PHP 5.0.0 RC2 and Windows XP SP1.

It's because the session is managed through cookies and they don't expire 
until the next load. 

You can:

1. Set the expiration time to time in the past using 
session_set_cookie_params();
2. Stop the cookies and use GET method.




 Regards

 Reynier Prez Mira

 3ero. Ing. Informtica

 Entre ms inteligente me siento, ms me doy cuenta de lo ignorante que soy.

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpohbo3m3AVw.pgp
Description: PGP signature


Re: [PHP] Two tables (Slightly 0T)

2005-04-16 Thread Petar Nedyalkov
On Saturday 16 April 2005 17:06, Ryan A wrote:
 Hey,
 My host has MySql 4.0.x so I cant really use the nested selects of 4.1 :-(
 please tell me how you solved something like this;

 I have two tables:
 users_online (username , dateandtime)
 users_details (cno, username, has_image, image_name)

 1a) I have to select x records from users_online where $username is not
 more than 3 minutes old,
 1b) then I have to check if that username has_image,if yes, get the
 imagename

 I thought of having the imagename also in the users_details, but we are
 allowing our members to
 change/modify their images at will

 What kind of sql do I use above? I dont want to run a query on every record
 returned from users_online
 as that would be really expensive.

See the JOIN syntax in MySQL. You can join the two tables.

http://dev.mysql.com/doc/mysql/en/join.html

BTW this is a question for the [MySQL General] list at [EMAIL PROTECTED]

:-)


 Thanks,
 Ryan



 --
 No virus found in this outgoing message.
 Checked by AVG Anti-Virus.
 Version: 7.0.308 / Virus Database: 266.9.13 - Release Date: 4/16/2005

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgp6qozVxgQ3o.pgp
Description: PGP signature


Re: [PHP] Levels of Site Protection

2005-04-15 Thread Petar Nedyalkov
On Friday 15 April 2005 10:37, R. Van Tassel wrote:
 I'm working on a website for a musical outfit where different levels of
 access are required depending on the specific section.

 Writers will have access to a section of the site where they can listen to
 an entire album (for review).

 Radio personnel will have access to a section of the site where they can
 download radio-quality mp3 versions of singles.

 Can anyone suggest how to approach this?

You can make a list of all actions that can be performed in your system, and 
then map subsets of these actions to roles. Then each actor (user of the 
system) gets a role and you can easily check if he can do a certain action.


 Is the easiest way to set up a table of username and passwords associated
 with an id which would let me know what level of access they have and
 direct them accordingly?

 Thanks in advance...

 -R. Van Tassel

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpsOUX3VypGx.pgp
Description: PGP signature


Re: [PHP] diffence between two numbers...

2005-04-15 Thread Petar Nedyalkov
On Friday 15 April 2005 13:35, [EMAIL PROTECTED] wrote:
 I need to know the difference between two numbers...
 eg:

 $a = 7;
 $b = 27;
 somefunction($a, $b)
 // outputs 20

 $a = 10;
 $b = 12;
 somefunction($a, $b)
 // outputs 2

function difference ($a, $b) {

return (max($a, $b) - min($a, $b));

}

 
 etc...
 does that exist?

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpoa9Fd8Ip9p.pgp
Description: PGP signature


Re: [PHP] diffence between two numbers...

2005-04-15 Thread Petar Nedyalkov
On Friday 15 April 2005 19:01, Chris W. Parker wrote:
 [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]

 on Friday, April 15, 2005 3:35 AM said:
  $a = 7;
  $b = 27;
  somefunction($a, $b)
  // outputs 20
 
  etc...
  does that exist?

 function difference($a, $b)
 {
   return abs($a-$b);
 }

Yep, I was wrong. Nice remark.




 Chris.

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgp3aXVVfTMql.pgp
Description: PGP signature


Re: [PHP] Image and PHP

2005-04-14 Thread Petar Nedyalkov
On Thursday 14 April 2005 10:06, Mario de Frutos Dieguez wrote:
 I have a page where i place an image but i want when i show the image
 delete it. How can i do this?

You want to delete it from the clients machine or what? 


 --
 Mario de Frutos Dieguez

 División de Ingeniería del Software
 y Comunicaciones

 CARTIF -Parque Tecnológico Boecillo

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpXvgvK7G0wH.pgp
Description: PGP signature


Re: [PHP] image display

2005-04-13 Thread Petar Nedyalkov
On Wednesday 13 April 2005 09:11, Cima wrote:
 hi,

 what is the best way to display an image, that is stored in a database in
 postgres, in a table form along with other fields that are in the same
 table?

 postgresql 8.0
 e.g my_table(name varchar(15),sex character (1), picture_id oid)

 in a table in php, i'd like to show all the rows in my_table with all the
 fields including the picture.

You'll have to write a separate php script that sends an image MIME type, 
reads the image from the pgsql database and sends it to the client. 

You can't use a single script since the images in a browser are loaded by 
separate http requests and the MIME type of the web page (text/html) is 
different from the MIME type of the image (image/jpeg, image/gif, image/png 
etc.).


 thanx.

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpVoaxdU44z6.pgp
Description: PGP signature


Re: [PHP] error handling

2005-04-13 Thread Petar Nedyalkov
On Wednesday 13 April 2005 08:46, Cima wrote:
 hi,

 im working with php 4 and postgresql 8 and i would like to know how to
 handle certain errors generated. in postgresql,  i've written a stored
 function that selects a record from a table and in case no record is found
 i 'raise an exception'. fine, now in my php script  i call that the stored
 function which works properly when there is a record but when the record
 doesnt exist, i would like to be able to place my own error message and not
 e.g  'fatal error, .'. how do i capture(in php)  the exception i raised
 in postgres so that i know the record doesnt exist?

Possible scenarios are:

1. Use string parsing to recognise the error message.
2. Upgrade to PHP 5, which is not that good if you need to change a lot of 
code afterwards.



 thanx.

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpOwxvUjhcjw.pgp
Description: PGP signature


Re: [PHP] Defined constant in mysql_query - Question.

2005-04-13 Thread Petar Nedyalkov
On Wednesday 13 April 2005 04:37, Labunski wrote:
 Hi,
 Can I use Constant in mysql query like this:


 define(LANG, eng);
 mysql_query(SELECT * FROM data WHERE col = 'articles' ORDER BY
 subjectLANG);

You can use:

 mysql_query(SELECT * FROM data WHERE col = 'articles' ORDER BY 
subject.LANG);


 Thanks a LOT,
 Lab.

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpk4pGJpKVjk.pgp
Description: PGP signature


Re: [PHP] php request entity body help

2005-02-21 Thread Petar Nedyalkov
On Monday 21 February 2005 11:08,  wrote:
 Dear phpers,

 I'm trying to get the entity body part from an http request. Is there an
 API which can do the job? We use post to communicate. But I don't the name
 of post.

Do you mean HTTP request or HTTP response?

 Please help!
 Any help would be appreciated. Thanks in advance.

 Sincerely,
 Kun

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgp4amLnBr0wb.pgp
Description: PGP signature


Re: [PHP] AutoLogin

2004-10-07 Thread Petar Nedyalkov
On Thursday 07 October 2004 07:57, Sagar C Nannapaneni wrote:
 BlankHi all,
 I have a website which has a login form with username and password.
 How can i login into that website providing the username and pwd from
 the php script. I know that this can be done...but wonder how.
 The website uses a JSP files with jsp session and also before
 logging in..it asks for ssl authentication.

Use cURL ;-)


 Ur help will b a great help to me...

 Regards,
 /sagar

-- 
Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)
-
Orbitel - the New Generation Telecom! See www.orbitel.bg.


pgpsIqAkuSv7B.pgp
Description: signature


Re: [PHP] Is it possible??

2004-10-07 Thread Petar Nedyalkov
On Thursday 07 October 2004 08:26, Sagar C Nannapaneni wrote:
 BlankThis may sound strange..but is there a way out???

 I need to know where the client moves from my page.
 Even using frames...like my page will b in the top frame
 of the page and the user can browse his stuff in the lower
 frame..so can v find from the top page whats the user is
 browsing???

If you control both pages - i.e. you have access to the applications - you may 
use javascript to send signals from the second frame to the first. But have 
in mind that if the domain of both applications is not equal you'll have to 
set it via javascript explicitly.


 I rreally wonder...i badly need the solution :(

 /sagar

-- 
Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)
-
Orbitel - the New Generation Telecom! See www.orbitel.bg.


pgpkABOFn8CdR.pgp
Description: signature


Re: [PHP] Newsgroups Space

2004-10-07 Thread Petar Nedyalkov
On Wednesday 06 October 2004 22:53, Joe Crawford wrote:
 i know this isn't completely related to php but i am creating a web based
 news reader in php, how much disk space do you think i need to run my own
 local news server?

depends on the number of external news sources you'll import ;-)

-- 
Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)
-
Orbitel - the New Generation Telecom! See www.orbitel.bg.


pgpJRgvIxfI19.pgp
Description: signature


Re: [PHP] Set up cron using PHP

2004-10-07 Thread Petar Nedyalkov
On Thursday 07 October 2004 13:17, Sheni R. Meledath wrote:
 Hello:

  We need to set up a cron to send an automated email at regular
 intervals. For this I need to execute a PHP file which retrieves the
 required information to be mailed. On my virtual server PHP is loaded as a
 module. Could you please let me know how can I execute a PHP file from the
 shell prompt.

  I have tried with the following commands:
  % virtual /usr/local/etc/httpd/htdocs/onlineeml.php

  It gives the below error:
  /usr/local/etc/httpd/htdocs/onlineeml.php: cannot open ?php: no
 such file

just insert:
#!/usr/bin/php -q 

in the first line of the script and make it executable (chmod u+x  ).


  I am not able to execute any general php related commands (Eg: php
 -v, man p ect)from the Shell prompt. I am getting the error message as
 php: Command not found.. I think this is because PHP is loaded as a
 module an not as a CGI version. In this context, could you please provide
 some details in executing a PHP script from the Shell prompt when the PHP
 is loaded as a module.



 Regards

 Sheni R Meledath
 Assistant Manager - Web Development
 *
 Cyber Gear LLC
 P.O. Box 53735
 Dubai, United Arab Emirates
 Tel: (971 4) 331-2627, Fax: (971 4) 331-8812
 Email: [EMAIL PROTECTED], http://www.cyber-gear.com

 VISIT OUR ASSOCIATE SITES:
 http://www.Click2Advertising.com
 http://www.DubaiCityGuide.com
 http://www.MiddleEastDirectory.com
 http://www.MiddleEastEvents.com
 http://www.MiddleEastPostBox.com
 http://www.PressReleaseNetwork.com
 *

 This message has been checked for all known viruses by McAfee. No liability
 is accepted by virtue of checking this message and you are recommended to
 have in place your own anti-virus detection procedures.

-- 
Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)
-
Orbitel - the New Generation Telecom! See www.orbitel.bg.


pgpWoqTMFOpY5.pgp
Description: signature


Re: [PHP] Set up cron using PHP

2004-10-07 Thread Petar Nedyalkov
On Thursday 07 October 2004 15:32, M. Sokolewicz wrote:
 Petar Nedyalkov wrote:
  On Thursday 07 October 2004 13:17, Sheni R. Meledath wrote:
 Hello:
 
  We need to set up a cron to send an automated email at regular
 intervals. For this I need to execute a PHP file which retrieves the
 required information to be mailed. On my virtual server PHP is loaded as
  a module. Could you please let me know how can I execute a PHP file from
  the shell prompt.
 
  I have tried with the following commands:
  % virtual /usr/local/etc/httpd/htdocs/onlineeml.php
 
  It gives the below error:
  /usr/local/etc/httpd/htdocs/onlineeml.php: cannot open ?php: no
 such file
 
  just insert:
  #!/usr/bin/php -q
 
  in the first line of the script and make it executable (chmod u+x  ).
 
  I am not able to execute any general php related commands (Eg:
  php -v, man p ect)from the Shell prompt. I am getting the error message
  as php: Command not found.. I think this is because PHP is loaded as a
  module an not as a CGI version. In this context, could you please
  provide some details in executing a PHP script from the Shell prompt
  when the PHP is loaded as a module.
 
 
 
 Regards
 
 Sheni R Meledath
 Assistant Manager - Web Development
 *
 Cyber Gear LLC
 P.O. Box 53735
 Dubai, United Arab Emirates
 Tel: (971 4) 331-2627, Fax: (971 4) 331-8812
 Email: [EMAIL PROTECTED], http://www.cyber-gear.com
 
 VISIT OUR ASSOCIATE SITES:
 http://www.Click2Advertising.com
 http://www.DubaiCityGuide.com
 http://www.MiddleEastDirectory.com
 http://www.MiddleEastEvents.com
 http://www.MiddleEastPostBox.com
 http://www.PressReleaseNetwork.com
 *
 
 This message has been checked for all known viruses by McAfee. No
  liability is accepted by virtue of checking this message and you are
  recommended to have in place your own anti-virus detection procedures.

 actually, that path you gave depends on the system (OS), the way it's
 installed and a whole bunch of other stuff. I agree it is the default,
 and most common, location though.

Yes, of course ;-)


 A different way of executing such scripts is by adding a cronjob like
 * * * * * * /usr/bin/php -q /path/to/script

 This does exactly the same as what Petar said, except that the script is
 passed to the interpreter, and thus the user that the crondaemon runs
 the script as only needs read (and doesn't need execute) permission to
 the script.

Your way is better for cronjob use, mine is better if the user needs to deploy 
the script not only as a cronjob.


 However; To find out the path to the interpreter, since you're saying
 you can't just call 'php -v' or any such commands, we'll need to
 investigate further.

 One way of doing this is a bit ugly, but it works. Instead of calling
 PHP directly, we'll call the server and request the php script (if you
 want, you can add tons of security shit in the call). We'll be doing
 this using wget (on Linux systems).

This workaround is fine, but I think using lynx or any similar browser can 
save the rm -f part.


 Imagine you'd like to run the following script:
 ?php
 // (let's presume it's located in www.example.net/scripts/bin/mail.php)
 if($_GET['user'] == 'a'  $_GET['pass'] == 'b') {
 mail('[EMAIL PROTECTED]', 'sub','body');
 } else {
 header('Status: 404 Not Found');
 exit;
 }
 ?

 You can call this as follows:
 
 * * * * * * wget
 http://www.example.net/scripts/bin/mail.php?user=apass=b ; rm -f
 ./mail.php 

 The first part will call the server via an http connection to run the
 script and show its output. It then downloads it to the directory run
 from, and saves it. That is what wget does. The second part, after the
 semicolon, the 'rm -f ./mail.php' will make sure to get rid of the file
 after it's been run.

 I hope this small example, will help you ;)

 - Tul

-- 
Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)
-
Orbitel - the New Generation Telecom! See www.orbitel.bg.


pgpDKmdSJSKAu.pgp
Description: signature


Re: [PHP] Set up cron using PHP

2004-10-07 Thread Petar Nedyalkov
On Thursday 07 October 2004 16:27, M. Sokolewicz wrote:
 Petar Nedyalkov wrote:
 [snip]

  Your way is better for cronjob use, mine is better if the user needs to
  deploy the script not only as a cronjob.

 [/snip]
 I agree ;)

 [snip]

  This workaround is fine, but I think using lynx or any similar browser
  can save the rm -f part.

 [/snip]yes... but wouldn't you be stuck with a running shell-instance
 after this? never really tried... so I wouldn't know :)

Try lynx -source http://bu.orbitel.bg for instance.
Then you can catch the output and analyze it - if the php sends an text exit 
status, that's fine.

-- 
Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)
-
Orbitel - the New Generation Telecom! See www.orbitel.bg.


pgpiCuAZqKAPQ.pgp
Description: signature


Re: [PHP] mapping a directory to a script like a servlet

2004-10-05 Thread Petar Nedyalkov
On Tuesday 05 October 2004 18:03, Roger Hyam wrote:
 Hi,

 I hope some one out there can help me. I have been looking around for a
 solution to this and just getting confused.

 I want to run a php script like it was a servlet. At the moment I have a
 little application where the urls look like this:

 http://www.mysite.com/index.php?current_page=contact

 but I would like them to look like this:

 http://www.mysite.com/contact

 so I have mapped / to the index.php script and then pick up the remaining
 path some how.

 I have done this kind of thing before with servlets and asp.net but can't
 figure how to do it with Apache + PHP. I was looking at mod_rewrite but
 then got scared!

mod_rewrite is the easiest solution ;-) just don't get scared but read the 
man.


 Any help most welcome.

 Thanks,

 Roger

-- 
Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)
-
Orbitel - the New Generation Telecom! See www.orbitel.bg.


pgpQQNaU2XUAf.pgp
Description: signature


Re: [PHP] regular expression help

2004-09-29 Thread Petar Nedyalkov
On Wednesday 29 September 2004 08:46, Ed Lazor wrote:
 complain
 Today I discovered that my ISP can't upgrade to PHP 5.  They use Plesk for
 server Administration and PHP 5 apparently breaks Plesk.  Plesk says
 they'll make PHP 5 support available as soon as it starts coming default on
 RedHat Enterprise.
 /complain

 Unfortunately, I now have a bunch of scripts that require PHP 5.  I'd
 upgraded my beta server for testing and everything has been going so great
 that I went gungho.  Honestly, I tried to not too many of the new features,
 just so I could ease into it and do more testing.  I'm finding little
 differences that I didn't even realize I was taking advantage of.  For
 example, there are a lot of places in the code where I've done something
 like this:

 print Learn more about {$product-get_Title()}.br;

http://www.php.net/manual/en/function.preg-replace.php

$pattern = /\{\$(.+?)\}/i;
$replacement = \\.\$$1\.\;

Try this out ;-) I haven't tested it but it's the right direction ;-)


 I uploaded scripts like this to the production server for more testing and
 PHP4 flagged all of the code like this as parse errors.  I'm not sure, but
 now I'm stuck having to go through all of the code to change the coding
 style  my editor (Dreamweaver MX 2004) allows me to do a global search
 and replace using regular expressions.  I have no idea what regular
 expression I'd use for something like this.  Any recommendations?

 Thanks,

 Ed

-- 
Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)
-
Orbitel - the New Generation Telecom! See www.orbitel.bg.

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



Re: [PHP] csv inssue

2004-09-24 Thread Petar Nedyalkov
On Friday 20 August 2004 16:28, Dustin Wish with INDCO Networks wrote:
 I was curious if anyone could help me. I need to write an insert to take
 data from a csv file to put into a MySQL db. I am not sure know to parse
 out 5 items of the string at a time i.e. (1,2,3,4,5,1,2,3,4,5,1...etc) so
 that the five putted items get inserted everytime. Like:

Check http://bu.orbitel.bg/fgetcsvfromline.php and 
http://bu.orbitel.bg/csv.php

I'm sure they will help you. I've posted this in PHP's manual fgetcsv 
function.


 insert into products (item,price,rate,name,desc) values (1,2,3,4,5)

 Then on to the next one and so forth.

 I am already parsing the file, but not sure if it needs to go into an array
 or set to vars then done in a loop.

 Please help!

 Here is the script so far:

 ?
 $filename = inventory.csv;
 $fd = fopen ($filename, r);
 $contents = fread ($fd,filesize ($filename));

 fclose ($fd);
 $delimiter = ,;
 $splitcontents = explode($delimiter, $contents);
 $counter = 5;
 ?
 brbr
 font color=blue face=arial size=4Database Insert Script/font
 hr
 ?
 foreach ( $splitcontents as $color )
 {

 $counter = $counter+1;
 echo bLine Item $counter: /b $color\nbr;



 }
 ?
 hr



 Dustin Wish
 System Engineer  Programmer
 INDCO Networks
 Pres. OSSRI
 Pres. WTA Arkansas
 
 Do not go where the path may lead, go instead
  where there is no path and leave a trail.
 Ralph Waldo Emerson (1803-1882)
 ***

-- 
Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)
-
Orbitel - the New Generation Telecom! See www.orbitel.bg.

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



Re: [PHP] Using '

2004-09-23 Thread Petar Nedyalkov
On Thursday 23 September 2004 16:17, Graham Cossey wrote:
  Hi!
  i have:
  $html = '
   html
 MY HTML
   /html
   ';
  Inside of my html i used ', this produced a parse error, how can i solved
  it?.

 Try:

 $html =  html ...  td width='90' ... /html;

 However my personal preference is the other way around:

 $html = ' html ...  td width=90 ... /html';

Try using marquees

?php

echo PHPMARQUEE
html code here
PHPMARQUEE;

?


 HTH

 Graham

-- 
Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)
-
Orbitel - the New Generation Telecom! See www.orbitel.bg.

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



Re: [PHP] implode errors if array empty

2004-09-22 Thread Petar Nedyalkov
Hello,

I suppose the $enterprise variable doesn't hold an empty array but is not 
defined and because of this you get the error. Test with the following 
example:

?php

$array = array();
$comma_separated = implode(,, $array);

echo $comma_separated;

?

It does not send any errors back. If you substitute $array = array(); with 
$array = ; you'll get a woarning: Warning: implode(): Bad arguments. in 
temp.php on line 4.

Just have in mind that when posting multiple select fields and no options are 
selected - you simply have no corresponding value in the _POST array (or in 
the $enterpise variable if you're using register_globals). There's no empty 
array but nothing defined.

On Wednesday 22 September 2004 13:16, [EMAIL PROTECTED] wrote:
 hi there,

 i am using implode to get the contents of an array into a single variable:

 $enterprises = implode(,, $enterprise) //enterprise contains the array.

 however, if the array is empty (the user didnt select anything in the
 form), the implode function errors out.

 can anyone think of a way round this?

 many thanks,

 luke m.

-- 
Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)
-
Orbitel - the New Generation Telecom! See www.orbitel.bg.

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