Welcome to Geeklog, Anonymous Thursday, November 28 2024 @ 01:38 pm EST
Geeklog Forums
Removing backslashes after apostrophes (in Geekbook)
jadiepoo
I tried including COM_stripslashes() in the index.php but it spat out errors and I know that lib-common is referred to by the plugin(I'm not a PHP coder).
Here's the GeekBook in action and here's my PHPInfo in case it might help.
I don't have problems with backslashes (since most of them have been addressed and fixed already in the upgrades) in any other part of geeklog so I think this is just a GeekBook bug.
Any help will be appreciated, thanks!
Anonymous
Here's a nifty program Blaine wrote to test for magic_quotes and the use of addslashes().
<?php
/* Program to test SQL inserts and handling of magic_quotes_gpc
* Blaine Lang
* Feb 26,2002
The SQL to create the test table is:
CREATE TABLE magictest (
id mediumint(8) NOT NULL auto_increment,
text varchar(254) NOT NULL default '',
PRIMARY KEY (id)
) TYPE=MyISAM;
*/
require_once('lib-common.php');
$_TABLES['magictest'] = 'magictest';
echo "This is a program for testing magic_quotes and database inserts of quotes";
if(get_magic_quotes_gpc() ) {
echo "<br>Currently magic_quotes_gpc is set to be on";
} else {
echo "<br>Currently magic_quotes_gpc is set to be off";
}
if ($HTTP_POST_VARS['test'] == "") {
echo '<form action="' .$_PHP_SELF. '" method="post">';
echo '<table border="0" cellspacing="0" cellpadding="3">';
echo '<tr><td>Enter test content:</td>';
echo '<td><input type="text" size="32" maxlength="128" name="test"></td>';
echo '</tr></table></form>';
} else {
echo "<p>Saving <b>{$HTTP_POST_VARS['test']}</b> as a new record ...";
if(!get_magic_quotes_gpc() ) {
echo "<br>magic_quotes_gpc is off - using addslashes()";
$test = addslashes($HTTP_POST_VARS['test']);
} else {
$test = $HTTP_POST_VARS['test'];
}
DB_query("INSERT INTO {$_TABLES['magictest']} (text) VALUES ('$test')");
echo '<br><b>Record saved ok.</b>';
}
?>
jadiepoo
THis is the beginning of my index.php:
$sitename = $_CONF['site_name'];
$result=mysql_query("SELECT name, date, email, comment, yahoo, aolim, icq, msn FROM geekbook");
$entriesperpage = 10;
$results = mysql_query("SELECT * FROM geekbook");
$endresult = mysql_num_rows($results);
//To protect entry number validation
$checkendresult = $endresult+1;
if ( $from == "" && $limit == "") {
$from = 0;
$limit = $entriesperpage;
$page = 1;
}
$result = mysql_query("SELECT * FROM geekbook order by id DESC limit $from, $limit",$db);
$display .= COM_siteHeader();
$display .= COM_stripslashes();
The first line in the function in lib-common is
Again, I'm not a coder and just tried a logical fix. I removed the line once I saw it didn't work.
Just to clarify, if I type "I can't and won't" in the geekbook, it displays "I can't and won't"
Thanks for replying btw
jadiepoo
My above post had an example of what error I'm getting but it didn't display how it should've had.
It should've been:
If I typed out "I couldn't and shouldn't and wouldn't" it'll echo out
squatty
In a world without walls and fences, who needs Windows and Gates?
jadiepoo
Unfortunately, that didn't work I tried $result as well but no cigar
Here's the index. Here are some other files that I think might need the stripslashes:
gbfunctions - it refers to the lib-common, geekbadd and gkaddentry.
Is there a documentation on how a static page has stripslashes implemented? I think geekbook is derived/used static pages.
Again, thanks a bunch!
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content