php

Apache.Httpd+Php or Apache.Tomcat+Java for large project

I want to start some large project. There are two technologies that i can use for it: 1. Apache.Httpd+Php 2. Apache.Tomcat+Java RDBMS is MySQL I need to select technology and argue the choice Thanks for advices ...

JavaScript: get original query string when url is rewritten

My page's url is rewritten like so, www.test-me.com/book-cat-white.HTML book is book.php cat is animal=cat white is color=white The original URL is www.test-me.com/book.php?animal=cat&color=white With PHP, I can get the values using $_GET, e.g. $_GET['animal']. How can I do the same in JavaScript? Is there a vari...

php image uploads

Hi Im wanting to accept image uploads onto my server. When a user uploads an image to the server I want to store its location in a database table. tblPictureStore: pictureid | serverlocation | caption | date added How can I do this? Also, How could I set up my add_Images form to quickly accept multiple uploads in one go, without know...

method_exists in parent class php

Hi, I'm trying to use the php function method_exists, but I need to check if the method exists in the parent class of an object. so: class Parent { public function myFunction() { /* ... */ } } class Child extends Parent { /* ... */ } $myChild = new Child(); if (method_exists($myChild, 'myFunction')) { /*...

Free resources while waiting for remote gate in (PHP, Apache, Nginx)

Hi, My php script waits for remote gate response, normally for ~20 seconds. It causes apache httpd threads to live in memory with opened MySQL connection and finally to exceed MaxClients value. How it can be managed to free idle resources until remote gate reponse. One solution is: 1) run remote gate request and then redirect user to ...

Zend Framework - How to do custom redirect with the redirector helper?

I want to use the URL schemes in Zend Framework like /list?id=2&name=test, something like that, when I do redirection, I call this way: $this->_helper->redirector('index','list','',array('id' => 2, 'name' => 'test'));. But the URL generated will be /list/index/id/2/name/test which makes it inconsistent. How do I prepare a URL scheme like...

PHP endforeach parse error

Hi folks, I'm learning PHP and CakePHP and I have a problem with the following code. When I execute it (with WAMP: PHP 5.3.0, Apache 2.2.11 and MySql 5.1.36) appears a parse error in the line of endforeach. Somebody knows what is happend? All the documentation I read it says that the endforeach; is legal but... I have a problem :-( Tha...

MySQL/PHP - Would putting quotes around numbers break any queries?

I want to have a generic PHP function that builds a mysql query based on the parameters of the function. Since it is generic the query may sometimes ask for id=123 or name='Bob'. I test out some queries with quotes around numbers, even stuff like WHERE id > '50' + 7 and it worked but I have my doubts that this won't cause trouble down t...

Advice when using MVC with php

Hi, Is it correct to use one view file with say 2 functions inside it. For example I have project table in my database and I have 2 functions inside the view file for this specific MySQL query. Each query returns a specific view so say function 1 = num_rows function 2 = data inside the rows Would this be correct or should I do s...

How to get the value form SimpleSAML_Session Object

The saml Session is SimpleSAML_Session Object $data = ( [trackid:SimpleSAML_Session:private] => 3eb [idp:SimpleSAML_Session:private] => https://abs.com [authenticated:SimpleSAML_Session:private] => 1 [attributes:SimpleSAML_Session:private] => Array ( ...

PHP output buffering to text file

I am having trouble with an update script. It runs for a few hours so I would like it to output live to a text file. I start the document with ob_start(); Then within the while loop (as it iterates through the records of the database) I have this $size=ob_get_length(); if ($size > 0) { $content = ob_get_contents(); logit($co...

Wordpress loop : get current post count inside The Loop

Hey, What i want to do i quite simple : when inside The Loop, i want to retrieve the current post count. For example, after every 3 posts, i want to insert an ad. So, how do i get the value of the loop count? Cheers, Kartik Rao ...

test if content is already published on users wall in facebook

Hi, im trying to automatically publish a post on the logged in users wall in facebook in my canvas (iframe) application. the only way to do this, is by using oauth via php i think? i see no way to do this automatically via the new js-sdk. so before i publish this post, i want to check, if i have already posted this content on his/her w...

Get contents of a url using Proxy, in php but without curl

I have to fetch content of some urls by using proxies from a list. All proxies requires authentication (i have username and passwords as well). Problem is i don't have curl installed on server , so can't use curl. I tried using sockets but having problem using that. Any help is appreciated . ...

Two files, exactly the same code, different output?

This is the weirdest thing that has ever happened to me sime I am a (PHP) programmer... I have two files, with the following code (proj. euler stuff) that return different outputs. <?php $numbers =<<<eot 2,3 5,2 9,3 4,9 6,3 10,5 eot; $numbers = explode("\n",$numbers); $max = 0; foreach($numbers as $k => $n){ list($base,$expo) = exp...

How to round a decimal number to nearest 5 or nearest 10 in php

How to round a decimal number to nearest 5 or nearest 10 in php ...

fopen returns Resource id #4

<?php $handle = fopen("https://graph.facebook.com/search?q=mark&amp;type=user&amp;access_token=2227470867|2.mLWDqcUsekDYZ_FQQXYnHw__.3600.1279803600-100001317997096|YxS1eGhjx2rpNYLNE9wLrfb5hMc.", "r"); echo $handle; ?> Why does it echo Resource id #4 instead of the page itself? ...

How to get called function name in __construct without debug_backtrace

How to get a caller method name in an class constructor, get_called_class() gives me the name of an extended class which was instantiated but how can I get the name of a method which was called in that class? I need this for a production state so debug_backtrace() is not a good solution. ...

preg_replace remove Youtube and Vimeo Object and Embed links

Hey! I'm really new to regex-expressions, so I was wondering if someone would bother to come up with one or more regular-expressions for removing Youtube and Vimeo object url's. It doesen't really matter that it only removes Youtube-objects/embeds, as long as it removes the <object> and </object> and everything in between. Thank you so...

HTML 1 click delete from MySQL database

Hey Guys, how would I create a link that would when clicked erase a record from a MySQL database based on the id of that item? using php if possible. edit// The link will require authentication in order to view Thanks ...