php

PHP Find All Combinations

Hi all, I'm trying to find all possible combinations of a word, and have certain letters replaced. So, I have the following code: <form name="search" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <input type="text" name="searchterm" /> <input type="submit" value="Submit"/> </form> <?php function pset($array) { $re...

Ajax request delimiters for data to be sent

Hi All, I have such an issue var url = "index.php?id=123&sid=321"; $.ajax({ type: "POST", url: "some.php", data: "name=John&url="+url, success: function(msg){ alert( "Data Saved: " + msg ); } Now here we have url which contains an & , but & is used to delimit data variables to be sent to server and so since we have...

How to disable PHP cutting off parts of long arguments in exception stack trace?

Sometimes things like this happen: #0 /some/path(1): Class_Name->exception_trigger() #1 /some/other/path(5): get_to('/some/long/path/tha...') How to I get to see the full arguments for everything? Thanks ...

Passing and URL as parameter in mod-rewrite

Hi Folks! I'm trying to pass an URL as a parameter in mod-rewrite. I guess there is a problem in my Regex. This my .htaccess: <IfModule mod_rewrite.c> RewriteEngine on RewriteRule **^go/((http:\/\/)+[A-Za-z0-9\-]+[\.A-Za-z])/?$** feedmini.php?url=$1 [L] </IfModule> the URL I want to pass looks like http://www.aaaa.com/aaa/?q=v but ...

dynamic object creation php, creating object from param problem

Hi, So Im trying to make an object dynamically, please see below code from my item model function get_total($param) { $i = new Item(); $items = $i->get(); $total_value = 0; $query = "$item->".$param; foreach($items as $item) { if($item->qty > 0) { $total_value += $query * $item->qty;...

zend newbie question - "No adapter found for "

Working through a zend tutorial & get this message, & not sure where to look. thanks, An error occurred Application error Exception information: Message: No adapter found for Model_DbTable_Books Stack trace: #0 C:\xampp\php\PEAR\Zend\Db\Table\Abstract.php(739): Zend_Db_Table_Abstract->_setupDatabaseAdapter() #1 C:\xampp\php\PEAR\Zend...

phpFlickr Caching to Filesystem or MySQL?

Are you supposed to be able to see distinct filenames via phpFlickr's caching to filesystem or MySQL? I've set the parameters as listed in the readme, but caching does not seem to generate any files or mysql table rows. I've tried both the filesystem (chmod 777 in cache folder) and mysql method (manually created cache table). Any advic...

Inserting Data into MySQL Table via PHP

I'm trying to add some simple user data into a database via a webpage written in PHP, but the following code (more specifically, line three) breaks the page. Am I using the wrong MySQL function? I'm pretty sure my query is formatted correctly. mysql_query("CREATE TABLE stats ( userAgent CHAR(20) )"); $userAgent = $_SERVER["HTTP_USER_AG...

php mysql select all with same data

I have a table with 3 cols, incremeting id, name, and data What i'm trying to achieve you enter a $name... and returns $data... then it takes $data and finds all $names that have the same $data. SELECT * FROM table WHERE name ='$name' data='$data' and data!='0' does not seem to cut it.. I'm basically trying to get all rows that hav...

Prevent curl generating fatal error for larger files

I am using curl and php to find out information about a given url (e.g. http status code, mimetype, http redirect location, page title etc). $ch = curl_init($url); $useragent="Mozilla/5.0 (X11; U; Linux x86_64; ga-GB) AppleWebKit/532.9 (KHTML, like Gecko) Chrome/5.0.307.11 Safari/532.9"; curl_setopt($ch,CURLOPT_HTTPHEADER,array ( ...

uploadprogress_get_info and large files

It seems that the PECL package "uploadprogress" works on files less then 10MB, But Anything greater than 10MB, it fails miserably. I've changed my php.ini to support larger upload, but it just doesn't return anything! Any Help on this? ...

array_push key=>value , how can do it?

Hi , all I want to push key and value in array , but I can't $con = mysqli_connect('localhost','root','','wp') or die (mysqli_error('Error:')); $query = mysqli_query($con,'set names utf8')or die (mysql_error()); $qy = mysqli_query($con,"SELECT ID,post_title FROM wp_posts WHERE post_type='page' AND post_status='publish'")or die (mysql...

How to program a super simple software activation system?

Hi, I have a piece of shareware that I wrote that I'd like to distribute on the internet. I have a serial number type thing set up but there is still a ton of key sharing :(. I'd like to add a system where once the user enters the serial, it is checked with my server to make sure that it is valid. Simplicity is key. -Client sends MD5 o...

PHP - generating JSON output

$showcaseObject = new stdClass(); $generalObject = new stdClass(); $generalObject->roundCorner = 0; $generalObject->borderStroke = 2; $generalObject->backgroundColor = '#fff'; $showcaseObject->general = $generalObject; echo json_encode($showcaseObject); and i get something like this {"general":{ "roundCor...

What's wrong with this php/regex query?

preg_replace("/(/s|^)(php|ajax|c\+\+|javascript|c#)(/s|$)/i", '$1#$2$3', $somevar); It's meant to turn, for example, PHP into #PHP. Warning: preg_replace(): Unknown modifier '|' HALP ...

Why would you ever use $_GET in PHP?

I haven't officially started learning PHP just skimming through a couple tutorials and I have a question. Why would some one choose to use Get vs Post? Why would you ever want the data shown in the url bar? I understand post is used for passwords and important info but I don't understand why you would use get instead of just post all the...

Custom Environment Variables in PHP

Is there a way to set a custom variable such as environment_name in my apache vhost file that can be read via $_ENV or ini_get("environment_name")? ...

Can't Connect to PostgreSQL with PHP pg_connect()

EDIT: I just realized that this question may be better suited to ServerFault. Instead of copying it, a moderator please move it over? Thanks. I've checked php-info, and the Postgresql extension is there (pg_connect() is not undefined). I am also able to connect to postgresql using psql on localhost (I've edited my pg_hba.conf file appro...

regexp find match

I'm working on a regexp to find and replace all matches that don't start with url(http relative paths are going to be converted to full absolut paths ie: url(foo/bar) > url('http://foo/bar') match: url(foo/bar) url('foo/bar') don't match: url(http://foo/bar) url('http://foo/bar') This is what I've come up with so far, but I'm n...

PHP Authorize.Net problem with credit card Expiration Date

I am trying to do a CIM transaction using authorize.net but whenever i am entering the credit card expiration date in the specified format(YYYY-MM) I am getting an error showing the date field length is greater than the maximum value and the date shown in this result is by default appending the "DD" portion. Please help me in getting th...