php

How to show html tags converted by PHP's htmlentities into div using jQuery?

I have a dynamic string from PHP that I encoded using htmlentities() so I can pass it on AJAX using jQuery and JSON. Now I got something like { "error": "false", "html": "<div id="user_add_title">Adding New User<div class="showhide-div"><a class="hideShowToggle" href="#" onclick=&qu...

Sanitation for URL used in Header: Location?

In a multi-step form process, I am receiving a URL as a form field. After processing, my PHP script redirects to that address using header("Location: ..."); Apart from the possibility of being misused as a redirect service for porn sites to generate harmless-looking links in E-Mails (Open Redirect, which can be helped by matching the U...

PHP "&" operator

Hi, I'm not a PHP programmer (but know other languages) and I'm trying to understand a web page that was done in PHP (5.1.6) in order to do some changes. The page has the following code (simplified): $db_hosts = array(); $sql = 'SELECT h.hostid, h.host FROM hosts h '; $db_items = DBselect($sql); while($db_item = DBfetch($db_items)){...

Symfony Propel Project: How to upgrade schema without database resets ?

I've deployed my symfony project to the server and now I wanna change the models inside schema.yml without reseting other unrelated database tables and keep the current data. Is there any diff / upgrade feature for symfony propel project ? ...

Flex Fileref... not receiving return result

I'm attempting to upload a file using FileRef and a php script. The file uploads and it definitely returns a test string ( I can see it with a web debugger).. but I can't grab that string in my flex app. I am using a DataEvent listener and a COMPLETE listener. Still no result. What am I doing wrong here? fileRef.addEventListener(Data...

NOt able to update existing data of a application form.

I am editing my application form.So what i am Doing telling you here..I am already logged in First of all i am giving a edit link(edit_profile1.php) on my home page NOw i am asking again for username and password so that unauthorized user can not making editing in your profile NOw on edit_profile1.php i am checking username and passwor...

Where should one store the cipher key when using AES encryption with PHP?

I am implementing AES-256 bit encrpytion in my web app: http://www.utoxin.name/2009/07/automatic-db-field-encryption-in-cakephp/ One of the steps says to store the cipher used and key in a boostrap file. But what is stopping someone from scanning the file system with PS or something and decrypting the data? What is the best way to se...

Require() and include() not working in Eclipse for code assist and autocomplete

I just started using Eclipse PHP. I finally figured out how to turn on auto complete code assist. My problem is that when I use require or include, those variables in those files aren't showing up. Example, code1.php <? $test = 'hi'; ?> code2.php <? require('code1.php'); ?> When I am editing code2.php, $test variable doesn't sh...

Multiple connections to mysql database with php

Let's say I call multiple functions on a given page. function getProfile { <mysql code to connect> ... ... } function getMatchingUsers { <mysql code to connect> ... ... } If I call the two functions above on a given page, wouldn't that open multiple connections to the DB? I assume php would automatically close...

how i can retrive files from folder on hard-disk and how to display uplaoded file data into a textarea

I have made a application form in which i am asking for username,password,email id and user's resume.Now after uploading resume i am storing it into hard disk into htdocs/uploadedfiles/..in a format something like this username_filename.In database i am storing file name,file size,file type.Some coading for this i am showing here $files...

Image size not defined in Javascript / PHP

Hi! I'm having problems finding the width and height of an image. I'm trying to pass it to the URL so I can set it as a PHP session variable. location.href="homeview.php?x=" + dd.elements.image1.x + "&y=" + dd.elements.image1.y + "&h=" + document.getElementById('image1').height; the URL reads as such with an example image: homeview...

How to get rid of extra elements in string literal in php ?

I have number like 9843324+ and now I want to get rid of + at the end and only have 9843324 and so how should I do this in php ? Right now I am doing $customer_id = explode('+',$o_household->getInternalId); also $o_household->getInternalId returns me 9843324+ but I want 9843324, how can I achieve this ? Thanks. ...

Change ASCII Transfer Mode To Binary

Is it possible to do so in PHP? Is there some function that changes the transfer mode from ASCII to binary? Thank you. ...

If statement returning both true and false in PHP

the following statement returns "do actions!what2" when run. What's going on here? it seems like both true and false are being returned! if (md5($email) == $emailHash) { echo "do actions!"; } else { echo "what2"; } ...

CSRF attack detected when submitting data using ajax

Hi, I'm trying to submit a form using jquery in symfony 1.4, but CSRF attack detected error pops up each time. This is the code i use to submit the form data: $.ajax({ type: 'post', cache: false, url: $('#assign-form form').attr('action'), data: ( 'activity[id]=' + $('#activity_id').val() + '&act...

How to store Markdown comments

I want to use Markdown for my website's commenting system but I have stumbled upon the following problem: What should I store in the database - the original comment in Markdown, the parsed comment in HTML, or both? I need the HTML version for viewing and the Markdown version if the user needs to edit his comment. If I store the Markdown...

How do I modify Request_URI using Apache or PHP?

I'd like some help with some URL rewriting magic. I am having trouble modifying the Request_URI variable. I would like to switch between two sites http://host.com/alpha and http://host.com/beta. They are both handled by the same php script. This script is http://host.com/index.php. The index.php expects to be given a GET variable SITE ...

How would I echo this in PHP using SimpleXML

Response example for MD5 hash found, for example http://md5.noisette.ch/md5.php?hash=2a0231531bc1a7fc29e2fa8d64352ae9 : <md5lookup> <hash>2a0231531bc1a7fc29e2fa8d64352ae9</hash> <string>noisette</string> </md5lookup> Response for MD5 hash *not* found, for example http://md5.noisette.ch/md5.php?hash=11111111111111111111111111111111 ...

Sorting MySQL results based on it's context

I'm trying to create a nested comment system using PHP and MySQL. But I'm stuck My Database structure is id, body, time, reply and depth. A regular comment's reply field will be '0'. If it's replying to another it will correspond to the id of the comment it's replying to. depth means how deep it is from the highest parent So if this...

PHP Curl: Getting a directory listing and downloading directories connecting to HTTP

I'm fairly new to CURL and I was able to fetch individual files like this: $c_session = curl_init(); curl_setopt ($c_session, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($c_session, CURLOPT_URL, $uri); curl_setopt ($c_session, CURLOPT_TIMEOUT, '12'); $content = curl_exec($c_session); curl_close ($c_session); Now I need to be able to li...