php

access and display wordpress posts from out of wordpress.

Hi friends, I have a commercial site (php), and have a Wordpress blog in a subdirectory. I need to display latest posts at homepage which is out of Wordpress :/ site: http://www.blabla.com blog: http://www.blabla.com/blog/ So I need to display posts at www.blabla.com/index.php. How can I access Wordpress functionality? Thanks a lot!...

Access array returned by a function in php

I'm using a templating engine that inserts code in my site where I want it. I wrote a function to test for something which is quite easy: myfunction() { return '($this->data["a"]["b"] ? true : false)'; } The problem is, $this->data is private, and I can't access it everywhere, so I have to use getData(); which causes my problem. $th...

breaking up strings with explode and foreach

I'm Trying to get a php string to break down into individual words, search for them in a database and then add the results into another database.. I currently have the string like this "SDGCC, ARISE, SDGFS" I want to search in the login tags table for tags LIKE these words i'm using this SELECT * FROM logintags WHERE tag LIKE '%st...

query for checking database is already existing

how can i check if a database is already existing ...

How to quickly obtain PHP localised ordinals using Zend_Locale

Hi, I need to localise ordinal values i.e 1st, 2nd, 3rd etc.. into various european languages There doesn't seem to be an option for doing this with Zend_Locale. Anyone know of a way of doing this in 5.2.x without the intl pecl extension? To be clear, 5.3 is not an option and installing an additional extension may not be either. Anyone...

php + mysql_num_rows issue?

Hi, I have a simple sql statement and I would like to perform a different action depending on the number of rows returned. $result_lists = mysql_num_rows(mysql_query("SELECT * FROM db_table")); //To see the number returned print_r($result_lists); switch($result_lists) { case($result_lists == 0): //To prove...

Self-extracting web environment

Hi, Basically I have two applications: a PHP web application that runs over Apache and Mysql a ruby application that has been built with gem dependencies What I would like to be able to create is a self extracting archive; once all the files have been extracted into any directory, my users can just click two bat files: the first o...

unterminated string literal

i'm using jquery to output the results of a json string created by php from a database, the only problem is, that some of the data is on multiple lines... how would i get around this causing a unterminated string literal error in javascript? ...

PHP $_SERVER['HTTP_HOST'] vs. $_SERVER['SERVER_NAME'], am I understanding the man pages correctly?

I did a lot of searching and also read the PHP $_SERVER man page. Do I have this right regarding which to use for my PHP scripts for simple link definitions used throughout my site? $_SERVER['SERVER_NAME'] is based on your web servers' config file (Apache2 in my case), and varies depending on a few directives: (1) VirtualHost, (2) Serve...

secure and resume support file downloading with php

I want to give permission to some of my website users to download a specific file. the download needs to be resume support just for user convenience. For that reason it came to my mind to secure the file with this piece of code: // Check for user session and privileges if it's okay continue ob_end_clean(); $data = file_get_contents("c:...

FTP Upload in PHP

hi All, I have installed XAMPP vrsion 1.7.2 on my Mac OS 10.5.7 ? I am using the following code to upload a file , but i am getting few errors <? $host = 'localhost'; $usr = 'nobody'; $pwd = 'xampp'; // connect to FTP server (port 21) $conn_id = ftp_connect($host, 21) or die ("Cannot connect to host"); // send access parameters ftp...

creating watermark in pdf's created with dompdf's php5 class

Hi, Is it possible to place a watermark into a PDF generated by the dompdf's php5 class? If yes; how do I do it? If no; is there another way? ...

check manually for jpeg end of file marker ffd9 (?) in php to catch truncation errors

basically trying to remove corrupt, prematurely ending jpeg files from a collection. i figured if the end of file marker was absent then that meant the image is truncated and therefore i would consider it invalid for my purposes. is this method of checking sound? if so any ideas of how i could implement this in php? cheers ...

Going from unsalted to salted MD5 passwords

I have a LAMP (PHP) website which is becoming popular. I played it safe by storing the user passwords as md5 hashes. But I now see that's not secure; I should have salted the md5 hash - because it's currently possible to decode unsalted md5 hashes using rainbow tables. What can I do? I don't want to make everyone type a new password....

When a PHP function returns an array, can I access its elements inline?

In PHP, this code works: $usage = (package_manager_get_user_usage($uid)); $usage = $usage[email]; But this does not: $usage = (package_manager_get_user_usage($uid))[email]; Why? They appear to be doing the same thing. ...

Returning An Array of Objects in PHP Web Service

Hi, I want to return an array of article objects in a PHP web service, using nuSOAP v 1.114. This is how I set up the WSDL: $server->wsdl->addComplexType( 'ArticleType', 'complexType', 'struct', 'all', '', array('articleId' => array('name'=>'articleId', 'type'=>'xsd:int'), 'heading' => array('name'=>'heading', 'type'=>'xsd:string'...

How to pass a session between tomcat and php.

Hey, I am in a WTF code situation working on a jsp tomcat server and trying to pass session data (user id, etc.) to php. i am planning to rewrite php session handling with session_set_save_handler() my question is where does tomcat stores it session data (harddrive?) and what kind of encoding does it uses? or am i on the wrong path? i kn...

Magento tutorial create a module for the backand (admin page)

Does anyone know a good tutorial for this subject. I want to create a module (extension) with more than one page. The extension must contain one overview page and a form to create a item. ...

Protection against SQL injection

Does the following PHP MySQL statement protect against SQL Injection? $strSQL = "SELECT * FROM Benutzer WHERE Benutzername = '".$Benutzer."' AND Password = '".md5($PW)."'"; The Variables $Benutzer and $PW are inputs from the User. We're checking the username and password against common SQL Injection techniques: ' or 0=0 --, " or...

PHP not letting me pull defined variables from external config.php

I'm moving a PHP site from development to a production server and testing the new database connection. I have a config.php page that has only this (but with real data): <?php // Database Constants defined('DB_SERVER') ? null : define('DB_SERVER', 'xxx.xxx.xxx'); defined('DB_PORT') ? null : define('DB_PORT', 'yyy'); def...