Jump to content

warpdesign

Members
  • Posts

    14
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

warpdesign's Achievements

Member

Member (2/5)

0

Reputation

  1. Thanks, I'll give that a try. It's been driving me crazy! (I don't know why it won't let me just turn it off)
  2. I've created a simple page that allows me to update HTML that is stored in MySQL. It uses the Tiny MCE editor and basically it reads the field from SQL, places it into the Tiny MCE text field using htmlentities(), and when you hit submit it writes it back the SQL and I escape the value returned in the Tiny MCE field using mysql_real_escape_string(). Now on my test server it works perfectly, but on the live server it adds slashes to the text. So for example if I have a link in HTML like <a href="mylinkhere"> it gets turned into <a href=\"mylinkhere\"> I know I can add strip slashes to anywhere the text is read from the database but I'm wondering why this is happening only on the live server. I thought this was an issue with magic quotes being turned on on the live server but I put the following in my file and that did not fix the problem ini_set("magic_quotes_gpc", "0"); set_magic_quotes_runtime(0); I also added this to php.ini magic_quotes_runtime = off magic_quotes_gpc = off magic_quotes_sybase = off
  3. My host turns allow_url_fopen to off for security reasons I used to parse RSS feeds just using $doc = new DOMDocument(); //start new DOM $doc->load( 'http://feedURLgoeshere ); //load XML file into the DOM Which I can't do now. I have a replacement method using CURL from my host but it literally takes five minutes to load the page if it even works: function My_simplexml_load_file($URL){ $ch = curl_init($URL); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, 0); $xml = simplexml_load_string(curl_exec($ch)); curl_close($ch); return $xml; } function showFeed($URL){ $xml = My_simplexml_load_file($URL); $i = 1; foreach( $xml->channel->item as $item ){ if ($i <= 5){ echo "<li><a href=\"".trim($item->link)."\" >".htmlspecialchars(trim($item->title))."</a></li>\n"; //echo "hi<br>\n"; } $i++; } } showFeed('http://digg.com/rss/index.xml'); I'm not sure if it's because CURL is inefficient or if the code is not written right. I'm sure there's a better way than this.
  4. I need to create a php script that writes form data to an XML file. I was sent an XSD file that contains the schema that the XML file needs to be written in. Apparently you're supposed to load up the schema and then PHP should be able to write the data using that schema. I have no idea how to do this. Is there any information on how to do this online? I've used the dom functions to read XML before but when I write XML files I just literally write out the tags but I can't do that in this case.
  5. I'm [i]trying[/i] to write a PHP script that uses XML to update a calendar of events. I'm using DOM functions to read the XML file and it's been working great on my test server, I also have a production server for personal files that has PHP on it and it works on that. When I upload it to the live server it stops working. According to the webhost DOM is not supported by them or installed, but according to php.net: http://us2.php.net/manual/en/ref.dom.php "There is no installation needed to use these functions; they are part of the PHP core." I did find this example online of how to use the function to read XML files http://www-128.ibm.com/developerworks/opensource/library/os-xmldomphp/ and it states "the Document Object Model (DOM) library compiled into [u]some[/u] installations of PHP" So I'm confused, are DOM functions part of PHP core or are they something I have to install myself?
  6. Is it possible to send variables to another webpage through POST without having the user fill out a form and hit submit? I want to pass variables between one page and another but they are not data that is collected from a form, and I don't want the information to be visible in the URL (_GET). The only way I know to send POST information is in a form tag using method=post, is there another way to send the data??
  7. Actually I found out parenthases are not the problem but & and <> are for sure causing problems... Is there a fix for this??
  8. I'm reading from an XML file using DOMDocument(), but I'm having problems when the data in the XML has special characters in it it returns an error. For example If there is a parenthases in it it will cause it to fail. Does the data in the XML have to be encoded somehow? I've tried using addslashes but that didn't help. :(
  9. Hi, I'm trying to create an XML parser in PHP. I'm using the basic code located in this article here: http://www.sitepoint.com/examples/phpxml/sitepointcover.php.txt The only thing I changed is the location of the XML file in the fopen which is here http://investors.wamu.com/phoenix.rss?c=101159&p=rssall and I removed the "DESCRIPTION" case from the switch statement since I don't need that. I recieve the following error when I change those two lines in the code "XML error: Empty document at line 1" ???
  10. Thanks for the advice on writing the function more efficient! I'm not a programmer so I know my code is always probably the least efficient way of doing it. When I echo the string that is being passed to the function it is: "Sep/18/2006 08:00 PM" Shouldn't it recognize that in strtotime() ? Basically when I call the function it looks like this: [code] <?php function writeTime($formatted){ return(date('Y-m-d H:i:s',strtotime($formatted))); } writeTime($_POST['date']); echo $_POST['date']; // <--- returns Sep/18/2006 08:00 PM ?> [/code] I should maybe also mention that I used this .js so the user can pick the date: http://www.rainforestnet.com/datetimepicker.htm So that is where the input is coming from.
  11. I'm reading dates from a database, they are in the format "Y-m-d H:i:s" and I'm reformating them for updating from the user using this function [code] function inputTime($timestamp){ $timestamp = strtotime($timestamp); $formated = date("M/d/Y h:i A", $timestamp); return $formated; } [/code] OK that works fine. Then when I write them back to the database I want to convert them back to the original format using this function [code] function writeTime($timestamp){ $timestamp = strtotime($timestamp); $formated = date("Y-m-d H:i:s", $timestamp); return $formated; } [/code] So the problem is, when I do that all my dates come out as Wed, December 31st 1969, 3:59 PM?? ???
  12. I'm creating an appointment application that the user inputs the dates of events. I created the interface as pull down menus so there are seven pull downs like so: -Day of week- -Month- -Day- -Year- @ -Hour- : -Min- -AM/PM- The desired input would be something like Mon, Sep 18 2006 @ 10:30 AM. So I have a two part question, 1) is there a way to check that the date is valid? For example if the user imputs Tue, Sep 18 2006 and Sep 18 2006 is actually a Monday it should return an error. 2) is there a better way to get date input from the user? Seems like there should be some kind of calendar or something they can click on to ensure that they can't enter an invalid date but I don't want to build something like that from scratch...
  13. Perfect. Thank you so much!!  ;D
  14. Hello, I'm having problems using strtotime. I'm pulling dates from a database, the dates are in the format: YYYY-MM-DD HH:MM:SS I want to reformat it so it's more user friendly, i.e. Sun, May 4 2006 4:30 PM I thought I could do this using strtotime and then reformating the date, but I get a strange number when I convert the string using that. Something like 1156723200... Do I then need to feed that number to another function? Also how do I convert it back to the original format to write back to the database?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.