I've created my first phar archive with the following code:
$phar = new Phar('myphar.phar');
$phar->addFile("index.php");
$phar->setStub($phar->createDefaultStub('index.php', 'index.php'));
The mentioned index.php only does a single output:
echo "I am in a PHP archive!";
When I run the above code, myphar.phar is created and whe...
I have seen a lot of upload forms hacked, and some had some really good security checks of the file being uploaded (at least I think so), but still somebody managed to upload a PHP file.
I was wondering: is there is a way to upload a file in the uploads folder that has 777 permissions? I am thinking of using HTTP PUT.
...
I'm using this but it's replacing single occurances of a new line with <br/><br/>
function nl2br2($string){
$string = preg_replace('/(\r\n){2,}/', '<br/><br/>', $string);
//$string = preg_replace('/[\r\n]/', '<br/>', $string);
return $string;
}
It happens with the first pattern.
...
Hi folks
Current image looks like
<img src="images/example.jpg" />
Now if img src do not have the alt="", the code itself will replace the image like
<img src="images/example.jpg" alt="" />
How can be done with php?
...
I have a customer that do a little wrap up of what happend during the weekend and prep a file in MS Word with pictures and text
that word document is then converted in pdf for downloading on the web site as link. I can make a php script that will check in the folder how many file there is ans make a list of them, but i like to be able t...
I created this application a couple of months ago: http://www.mondofacto.com/word-tools/scrabble-solver.html
The application lets the user enter the set of letters they are given, and echos back what valid words they can use, along with what score they will get for using those letters.
Basically, what I want to do is extend the applica...
Hello All,
I would like to get driving time information from one location to another using google maps.
I have found another fantastic post on this site here
Although the above link is based on geo codes I woud like to use zip codes if possible.
But I really like to get the time via a php call as this time is being worked out in the ...
There are 4 tables used for storing tags:
tagovi, tagovi_vijesti, tagovi_blogovi, tagovi_dogadjanja
Structure od table tagovi:
id - name
Structure of table tagovi_vijesti:
id - vijesti_id - tag_id
The same is for other two tables.
On main page I display tags from all three tables this way:
$sql = "SELECT
T.id AS id, T.na...
What's the best way to collect data from a form using checkboxes so it's nicely grouped into one array from the $_POST array in the receiving page.
For example, in my form i'll have HTML which looks like this (x = ticked):
[x] Option One
[ ] Option Two
[x] Option Three
which i want to translated into an array from the $_POST array:
...
Hey, yeah, I've tried so many times to get rid of this error:
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING
I'm thinking it's a sql problem, but it's only a simple query I'm running. Any help would be greatly appreciated.
$connDB = mysql_connect($host,...
I just noticed that the Zend lucene implementation has a default analyzer that can be modified using Zend_Search_Lucene_Analysis_Analyzer::setDefault(), but I couldn't find a way to override that default when performing a query. Do I really need to reset the default analyzer if I'm working on multiple indexes or am I missing a function?
...
What are some non-captcha methods for blocking spam on my comments?
...
Hey all. I've been looking for a while for something that can help me out with this.
I'm writing a script that will login to Gamefly.com, and add 50 games to my queue. The queue part works fine enough, but the login simply won't work. I've read about using cURL before, and I noticed that PHP has a decent enough time with it. So here's w...
PHP has built in support for reading EXIF and IPTC metadata, but I can't find any way to read XMP?
...
Possible Duplicate:
Can I swap colors in image using GD library in PHP?
How to do that with GD?
...
I have a wrapper php class for mysqli which amongst other things needs to be able to handle multiple queries (using mysqli::multi_query). It works but I can't find how I'm supposed to get error details when one of the queries fails. This is a simplified version of the code:
$queries=array('SELECT * FROM core_order_items',
'SELaaa...
Hello,
I am creating a file with php. I just want to be able to create it, with no content, under a directory. Then I want to be able to edit it when I access my server with ftp. I can't! The user of php is different from the ftp user, and this last one does not have permissions to change it! I tried chmod,umask,chown, but nothing works....
I have an input on my form to allow a user to browse to a file location. the idea being that they can attach a resume to to the application they are getting ready to submit.
<label class="description" for="element_5">Upload a File </label>
<div>
<input id="element_5" name="element_5" class="element file" type="file"/>
For ...
This is a really amateur question but I've installed ImageMagick from the ports on my FreeBSD.
However when I use
$image = new Imagick($filename);
I get:
Fatal error: Class 'Imagick' not found in /usr/local/www/test.php on line 1
How do I make this class accessible to the scripts?
...
I have a good understanding of everything up until the actual embedding in the video.
Anyone know the best way of doing this?
http://sendables.jibjab.com/ecards
...