php

Php get Navigation

Hie I use the GET method for navigation on one of my websites. The problem is that some dirty Einstein has create a link that calls another domain: http://www.mywebsite.com?products=http%3A//www.dirtyeinstein.com?fishform.inc Is there a script that i can use to block this kind of abuse. Thank you. ...

protect specific url with .htaccess

I have a central script 'web' in the root of my site that handles everything. In the .htaccess the following lines tell appache to handle 'web' as a php file: <Files web> ForceType application/x-httpd-php </Files> The script 'web' splits the REQUEST_URI in parts so it can generate the right page: http://www.mysite.com/web/var1/var2/v...

Convert to dd/mmm/yyyy

I am retrieving date from MySQL in the format yyyy/mm/dd 00:00:00. I want to convert this date into format dd/MMM/yyyy in PHP. How to do this? ...

Can I change items in jquery dynamically?

I have the following jquery. $(function() { $('div#slideshow').append('<img src="images/forsiden/grans_julebrus.jpg" /><img src="images/forsiden/cappelen_hippo.jpg" /><img src="images/forsiden/capplen_grandmarap.jpg" /><img src="images/forsiden/agm_peace.jpg" /><img src="images/forsiden/cappelein_aboriginee.jpg" />'); ... ... I want t...

Store complete request in a PHP variable

Hi, I'm creating a framework in PHP, and I need to get the complete raw request done by the browser. So I want something like this in a variable: POST /lolzorz/xD HTTP/1.1\r\n Host: localhost\r\n User-Agent: UserAgentHere/1.0.00\r\n Content-Type: application/xml; charset=utf-8\r\n Content-Length: 0\r\n \r\n <?xml version="1.0" encoding...

PHP $_POST variables are sometimes empty

Hi All I am a PHP novice and I am having a problem with POST variable sometimes being empty when I submit them. The part which is making this difficult for me to figure out is that this doesn't happen every time, and I can usually get the post data in my PHP program by simply refreshing the page. Sometimes it will take a few times, but ...

australian mobile numbers strings formatting

i need to format mobile numbers. e.g. +61421 123 123 0421 123 123 0061421123123 0421 123123 1) into this type of string to save in the dbf 0421123123 2) then display it in this format 0421 123 123 any suggestion on the most effective way to format the numbers? ...

open_basedir restriction in effect. File(/) is not within the allowed path(s):

I'm getting this error on an avatar upload on my site. I've never gotten it before and nothing was changed recently for me to begin getting this error... Warning: is_writable() [function.is-writable]: open_basedir restriction in effect. File(/) is not within the allowed path(s): ...

PHP teaching supplements?

I have a friend who has wanted to learn PHP for a while. She is very bright and picks things up quickly, so what I have been able to show her has helped quite a bit. I have been coding in PHP for ten years or so. The problem is that I can answer most any questions she has, but I do not have time to sit down and put together a line of pr...

How to make a workeable <a href.. in PHP

Hi all, I'm using this code $patterns = "!((http:/{2}[\w\.]{2,}[/\w\-\.\?\&\=\#]*)|(www\.[/\w\-\.\?\&\=\#]*)|([a-zA-Z0-9-\.]+(com|us|co.il)[^\s]*))!e"; return preg_replace($patterns, "'<a class=\"highlight boughtAt\" href=\"\\1\" title=\"\\1\" target=\"_blank\">'.(strlen('\\1')>=$chr_limit ? substr('\\1',0,$chr_limit).'$add':'\\1').'<...

PHP/MySQL Ordering MySQL Data problem?

I was wondering how can I order my MySQL data using the DESC and ASC in my following code I tried doing this but some how it did not work can someone help me fix this problem. Here is the code. $result = mysql_query("SELECT a_tags.*, tags.* FROM aa_tags INNER JOIN tags ON tags.id = a_tags.tag_id WHERE a_tags.users_a_id=3...

String concatenation vs array implode in PHP

Having used Java for a long time my standard method for creating long strings piece by piece was to add the elements to an array and then implode the array. $out[] = 'a'; $out[] = 'b'; echo implode('', $out); But then with a lot of data. The (standard PHP) alternative is to use string concatenation. $out = 'a'; $out .= 'b'; echo $ou...

Can I use the assemblies PublicKey to decrypt a string encrypted with the corresponding PrivateKey?

Signing an assembly in .NET involves a public/private key pair. As far as I can tell from what I've read .NET uses the RSA algorithm and the private key to sign the assembly, checking it with the embedded public key. I know how to retrieve the public key (Assembly.PublicKey). I was wondering, if that key could be used to decrypt a short...

How to place multiple content types on a Drupal page?

Hi all, I've created a new content type called Homepage, which has a number of fields. The fields are node references to the Single Image Promo content type. Single Promo Box has fields for title, text and image. The idea is that I can create multiple copies of a Single Promo Box, each with different field values. I then want to place a...

convert 01, 02, 03, 04 .. 09 to 1,2,3,4 ... 9

Hay how can I convert 01 to 1 02 to 2 all the way to 9? Thanks ...

JavaScript function in PHP page causing issues with PHP tabs format

I am trying to reference a JavaScript file, containing a table sort function, in a PHP file. Everything functions the way it should, but once I add the code below to my PHP report page it causes issues with the format of the tabs on my navigation page. The same issue comes up if I add a random document.write outside of the PHP code. Not ...

amfPHP Function Input Trouble

Hello, I'm writing an amfPHP function which should take string input. It takes alphanumeric characters without a problem, but unfortunately it returns data as "2" if I send "2.UgnFl4kAWovazp_tVo6fHg__.86400.1260025200-571701419" as parameter. here is the function (real simple as you can see) function checkOpenSession($guid, $session_k...

What PHP framework is most similar to Apache Wicket?

Feature I'm looking for is being component based but not event driven. I also like the idea of defining component in his parent code but describing its placement and some visual aspects in the template of his parent. ...

How to count between two MySQL tables using MySQL and PHP?

For example, how can I count how many times the tag HTML is displayed in the a_id column and then display all the tags that are related to the a_id column in alphabetical order. Here is the MySQL tables CREATE TABLE a_tags ( id INT UNSIGNED NOT NULL AUTO_INCREMENT, tag_id INT UNSIGNED NOT NULL, a_id INT UNSIGNED NOT NULL, PRIMARY KEY (...

Pear Excel Writer: trimming leading zeros - how to prevent?

I'm using the Pear Excel Writer package to export a dataset to Excel from PHP. My problem is some of the data fields have leading zeros (such as a zip code), but these are being trimmed in Excel. I tried adding an apostrophe to the start of the fields to force a text field, but then Excel displays it, which I don't want. I'm neither a PH...