php

Get all images url from string

Possible Duplicate: How to extract img src, title and alt from html using php? Hi, I have found solution to get first image from string: preg_match('~<img[^>]*src\s?=\s?[\'"]([^\'"]*)~i',$string, $matches); But I can't manage to get all images from string. One more thing... If image contains alternative text (alt attribute) h...

Copy all files and folder from one directory to another directory PHP

Hi, I have directory called "mysourcedir" it has sonme files and folders. so i want to copy all content from this directory to some other "destinationfolder" on Linux server using PHP. function full_copy( $source, $target ) { if ( is_dir( $source ) ) { @mkdir( $target ); $d = dir( $source ); while ( FALSE !== ( $entry = $d->read() ...

How to execute a applescript from php.

Anyone know how to tell php execute a applescript? ...

Creating an object from a class in Codeigniter

The following codes are from http://d.hatena.ne.jp/dix3/20081002/1222899116 and codes are working well. This is an example of using snoopy in codeigniter. Q1. Am I correct to say that I can't use, $this -> load -> library('snoopy') since Snoopy.php does not create an object. And the example below is the way to do it? If so, can you ...

Uploading a file to an external site with progress reporting

Hi, here is my situation: I want to create an AJAX file-upload script, which will upload to an external site (ie: not the one the script is located in) and at the same time report the progress of the upload. How would I go about doing this? Note that the process must be secure. ...

Automatically add "$" character into PHP scripts

I have a programming text editor (written in PHP) and want to remove the $ signs available in PHP scripts upon loading of the document for editing ... to "quietly" insert them back once the user saves the file. Basically, I want to save the user the work of always typing the $ icon in front of variables (similar to how you don't have to ...

Converting big String back to Array - PHP

Hello everybody. [Check My EDIT for better Explanation] I need some help with a very big string i have. Its like this: $big_string = "TinteiroID:1#TinteiroLABEL:HP CB335EE#TinteiroREF:CB335EE#TinteiroMARCA:HP#TinteiroGENERO:Tinteiro Preto Reciclado#TinteiroQUANTIDADE:23#FIMPROD#TinteiroID:4#TinteiroLABEL:HP 51633 M#TinteiroREF:51633 ...

Error: file is encrypted or is not a database

Hi, I used PHP to create a database with a table. I did it in the following way: <?php $db = new SQLiteDatabase("test.db"); unset($db); $db = sqlite_open("test.db"); sqlite_query($db,"create table students (names char(255))"); sqlite_close($db); ?> After I execute my PHP file from the command line: "php test.php" I get a new file in m...

How to make an xpath result into a string with PHP?

if($xmlobj = simplexml_load_string(file_get_contents($xml_feed))) { $result = $xmlobj->xpath("TrafficMeta"); } The above code returns the desired result and when viewed with print_r it shows this, which is what I want to get (sessionId): Array ( [0] => SimpleXMLElement Object ( [sessionId] => tbfm1t45xplzrongbtbdyfa5 ) ) How ca...

Simple check (PHP) to see if Shoutcast radio is online?

Basically, just a simple script that can check to see if a shoutcast radio is online or not, and output a code based on it. I tried to do this with file_get_contents and eregi, but it didn't seem to work, or was waaaaay to slow. Cheers. :) ...

How to create a session in PHP with a randomized string?

How do I keep session state of a variable throughout a site? For example: A user lands on my website, the string generated is $string = 'uejsh37rhda283jde86541as'; (This string is autogenerated by an xml feed on every page refresh). Now, everything works so far ok. The problem is when the user clicks on another page on the site, ...

Tinymce - insert html code

Hello folks, I would appreciate if there is someone who can help me solve this problem, I've been trying to resolve it for few days, but with no success. I made custom button that inserts image into code, and here is textual version: <a href="javascript:;" onmousedown="tinyMCE.execCommand('mceInsertContent',false,'<br><img alt=$img_titl...

download link hidden

I'm working on a shop system and I have the following link http://cmstutorials.org/shop/downloads/2793156879 (original link is cmstutorials. org/shop/downloads.php?download=2793156879) what I'm trying to do is let the user download the item that matches with the id 2793156879 withouth showing the actual link to the file. Like they have ...

selecting results by postcode / longitude / latitude

i have 3 tables: 1 contains people with their city (comes from other table) and the range (int, 1-20) they want to be found in (in miles) 1 contains cities and the beginning of the postcode (i.e. BB2) 1 contains cities and their logitudes/latitudes what i am trying to do is select the people according to a postcode someone enters. if th...

How to Store Passwords in Databases and Cookies (PHP/MySQL)

Hi, Having read this article and many others out there on how to not store passwords in databases and cookies, I'm wondering now how I should do it... What I've come up so far (after reading around a bit) is taking the clear-text user password, padding it with salt till it fills up 512 bits (64 bytes => 64 chars, since the page is non-...

Help with setting a session

Hi Guys, I tihnk my other question was a bit vague so... This is the situation. I have an xml feed that generates a random 24 character string on every page refresh. So, when a user visits my site and lands on a page called 'how-to-make-blue-widgets.php' - their unique string is generated as 38jsue710ppahchd67ywha94 for example. No...

PHP: POST data + apostrophes

Imagine this: Form data contains an apostrophe Form gets submitted POST data gets serialized POST data is written to database Database data is retrieved Data cannot be unserialized The problem is found in the serialized data. I tried without and with an apostrophe: s:7:"company";s:12:"Joes company" s:7:"company"...

Clicker counter script not working properly!

I have this php code: <?php if(!file_exists('counter.txt')){ file_put_contents('counter.txt', '0'); } if($_GET['click'] == 'yes'){ file_put_contents('counter.txt', ((int) file_get_contents('counter.txt')) + 1); header('Location: ' . $_SERVER['SCRIPT_NAME']); die; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:...

php file/folder treeview with descriptions script?

Hi, I am displaying a file/folder structure using a treeview component using PHP, for an online library. Now I need to be able to add optional descriptions to each folder/file, so I guess I need to cross this with a mysql database. I was wondering if someone knows of an opensource script that will let you do this, so as not to have to ...

What's the final solution to set html attributes with PHP?

I'm now doing it this way: <a title="<?php echo $title; ?>">... But it will brreak when " is included in $title. ...