php

Problem with class variables , to use them in if block in function

I am having problem in accessing variables in class here's the code class Text { private $text = ''; private $words = ''; // function to initialise $words private function filterText($value,$type) { $words = $this->words; echo count($words); // works returns a integer if($type == ...

exploring zip archive by PHP

this my code $z = new ZipArchive(); if ($z->open('file.zip')) { for ($i=0; $i<$z->numFiles;$i++) { $aZipDtls = $z->statIndex($i); echo $aZipDtls['name'].'<br>'; } } it returns docs/ docs/INSTALL.html docs/auth_api.html docs/install/ docs/install/index.htm but i want i...

Using an accordion in a view in codeigniter

Hi, I am currently building a website in codeigniter that is based around the idea of being a one page, site, I currently have a main view that looks like this, <?php $this->load->view('template/main_menu.php'); $this->load->view('template/left-content.php'); $this->load->view('template/right-content.php'); ?> In the ri...

Is this a bad login algorithm in flash, php and mysql ?

My site is in flash. The login is also in flash. This is the login flow: Enter username and password Send to authentication.php page Here is my doubt on authentication.php page: (1) Check the post parameters, i.e username and password (2) Sha/hash the password (3) Q1(query 1), select username and password from users table (4) If ma...

How to disable eval function without going to php.ini file?

Hello All, Is there a way to disable eval function without doing so from php.ini file. I have tried ini_set function but even that doesn't work. Basically I want my framework users to decide whether this function should be enabled or not through a config file. If they say no, i should be able to disable it using code as i can't go to s...

2CO Dontate Button

Hello There, How can I make a 2CO donate button? Thanks ...

Good PHP Email Library?

Hello There, I would like to know which is the good opensource php email library to incorporate in my next project? Thanks ...

Search engine optimization for kml file type

I've a web site that generates kml files. An uri like this: /tokml?gid=2846 Generates a file like this: Mt. Dana Summit Trail.kml Using Header('Content-Disposition: inline; filename="Mt. Dana Summit Trail.kml"'); in a PHP script and running on Apache http server. But a Google search on filetype:kml will not give any results from my we...

How to design a Wolfram Alpha-like search engine?

I want to build a search engine that is similar to Wolfram Alpha. I want to insert a query and receive a response from a dedicated database, or multiple databases for multiple responses. Up until this point I know HTML + CSS, but I am mostly focused on design. I want to expand my skill set and create a web application like this but on a ...

UCS2/HexEncoded characters

Any one can help me ? how could I get UCS2/HexEncoded characters like 'Hello' will return "00480065006C006C006F" This are the HexEncoded values: 0048 = H 0065 = e 006C = l 006C = l 006F = o* Also in arabic (!مرحبا عالم) will return 06450631062d0628064b06270020063906270644064500200021 How I can get the encoded UCS2 in php? ...

Get all constants from class

Is it possible to fetch all defined constants from class ? I.e. I have following class: class Cl { const AAA = 1; const BBB = 2; } and I would like to get an array: array ( 'AAA' => 1, 'BBB' => 2, ) ...

Output of ZipArchive() in tree format

i have this list of files i get it by new ZipArchive(); i mean its in zip file now ths files docs/ docs/INSTALL.html docs/auth_api.html docs/corners_right.gif docs/corners_right.png docs/COPYING docs/corners_left.png docs/bg_header.gif docs/CHANGELOG.html docs/coding-guidelines.html docs/hook_system.html doc...

Timestamp of nearest valid month

Just a quickie.. How to derive the unixtime of nearest March or June? If the current month is February of 2009, the script should give the unixtime of March 01, 2009. If the current month is April of 2009, the script should give the unixtime of June 01, 2009. If the current month is October of 2009, the script should give the unixtime...

mysql - update two records at once

Using PHP's msqli is it possible to update two records with one query? First I do a SELECT to check that $pay_user has enough game currency in his account, if he does then I do the following... My update query is: "UPDATE account SET money= money - ".$money." WHERE User_id=".$pay_user "UPDATE account SET money= money + ".$money." WH...

PHP regex for filtering out urls from specific domains for use in a vBulletin plug-in

I'm trying to put together a plug-in for vBulletin to filter out links to filesharing sites. But, as I'm sure you often hear, I'm a newb to php let alone regexes. Basically, I'm trying to put together a regex and use a preg_replace to find any urls that are from these domains and replace the entire link with a message that they aren'...

Is it possible for $_SERVER['SCRIPT_FILENAME'] to not be set?

Hey everyone, some background info: In the config file for my website, I set the mysql database name, username and password based on the contents of $_SERVER['HTTP_HOST']. Because it is possible for this variable to not be set in the case of old (HTTP 1.0) requests and cron jobs, I include a file that spoofs the $_SERVER['HTTP_HOST'] va...

from multi dimensional array to mysql

I have a multidimensional array called $data that is basically data extracted from a table into the array. This is how I get my array using JS_extractor: set_include_path(get_include_path() . PATH_SEPARATOR . './library/'); require_once 'JS/Extractor.php'; $extractor = new JS_Extractor(file_get_contents('temp.html')); $body = $ext...

PHP/MySQL - How to display PHP generated text any where on a web page using PHP?

I want to display part of the script any where on the web page that generates the text to tell the user they submitted something. How can I fix my script in-order to do this? And what part of my code should be changed? Here is the part of the script that I want to display anywhere on a web page. if (count($tags) == 1){ echo $tags[0]...

how to capture CURL / XML data with Apache?

Hi, I'm developing a gateway script that needs to send info to another provider's server, and I need to debug the code. Is there a way, on my own Linux + Apache + PHP server to capture the CURL / XML data from this script? I know with PHP, that I could see for example the $_POST, $_GET or $_REQUEST data in a script, but with CURL I...

How can you compare sets of numbers and get the most relevant results using MySQL and PHP?

Consider this: set A: 1 2 3 4 set B: 3 4 5 6 set C: 4 5 6 7 set D: 1 I want to compare D with the rest and get as a result a set of numbers as most relevant. The result should be in this order: 4 (as D has a common number with A and 4 is in A and also in B and C), 3 (as D has a common number with A and 3 is in A and B), 2 (...