Jump to content

trav

Members
  • Posts

    12
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

trav's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi All, It has been a while since I posted, but I am hoping someone can help me out as I have definitely reached the end of my knowledge base. I have an issue with the XMLWriter object when trying to use the openURI() method. I recently installed Drupal 7 and I tried to enable the xmlsitemap module. it produced a ton of errors relating to the XMLWriter object not being valid or initialized example: Warning: XMLWriter::startDocument() [xmlwriter.startdocument]: Invalid or unitialized XMLWriter object in ...(path to test file) I quickly realized that this is a server specific issue. I tried this testing code and reproduced the error: <?php $writer = new XMLWriter(); $writer->openURI('php://output'); $writer->startDocument("1.0"); $writer->startElement("example"); $writer->startElement("specchars"); $writer->text('&'); $writer->endDocument(); $writer->flush(); ?> result Warning: XMLWriter::startDocument() [xmlwriter.startdocument]: Invalid or unitialized XMLWriter object in ...(path to test file) So I then tried to use the memory write instead with this: <?php $writer = new XMLWriter(); $writer->openMemory(); $writer->startDocument("1.0"); $writer->startElement("example"); $writer->startElement("specchars"); $writer->text('&'); $writer->endDocument(); print_r($writer->outputMemory()); $writer->flush(); ?> output <?xml version="1.0"?> <example><specchars>&</specchars></example> which works fine...... so i figured that it has to be something to do with the openURI("php://output") and my server config. I am running ubuntu server 10.10 with zend php 5.2.14 . LAMP server. I can dump the php.ini file if necessary, although i am hoping I am just missing something very obvious here. also, if i actual write to a file (ie. $writer->openURI('test.xml'), then i am able to initialize the object and it works fine), it seems to only be when i use the php:// for the uri. any thoughts?
  2. well i think i figured it out the mysql_real_escape_string function was trying to connect to the previous mysql connection which wasn't there. i knew had to me something small or stupid.... grrrrrr
  3. bump i am not normally this impatient but i really am going nuts. thank, trav
  4. I borrowed some code from a website, and then hacked a little part of the class adding my own function, except it doesn't work. I am sure there is something small that i am missing, class auth { // default constructor function auth() { if( isset( $_POST['username'] ) && isset( $_POST['password'] ) ) { $this->mysql_bind(); } else if ( isset( $_GET['logout'] ) ) { $this->user_logout(); } } // cut a bunch of code out here function user_secLevel($username, $secLevel){ $sql = sprintf("UPDATE auth_users SET secLevel = %s WHERE username = %s", $this->quote_smart($secLevel), $this->quote_smart("patty")); mysql_query($sql) or die ("Couldn't execute query. r_name=".$username.". seclevel".$secLevel." : ".$sql); } // Quote variable to make safe function quote_smart($value) { // Stripslashes if (get_magic_quotes_gpc()) { $value = stripslashes($value); } // Quote if not a number or a numeric string if (!is_numeric($value)) { $value = "'".mysql_real_escape_string($value)."'"; } return $value; } } // create the auth object $auth = new auth(); <? include('../includes/auth.php'); switch ($_GET['action']){ case "delete": echo "i equals 0"; break; case "update": $auth->user_secLevel($_GET['uid'], $_GET['secLevel']); echo "the user ".$_GET['uid']." has been updated to security level ".$_GET['secLevel'] ; break; default: echo "There was a mistake and you should not be viewing this page"; //2265 } ?> this is the output that i get Couldn't execute query. r_name=patty. seclevel2 : UPDATE auth_users SET secLevel = 2 WHERE username = '' I know my debugging is ugly. but it seems to spit out the relevant info. This leads me to believe that the quote_smart function works for the numeric value but not the string value. which baffles me since it works when tested alone. i am pulling my hair out here. what am i missing? thanks in advance.
  5. i am less confused but still slightly, can you post some code. one quick point though, the header('Location :' .$page); will only work if it is called before any html is displayed. I don't know how this would work calling it in a javascript function but i wouldn't expect it to work.
  6. i am a little confused as well, are you looking for a javascript event to automatically send the user to a new page once the file has been confirmed saved? ie. so when they click the save button the info is sent to the server and saved, then retrieve the file name and send to a new page.
  7. here is another tutorial aimed more at php integration http://www.w3schools.com/php/php_ajax_intro.asp also one last thought, you should have a catch so that if a person's website doesn't support ajax it will display normally with a note that the information will not be refreshed (or use a meta tag)
  8. i would use ajax here is a quick fast tutorial http://w3schools.com/ajax/default.asp you don't even really need to know javascript, just take the section of your code that displays the dynamic data and move it into another .php file, then use ajax to grab it, then you can make a button or link that refreshes the data, or a timer, or set a function that checks at intervals for the number of result to have changed from the number display and at that point display a button to refresh or some other notification so the user can be in control of when to refresh, hope that helped.
  9. if you don't want people changing the style definitely strip the tags before they are inputted into your db. this makes it much easier to deal with displaying later. now if you have certain people (ie admins, or moderators) that you will allow, you might want to use a different approach.
  10. although it might be a little bit of a hassle, you could use javascript to built the url with GET variables that track it.
  11. This is kind of a stupid question, but i have been useing dreamweaver for several years now, but i mainly use it for creating the html the way i want and then put in the php or echo the stuff i need to make it dynamic, recently a friend of mine said that dreamweaver can manage variables and other dynamic features of php and mysql, is it worth it to try to use these features or are do they overly complicate things.
×
×
  • 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.