The PHP XML-parser Doesn't Like < Or > ??
I'm using PHP's SAX parser to parse an XML file and display it as a chat-style application.
However, to prevent people posting tags, I'm using htmlspecialchars() to convert <, > and ". These go into an XML document fine.
Once it comes to parsing, the parser seems to interpret < and > as actual XML tags though, and it messes up everything. Is this a known bug, or is there a way of combatting it?
View Complete Forum Thread with Replies
Related Forum Messages:
$GET Doesnt Exist
A while back, when I was using PHP4 with IIS, I had a problem getting my PHP scripting to pickup the post data via GET and POST. I solved it by going into the php.ini and setting register_globals to On. Now Im working on PHP 5 with Apache. I m having the same problem, my scripts are definetley not picking up the posted variables, like $GET and $POST dont exists no matter how many times I submit. I have gone to the php.ini and changed the register_globals value to ON but still nothing is happening, have I missed anything out?
View Replies !
Doesnt Iterate
I'm trying to do write a multiple update routine but its not looping , just runs once and stops. if ($REQUEST_METHOD=="POST") { if (isset($num)){ $i=0; while ($i<=$num){ ($result = mysql_query ("UPDATE data SET valid = '$valid' WHERE id = '$id' ")); $i++; } echo ("<P><center> Successfully validated<center></P> "); } } else {..... BTW, $num is valid and comes from data in other part of the script.
View Replies !
Db4 Dba_replace Doesnt Seem To Work For Me
I am trying to write to a dba and the result is creating a database file, but not writing anything to it. The relevant function is being called, and my variables are populated, but the database file remains empty. Am I writing the string arguments wrong, please ? function addplayer($realname,$pokername){ $dbh=dba_open("../pokeraliases","n","db4") or die ("Couldnt make the database"); dba_replace("$realname","$pokername",$dbh); dba_close($dbh); print ("PERFORMING ADD FUNCTION <br />"); print ("posted variables are $realname and $pokername <br /><br />"); } if ($addplayer=="add") { addplayer($name,$alias); }
View Replies !
Posix_setuid Doesnt Work
I've got problem with posix_setuid(). I've compiled php with --enable-posix. Everythin like posix_getpwuid() works fine except posix_setuid and posix_setgid. Configuration: php 4+mysql 4+apache 1.3.31. System - FreeBSD 5.3
View Replies !
If Page Doesnt Exist
I did the mistake of writing my whole website on one index page The problem is, each page uses if ($_GET['pg']==page){ #code } But if it is not a page, it doesn't execute anything. and the whole site is messed up. Is there anyway to make it so if $_GET['pg'] is not a valid page, then go to a 404 script?
View Replies !
Use A Session It Doesnt Display Anything
I have an index.php page that I have a login form on. I have another page (login.php) that checks to see if the username and password is valid from my database. The login.php redirects them back to the index.php page. Instead of the login form, i want it to say something like hello <username>. someone told me to use sessions but every time i try to use a session it doesnt display anything. I dotn know if the variable is beign carried over or if its even possible to be carried over to a different php page. I have the start_session() thing on top of each of the pages. I define the $_SESSION['user'] variable on the login.php page but when i get redirected back, it doesnt have a value and its not showing up.
View Replies !
Unlink Doesnt Work
i have this image "a.jpg" under directory "image/product/a.jpg". whenever i do unlink("image/product/a.jpg");. it says that permission denied... i dont know why i have done chmod("image/product/a.jpg",0777) before i do unlink. anyone know why?
View Replies !
Set Cookie In IE Doesnt Work In FF
i am facing problem in Firefox which is working fine in IE. This code doesnt set a Cookie in FF but it does in IE.. $id = $_POST['sendmobID']; $var = $_POST['vote']; setcookie ($id+1, $id, $time + 7776000); header("Location: specs_".$var."_".$id.""); so what could be wrong?
View Replies !
Info That Doesnt Print
I am querying a table and i dont want to print some information if the table doesnt contain any information. my code: $query="SELECT * FROM items WHERE name='john doe' $result=mysql_query($query); $row=mysql_fetch_array($result,MYSQL_BOTH); if($row{$k}!=""){ echo 'I should only be here if $row{$k} not empty' echo $row{$k}; } This will sometimes print even when $row{$k} contains nothing. The table value it is returning should be null or empty and therefore shouldnt print anything? Is it carriage returns or something? When I view the HTML source it will print a new line where the $row{$k} is at.
View Replies !
Data Doesnt Get Updated
I am working on a club software which will allow me to manage players and get a list of all the registerd players, i can add, get list of all of the players, but when i try to modify any one of them i cant .
View Replies !
Script Doesnt Work
if ($AB == 'On') { if ($line == 'Front Sideline') { $yc = 204; } if ($line == 'Back Sideline') { $yc = 85; } if ($line == 'Front Hash' || $line == 'Back Hash') { $yc = 206; } } For some reason,this part of my code is causing me problems. I know this,because I tested it over and over and figured out THIS is where the problem is coming from,and nowhere else. the script doesnt work The problem is this: IF: $AB is On and $line is Front Hash or Back Hash
View Replies !
Preg And Why [^word) Doesnt Work?
I was trying to write a script to replace some text inside some tags. Lets say I had <tag stuff=stuff><tag stuff=otherstuff><another> I wanted it to find all the <tag and remove them. So I tried to write it so that it would go forward until it reached [<^another] came. But when I tried that it would respond to another as single characters and not as the word. How can I do this with regular expressions, matching up against words using [^ ] ? I know I can do what Im trying to do other ways, but when it didnt work with [^ ], it got me thinking about how to do it that way. Because there might come other times when I want to 'NOT' against a word, and there has to be a way of doing this with Regular expressions?
View Replies !
Odbc_fetch_array Doesnt Return Any Values
My problem is odbc_fetch_array returns no value at all, but the scripts returns no error and all i can see in the page is the html table without any data in it.. the connection to oracle via odbc works, and in my other scripts i used odbc_fetch_row to retrieve data, but this one is kinda slow in getting massive amount of data from oracle. im now testing which is faster, odbc_fetch_row or odbc_fetch_array? but odbc_fetch_array returns no value at all. PHP Code:
View Replies !
Redirect Different Server Doesnt Work
i am having a problem with redirect. the page which works fine with my localhost, when copied to a different server doesnt work. the code is below: <? session_start(); if(!session_is_registered(myusername)){ header("location:template.php"); } ?> <html> <body> <?php header( 'Location: showrec.php' ) ; ?> </body> </html> when copied to a differnt server it stops redirecting the page and sits there.
View Replies !
Integer Doesnt Subtract Fully
I have a variable set at 10,800 and im trying to subtract it in my query like here: $Price = 10,800 in this example. Â Â Â Â Â Â Â Â Â $subtractMoney = "UPDATE userregistration SET MoneyInHand=MoneyInHand-'$Price' WHERE UserID='{$_SESSION['Current_User']}'"; $result = mysql_query($subtractMoney) or die(mysql_error()); if (mysql_affected_rows() == 0) { die('Error ID 0001A, contact admin on the forums immediately about this error!'); } But the subtraction is only going down by 10. Not 10,800.. although this 10,800 could be any value this was what i used for this example.
View Replies !
Email Validation Doesnt Work?
How come: if(!eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+.[A-Z]{2,6}$", $email)){ echo 'Incorrect'; } doesnt work? Tried with things like "name", "name@name.com" and it comes back as valid?
View Replies !
Include A Function Doesnt Work
I have this big spaghetti code (my first real PHP project) file and I want to move my functions out of the big ass 12k php file. Well. I moved a function called "listprojects" to listprojects.php <?php function listprojects($conn) { . . . .function stuff } ?> . . . and in the main program I put the include statement . . . . include "listprojects.php"; but when I run the program in the browser nothing happens. The files are in the same directory by the way .
View Replies !
Cookies Doesnt Appear In Cookie List
hi, what's wrong in the next code? The cookies doesnt appear in cookie list, cookies are enabled for sure. if (blabal) { ... } else { $status = "ok"; $newdata2 = "1:5689741"; setcookie ('userdata', $newdata2, $time+604800);header("Location: login.php"); }; This piece of code appears above all html, and I run the script at the localhost at my own computer, there are other cookies set on localhost.
View Replies !
Php5 - Phpmyadmin Doesnt Work
I am useing apache 1.3.x (someing like that) and I Just Installed php 5. And Now phpmyadmin doesnt work. I was reading on php.net and mysql support doesnt com enabled in php 5. How Do I Enable this to allow php and mysql to work together in harmony and not problems.
View Replies !
Comparison Operators Doesnt Work
But here we go: My problem is that the comparison operators fail in some situations. I've got an input field where the visitors enter a number. I have limited the size of the number to 10 000 by doing the following: Code:
View Replies !
Wrong Error Line That Doesnt Exist?
I got the wrong Parse error: parse error, unexpected $ in /web/www/frac/users/ultimadark/train.php on line 104. But i counted the rows three times and i have only got exactly 104 rows in the page, and the 104th row is only </html>. Why do i get that wrong message
View Replies !
Mysql Doesnt Return All Results Of A Query
I have an sql query like this: SELECT column FROM table WHERE column1="3" AND column2="1" This query works perfectly if i run it in the command line, to be exactly it return two results. But if i run it from php i just get the first of the two results. Any ideas? Mysql 4.1.8 php 5.0.3 I have a second problem. But its more of a question. if i run the foreach loop on an array like this array("id" => "78"), then it splits 78 up in 7 and 8. Now you say its stupid to use a foreach for this array. But in the function there i use it the array could also be two dimensional. Is this behavior normal? I looked in the php manual but found nothing.
View Replies !
Form Validate, But User Doesnt Have To Retype
currently i have a form, and when users click on the submit button, the contents get validated, and if there is a mistake, the user is brought back to the form page. What i want is to free the user from having to retype the sections that they got correct, and only retype the sections that are wrong. I am thinking of getting the form to send the content to my validation page, and back to itself $PHP_SELF so that if there is an error, the message will still display. Is this the correct way to do it? Code:
View Replies !
Using Fopen() To Create New File - Works For A Few Then Just Doesnt
I am currently working on a content management system where a user can fill in a form (title, keywords, link text etc. - all the initial attibutes), which when submitted, will go onto create a web page. The code is as follows: $html = "<html> <body> <p>Hello World</p> </body> <html>"; $handle = fopen($_SERVER['DOCUMENT_ROOT']."/path/to/folder/".$filename, "w"); fwrite($handle, $html); fclose($handle); Pretty basic, I think. I works for a few and then it just stops. I get no error to say that 'could not create file' or 'file not found', it just submits. Any reason for this? I have tried searching the C: drive for the file but it cannot be found. At the moment Im trying to figure out when it actually occurs but for some annoying reason, it seems to be working now. I would prefer to be assured that it wont occur again so just thought I would still post something here just encase this problem is a known one. Is fopen() the best solution for creating files? I was aware that it was used to open an existing file but create one (?). Is this what it was intended to do? Im sure it is, but its new to me.
View Replies !
Php Upload Doesnt POST Any Info In Firefox
I am not sure why but I have had this problem for a while and havent really been able to solve it. A really simple php upload script works in IE but not in FF. FF just comes back to the page as if there is no POST information. For example code below will output when landing on the page, it outputs: Code:
View Replies !
Changed To PHP5 Now Script Doesnt Work
I had a dynamic img creation with gdlib and Right Alignment. I 'pinched' this script which worked well until my host upgraded to php5. Any ideas. the following error messages are received. ‰PNG IHDR�2ý~Ê Warning: imagepng() [function.imagepng]: gd-png: fatal libpng error: zlib error in /home/clearcon/public_html/fonts/title.php on line 40 Warning: imagepng() [function.imagepng]: gd-png error: setjmp returns error condition in /home/clearcon/public_html/fonts/title.php on line 40 Code:
View Replies !
Preg_replace? AddSlashes Doesnt Seem To Work Properly
Im accepting user input from a text-box on a webpage. I am then wanting to echo that back into the same box when the page is submitted. The problem I have is that the input COULD contain multiple quotes and double-quotes. AddSlashes doesnt seem to work properly, as it turns ' into ' ....and " just into (removing everything after) I thought of using single-quotes for the Value='' and then use preg_replace to replace all occurances of ' with ' ...but I cant figure-out how to do it. Code:
View Replies !
Uploading Image Name Doesnt Get Rid Of The Space By Script
I use the below code to upload images: $target_path = "images/"; $target_path = $target_path . basename( $_FILES['Image1']['name']); $_FILES['Image1']['tmp_name']; $target_path = "images/"; $filename = basename( $_FILES['Image1']['name']); if (file_exists($target_path . $filename)) { $filename = time() . '_' . $filename; } $target_path .= $filename; if(move_uploaded_file($_FILES['Image1']['tmp_name'], $target_path)) { echo "Image1: was uploaded successfully!"; } else{ print "Image1: could NOT be uploaded!";} The above code renames the images too However, when a user uploads images which the name has spaces The code doesnt get rid of the space, and i get trouble displaying them later What part can i add to to the code to take space from the image name, then rename it.
View Replies !
Change Password On Another Site It Doesnt Work
I have this code on other sites and when I put it on another site it doesnt work. I changed everything to adjust so the variables work. Here's the code: <?php if ($_GET['task'] == 'send') { $error = 'true'; include("includes/include_connect_db.php"); $query = "SELECT * FROM user WHERE personal_email='$email' "; if (mysql_query($query)) { $error = 'false'; include("includes/include_random_gen.php"); $new_pw = get_rand_id(7); $newpassword = md5($new_pw); $query = "UPDATE user SET password='$newpassword' WHERE personal_email='$email' "; if (mysql_query($query)) { //do this mail("$email" , "Password Reset for: site.com" , $body, "From: me@email.com "); }
View Replies !
Getimagesize() Not Working ... Image Exists, Error Says It Doesnt :(
I am using the latest version of PHP and GD (reinstalled both today - march 29 2005) and am using GD to create thumbnails on the fly. I am having no issues with GD, however, I am now trying to retrieve the width and height of other images withought ANY sucess ... I am recieving the same error repeatedly : "... failed to open stream: No such file or directory ..." I am replacing spaces with '%20' as PHP.net suggests, and have parsed local and full paths (which all work when entered into a browser) with no success. here is my code : $image=str_replace(' ','%20',$_GET["image"]); $imageinfo = getimagesize($image); $w=$imageinfo[0]; $h=$imageinfo[1];
View Replies !
Search Page Doesnt Recognize The Existing Session
im trying to run sessions, but when i log in and go to the search page, it doesnt recognize the existing session, but when i do a search where i post variables back to that page, it recognizes the session data the second time. anyone know the problem?
View Replies !
Rating System Doesnt Enter The Vote In The Database
Im trying to make my rating system work, as of now it doesnt enter the vote in the database, for example if someone submit a new peice of art and I go to rate it and i click 4 stars, then I got in the database and it will have entered the id of the rating we just did, and the ID of the art we just rated but in the rating and number of votes put 0 I dont know why. Here is my code:
View Replies !
My Form Doesnt Work After I Added A Checkboxes Input..
My form doesnt work after i added a checkboxes input..i am using a image validation as well... Its always asking for the verification which is suppose to do once, not everytime :SÂ Everything else on the site work fine though, its only this checkboxes thing who doesnt work, which i need as a requiremnt. Code:
View Replies !
Php-xml Parser
I have a PHP script which sends a authorisation request to a Servlet and receives a response in XML format. I have also created a parser (using both DOM as well as SAX) for parsing the output. My problem: The parser takes in input from an external xml file but the output from the servlet needs to be dynamically fed into the parser something like this: PHP Code:
View Replies !
Php Parser
I like to know wheter it is possible with php to do the following taskes: - read a file (.txt, .doc, .pdf, ...) word by word to chek if a word or a sentencs exists... - chek the form of presentation of a word i.e. chek if the word is bold, in which size, is it centered or aligned to left,...
View Replies !
PDF Parser
i am trying to make a PDF parser in PHP which will be able to extract data from PDF files. i want to basically convert pdf files to XML data. any idea from where i could start?
View Replies !
XML Parser
I have a very complex xml doc which if convert into array gives you a lot of nested array. i wanted some good parser which would parse this complex xml data. any idea about a good parser or code..which would work on php 4.4.4 I want to extract values from one offset tag and get those extracted values to the DB.
View Replies !
Rss Parser
im using this script that somebody else has made. well some feeds work just fine, some feeds end up with nothing in the item array at all and some feeds come up with this fopen error. Code:
View Replies !
DOM XML Parser
Can we parse Xhtml file using DOM XML parser of PHP. What i really want is this, I have an xhtml file and i want to edit/delete some of the contents in that xhtml file. Xhtml file is organized into parts using <div> tags. this is how it looks like, <div id="book1"> this is the book introduction part. <div id="part1"> This is the part introduction <div id="sec1"> This is the section intrduction <div id="subSec1">This is the sub section introduction</div> </div> </div> </div> now what i want is to get the contents that resides inside the <div> tag and edit / delete that content. Which <div> tag to choose, is depending on the parameter i passes and the parameter i pass to the script will hold the <div> id . So according to that i know which <div> tag to choose. Can i do this using XML parser.
View Replies !
Parser
can anyone give me a good defination of a parser, (ive used it to take text from one website and put it into another) but i need some background knowledge of the workings of a parser etc.
View Replies !
Parser?
I am in the process of creating a parser, the following is the code i have started with: <?php /* © MMVI weiqiang's minisite productions This programme is intented to be used only on weiqiang's minisite,and no unauthorised usage is allowed. You may use the programme if only granted permission by the author. Programme filename: manager.php Programme function: Programme authorised to: Original Copy(weiqiang's minisite) */ /*Start Of Programme*/ function parsedocument($document,$returnview=null){ //document is with regards to root folder if(stristr($document,'.php')){ $handle = fopen($document, "r"); $contents = fread($handle, filesize($document)); fclose($handle); sprintf($contents); preg_replace("{title}","$title",$content); } /*elseif(!stristr($document,'.php')){ die(error_note(1010)); return false; }*/ } parsedocument('bbcode.php'); ?> But i am having a problem of "printing" out the final code as print() does not support anything other than variable,html and characters right?I mean it doesn't suppot those "<?php" and "?>".
View Replies !
SQL Parser
IS there a script out there in PHP that can run over a simple SQL statement a report in plain english what it will do? E.g. Updating data in company table name is now xxx date is now xxx.
View Replies !
How To Use My Own Parser?
My web host's PHP doesn't provide curl, so I want to run .php files thru my own PHP parser. However, I don't want to rename all the .php files into .cgi files and add some #!/path/to/php as the first line. Code:
View Replies !
Css Parser
is there any reason for this script not to work? after trying various ways of reading in the css files for some reason all im getting is the echo statements at the bottom. Code:
View Replies !
XML Parser Installation
I am using RH 7.1 with Php4.1.0 and Apache 1.3.22 .... I have installed libxml and zlib also configured php with dom support. now problem is that when i try to open xml file it gives following error: Fatal error: Call to undefined function: xmldocfile() in /development/test.php on line 19 any idea where is the problem ?
View Replies !
Parser Question
I would like to make a simple parser which should work as follows: this is my text {link:href=mypage,link_text} some other text {link:href=otherpage,other_description} This is a string I would like to store in the database and then load in php. Later I would like to insert some other text between { and } signs. I would have a function name "link" with one parameter passed. Return value of this function would be a string to replace that one between { and } signs. function link($params) { ... some logic ... return string; } This function will return something like <a href="/mydir/some_file.php">link_text</a>
View Replies !
|