php

Can't pass mysqli connection in session in php

I'm trying to pass a session with mysqli connection for multiple queries on the site, but when I try to do a query it outputs a warning "Couldn't fetch mysqli" $_SESSION['db']=new mysqli($host,$username,$password,$db); Is it impossible to pass a mysqli connection reference thru session? is there a different method to use? ...

htaccess Redirect to same file, but display different URL without having to change internal links?

I currently have links on my website in the form of:- http://example.com/products.php?cat=X I want that once taken to the destination of the link, the url displays something like:- http://example.com/new. The file on my server is the same file, but only the url should appear neater without me having to change any of the links. I tri...

Text Parser with PHP, like Instapaper

Hi, I'm trying to write a text parser with PHP, like Instapaper did. What I want to do is; get a webpage and parse it in text-only mode. It's simple to get the webpage with cURL and strip HTML tags. But every webpage have some common areas; like header, navigation, sidebar, footer, banners etc. I only want to get the article in text mo...

i cant use imagecopyresized

I have a problem with the GD functions. When I upload an image on localhost, everything works fine, and a thumbnail is created, but when I upload my website on hosting then imagecopyresized just fails. When I insert in a blank page, that function (whole resize function) it works just fine. What could be the problem? Update: Actually ...

Removing default routing in symfony causes internal server error.

Error Message: The route "default" does not exist. Yes, it doesn't exist. But as described in the Doctrine version of "Practical Symfony | Day 5" everything should work well when default routing is removed, because all actions of the job module has been successfully routed by other routers. I get the error when I request the URL below...

PHP Encoding with a Remote Key?

I have coded a pretty nice class and I'd like to install it on the clients server without risking them taking the code and not paying me. If possible, a method where I have the "key" on my server, and encrypt the source code on the clients server with that key and some how code the method for retrieving the key from my server into it, s...

Are out there any PHP to Haxe translators?

So I want to port WordPress to Haxe. I need HP to Haxe translators. Where can I get tham? ...

PHP Regular expression help

I have a function that loads all image files it finds in the wordpress uploads directory. I'd like to modify it slightly so that it skips over any image that begins with an underscore character, "_someimage.jpg" is skipped, while "someimage.jpg is not... Here is the existing function.... $dir = 'wp-content/uploads/'; $url = get_blogi...

Some questions about the performance of PHP Objects

Right now since I am new to using Objects in PHP I feel like in my head, I think of a PHP object as being something big and bulky. This makes me want to use them less often, I feel Like I am taking really simple code and really over-complicating it by putting it into objects. If I have a database, cache, session, core, and user objec...

Wordpress loop inside of function = fatal error

I have my Wordpress blog on blog.mysite.com, and a totally different site (built in my framework) at www.mysite.com. I know if the blog and another site are on the same server, and have correct permissions, I can use the following to "syndicate" my blogs to the non-blog site with: define('WP_USE_THEMES', false); require('/var/www/vhos...

PHP - writing data to a file with 777 permission

I have a .TXT file in a web-server with the permission as 777. So what are the changes that others might be able to edit the content of this file? The content is not much - just a number. Someone seems to have been tinkering with this file as the number vanished the other day! No one else except me has the FTP password. So I was wonderi...

Error Using Multiple Database In CodeIgniter

Hi ..., I'm trying to implement mutiple database in CI. My code Is here: //database.php $active_group = "default"; $active_record = TRUE; $db['default']['hostname'] = "localhost"; $db['default']['username'] = "root"; $db['default']['password'] = "root"; $db['default']['database'] = "ravelex"; $db['default']['dbdriver'] = "mysql"; $db['...

delete session files after a time from creation

hello, I am saving my sessions in another directory from /temp directory. say /session directory.( using session_save_path("session") ) also, there is a code to kill the session after 10 minuets from creation and logout. but I mentioned that if the user logs in and for example shut down his computer, my log out and session destroy cod...

PhP/MySQL Storing User Searches between Pages so the User Can Go Back to Them

I'm writing a php-mysql application. The application allows the user to run a search against the database. When the search is run, if the user clicks on the back button to go back to it after examining an item brought up by it, they are asked if they would like to resend the query (it uses post). Which would rerun the search in the da...

Auto Refresh Wordpress Post Div

I would like to autorefresh a certain div with the ID of blue everytime I update a post with that ID. I know the Jquery code looks something like this: var auto_refresh = setInterval( function () { $('#blue').load('load.php').fadeIn("slow"); }, 10000); Instead of loading "load.php" I would just like to reload the updated contents in t...

PHP Array Operation

$arr = array('id1','id2',...); How to get #id1,#id2,.. from the above array? ...

PHP with Zend Framework can't start a SQLite database?

Trying to get a simple PHP/Zend Framework setup to create a SQLite databse and manipulate it. <?php require_once("Zend/Db.php"); // Zend framework $db = Zend_Db::factory('Pdo_Sqlite', array("dbname" => "./test.sqlite3")); $sql = "CREATE TABLE IF NOT EXISTS ".$db->quoteIdentifier("configs")." (".$db->quoteIdentifier("name")." TEXT NOT ...

Uploading a file through exec, hanging script

Basically in a nutshell is I am using exec() to run WinSCP, which is causing the script to hold until the file is uploaded. Is there anyway to make it so that the script continues, and the upload runs in the background? Running PHP 5.3.1 on Win7. ...

How to make a post to wordpress using the api?

How can I remotely make a post to a user's blog after he/she gives me his login info using the wordpress api? What method do i need to use, what paremeters should it have, etc? Sample code will be great. I'd prefer to use the XML-RPC api but others will also be acceptable. ...

Switch or If statement quicker in PHP, and why

Hello, Does a switch or If statement quick to execute, where there are atleast 10-20 conditions Thanks Dave ...