using expat would probably be your easiest/best option, but if you really wanted to it wouldn't be too hard to make a rudimentary xml parser.
1 2007-04-27 19:32
Re: C++ source code to compare XML files like ExamXML XML differencing too (6 replies, posted in Programming)
2 2007-01-10 23:46
Re: PHP problem - functions within regex (4 replies, posted in Programming)
woops, managed to mispell something and forget some quotes. sorry about that, fixed now.
3 2007-01-10 23:38
Re: PHP problem - functions within regex (4 replies, posted in Programming)
the problem, I believe, is that preg_replace takes a string as a second argument; what's happening is that the dice function is first called with the parameter '$1', then the return value (ie. '$1 = 0') is used as the replacement string. I'd do something like this (assuming dice() isn't used for something else as well):
$message = preg_replace_callback('#\[diceroll\](.+?)\[/diceroll\]#s', 'dice', $message);
then, in the dice function, add this to the very beginning
$rollwhat = $rollwhat[1];
'
4 2006-12-23 13:26
Re: .htaccess issues (9 replies, posted in Programming)
You could try something like this:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)(/([^/]*))?$ /base_forum/$3?forum_name=$1 [QSA,L]
5 2006-12-16 11:57
Re: Submit Form (9 replies, posted in Programming)
How do you know that that error dosn't come from the way you get the variables and create the query string? It seems unlikely that a browser would be limited to 'the number of variables in a query string' when it's all just one long string anyway.
6 2006-12-15 22:30
Re: Submit Form (9 replies, posted in Programming)
If you're sending it via post I don't really think there is a limit to how much information you send, although I might be wrong.
7 2006-12-14 20:43
Re: Submit Form (9 replies, posted in Programming)
I don't believe there is a way to 'easily' submit forms via AJAX without building up the query string. I'd recommend, though, making the adminProfileNewSubmit function a little more general, to allow for easier alteration of the form and more possible applications of the js. So instead of simply retrieving the value of each field in a seperate statement, a more expandable approach would be to loop through the fields and retrieve the value based off its type. (eg. switch(field.type) { case 'text' : bla bla bla; break; case 'checkbox' : bla bla bla; break; etc... })
8 2006-10-18 19:41
Re: What is actually a "NULL byte"? (14 replies, posted in Programming)
That's what I said. I said \0 is an escape char for a null, not an escaped null. The same way \r and \n are escape chars, representing the values 13 and 10.
elbekko: in a character or string literals, yes
9 2006-10-18 17:33
Re: Alt Tag in Images (12 replies, posted in PunBB 1.2 troubleshooting)
$str = preg_replace("#\[img\?width\=(.+)&height\=(.+)&alt\=(.+)\](.+)\[/img\]#i", '<img src="$4" width="$1" height="$2" alt="$3" />', $str);
This has some major security vulnerabilities in it, as none of the user input is verified. Something as simple as [img?width=5&height=5" onerror="alert('hi there');&alt=test]http://not.an.image/file.png[/img] could inject js into the output (the url could be used as well). In addition, a regular expression like that would require that all the attributes be present in that order, something that could become an annoyance for users.
@wii: The html is actually not incorrect if an img tag does not include the width and height attributes; the only required attributes are src and alt: http://www.w3.org/TR/html401/struct/objects.html#h-13.2
10 2006-10-18 17:18
Re: What is actually a "NULL byte"? (14 replies, posted in Programming)
@elbekko: '\0' is an escape char for a null byte, 0, as Rickard mentioned, is it's actual value. And when you have a string literal in C (eg. "Hello World"), it is implicitly null terminated.
11 2006-10-18 17:06
Re: problems with ajax (3 replies, posted in Programming)
I would highly recommend using a library for your AJAX code, it would greatly simplify matters for you, and be much less likely to contain any bugs. And there is a js function called setInterval, by the way, which may be easier to use than continually calling setTimeOut.
12 2006-10-04 18:16
Re: A website for bulletin boards (2 replies, posted in General discussion)
13 2006-10-04 17:54
Re: MySQL problem (Full text searching) (4 replies, posted in Programming)
14 2006-09-17 10:55
Re: How to have UTF-8 with this script ? (2 replies, posted in Programming)
If your text dosn't use any extended characters I don't believe you have to 'convert' to utf-8, but if so then these pages might be of interest:
http://php.net/manual/en/ref.mbstring.php
http://php.net/manual/en/ref.iconv.php
http://php.net/manual/en/ref.recode.php
15 2006-09-10 14:54
Re: RSS newsbot not working so well (7 replies, posted in Programming)
Oops, yeah, forgot to say that that was line 186 in viewtopic.php. Your modification was checking an array index which didn't exist, so the condition always evaluated to false.
16 2006-09-10 09:55
Re: RSS newsbot not working so well (7 replies, posted in Programming)
The problem is that the mysql query on line 186 isn't including p.html in its query. You need to add ', p.html' somewhere in the select part of the query so the html field will be present in the array. Additional, you spelled 'topics' incorrectly in your last query, and it might be a good idea to use $db->prefix.'tablename' instead.
Furthermore, every time this executes it will add a new topic for each item in the rss feed, regardless of whether you've already posted it. You should implement a method to store the lsat rss timestamp or store all the used guids so you won't repost messages.
17 2006-08-22 13:23
Re: Strip (preg_match) bbcode of entire quotes, and quote on quote (9 replies, posted in Programming)
This is pretty old, but I'd just thought I'd mention that regular expressions have a recursive aspect, which may be useful if you need to deal with nested quotes. For instance, this strips out all nested quotes without a loop:
$out = preg_replace('/\[quote(=[^\]]*?)?\]((.*)|(?R))\[\/quote\]/is', '', $text);
18 2006-07-01 11:32
Re: IE7 Beta 3 Released (1 replies, posted in Programming)
The UI is still as ugly as hell.
19 2006-06-29 21:42
Re: Textarea content preformatted (3 replies, posted in Programming)
This:
<textarea>hello
world.
test ing</textarea>
shows up with all the white-space intact for me.
20 2006-06-29 20:26
Re: Textarea content preformatted (3 replies, posted in Programming)
Um, isn't it sort of already like that?
21 2006-06-12 16:31
Re: Need help in C++ (1 replies, posted in Programming)
Well, what do you need help with specifically? All you have to do is go through each line, picking out the integers as you go and storing them in a 32*32 sized array. Eg.
int whatever[32][32] = { 0 };
void retrievevalues(char *line, int index)
{
int i;
char *p;
for(i = 0, p = line; i < 32 && *p; i++)
{
while(!isdigit(*p) && *p) p++; //find int
if(*p) whatever[index][i] = strtol(p, &p, 10); //convert int and move pointer
}
return;
}
//get lines, etc...