Should an object's method be able to access a protected property of another object of the same class?
I'm coding in PHP, and I just discovered that an object's protected property is allowed to be accessed by a method of the same class even if not of the same object.
In the example, at first, you'll get "3" in the output - as function r...
I have a project with very messy code - lots of duplication and dead code here and there.
Some time ago there was zero code coverage by unit-tests but now we're trying to write all new code in T.D.D. manner and lowering technical debt by covering "old" code by unit-tests as well(test-last technique).
Business logic's complexity is quit...
Hi.
I am currently writing a little application for my University radio station in PHP. It basically grabs the listener count from the status page (http://www.address.com:8000/status.xsl) and puts it in a database every minute.
Now the script seems to work fine when it's run off of my home machine. I have no issues retriving the inform...
When users register, should I store their email in the db as is or hash it.
I want to be able to decrypt it later, so should I use md5?
thank you!
...
Hello all,
I'm trying to work with dates for the first time, I did it something about that with Flash but it's different.
I have two different dates and I'd like to see the difference in hours and days with them, I've found too many examples but not what I'm loking for:
<?php
$now_date = strtotime (date ('Y-m-d H:i:s')); // the cur...
I want to accept a list of character as input from the user and reject the rest. I can accept a formatted string or find if a character/string is missing.
But how I can accept only a set of character while reject all other characters. I would like to use preg_match to do this.
e.g. Allowable characters are: a..z, A..Z, -, ’ ‘
User must ...
Hello,
I need to be able to encrypt the MySQL traffic from a web server to a database server. I know how to set MySQL to use SSL based on the server and client settings in my.cnf however, this needs to be done using mysql_connect() in PHP. This may be a 2 part question.
1) Does mysql_connect() use the MySQL client settings that are s...
I need to strip all <br /> and all 'quotes' (") and all 'ands' (&) and replace them with a space only ...
How can I do this? (in PHP)
I have tried this for the <br />:
$description = preg_replace('<br />', '', $description);
But it returned <> in place of every <br />...
Thanks
...
I'm string to seek in a remotely hosted FLV file and have it stream locally. Streaming from start works, but when I try to 'seek', player stops.
I'm using this script to seek to remote file
$fp = fsockopen($host, 80, $errno, $errstr, 30);
$out = "GET $path_to_flv HTTP/1.1\r\n";
$out .= "Host: $host\r\n";
$out .= "Range: bytes=...
I have this regex:
preg_replace(
'/\["'.$key.'"\] = (.+?);/is', '["'.$key.'"] = '.$newValue.';',
$contents);
It writes an array value in a config file. I need to allow single or double quotes around the array key and I'm not sure how to do that. I didn't write this regex.
...
I have tried and tried and tried now.
I have a mysql field (TEXT) which contains the value of a textarea.
That is, if the text is written EXACTLY like this:
Hello. Hello.
Hello.
Hel
lo.
Then thats how it will appear in the mysql field because Im using wordwrap and nl2br functions when inserting it there.
Now, I am creati...
Hi all,
I have a piece of codes that resizes a .png file in php. It start with:
$im = new Imagick( "strawberry.png" );
I have a .png file in www.mydomain.com\test\strawberry.png. How can I correct the code above for this address?
Thanks
...
I have a client who will be selling access to an online service on their website. They would like to integrate a PayPal Buy Now button into the site... no problems there. However, they want their customers to have instant access to the online service that they are selling as soon as the payment is processed. That seems reasonable to me.....
Hi all,
I am writing a anti-leeching download script, and my plan is to create a temporary file, which is named by session ID, then after the session expires, the file will be automatically deleted. Is it possible ? And can you give me some tips how to do that in PHP ?
Thanks so much for any reply
...
I have a php-apache website on which I am trying to track download conversions using Google Analytics. I want my users to initiate the download and be redirected to a "thank you" page in one click. The way I'm envisioning this is:
The user clicks one of several download buttons which sends them to a generic thankyou.php page, and passes...
Hi guys, i have a LAPP (linux, apache, postgresql and php) environment, but the question is pretty the same both on Postgres or Mysql.
I have an cms app i developed, that handle clients, documents (estimates, invoices, etc..) and other data, structured in 1 postgres DB with many schemas (one for each our customer using the app); let's a...
Hi All,
I have been trying for hours to get this working and I still have had no joy. Basically I am trying to connect to Google Base using the GData library built into Zend Framework 1.9. I have cut my example right down the nothing, just to get it working. All I am trying to do for the sake of the example is simply connect and insert ...
Well, here is a small problem.
I am to design a web application database to use what is, basically, one spoken language. However this language has two alphabets (Latin & Cyrillic) and three spoken variants that actually have only some minor differences (I think there is several hundred words that are slightly different). To make matters...
I'm trying to rewrite the categoy file of my shop system, I also integrated a pagination so I need to rewrite 2 parameters. it almost works, otherwise I wouldn't be posting in here
this is the rewriteurl
RewriteRule ^shop/cat/(.*)/page/([0-9]+)$ /cmstut/shop/cat.php?cat=$1&page=$2 [QSA,L]
This is the url
http://localhost/cmstut/sho...
when I send a user an email verification message, how do I construct it to look something like this:
How do I add links? using tags? and newlines?
$message = 'Thanks for signing up!' - a newline afterwards...
then blablablah *link to confirmation*
I would really appreciate any kind of help in this.
...