php

PHP + ie6 + cookies: failing a hello world world for cookies

I tried, to no avail! My problem is php's setcookie() fails in IE6. It's fully functioning (albeit buggy) for Firefox 3 and IE7/8. The following is the code. IE6 displays fail. Simple question: why? <? header('P3P: CP="DEV PSAi NAV STP DEM OTRo NOI IDC DSP COR CURa ADMa OUR IND PHY ONL COM STA"'); setcoo...

rating system without reloading a page

i have a page on which i have some rating function like people who like the post can rate up or who don't can rate down. on that link im calling a php file with some parameters passed in the anchor tag. Then in that php file im saving that rating with +1 or -1 (whichever is the case) in the database and after doing that im redirecting t...

Include problems in PHP

I need to turn allow_url_include On. How can I do this? I have access to .htaccess as well as php.ini. I'm using PHP version 5.2.9 I've tried adding php_value allow_url_include On in .htaccess and allow_url_include = On in php.ini. Both files are at the root of my website. Is there a way to use the curl/get page function as a ...

Can anybody suggest the best image resize script in php?

HI i need all types of images resize script in php ...

How can I determine mySQL prepared statement result column names in PHP?

That is, with a prepared statement like: select col1,...coln from table where col3 = ? I believe I can use $mysqli->field_count to get the number of columns being returned (haven't tried). But is there a way to link each column name to the values returned in bind_results? I could always try to parse the column names out from the comm...

Facebook status update through php

Hi, I want to develop a bot which will update the status of a facebook account using php. Please guide me on this ...

How to sort MYSQL fulltext search results by relevancy

Hello, I am relatively new to MYSQL and have had an issue that has been bugging me for a while. I've tried googling all over the place for the answer, but have unable to find an acceptable solution as of yet. Here is the query I am running currently to find the best possible match for a given search term: $query="SELECT * from `vocabu...

Search engine redirecting

Hi I don't know the official terms for what this is called, but would greatly appreciate any advice. The scenario is as follows: I have an index.html page on my domain to serve as a 'Under Construction' page, while I develop the website behind that using Drupal on an index.php page. Is there any way in which I can have Google index th...

PHP and parsing XML question

I'm building a web form in which administrators on my site can add XML to a textarea and submit it to be stored in a database table, but I'm a little confused as to the best method of parsing the XML. The PHP script needs to parse the XML and if there are any parse errors it should return the error message and line/column where the pars...

Add quotes to values in a string seperated by a comma php

I have a search box that can contain multiple values using a comma, eg Pasta, tuna, eggs Im using FULLTEXT mysql search but I need to use some kind of preg_replace to turn Pasta, tuna, eggs into 'Pasta','tuna','eggs' If I enter this 'Pasta','tuna','eggs' into the search box the results are correct. Thanks people ...

php to extract a string from double quote

I have a string This is a text, "Your Balance left $0.10", End 0 how can i extract the string in between double quote and have only the text 'Your Balance left $0.10' (without the double quotes) Tried preg_match_all but no luck ...

migrate from C#.net 2.0 to php so the hash value of the password - how to resolve?

Hi we previously use a C#.net 2.0 to create a web app. Users password were hashed and stored in database using the following code. private const string encryptionKey = "AE09F72B007CAAB5"; HMACSHA1 hash = new HMACSHA1(); hash.Key = HexToByte(encryptionKey); encodedPassword = Convert.ToBase64String( hash.ComputeHash(Encoding.Unicod...

Fastest way to fill a table

Hey! I am trying to find the fastest way to insert data into a table (data from a select) I always clear the table: TRUNCATE TABLE table; Then I do this to insert the data: INSERT INTO table(id,total) (SELECT id, COUNT(id) AS Total FROM table2 GROUP BY id); Someone told me I shouldn't do this. He said this would be much faster: C...

How do I remove accents from characters in a PHP string?

I'm attempting to remove accents from characters in PHP string as the first step to making the string usable in a URL. I'm using the following code: $input = "Fóø Bår"; setlocale(LC_ALL, "en_US.utf8"); $output = iconv("utf-8", "ascii//TRANSLIT", $input); print($output); The output I would expect would be something like this: F'oo ...

php variables question

Is it possible to create a variable with a reg expression of some sort or some other type of code that might complete the below task? For instance, the data in var test = parta but could also be equal to partm. Note i don't want an array... I'm using this in a sql search, but I have 1000s of different models and series and only want ...

How to get X newest files from a directory in PHP?

The code below is part of a function for grabbing 5 image files from a given directory. At the moment readdir returns the images 'in the order in which they are stored by the filesystem' as per the spec. My question is, how can I modify it to get the latest 5 images? Either based on the last_modified date or the filename (which look li...

Proper Design of a MVC Project

I've been using Kohana for a couple months now, and am still relatively new to the MVC style of organizing your code/presentation/db-layer. Unfortunately, while there is plenty of documentation on how to create a controller, establish a view, and interact with a db via a model, I've not found many resources that deal with clean, and sugg...

Registration Codes/Server Verification & Joomla

This question can be broken up into a couple of parts: What is the best way to create a registration key for a product in PHP (ie. a person purchases a PHP program and after payment receives an activation key) I want to be able to store the registration keys on my server (Joomla) and associate the key with my existing users. Then the P...

how to "rewrite rule" for a sub-sub-directory? .htaccess/php

Hi I have one folder named test located at www.mydomain.com/abc/files/test. I need to change the URLs from www.mydomain.com/abc/files/test/test.php?id=15&key=some-text123 to www.mydomain.com/abc/files/test/15/some-text123 this is similiar to SO urls. I tried following in .htaccess file with following code RewriteEngine on Options +F...

PHP And MYSQ help

ok here is my php and mysql code: where it is bold i wanted to the the uid from the online table and if it in there where online.uid = '' i needed so it put the uid in there. $sql = ("select accounts.id, accounts.tgid, accounts.lastactivity, cometchat_status.message, ...