Re: [PHP] Anybody got a little spare time to help me out with a little OOP

2008-06-01 Thread Michael Kubler

http://en.wikipedia.org/wiki/Object_oriented_programming
I remember having troubles understanding OOP, especially going from Pic 
Microcontroller assembly to Java, but I found the Wikipedia article 
helped a lot.

I still write in functions, but I understand OO :-) .

BTW : Hello list. I just joined.

Michael Kubler
*G*rey *P*hoenix *P*roductions http://www.greyphoenix.biz



Ted Wood wrote:


On 1-Jun-08, at 8:15 AM, Ryan S wrote:
Thanks for replying, but how and where do I put that into the script? 
all that this- stuff is confusing
Tony Marsten's links seem to be very good, but let me offer you a 
simpler introduction. Once you can think in an OOP fashion, 
procedural-/functional-based programming seems archaic.


Object-oriented programming is all about thinking about everything as 
objects people, cars, flowers, dogs, pictures, food items... 
whatever your application manages. You model up these real-world 
objects using simple PHP syntax.


Objects can refer to themselves (or their inheritance) using $this-, 
which means me or mine. When using $this-, the object is 
referring to a property or method (aka function) within itself or 
inherited from one of its parents, whichever comes first.


~Ted 


Re: [PHP] strlower problem

2008-06-02 Thread Michael Kubler

Does :

/echo strtolower(CL22);/

work?
You could also try :

/var_dump($strLow);

/

Ed Curtis wrote:

Richard Heyes wrote:

Ed Curtis wrote:
I'm converting upper case characters in a string to lower case and 
am coming up with an empty string.


As I've done a million times before with other non-numerical strings.

$thisStr = CL22;

$strLow = strtolower($thisStr);

echo $thisStr;

Why does $strLow come up empty?

My mistake. I meant to type echo $strLow; not echo $thisStr; in my post.




Re: [PHP] imap_open() error. (Can't open mailbox)

2008-06-09 Thread Michael Kubler

File Permissions? PHP safe mode?
Mail server locking the file?

Can you /tail /path/to/file-with-contents-at-bottom /  ??

Michael Kubler
*G*rey *P*hoenix *P*roductions http://www.greyphoenix.biz



Mathijs van Veluw wrote:


I get the error message: Can't open mailbox.
While on the live server it works and i get the correct resource
resource(42) of type (imap).

I realy don't know what the problem is.
Can someone help me with this?

Thanks in advance.
Mathijs.


Re: [PHP] how to create a slide show using PHP5

2008-07-02 Thread Michael Kubler

You could look into something like PicLens lite.
http://piclens.com/lite/webmasterguide.php

It's more of an image viewer than slideshow. But the FFox plugin works 
great with Flickr, youtube, etc..

Basically you create a media RSS feed of the photos or video.
There's two flavours.
PicsLens is the plugin for browsers, while PicLens lite uses javascript 
and lets people who don't have the browser plugin view the photos.


http://piclens.com/lite/webmasterguide.php

Michael Kubler
*G*rey *P*hoenix *P*roductions http://www.greyphoenix.biz



philip wrote:

Hi everyone,

I want to create a slide show of photos for my web site. How is this 
done using php5? I am using Opensuse 10.3, Apache, PHP5.


TIA for any assistance,

Philip



Re: [PHP] Problem with special characters - PHP AJAX

2008-07-07 Thread Michael Kubler
Are the messages being sent as UTF-8 or something else? Is the server 
sending the headers as something different to that listed in the header?
Actually, looking at it, you don't have a valid DOC-TYPE 
http://validator.w3.org/check?uri=http%3A%2F%2Fkllapa.com%2Ffjahalori%2Ftest.htmlcharset=%28detect+automatically%29doctype=Inlinegroup=0, 
nor character Encoding set.


It might be something else, but I haven't played with enough AJAX to 
debug the javascript.


Michael Kubler
*G*rey *P*hoenix *P*roductions http://www.greyphoenix.biz



bperquku wrote:

Hi all,

I'm writing a simple dictionary with php and ajax. It works perfects with
firefox but not in IE.
Here is the link

http://kllapa.com/fjahalori/test.html

I used alerts in js and find out that in the following function:

function updateMsgOnBrowser(testXML) {

var test = testXML.getElementsByTagName(test)[0];
var message=new Array(20);
var m = new Array(20);
var td = new Array(20);
var i;
for (i=1;i=10;i++){
message[i]=testXML.getElementsByTagName(message+i)[0];
message[i+1]=testXML.getElementsByTagName(message+i+r)[0];
if (message[i]!=null){m[i] = message[i].firstChild.nodeValue;}
else{m[i]=}
if (message[i+1]!=null){m[i+1] = 
message[i+1].firstChild.nodeValue;}
else{m[i+1]=}
td[i]= document.getElementById(td+i);
td[i+1]= document.getElementById(td+i+r);
td[i].innerHTML=+m[i];
td[i+1].innerHTML=+m[i+1];
}
}

the line 


message[i]=testXML.getElementsByTagName(message+i)[0];

becomes null in IE when tag message contains special character (ë, ç, Ë, Ç,
etc.). Why this works perfect in Firefox?

Any idea what could be the issue??


Thanks in advance
  


Re: [PHP] Re: geolocation

2008-09-21 Thread Michael Kubler

This is a slightly OT but along the same lines.
I've found that the main way that ISP's and large content hosts control 
who can access their site and from where is by using BGP routing (Border 
Gateway Protocol), and other advanced things that are beyond the control 
of the majority of webserver admins.


It allows them to change the routing that information, which is for 
example, how your ISPs servers know where to forward your data packet to 
next.
However with some funky router, you can get 'magic' IP addresses, like 
Akami and most ISP's DNS server have.
E.g, You will request to access data on a certain Akami IP address, 
instead and taking 200ms to hit some server on the other side of the 
world, and come back, it could go to a server sitting in your nearest 
capital city in 50ms, which is great for video content, and AJAX calls. 
The thing is, someone in another country could request the same data 
from the same IP, and the request will automatically be sent to a 
completely different server, most likely that of one in their capital 
city (or at least the closest place that has an Akami server containing 
the required info).


Above is just another example of how you can't purely rely on IP 
addresses, although it is the easiest thing from a webservers PoV, and 
usually right 90% of the time (as far as I am aware, although haven't 
tested, nor have any good ways of testing besides Traceroute).


Michael Kubler
*G*rey *P*hoenix *P*roductions http://www.greyphoenix.biz



Michelle Konzack wrote:

Am 2008-09-02 09:08:50, schrieb Schiz0:
  

I use the GeoIP libraries. They work perfectly. YOu just need to
install the pecl-GeoIP package, then make sure you keep the binary
database up-to-date (from www.maxmind.com).

http://php.net/geoip



How does ths work with Compuserver or ALOL or even my IP's?

We are using dynamicaly allocated IPs arround teh world...

AOL in Germany is using IPs from the USA (ARIN) I use IPs  from  Germany
(RIPE) but they are dynamicaly allocated  in  Iran,  Turkey,  Gemany  or
other Countries where I have POPs


Re: [PHP] Mailing lists

2008-10-29 Thread Michael Kubler

I agree.
Mailman has everything you need from a mailing list and is the defacto 
standard.
Besides, with it you only need to press 'reply' not 'Reply all' when 
trying to send to the list... unlike this one.


Usually you would setup it up on a subdomain (e.g _lists.__domain.com_) 
and can then have multiple lists on that domain, such as  
[EMAIL PROTECTED], [EMAIL PROTECTED] etc..



Michael Kubler
*G*rey *P*hoenix *P*roductions http://www.greyphoenix.biz



Bjoern Bartels wrote:

Dotan Cohen wrote ..
  

2008/10/29 Richard Heyes [EMAIL PROTECTED]:


Hi,

Anyone know of a good (as opposed to a bad) mailing list manager,
other than freelists.org (which I can't seem to get working).

Thanks.
  


 ?!? that's ajoke, right?

 i pledge loyalty for gnus mailman

  http://www.gnu.org/software/mailman/index.html

cheers
bb

  


Re: [PHP] Weird Syntax Error

2008-11-13 Thread Michael Kubler

Hi Kyle,
The line looks fine in my text editor (SciTE).
Have you checked the line above it is properly enclosed and ended?

Michael Kubler
*G*rey *P*hoenix *P*roductions http://www.greyphoenix.biz



Kyle Terry wrote:

I keep getting this syntax error on the following string...

syntax error unexpected T_ENCAPSED_AND_WHITESPACE expecting T_STRING or
T_VARIABLE or T_NUM_STRING

$insert = INSERT INTO release_file_upload (upl_file_name, upl_file_type,
upl_file_size, upl_date, upl_by, upl_path, release_id) VALUES ('$filename',
'$_SESSION['upload']['type']', '$_SESSION['upload']['size']', now(),
'$username', '$path', '$release_id');

  


Re: [PHP] Another question about Google maps

2008-11-16 Thread Michael Kubler

Well, it shows up for FFox v2 and v3 on Windows XP as well.
I managed to replicate it by shift+refreshing the page.

I also managed to stop it mid load by setting Firefox to 'Work Offline' 
just as it displayed the flash of both boxes.


Using the Web Developer plugin for FFox I can tell you that the top box 
has a class of '.gsmsc-mapDiv' while the bottom div one is 
'.gsmsc-idleMapDiv', and both are wrapped in the '.gsmsc-appContainer' 
div, and also the '#mapsearch' div.


I've not played with google maps enough, but doubt the above helps, I 
just but know that it's not a PHP issue. It's almost like a flash of 
unstyled content http://www.bluerobot.com/web/css/fouc.asp/, but is 
being generated because of the javascript.


I hid the '.gsmsc-mapDiv' which stopped the flash of both box boxes 
appearing, and I could view the map, but caused the map to disappear 
after I tried searching for a different Google Maps location.


Michael Kubler
*G*rey *P*hoenix *P*roductions http://www.greyphoenix.biz



tedd wrote:

Hi gang:

I posted this question on the Google Map Discussion group/list 
thingie, but got zip in replies. Maybe someone here might have an idea.


Here's the url:

http://masoncollision.com/contact.php

In both Safari and FireFox for the Mac (I have not tested it with 
other browsers) as the page loads the map border is momentary drawn 
twice. The map border is shown stacked one above the other making the 
page much longer than it actually is. But immediately thereafter, the 
map is drawn correctly and the page returns to the size it's supposed 
to be.


I just want to get rid of the momentary flash.

Anyone have any ideas?

Cheers and thanks,

tedd


Re: [PHP] how can I make an email bounce

2008-11-24 Thread Michael Kubler
If you have a previous bounce message then something like Mail Redirect 
https://addons.mozilla.org/en-US/thunderbird/addon/550 extension in 
thunderbird might work. You simply bounce the email to yourself, or from 
one account to another.

I've used it quite often to test procmail rules, and the like.

Although, as I use gmail for my email I don't have to worry about my 
inbox being full.
Also, if you can give us more details about the actual email server then 
maybe there could be a way to induce the required bounce messages, 
somewhat like the eicar http://www.eicar.org/anti_virus_test_file.htm 
file is a semi-standardised anti-virus test. Then again, I run exim4, 
and haven't bothered looking at trying to force certain bounce messages 
without reconfiguring the server.


Michael Kubler
*G*rey *P*hoenix *P*roductions http://www.greyphoenix.biz



[EMAIL PROTECTED] wrote:

On Nov 23, 2008, at 7:01 PM, Richard Kurth wrote:

I need to make a bunch of emails bounce in different ways so I can 
check to see if my script to read a mail box full of bounced emails 
will work properly.

Does any body know how I can do this.
If you have access to a Mac, in Apples Mail.app there is a feature for 
bouncing messages that show up like a real bounce. All you need are 
the donor e-mails to bounce from.


Just keep in mind that when you bounce a message in mail.app it 
removes the e-mail... So I wouldn't go bouncing lvoe letters from your 
girl! ;)


If you don't have such access, let me know, and I can probably help 
out with it.


Re: [PHP] Text To Speech Update

2008-11-29 Thread Michael Kubler
Works ok for me on FFox v2 and v3 on my Windows XP machines, but when 
trying it on IE v6.0 the speech is played back REALLY fast. Like super 
chipmunk style.
I tried a duration of 5.5, but that mainly just made the pauses between 
the words longer, but was still very high pitched and fast.


Also, it's really annoying that the text that I just typed in to test 
disappears. I HATE it when websites forget what I just input, and when 
writing scripts I hate loosing or throwing away user input.


But still, good work on the VOX, too bad all text to speech synthesisers 
I've used sound like a computer. My Dad blurted out when I first went to 
your site 'Ohh I was playing with text to speech 30 years ago.'


I can see things like this being a big plus for usability.

Michael Kubler
*G*rey *P*hoenix *P*roductions http://www.greyphoenix.biz



Nathan Nobbe wrote:

On Sat, Nov 29, 2008 at 5:21 PM, Daniel P. Brown
[EMAIL PROTECTED]wrote:

  

   Any/All:

   For those of you who were asking about the PHP Text-To-Speech
system I had running, it's back online now.  If you have a few free
seconds, please take a look at http://www.pilotpig.net/txt2wav.php and
let me know if it's working for sure in your browser and on your OS.

   With a bit more time being available to devote to non-paid
projects, and hopefully getting a bit better still in the next week or
so, I've had time to be able to work more with the PHP project and the
PHP-VOX.  When I make enough improvements to the installation routines
so that folks can easily do it on their own servers, I'll have the
source available for download.

   Thanks, everyone.  Hope you're all enjoying the weekend.




kick-ass dan, i cant wait until the source is out there :D

-nathan

  


Re: [PHP] Accessing the 'media' attribute in php

2008-12-03 Thread Michael Kubler

A couple of sites about making CSS print stylesheets.

http://www.alistapart.com/articles/goingtoprint/
http://www.webdesignschoolreview.com/css-printing.html

I'd send you links to more, but my Internet connection is shaped, and 
it's too slow to look through many more.


Michael Kubler
*G*rey *P*hoenix *P*roductions http://www.greyphoenix.biz



Clancy wrote:

On Wed, 3 Dec 2008 15:28:17 +1300, [EMAIL PROTECTED] (German Geek)
wrote:

  

You can do things on the client side with Javascript ;) Sorry, what was the
result you are after?



I have enough trouble getting my rather ancient brain around PHP, and
was hoping that I could avoid getting involved with JavaScript.
However it seems that it, or CSS, are the only possibilities for this
case.

Bother!


Re: [PHP] Poll of sorts: Javascript Form validation or PHP

2008-12-06 Thread Michael Kubler

I agree with Nathan.
Always do server side validation, and if you have the skills, time, or 
are being paid then add javascript validation to make the user 
experience better.
I have a general contact form which checks the input server side (PHP) 
and if there's something wrong then it indicates as such, and shows the 
user their input, with the errors and why (e.g not a valid email 
address, etc..).
If it was for anything larger than about 10 fields per page, then 
javascript validation can be useful.


Slightly off topic, but does anyone know of an easy way of checking user 
input like the PHP filter_var() function?
I've seen plenty of libraries for AJAX, and the like (Prototype, jquery, 
etc), but haven't run across any for standard form input validation.


Thanks.

Michael Kubler*
* http://www.greyphoenix.biz



Nathan Rixham wrote:
where as I think validation always needs to happen at the server side; 
each application or script should be self contained, it needs to check 
that the data it recieves is valid before working with it; if it is 
not valid it needs to inform the system that sent it the data is not 
valid.


The system that sent it in this case is the html output; so you need a 
method of displaying errors in the html.


That is the bare minimum and always needed.

As for making the experience nicer; javascript is good for this; it 
can be used to pre-validate input on the way in to the system; but 
should not be relied upon as it can be turned off, stop functioning 
due to another faulty javascript on the page or simply not be 
supported by the client. You still need the server side validation 
though.


So.. more of a case of always validate server side; and should / do 
you want to use javascript validation in addition.


IMHO :p


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



Re: [PHP] array_reverse() and garbage collection

2008-12-07 Thread Michael Kubler
What about using array_pop to take the bottom array element from the 
first one and add it to the second?
So basically you are feeding the 2nd array from the bottom of the 1st 
one, and assuming garbage collection is done for each call of array_pop, 
then you'd only need the memory usage of one copy of the array, not two.


The downside is that it's not going to be as fast as just looping 
through, and making two copies, but the upside is less memory usage.
I can see it being particularly useful for processing large arrays on 
memory restricted webservers which would possibly not have the ram for 
two copies of the array in memory at the same time.


Not sure if that actually helps, seeing as array_reverse() is already a 
function that's probably written in C which could just make a copy with 
re-arrange the pointers or something.


Michael Kubler
*G*rey *P*hoenix *P*roductions http://www.greyphoenix.biz



Richard Heyes wrote:

Hi,

So I've been thinking, because occassionally I do, about
array_reverse() and how to implement it. Of course, it's entirely
theoretical, because it would a total waste of time. But I'm wondering
which of two methods would be best.

1. Do it correctly and in place. ie, loop through the the first half
of the array once swapping element 0 with the end one, element 1 with
the next to last one and so on.

2. Loop thru the array once creating a new one. Normally this would
take up a little more memory because you end up with two copies of the
array in memory just before the end of the function. But what if you
set the original element to null once you've assigned it to the new
array? The most memory I can see it using is two copies of one
element. But only if garbage collection kicks in before you start on
the next element. Does garbage collection kick in that often? From
what I remember from an article by Derick Rethans, if the refcount is
zero, then it gets cleaned up.

Cheers.


Re: [PHP] Online Members

2008-12-26 Thread Michael Kubler
Some people will be happy with just a corny 1 liner, other's you'll need 
to invite to dinner, and promise a romantic evening, and show how 
masculine/feminine you are.
But I doubt you'll be able to get that many dates, unless it's a single 
site most will probably already be in a relationship, or are simply not 
interested.


Seriously though, I'm not quite sure what you mean by picking up all the 
members online.
If you mean working out how many people are currently online, then you 
can tail the log files, if you have HTTP auth, and manually work it out, 
or the easier way (that likely keep a track of the last activity from a 
user, and assume they are online if they have had any activity within 
the last 30mins, assuming they haven't logged out.


Hope that helps a little, unless I've completely mis-interpreted the 
question.


Michael Kubler
*G*rey *P*hoenix *P*roductions http://www.greyphoenix.biz



Stephen Alistoun wrote:

Hi all,

What is the best way to pick up all the members online on a website?

Regards,

Stephen 
  


Re: [PHP] PHP webhosting - USA

2009-01-24 Thread Michael Kubler

Hi,
If your a windows user, then ignore the text below.

Quantact.com are great. Great value, great support, I've been with them 
for a few years now.
I guess the only downside is that while the bandwidth is great (both 
quota and speed), and the hard drive access is fast, the memory usage is 
usually much lower, although on the OpenVZ plans can burst up higher if 
needed.


You get full root access (SSH), and I've installed Apache, PHP, MySQL, 
Exim, and Mailman, and could do more if I wanted (FTP, DNS, SVN), except 
I run most of the other services on other boxes.
The uptime is usually pretty great, although I've had two issues in 
recent memory where something major has died (like the hard drive raid 
array, or the motherboard), taking the server down for 1 hour, which 
may not be acceptable if your doing financial transactions, but ask them 
about the Xen hosting, which might have better data replication.


I know they have snapshot capabilities, although you need to stop the 
server for a while to do that, so I just run a daily rsync onto a Linux 
box at home. rSnapshot is great for that.


Running your own server may be a bit more work, but it's so much more 
customisable. Don't have PERL? apt-get install it (assuming Debian or 
Ubuntu), need to probe a server? Run nmap.


I have a script that emails me the compressed MySQL database, and also 
have a PHP CLI script that I cronjob daily to send me the server stats, 
membership details of various mailman mailing lists, amount of data 
transferred, HDD space left, ram used, uptime, and current load, and all 
sorts of things.


Michael Kubler
*G*rey *P*hoenix *P*roductions http://www.greyphoenix.biz



Daniel Brown wrote:

On Sat, Jan 24, 2009 at 10:03, Martin Zvarík mzva...@gmail.com wrote:
  

Hi,

I currently host my site by Powweb, and I am WANT to change it - can you
guys recommend me something good?

Powweb's website looks awesome and it's the best marketing I think I had
saw! After a minute it makes you think there is NO better hosting - and it's
a LIE.


Re: [PHP] New PHP User with a simple question

2009-01-24 Thread Michael Kubler

The easiest way would be to use GET parameters (i.e data in the actual URL).
There are a number of ways you can structure a HTML link to get what you 
want.
You can have something basic (but not very elegant looking), like 


   a href=index.php?page=HomeHome/a

Then in your index.php code you'd probably have something like :

   ?php
   $page = urldecode(*$_GET['page']); *
   include_once header.inc; //Include a script that contains the
   general header information
   if(is_file(pages/*$page*.inc;)) //make sure they haven't requested a
   non-existant file
   {
   include_once pages/*$page*.inc; //Doesn't have to be .inc you
   could simply output HTML data if that's all your using.
   }
   else
   {
  include_once pages/Home.inc; //If the user wanted a file that
   doesn't exist, then just take them to the home page (or you could
   take them to an error page if that's what you want).
   }
   include_once footer.inc; //Which would contain the footer if you've
   got one.
   ?


This is approximately how I do it although sometimes have a functions 
file I call, or a config file with basic presets, and various other 
things. I use .inc (for inclusion) as the file extension, so I can 
easily differentiate between .php files that customers will use (such as 
index.php, admin.php, login.php, etc..), and the included files.


In the header file I usually have something like that below.

--- header.inc starts below this line ---

   !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
   html lang=en
   head

   title?php echo *$page*; ? - Insert Company or Website Name/title

   !-- Meta Tags --
   meta http-equiv=content-type content=application/xhtml+xml;
   charset=utf-8
   meta name=robots content=index, follow

   !-- CSS --
   link rel=stylesheet href=css/main.css
   media=screen,projection,tv,tty,handheld,embossed,braille,aural
   type=text/css
   link rel=stylesheet href=css/print.css media=print
   type=text/css
   /head
   body
   div id=header
   h1HEADER INFORMATION (or image) HERE/h1
   br /
   !-- end header div --
   /div
   div id=mainNav
   ?php
   *$main_navigation_list* = array(0 = array( 'name' = 'Home',
  
   'url' = 'index.php?page=Contact',
   
   'title' = 'The home page'),
  
1 = array('name' =

   'Contact' ,
 'url'
   = 'index.php?page=Contact',

   'title' = 'The contact details')

   );
   ?
   ul id=main_nav_list
   ?php
   foreach(*$main_navigation_list* as *$index* = *$nav_list*)
   {
   echo 'lia href=' . *$nav_list*['url'] .' title=' .
   *$nav_list*['title'] . ''. *$nav_list*['name'] . '/a/li';
   }
   ?
   /ul
   /div
  
   !-- end mainNav div --

   /div

--- END header.inc --



In the header.inc I've manually created an array, then got PHP to go 
through the array to add the name, URL and other details from the array, 
but that's just to simplify this, usually I pull the navigation data 
from a database (or if there's no MySQL installed I might unserialise it 
from a file).


There are other ways of pulling the data. If you want nice URLs, you can 
have something like /pages/Home/ and then have a mod_rewrite rule in 
Apache to then change that into index.php?page=Home, (although you'll 
also need to change the a href to the new links. If you aren't running 
on apache, you can manually find the page information by doing 
print_r($_SERVER), and seeing what bits and pieces you can put together, 
but that's not nearly as good or reliable.


Sorry if there's too much info, but I'm guessing this is roughly what 
you'll be doing.
If you want to have more than one variable (like say a sub page) then 
you add  *amp;* between each variable. E.g


   a href=index.php?page=Homeamp;sub_page=more%20newsHome -
   Archived News/a

You can usually get away with just using ** as the separator but it 
probably won't validate properly if your making it in xhtml (as you 
should be). Also, if your not sure what the %20 means (a space) then 
look up urlencode http://au.php.net/manual/en/function.urlencode.php 
and urldecode http://au.php.net/url_decode.


Michael Kubler
*G*rey *P*hoenix *P*roductions http://www.greyphoenix.biz



Christopher W wrote:

At least I hope it is simple...

I am trying to get an HTML menu link to set a variable's value.  For 
example, when a user clicks the Home button on my page it would cause 
$page = home; or clicking the About Us button will set $page=about_us; 
etc.


I think this should be fairly simple but being

Re: [PHP] Re: process creation

2009-01-25 Thread Michael Kubler

Hmm, are people getting confused between  and = ?
for($icount=0;$icount11;$icount++) (is less than 11)
for($icount=0;$icount=10;$icount++) (is less than or equal to 10)

Both iterate 10 times.

Michael Kubler
*G*rey *P*hoenix *P*roductions http://www.greyphoenix.biz



Per Jessen wrote:

Tom Sinclair wrote:
  

Per Jessen wrote:

for($icount=0;$icount11;$icount++)
  

Iterates 10 times??
Hmm



10, 11 - no big difference is there?
/Per Jessen, Zürich


Re: [PHP] profiler web server

2009-01-26 Thread Michael Kubler
If you want to profile your web server, i.e artificially see what it's 
like under load, then you can use a program like 'ab' on Linux which 
will create the specified number of HTTP requests as if the URL was 
being requested (although not all the other things like the images, .css 
files, etc..)


An example command might be *ab -n 1 -c 50 http://localhost/*;, 
although you'll want to check the options first.
You'll probably also want to use something like htop (or at least top) 
to view the current load on the server, and how many apache threads are 
spawned.
Ohh and I'd suggest backing up or clearing the log file before and after 
(depends if you keep the log file or not).


I just tried myself, and on my un-optimised backup server at home it 
responds to 150 concurrent connections faster then 500 concurrent 
connections mainly because it has to spawn so many children as it ramps up.


Actually if the OP wants a proper answer we will need more detail, like 
the operating system or distro. I know on Ubuntu it's simply seen as 
apache2, and ps shows it as '/usr/sbin/apache2'


Also, if you want to know how many threads are running this command 
works for me :

 ps augx | grep apache | wc -l

Sorry, I know this isn't directly PHP specific,although this sort of 
thing  can be useful when testing various scripts, and comparing an 
internal looping test in PHP to time an algorithm, and actually running 
the script say 10,000 times. Also good for making sure your site can 
survive a slashdot (it turns out that without some tweaking of apache 
mine can't).


Michael Kubler
*G*rey *P*hoenix *P*roductions http://www.greyphoenix.biz



Boyd, Todd M. wrote:

Statements do not end with question marks... He is asking a question.

It looks to me like he wants to know which process he should watch to
determine the performance of Apache v2.2.

I believe it's httpd.

HTH,


// Todd

  



Re: [PHP] Kinda 0.T... php site and maintenance

2009-01-26 Thread Michael Kubler
Depends on what they want, how much time it'll take you (and thus how 
experienced you are at PHP), and how much code you can re-use.
Break it down a bit. You'll probably want PHP to do a few things. It'll 
probably generate the main navigation when you view the page, that's one 
section.
You'll probably want an admin page so they can edit the HTML. That's 
another section (that deals with writing files, and also lots of user 
input). Maybe they can't edit raw HTML, and want a BBcode editor, or 
even full wysiwyg editor, that's at least a sub-section.
Then there's photos. So they'll want a gallery. Does the gallery just 
show next and back, or does it show an index page of thumbnails?

Will they be able to save comments? Will users be able to leave comments?
How will the customer upload, edit, and delete the images?

What about a news feed, if done properly it'll be a bit like a blog, 
with an RSS feed, and postings, and archives. Will the data be pulled 
from a database? Are you familiar with databases?
Also, what about an AJAX interface? some things, especially the back end 
(and pre-loading the next gallery image), lend themselves to being done 
in AJAX. Do you know javascript, and XML?
What if they want to upload a video instead of a picture? Will you just 
get them to use YouTube and embed it, or will you work out the issues of 
uploading LARGE files, using something like FFMPEG to compress it, and 
then finding a suitable flash player to play them.


As you can see, there's a lot of things that could be done on such a site.
Personally I try it this way. I estimate the time it's going to take me 
to do each thing, then double it (as I am habitually optimistic in my 
timing), then work out the hourly rate.
I personally wouldn't work for less than $25/hour, even if it was a 
friend, and that wouldn't be for something of this magnitude. I normally 
charge AUD$45/hour, and most people think I'm undercutting the market. 
Although my rates can be off as I usually have to do photography, and 
film work for a client as well.


At the end, you multiply the number of hours it'll take you, by your 
hourly rate and get a total.
The hard thing is, the first time you make such a site you'll probably 
learn a LOT, and it'll take you a fair amount of time, then the second 
time you'll probably re-program it because you know better (like to use 
Object Oriented, and whole new programming and UI techniques), and after 
that you'll probably just write an installation script that'll allow you 
to create new sites within minutes. So do you charge the 1st person 
$10,000 when they'll probably end up with the worst site, and everyone 
else gets charged $200, or do you split the cost up over a number of 
potential sites, and absorb any miscalculations?
But the real question you have to ask is if it is really worth all the 
effort when you can simply use a plugin for something like Wordpress 
http://wordpress.org/ which will be 10x better than anything you'll 
ever create anyway.


Michael Kubler
*G*rey *P*hoenix *P*roductions http://www.greyphoenix.biz



PS : Sorry to everyone about the long email replies... seems to be my 
thing today.


Ryan S wrote:

Hey,

Got a question for you guys who make a lot of personal sites.

I got a US client who wants me to make a personal site, 4-7 sections (eg: 
about me, photos, whats new etc)
and have to put a yearly maintenance $$ amount...

I thought i'll make most of the stuff using php rather than plain html so the 
client can update different sections without me (eg: whats new, add pics)

What do you guys charge for something like this (dont count hosting and domain 
fees)

Thanks!
R


Re: [PHP] Dirty Button

2009-01-26 Thread Michael Kubler
I like the idea of not updating the content straight away (as the user 
might not want to see it updated), but depending on the situation I 
would personally make the submit button look grey and inactive unless 
they've changed something in which case it'll be normal and (black).
Although actually making it inactive could be bad as the javascript 
might not correctly update it's status to active, preventing the 
customer from actually submitting the data they've just painstakingly 
entered. The whole progressive enhancement/graceful degradation thing.


However, on the other hand to having it not automatically update, the 
thing that I hate the most on a website is when it looses valid data 
that I've entered (clicked, selected, whatever), which is where saving 
the current state using Ajax can be useful, although probably over the 
top for most things anyway.


Ohh btw Tedd, the problem with your implementation is that as a user, if 
I change some settings, but want them back, when I set it back to say C 
5 as I had it before, the button is still Red, and I could get confuzled 
about what I'd previously entered. Obviously having a reset button would 
fix that, (as long as it set the submit text back to normal), or you 
could get PHP to set the javascript to check if the values are as they 
were before and set the button back. Obviously a lot more javascript 
than the 3 lines of code you've got there, for only a minor usability 
point, especially if the users previous selection is listed next to the 
actual buttons, but it's at least something to be aware of.



My 2c.

Michael Kubler
*G*rey *P*hoenix *P*roductions http://www.greyphoenix.biz



Nitsan Bin-Nun wrote:

Since you are using JS why not just update the content straight away?
(ajax/etc)

On Sun, Jan 25, 2009 at 7:55 PM, tedd tedd.sperl...@gmail.com wrote:

  

Hi gang:

I had a problem and solved it -- here's the write-up:

http://www.webbytedd.com/b/update-select/index.php

What do you think of the solution?

Cheers,

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


Re: [PHP] Re: unlink file rights problem

2009-01-28 Thread Michael Kubler

http://au2.php.net/cli

PHP via command line.

Michael Kubler
*G*rey *P*hoenix *P*roductions http://www.greyphoenix.biz



Shawn McKenzie wrote:

Merlin Morgenstern wrote:
  

Hi there,

I am trying to unlink a file which is inside a folder that is not
writable to phps user www. Of course this failes, but I need to find a
solution for it.

Backgroud is following:
I have pure-ftpd installed where user directories get created by
pure-ftpd. Unfortunatelly there seems to be a bug and pure-ftpd does
only create the homedirectory folder in 750 mod.
My PHP-Script scans this directories every x minutes and processes those
files. Upon completinon those files should get deleted, but as the dir
is not writable by the user www this failes.

The dir looks like this:
drwxr-x--- 2 ftpuser ftpgroup 4096 Jan 28 10:18 merlin/

files inside look like this:
-rwxrwx--- 1 ftpuser ftpgroup 16868 Jan 28 10:20 test.xml*

User www which executes php via cron is inside the group ftpgroup.

Any ideas? I am kind of lost with this one. Thank you for any help!

Best regards, Merlin



Why not run the cron as root, or ftpuser?

  


Re: [PHP] Web Shop Management

2009-01-31 Thread Michael Kubler

If it's just documentation you could use a wiki.
I've found that mediawiki http://www.mediawiki.org/wiki/MediaWiki is 
the best (the one that wikipedia uses), although twiki isn't too bad, 
but the problems with wiki's are that they expect you to know how to use 
them, and all their crazy words and syntax. Something like Google Docs 
http://www.google.com/google-d-s/tour1.html is actually really sexy 
(can I say that about a web app that looks like a slimmed down version 
of office?), because it is so easy to use.


You could also check out things like dotproject 
http://www.dotproject.net/, or google 'project management + PHP'.
As a non PHP, hosted alternatively you could look into basecamp 
http://www.basecamphq.com/, which is designed for making project 
collaboration, with goals, timelines, and all sorts, although that 
doesn't quite sound like what you want as it isn't something you host, 
and you'd basically need to create a new one for each project.


Michael Kubler
*G*rey *P*hoenix *P*roductions http://www.greyphoenix.biz



Sancar Saran wrote:

Not really.
It was someting like customer tracking.  


Finding 200 apache directory with no info was very frustrating experiment.

Some of them are abandoned,  some customers are leaved. some of them just 
projects but customers does not accept.


I want store some info about the customer or project. Maybe categorize them. 

Lets call it customer documentation. 


I want to record something like that

This was blahblah.com owned by some guy, needs this. dislikes this. Please be 
careful when moving or altering site. 
He was sychopath to check every 30 min to his 5 hit per day site. 

This system uses uber CMS system which needs php-tidy php-postgresql etc etc. 
Have to acess some blah blah service.



Regards

Sancar
  


Re: [PHP] Weird url passing what does it mean, am I hacked?

2009-02-01 Thread Michael Kubler
Maybe you can use Firebug http://getfirebug.com/, or the Web Developer 
https://addons.mozilla.org/en-US/firefox/addon/60 plugins for Firefox?


Michael Kubler
*G*rey *P*hoenix *P*roductions http://www.greyphoenix.biz



Ashley Sheridan wrote:

On Sun, 2009-02-01 at 13:42 -0600, Terion Miller wrote:
  

On Sun, Feb 1, 2009 at 11:17 AM, Ashley Sheridan
a...@ashleysheridan.co.ukwrote:



On Sun, 2009-02-01 at 11:01 -0600, Terion Miller wrote:
  

On Sun, Feb 1, 2009 at 10:57 AM, Ashley Sheridan
a...@ashleysheridan.co.uk wrote:

On Sun, 2009-02-01 at 10:10 -0600, Terion Miller wrote:
 I noticed yesterday that sometimes I was seeing a strange
url passing at the
 bottom of the browser when clicking around my site I'm
working on while
 watching the page loads, its calling to mouserunner.com and
I went to the
 site and it is a bunch of links, my site is on a private
server for a large
 media company, clues on what this means and where to look to
stop it, what's
 it doing scraping my site or something?

 Thanks folks...

Are you using some of their content on your site? You may not
realise
it's come from them, it could be some Javascript you've found
online and
used on your site. It's more than likely just a call-back
script to
register a 'hit' along with other details.

As for scraping your sites content, there is no way to prevent
this. If
your content is viewable for a human, it's viewable for a
computer.

Would you mind posting a link so we can see what you're
seeing?


Ash
www.ashleysheridan.co.uk

Hi Ash!
My site isn't an outside app, it's an in house work order app hosted
on our corporate servers, I was working on it yesterday and caught a
glimpse in the bottom of the browser where you can see page loads , I
kept seeing a www.mouserunner.com in there and was wondering what the
hell...I googled and visited the site and found no other post anywhere
complaining about this site or if it was a hacker/phishing site...


Copying the list back in on this.

You still haven't mentioned if you were using any scripts you sourced
from elsewhere? Have you performed a search on the server in question
for any files containing a link to that website?


Ash
www.ashleysheridan.co.uk

no scripts that i've found, I inherited this app, and its about 57 pages
  

1200 lines each and I don't have access to the server corp rules...


Do a search on all the files for that site. I'm guessing you'll find
something in a .js file somewhere.


Ash
www.ashleysheridan.co.uk


  


Re: [PHP] Question about version control.. sorta..

2009-02-06 Thread Michael Kubler

I'll put in a +1 for Subversion. I use it and love it.
I have the actual repository sitting on a linux box and usually use 
TortiseSVN to update, and commit to the repository.
It's pretty easy to use, and was much easier to setup than I expected. I 
simply apt-get install svn, and then edited some Apache config files, of 
which the code is available with a quick google.


I keep all the websites I code in the repository and even though I have 
3 computers on the same network I'll sometimes commit related files on 
one PC, and update the local copy on another computer because it's even 
easier than using windows network file transfer. Plus the fact that I 
have a script to automatically backup the repository regularly, so once 
the data is in the repository I'm highly unlikely to loose it (esp as 
I've got local cached copies on 3 computers).


Best of all? IT'S FREE!

my 2c.

Michael Kubler
*G*rey *P*hoenix *P*roductions http://www.greyphoenix.biz



TG wrote:
So, for my purposes.. after trying a handful of solutions.. open source and 
commercial..  I think I've decided that Reliable Software's Code Co-op 
is what's going to work best for me.


My trial is almost up, so as soon as my next paycheck comes, I think I'll 
be purchasing the full version for $150.


For me, it's totally worth it.   It stores everything in a local database, 
but allows collaboration if that's what you're into.  Via email for the 
$150 version, via LAN for the $200 version.


It lets me add files by type, is easy to check out files.  Anyway.. if 
anyone's looking for an easy Windows version control system, check it out.


(no, I don't work for them, just passing along the recommendation since I'm 
digging this software)


Thanks for all the input!

-TG
  


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



[PHP] php validate user password

2009-02-09 Thread Michael Kubler
These days SHA should really be used instead of MD5, and you should be 
SALTing the password as well.

Here's a great guide : http://phpsec.org/articles/2005/password-hashing.html

Michael Kubler
*G*rey *P*hoenix *P*roductions http://www.greyphoenix.biz



Jan G.B. wrote:

2009/2/9 Andrew Williams andrew4willi...@gmail.com:
  


Can some body help out on how to validate user password from the database?



There are several possibilities. This would be one.
?
$query = 'SELECT 1 from `usertable` where `name` = ' .
mysql_real_escape_string(STRIPPED_AND_TRIMMED_REQUEST_VAR_HERE)
  . ' AND `pass` = md5(' .
mysql_real_escape_string(STRIPPED_AND_TRIMMED_REQUEST_VAR_HERE) .
');';
?


  


[PHP] Looking for some PHP OO programming guides

2009-02-10 Thread Michael Kubler

Hi,
I'm just getting into programming in an Object Oriented fashion, and am 
looking for some guides, tutorials, hints, tips, etc...


I only just found out that you remove the $ from variables when calling 
them from $this-


e.g :
?php
class People
{
private $person = not set;
   function __construct()
   {
*$person* = A person; //This doesn't work (well it creates a 
variable $person that only has the scope of the current function from 
what I can gather)..

$this-*person* = A person; //This works properly
}
   function display_list()
   {
   echo $person; //This doesn't work
 echo $this-person; //This works.
   }
}

$person= new People;
$person-display_list();
?


Instead of painstakingly working out most of the other mistakes I'm 
likely to make, I'd love to read about other peoples issues they had 
with learning OO so I can skip most of the hard stuff, and only make 
small mistakes (hopefully).

--

Michael Kubler
*G*rey *P*hoenix *P*roductions http://www.greyphoenix.biz



Re: [PHP] Google Apps AuthSub = missing $_GET element

2009-02-15 Thread Michael Kubler

Do you have magic quotes on?

Also, try a *print_r($_SERVER);*
or even a   *var_dump($_GET);*
See what's actually in the arrays.

Michael Kubler
*G*rey *P*hoenix *P*roductions http://www.greyphoenix.biz



John Corry wrote:

I am completely baffled by this.

I have a PHP script  that is using Cameron Hinkle's 
LightweightPicasaAPIv3 to authenticate with the Google Picasa service 
using the AuthSub method.


Basically, if we're not authenticated, redirect to the google authsub 
URL:
(https://www.google.com/accounts/AuthSubRequest?next=http%3A%2F%2Ftwozerowest.com%2Fsnowdog%2520gallery%2Fadmin.phpscope=http%3A%2F%2Fpicasaweb.google.com%2Fdata%2Ffeed%2Fapisession=1) 



This page requests that the user either grant access or deny access.

Grant access takes us to the URL specified (my authentication script) 
with a ?token=x added to the end of the URL.


This all works. We get back to my URL with ?token=x appended to 
the URL.


That's when it starts getting weirder than anything I've seen in PHP:
My debugging output confirms that:
1. $_SERVER['request_method'] = GET
2. strlen($_GET['token']) = 0
3. $_GET - array()...but it's empty!
4. $_REQUEST[] contains no 'token' element
5. echo($_GET['token']) prints the value of ?token= from the URL

So WTF?


[PHP] PHP AS an FTP server

2009-02-17 Thread Michael Kubler

Hi,
This is probably a bit stupid, but I've been having issues getting any 
of the good FTP servers running on my Ubuntu 6.06 (LTS) box.
I've tried Pro-FTP, Pure-FTP, and briefly installed some others, but the 
versions available for my distro don't seem to support MySQL (or I'm 
simply doing something wrong).


Anyway, I had the thought that the FTP server won't be used much, as I 
mainly use SSH, however I need to be able to give other people access, 
which is why I'm wondering if there are any PHP scripts that can be used 
AS an FTP server. That is, I'd setup Apache to accept on the standard 
FTP port(s), and get it to point everything to a PHP script, which I 
could then use to pull user/pass details each of which would have their 
own directories, allowing each user to access a sym-link to their 
domain(s) log file, website directory, and anything else.


Has someone already got a script that does this (at least accepting FTP 
connections), or is this a crazy idea that's just not possible?
Should I just compile the latest version of some FTP server, and try and 
configure that to do what I want instead?


Thanks.
--

Michael Kubler
*G*rey *P*hoenix *P*roductions http://www.greyphoenix.biz



Re: [PHP] PHP AS an FTP server

2009-02-18 Thread Michael Kubler
Yeah, I don't want local user access (SSH, their own entries in passwd, 
etc..). Too much work to ensure they all have the correct file 
permissions, etc..
I think I'll just skip the PHP bit and use a proper FTP server. I've 
configured them a few times, but all the examples I found only had 
Anonymous FTP login, or MySQL (which is what I want), but the server 
wouldn't work with the MySQL plugin.

Looks like I'll have to compile from source... joy.

Thanks for all the replies though.

Michael Kubler
*G*rey *P*hoenix *P*roductions http://www.greyphoenix.biz



Thodoris wrote:


The local users part was about ssh-sftp access Ash not ftp.

IMO when you add local users you add extra risks to your system than 
simple ftp (non-local) users may not cause. Of course if you secure 
your system carefully everything will work fine but I would avoid that 
and there are many security issues that here is not the place to discuss.


Of course if this fits your needs I have no objections.
--
Thodoris


Re: [PHP] Working directory of PHP pages?

2009-03-10 Thread Michael Kubler

You can configure different index file names for Apache to check for.
e.g index.html, index.htm, index.php, default.htm

I had one webserver where it would only accept default.htm as the file, 
and didn't allow .htaccess files.


Michael Kubler
*G*rey *P*hoenix *P*roductions http://www.greyphoenix.biz



Clancy wrote:

It is my understanding that when you open a page the PHP server looks for 
index.php in the
site root directory, and loads it. As a result the working directory of the 
page will be
the root directory of the site.  I have always worked on this assumption, and 
it has
always been correct.  On the other hand Stewart thinks that I cannot rely this, 
and am
likely to get into trouble as a result.

Are there any systems in which my assumption will not be correct?


  


Re: [PHP] PHP bandwidth control

2009-04-06 Thread Michael Kubler

DO NOT USE GO-DADDY.
Sorry, just had to say that Go-Daddy will cause all sorts of issues when 
your domain expires, or if you check for a domain but don't purchase it 
straight away. When you come back a little bit later you'll have to pay 
hundreds of dollars for the domain (as they registered it while you were 
gone), instead of the usual $20/yr type thing.


Try Planetdomain (although their website is being re-designed at the 
moment), MelbourneIT (expensive), or even Google (surprisingly cheap).
Actually if you search, there's a website that has a list of the 
different domain registrars and their costs that you could look at.



As for quota control you can pipe everything through PHP which is more 
CPU intensive but will be more accurate in terms of which user was 
accessing the account. You could also parse the Apache log files (or 
whatever the web server is), which is more accurate but also slower.


For bandwidth you can use something like the bandwidth mod for Apache 
which will allow you to prevent your webserver from completely 
saturating your Internet connection, allowing you to still surf the net 
or play games while people are accessing your site.


Michael Kubler
*G*rey *P*hoenix *P*roductions http://www.greyphoenix.biz



JD wrote:

Excellent, thanks both for the suggestions. I'd like to continue hosting it 
myself if for no other reason than I want to learn how to manage some of the 
hardware, software and operating systems that I otherwise don't get much 
exposure to. I'm treating this as a learning experience.

I like the idea of the file_get_contents() as it sounds easier to implement, 
but, again, I'm using this as a learning experience so maybe I'll try and parse 
out the log files as you suggest.

Again, many thanks!
Dave

-- Original Message --
From: Michael A. Peters mpet...@mac.com
To: Yannick Mortier mvmort...@googlemail.com
Cc: JD danceintherai...@netzero.com, php-general@lists.php.net
Subject: Re: [PHP] PHP bandwidth control
Date: Mon, 06 Apr 2009 06:03:12 -0700

Yannick Mortier wrote:
  

2009/4/6 JD danceintherai...@netzero.com:


Hello,

I am relatively new to PHP and am trying to make a video/image sharing site for 
my family to upload and share family videos and pictures. My concern is that 
because I'm hosting this site at my house, I will quickly exceed my bandwidth 
limitations each month if all the family members I think will use the site do 
actually end up using it. What I'd like to do is set up each family member with 
their own login and track how much bandwidth they use and cap it after a 
certain amount. The login stuff is easy and I have that figured out, but I 
haven't been able to figure out a good way to track the bandwidth used by each 
user that logs in. Is there a good way to do this with PHP?

Thanks,
Dave


Click here for free information on how to reduce your debt by filing for 
bankruptcy.
http://thirdpartyoffers.netzero.net/TGL2231/fc/BLSrjnxXKInZ3kl2SDnqN7ifO3PSaE96m9RMpRCn9agvvsomFpM5Y0grTAM/

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


  

I guess there are multiple ways to engage this problem. It depends how
deep you want to log the traffic. If you just want to count the
traffic of each image, video etc you could just wrap up each image and
video to go through php first with file_get_contents() (look in the
php manual there are some examples how to work with this), count how
many bytes of data will be sent out and log this in a database or
however you want to do this.
If the bandwith limit is exceeded you don't deliver the image anymore
and display an error message instead.

If you want to catch all traffic you must parse the log files from you
webserver. To do this you could save the IP with which the login of
the user was performed and connect all traffic that was done by that
IP to the User. If the traffic limit is exceeded you display an error
message.

I guess for some family-internal sharing the first approach should be
good enough. Just make sure you take some bandwith for the html pages
into your calculations.




My suggestion would be to do it on a real server and avoid any and all 
ISP restrictions, present and future.


Don't register your domain with your host though, I found it to be a 
real PITA to switch hosts when you use them as your registrar, getting 
them to relinquish control of the domain can be a PITA.


Instead register with someone like godaddy that lets you specify the 
nameservers and host elsewhere. Then if you feel like you need to move 
it to a different host, your current host can't be jerks about it.




Purify your water with professional water treatment. Click now!
http://thirdpartyoffers.netzero.net/TGL2231/fc/BLSrjnxWi0WoglDK0IWRPkII8DwKjpWYPNFWYl5H4goF180aUp9479wxiL2/

  


Re: [PHP] Add php.net to my browser search box

2009-07-17 Thread Michael Kubler



Jim Lucas wrote:

I use FF 2  3 and I created a bookmark that simply had a keyword
assigned to it.

Bookmark properties are as follows:

Name:   PHP.net
Location:   http://www.php.net/%s
Keyword:php
Description:Type php search term in the address bar
to perform a PHP.net search

Not sure if you can do this with other browsers, but I have found it to
be very useful.

Jim Lucas


I second that.
It's great to be able to type something like PHP str_replace into 
Firefox's address bar and go straight to the documentation on that function.


Michael Kubler
*G*rey *P*hoenix *P*roductions http://www.greyphoenix.biz




Re: [PHP] Shoutbox suggestion needed

2009-11-17 Thread Michael Kubler
The main issue with these systems is updating the client on a regular 
enough basis.
If the content is time critical, like with Facebook chat, then you need 
to do long polling.


However for a Shoutbox, because it's more like an IRC channel with 
people 'shouting' to a channel, you can probably just set the client to 
automatically update on a regular basis. Or even more advanced, would be 
to get it to check in increasing intervals. Firstly it checks 0.5s 
later, then 1s later, then 2s, 4s, 8s, 16s, with a limit of 60s (i.e it 
checks at least once a minute for an update), upon new content being 
received the time is reset back to the 0.5s


If you need to do long polling http://ajaxpatterns.org/HTTP_Streaming 
then look into the Tornado Webserver http://www.tornadoweb.org/ which 
Friendfeed http://friendfeed.com/, and more recently, Facebook use 
(for their LiveFeed system).
For a PHP based implementation check this out 
http://www.zeitoun.net/articles/comet_and_php/start.





Michael Kubler
*G*rey *P*hoenix *P*roductions http://www.greyphoenix.biz
Mobile : 0433483008

I believe in a better world. I support the Zeitgeist Movement 
http://www.zeitgeistsa.com.




Ashley Sheridan wrote:

On Mon, 2009-11-16 at 12:06 -0500, Paul M Foster wrote:

  

On Mon, Nov 16, 2009 at 02:46:45PM +, Ashley Sheridan wrote:



I don't know of anything you can use like this, especially that runs
purely on Ajax. Just take a look at Facebook chat. That's Ajax, and
fails and falls over on a constant basis to the point where it is almost
useless. Imho, Java seems to be pretty good at this sort of thing, and
there are plenty of free options out there that you could use.
  

It's often been argued back and forth whether people have Javascript
turned off. I suspect the vast majority of people have Javascript turned
on. However, Java is another story. You may find that many more have it
turned off.

Paul

--
Paul M. Foster





Yeah, but then, generally, you can tell the people visiting this site
what they need enabled, as it looks like the visitors are going to be a
select few. Java is available on all the main browsers, and generally
only needs one to accept the applet. For a chat application to be
written using only Ajax technology, well, like I said before, if
Facebook tried it and still can't get it right with all the financial
backing they have, what hope for someone to release this sort of thing
open source and Facebook not be aware of it?

Thanks,
Ash
http://www.ashleysheridan.co.uk



  


Re: [PHP] RSYNC - who knows more?

2010-01-18 Thread Michael Kubler

What is it you want to do?
Do you want to create a client for RSYNC, or maybe rsync to AmazonS3 
http://jeremy.zawodny.com/blog/archives/007641.html (which is 
admittedly hard), or maybe use something like rsnapshot 
http://www.rsnapshot.org/ to have rsync + snapshot functionality, 
which is great when you get a whole heap of corrupt data that gets 
sync'd across, you can go back to an old snapshot instead of loosing 
everything.


--
Michael Kubler
*G*rey *P*hoenix *P*roductions http://www.greyphoenix.biz
Mobile : 0433483008

I believe in a better world. I support the Zeitgeist Movement 
http://www.zeitgeistsa.com.



Jens Geier wrote:

Hello,

as sugestet i tried backup by using RSYNC.
It is working fine.

But i have some more Questions for this software.

Is here some one that can help me with it?

Kind Regards
Jens Geier


Re: [PHP] Do you use a public framework or roll your own?

2010-01-26 Thread Michael Kubler
I read somewhere (can't find the link at the moment) that there's 
probably 2.5 frameworks per PHP developer.
I know that when I started I was writing my own bits and pieces of two 
frameworks. One was function based and the other was OO based.
I've since found the Yii http://www.yiiframework.com/ PHP framework 
and LOVE it. As someone that used to do assembly code programming on Pic 
microcontrollers with very little SQL background it was a bit of work to 
try and understand OO, MVC, ActiveRecord, etc.. But now that I have I'm 
much faster and more efficient. There's also the added bonus that being 
a Open Source project it is being worked on by lots of people and 
constantly getting better.


So I'd have to vote twice. I've used my own frameworks, but now using a 
proper one.


My 2c.
--
Michael Kubler
I believe in a better world. I support the Zeitgeist Movement 
http://www.zeitgeistsa.com.



James McLean wrote:

In hindsight, it's a little clunky now. But I was proud of it and I
still am to a point :) Personally I believe any PHP developer who
wants to be taken seriously should have written thier own framework :)
  


Re: [PHP] Re: Good source for sample data?

2010-01-29 Thread Michael Kubler

Agree'd.
I've done this a couple of times. Usually best is to grab a couple of 
free online dictionary lists. One for peoples names, another for 
business names, then just randomly pull the data from the dictionaries. 
Addresses, websites, phone numbers, and zip codes can all be randomly 
generated, or you can use the GEONames database 
http://www.geonames.org/ to generate actual locations.


Also, wasn't there some test data available by MySQL? I think it was the 
Sakila http://dev.mysql.com/doc/sakila/en/sakila.htmldatabase 
http://forums.mysql.com/list.php?121.


--
Michael Kubler
I believe in a better world. I support the Zeitgeist Movement


Shawn McKenzie wrote:

Brian Dunning wrote:
  

Hey all -

I need a few million sample contact records - name, company, address, email, 
web, phone, fax. ZIP codes and area codes and street addresses should be 
correct and properly formatted, but preferably not real people or companies or 
email addresses. But they'd work if you did address validation or mapping. 
Anyone have a suggestion?

- Brian



It should be easy to code a routine to generate random data.  Maybe 20 -
30 lines of code.  Obviously you may have a name like Dgidfgq Xcvbop and
company Wsdkn, but it shouldn't matter if testing is your purpose.

  


Re: [PHP] Mail Function In PHP

2010-03-10 Thread Michael Kubler
Having worked at a decent sized, respectable ISP with 100,000+ customers 
sending email via Iron Ports (email scanners), even they would get put 
on a blacklist on a monthly basis. Hell it wouldn't surprise me if 
Gmail's SMTP servers got put on a black list at some point.
There's seemingly hundreds of blacklists and whilst some play nice, 
others are very paranoid.
Usually the good email servers will detect your on a blacklist then rate 
limit the number of emails it'll accept from you. If you keep pissing it 
off, by sending emails to non-existant addresses (something they REALLY 
hate), sending emails that are too big, or simply sending too many 
emails or emails with too many recipients, then it'll tighten the 
restrictions. Over time if your good then those restrictions will be 
released and eventually you'll be able to send at normal rates.


--
Michael Kubler
I believe in a better world. I support the Zeitgeist Movement -- 
www.zeitgeistaustralia.org


Teus Benschop wrote:


Once a domain or ip address was black listed, it was quite a process to
get it unlisted again, and even then as soon as mail came from that
domain, it got blacklisted again. Supposedly there is some certification
process that official smtp relays need to go through so as to prove or
certify that they won't allow spam to be sent through them, and take
steps to remove offenders from using their relay. However, this is all
guessing, and in the end we just gave up and used our ISP's official
relay. Teus.


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