php

How to wrap each new line in textarea with li tags? PHP

I have a textarea form field where users will put URL's separated by a new line. Would it be possible to wrap each line from this textarea field with < li > tags? So I would need the output from the field to be something like this: <li>some.url.com</li> <li>some.url.com</li> <li>some.url.com</li> <li>some.url.com</li> <li>some.url.com<...

Loading file from the same directory doesn't work unless I specify the full path

So I have this line of code inside a WordPress plugin. The code file is in the same folder as the XML file I'm trying to load. When I remove the full path and leave just the filename I get an I/O error. $dom->load("/home/tapadmin/public_html/demo10/wp-content/plugins/". "agentmanager/fielddefs.xml"); What's the correct way to load...

Storing $_POST values in an array to save them to text file

I have multiple $_POST values which I want to store in an array to save to a text file. How would I go about doing this? PHP code: <?php $name=$_POST["name"] $email=$_POST["email"] $msg=$_POST["msg"] $origin=$_POST["origin"] $file="test.txt"; $open=fopen($file,"a"); if($open){ fwrite($open, $entry); fclos...

Change the result of mysql_query

Can I modify the result that I have received from mysql_query than reset the pointer with mysql_data_seek($result, 0) and process the output like from normal query Dummy example: $result = mysql_query($query); while($row = mysql_fetch_array($result)){ $row[$fieldName] = $this->someFunction($row['id']); } mysql_data_seek($result, 0);...

Facebook stream publish question

hello, how do i add a link in message? $msg = 'hello, how are you, we posted an update on our site'; $action_links = array( array('text' => 'sitename', 'href' => "http://domain.com/news/latest.php")); $action_links = json_encode($action_links); works but without href link $fbclient->api_client->stream_publish($msg); works but with...

Working with HTML econding in PHP (intelligent way to decode)

Hi guys, from a PHP script I'm downloading a RSS feed like: $fp = fopen('http://news.google.es/news?cf=all&amp;ned=es_ve&amp;hl=es&amp;output=rss','r') or die('Error reading RSS data.'); The feed is an spanish news feed, after I downloaded the file I parsed all the info into one var that have only the content of the tag <descriptio...

PHP: Check string for certain words

How can I check if data submitted from a form or querystring has certain words in it? I'm trying to look for words containing admin, drop, create etc in form [Post] data and querystring data so I can accept or reject it. I'm converting from ASP to PHP. I used to do this using an array in ASP (keep all illegal words in a string and use ...

comparing timestamps

HI, My php is very rusty and I can't quite remember how to do this. I have a script that i only want to call every 15 minutes. I've created a table called last_updated. What I want to do is have some code at the top of my script that queries this last_updated table and if now() minus the last updated is greater than 15 minutes then run ...

Using HTTP proxy in PHP

May you give me an example for using an HTTP proxy in PHP? ...

Passing values to a php file via jQuery ajax problem

I have a contact form, the values of which I'm passing to a php page to save it to a text file. Somehow, it seems I cannot get the $_POSt values via ajax to save. What am I doing wrong? I am assuming something is wrong with my javascript code. Here is the jQuery: function checkForm(form) { var cssObj = { ...

Securing one particular file on the server; .htaccess good way of doing it?

I have a classifieds website. I as an administrator need to be able to remove classifieds as I wish... So I have created a very simple remove function which only requires the name of the classified. I plan on placing it on the server ONLY when I need to remove classifieds, so it wont be there unless I upload it and plan on using it. Th...

How to use regex to extract values from a string.(PHP)

I have a string like this \"access_token=103782364732640461|2.ZmElnDTiZlkgXbT8e34Jrw__.3600.1281891600-10000186237005083013|yD4raWxWkDe3DLPJZIRox4H6Q_k.&expires=1281891600&secret=YF5OL_fUXItLJ3dKQpQf5w__&session_key=2.ZmElnDTiZlkgXbT8e34Jrw__.3600.1281891600-10000186237005083013&sig=a2b3fdac30d53a7cca34de924dff8440&uid=10000186237005083...

How to convert a hardcoded website to a PHP MVC framework site?

I would like to convert our college's hard coded website. Should i follow any pattern to achieve efficient & fast Conversion ? kindly guide me. ...

Using html in jQuery UI autocomplete

Before jQuery UI 1.8.4 I could use html in the JSON array I built to work with an autocomplete. I was able to do something like: $row_array['label'] = '<span style="color: red; font-family: courier;">User, Name</span>'; That would show up as red text in the drop down. As of 1.8.4 that does not work. I found http://dev.jqueryui.com/...

PHP framework similar Zend Framework

I uses Zend in my project: it does not need MVC, but it uses Zend classes like Zend_Translate or Zend_Validate. I should not create Zend environment for validate few HTTP request params I just need Form and Validators. Zend is more class library then framework. I'm looking the similar framework for PHP 5.3. What can you suggest me? ...

PHP/jQuery: Ajax call & where to have my code?

Hello. So im making a "delete" button to my commentsystem.. I want to make it smart, so it should run a ajax call to remove the comment. Now I have tried out myself, this and have gotten this far: <?php echo "<a href='#' onclick='javascript:DoCommentWallRemove()' title='ta bort inlägg'> <span class='removeWallComment'></span> </a>"; ?>...

Whois PHP script

Hello, I would like to know how can I add a button to enable user to register the available domain name? My idea is to a button linked to registration page next to the available domain name. When the user click the button, the name of the searched domain will be passed to the next page, which is the registration page. I've added the fol...

google checkout get custom variable at continue url

Hello everybody, I am working with google checkout and currently working at sandbox environment. I have used Paypal and i thought google checkout should work like the same. but i wonder that google checkout is not posting back the HTML form field on return URL and im not able to find any proper solution for this problem yet. Here is my ...

determine whether checkbox is checked php $_GET

Hi, I just want to have php determines whether a checkbox is checked, but I am running into a problem of getting the right return. Help please. My html code <label> <input name="Language" type="checkbox" id="aa" checked="checked" /> One</label> <label> <input name="Language" type="checkbox" id="bb" />Two</label...

PHP Class to Generate HTML?

Anyone know of any classes written for php that can clean up your code a bit? Something like, $htGen = new HTMLGenerator(); $htGen->newDOM('div', 'here is what goes in the div', 'optionalID', 'optionalClass'); Or does that just sound redundant? I end up with some complex looking mish-mashes of html and php sometimes that I feel co...