php

Check for domain name in redirection

We have a web application on a domain. Now another domain will use this application by doing a 301 redirection to former domain. What are ways to safeguard the app. So that no one can access it directly. Referrer check is one way, but not reliable. ...

How to make db structure for multiple input in MySQL and PHP

Below is my current structure for MySQL database id | item_name | item_files ------------------------------------------ 1 | Item A | file1.zip,file2.zip,file3.zip 2 | Item B | file3.zip Example I create simple form to fill up Item Name and Multiple upload files then store it to db. Question :- How to design the db str...

If statement continuing outside include?

Hi all, I've got an index.php page, and a lot of includes on it. How can I make an if statement from the first include continue to the last include, without getting an Parse error: syntax error, unexpected $end error. Thanks! ...

Should I sanitize EVERY form variable passed along?

I have a form with many fields... The action is set to a php page which queries mysql... Should I sanitize with mysql_real_escape_string every single variable? Or can I ignore sanitizing drop-lists and radios for instance? Also, besides mysql_real_escape_string, what else should I do to prevent attacks? Thanks ...

HOW to send message from php to desktop app (c#)

Hello guys, Am developing a desktop app that will serve as message notifier, just like yahoo messenger and Gmail notifier does. All i want is that when a message is sent to a particular account, the php script would send message to a particular ip:port of the desktop application. Any help ...

How to solve "call to undefined function domxml_new_doc()...."

Hello guys. I am trying to output xml by using domxml_new_doc. However, I just got the call to undefined function domxml_new_doc() error. I tried google it but still not luck. Do I have to install any extension or library? Thanks for the help. $doc=domxml_new_doc("1.0"); //error on this line.... $node=$doc->create_element("marker...

running php script manually and getting back to the command line?

I'm running a php script via command line, and it works just fine, except that when it's finished, it doesn't go back to the command line? Just sits there, so I never when it's done... This is the script: $conn_id = ftp_connect(REMOTE) or die("Couldn't connect to ".REMOTE); $login_result = ftp_...

Retrieving events from Google Calendar

I am trying to retrieve the XML data for Google Calendar. Authentication and retrieval all works. However, when I retrieve the events, gd: data isn't included as the protocol reference documents it would be (http://code.google.com/apis/calendar/data/2.0/developers_guide_protocol.html#RetrievingWithoutQuery) Some error messages I'm runni...

"slash before every quote" problem

I have a php page which contains a form. Sometimes this page is submitted to itself (like when pics are uploaded). I wouldn't want users to have to fill in every field again and again, so I use this as a value of a text-input inside the form: value="<?php echo htmlentities(@$_POST['annonsera_headline'],ENT_COMPAT,'UTF-8');?>"> This ...

Safari Back button not honouring PHP logout session

I've got a logout.php page which ends a user's session and works well and does the following: session_start(); session_unset(); session_destroy(); I've just noticed when testing with Safari that when you logout you can click the back button to return to the previous page which requires authentication but are not prompted. You cannot na...

Using Java server-side with PHP-generated front-end

Hi!  Does anyone have a real-world experience in building such a project? I'd like to move away questions about "is it good idea or not", but focus on possible solutions. I see one simple way - HTTP GET/POST + xml/json - and one more elegant - AJAX/DWR. As for the first one - I understand that it is possible, but needs quite a lot coding...

PHP (A few questions) OO, refactoring, eclipse

I am using PHP in eclipse. It works ok, I can connect to my remote site, there is colour coding of code elements and some code hints. I realise this may be too long to answer all questions, if you have a good answer for one part, answering just that is ok. Firstly General Coding I have found that it is easy to loose track of include...

IIS, Apache, and header()

I'm working on migrating a website from an external server (running Apache) to a local server (running IIS), and have come across an issue that I can't seem to resolve. The site is using a custom Joomla plugin that grabs some graphics stored in a mysql database (for e.g. http://www.norfolktourism.ca/index.php?option=com_bdirectory&amp;t...

Send SOAP XML via curl, PHP

Hi. This has been bugging me for days, i'm trying to send a SOAP post via curl but i just keep getting a 'couldn't connect to host' error but i really cant see how. I have an asp version which works fine with the same url and data, i think it's just a php/curl thing...? I currently have the following code (the CURLOPT_POSTFIELDS data is ...

turn array into object active record can use

I'm running a query and then decrypting it in the controller. After it is decrypted I was putting the results into an array and sending that to the view. The problem is with this solution I need to rewrite all of my views to parse the arrays sent instead of the active record objects sent before. Is there a way to turn the decrypted arr...

url rewrite, login problem in particular pages, no response headers

Recently, I was doing .htaccess url rewrite, make all my php url into html, in some page, the logout button wont work properly. for example, in page ‘quotedetails/Q9999.html’ (rewrited from ‘quotedetails.php?quoteID=Q9999′), when I click logout button in this page, it wont do the trick, but when i use the old php url of this page, it wor...

php Preg_replace_callback problem

Hi I have the following code but im not a big fun of reg exp as they are too confusing: <?php $r = '|\\*(.+)\\*|'; $w = ''; $s = 'hello world *copyMe* here'; function callbk($str){ print_r($str); foreach($str as $k=>$v) { echo $v; } } $t = preg_replace_callback($r,'callbk',$s); //output: Array ( [0] => *copyMe* [1...

Conversion of Facebook PHP string to Javascript

$facebook->api_client->stream_get('','','','','','app_YOURAPPLICATIONID',''); Oh dear, shows that I'm lacking motivation.. What I would like is to have the Javascript equivilent of that line. ...

Drupal Views Relationship ADD not LIMIT

I'm trying to set up a relationship system between node, using flags and cck node reference (using views selection). I need to create a view that does not LIMIT by relation, it adds to it. Example: When you add a Node-B, you can reference a Node-A that you have created - OR - flagged (using flags module) When I use views to get the fl...

PHP command shell_exec() not working for my custom Java app5

I have made a custom java program to output a license and am trying to run it in php. $deviceid="12345"; $command_app = 'java -jar /home/myname/secure/mycommand.jar '; $privateKey = 'QEFAASCAmEwggJdAgE'; $command_app_args = "\"$privateKey\" deviceid=$deviceid"; $command=$command_app.$command_app_args; $license = shell_exec($command); ...