php

Simple question about javascript history.go

I have a classifieds website. In every classified, there is a back link which simply takes the browser back one step. This is because when users search classifieds, and click on one to view it, they can easily go back with a link also (instead of only the browser back button). Here is the problem, if the classified is entered directly i...

Hide URL of PHP page

I want to hide the URL of my PHP page; that is, I don't want to write /register.php directly in the href tag, I want to write /register/ and have it open the register.php page directly. I want to do that for all the webpages. ...

jquery ajax and php arrays

Hi There, I am trying to submit some data to a PHP script, however the PHP scripts expects the data to arrive in a specific format, like this example which is a dump of the post, Array ( [save] => Add to shortlist [cv_file] => Array ( [849709537] => Y [849709616] => Y [849709633] => Y ) ) The process is currently that a user selects t...

Problem with foreach loop and $_GET

I have a very simple foreach loop foreach($tv as $id => $channel) { $ID = $_GET['ID']; if($ID == $id){$class = "currentt";} echo '<a href="http://www.mysite.com/tst.php?ID='.$id.'" class="'.$class.'">'.$channel.'</a><br>'; } With url query, with every click the current class repeated. How can avoid this? Thanks alot. ...

PHP All Function Variables Global

Hi, I have a function called init on my website in an external file called functions.php. Index.php loads that page and calls function init: function init(){ error_reporting(0); $time_start = microtime(true); $con = mysql_connect("localhost","user123","password123"); mysql_select_db("db123"); } How can I get all of these ...

Nested foreach loops for associative array combinations

I have an associative array as follows: $myarray = array('a'=>array(), 'b'=>array(), 'c'=>array(), 'd'=>array()); I want to be able to get all pairs of elements in the array. If it wasn't an associative array, I would use nested for loops, like: for($i=0; $i<count($myarray); $i++) { for($j=$i+1; $j<count($myarray); $j++) { do_s...

.tpl files and website problem

Apologies if the title is in lowercase but it's describing an extension format. I've started using Dwoo as my template engine for PHP, and am not sure how to convert my PHP files into .tpl templates. My site is similar to, but not the same as, http://library.digiguide.com/lib/programme/Medium-319648/Drama/ with its design (except colou...

php nested for statements?

I'm trying to process a for loop within a for loop, and just a little wary of the syntax... Will this work? Essentially, I want to run code for every 1,000 records while the count is equal to or less than the $count... Will the syntax below work, or is there a better way? for($x = 0; $x <= 700000; $x++) { for($i = 0; $i <= 1000; $...

PHP: Inhibit AddOutputFilterByType .htaccess option

Hi, in the root directory of my webapp, the .htaccess file contains the following line: AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-javascript text/javascript This means that all my pages are gzipped, and it's ok. In some pages I need to make the browser close the connection before the script en...

grabing data from ajax request, is it possible?

When i need to get a content from a site, i use file_get_content() function, but now i need to grab a data, which loads after ajax request. so i can't mention the exactly url address. are there any algoritms to do such things? Thanks. ...

Php referrer works or not?

I need to know the referring server for a page on my site. Is there any safe method to check where the user "came" to the page FROM? I tried uploading this to my server, but this wont output anything at all when I write the adress to the file in the browsers adress bar: <?php echo $_SERVER['HTTP_REFERER']; ?> I need to check thi...

Check if hydrated doctrine result is NULL

Hi, I'm trying to check if a result in my DQL is NULL. I got the following DQL query: $q = self::createQuery("l") ->select('i.*, s.aantal, m.naam, c.cat_naam, a.app_id') ->from('InstalledBase i, i.Spare s, i.Apparaat a, a.Categorie c, a.Merk m') ->execute(); return $q; Now i want to check if the s.aa...

Is there a way to programatically access a bazaar repository?

I would like to access a bazaar repository and pull code from it with either a Python or PHP script. How is this done? Is there a Python module / PEAR library that makes this easy? If it helps, the repository is on Launchpad. Edit: As mentioned below, running the bazaar commands directly is not an option. Also, an example would be muc...

Compare http_referer value

My http_referer says this: http://www.domain.com/search/?etcetcetcetc... I need to compare my http_referer to look for this: http://www.domain.com/search And if the first part of the referer is this, then do some code... Ex: if($_SERVER['HTTP_REFERER']=='http://www.domain.com/search'){ do stuff... But first ...

User Database Script for iPhone API interaction

Is there any kind of PHP script that has a user database with custom tables that I can access through a RESTful API? I am wanting to create an iPhone app that interacts with the user database.. such as register, login, update info... Any ideas? Thanks! ...

php/mySQL error: mysql_num_rows(): supplied argument is not a valid MySQL result

I'm trying to INSERT INTO a mySQL database and I'm getting this error on: if (mysql_num_rows($login) == 1){ Here is the php, The php does add the user to the database. I can't figure it out. <? session_start(); require("config.php"); $u = $_GET['username']; $pw = $_GET['password']; $pwh = $_GET['passwordhint']; $em = $_GET['email']...

Using Cappuccino JS framework with PHP backend

I have php based application currently written using CI. I want to integrate Cappuccino JS framework at my UI layer. Does anyone know how can one go about doing that? ...

PHP MySQLi isn't letting me alter a table (adding a new column)

Well thats pretty much it. This is my query: $query = 'ALTER TABLE permissions ADD '.$name.' INT NOT NULL DEFAULT \'0\''; Where $name is already checked to exist with only lower case alpha letters, and not more than 20 length. Im just starting this out with very simple names. The next 4 lines of code after that one are: if($stmt = ...

is phpmailer secure enough on its own?

I'm using the latest version of PHPmailer, are there any security precautions i should take on top of phpmailer for preparing and sending messages? ...

Ruby function similar to parse_str in php?

Hi, I need to parse a string like this: a[metadata][][name]=dont|do|this&a[name]=Hello World&a[metadata][][value]=i|really|mean it CGI::parse gives me this: {"a[name]"=>["Hello World"], "a[metadata][][name]"=>["dont|do|this"], "a[metadata][][value]"=>["i|really|mean it"]} I would like something like what PHP does with parse_str, whic...