Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> [resolved] vs.hive issues with apostrophes
morbid romantic
post Jul 25 2008, 07:31 AM
Post #1


Rank #5: Obsessed
*****

Group: Members
Posts: 274
Joined: 12-May 03
From: Hampton, Virginia
Member No.: 33



I just started to use vs.hive for a webring because ringsurf is terrible.

I've noticed, though, that when anyone tries to add a site that has an apostrophe in their name, the site title, or the description... well, anywhere, they get an error:
QUOTE
Could not add your data to the database! This is a fairly major error..


Does anyone know how I can make it so that this doesn't happen?


--------------------
"Let us aquaint ourselves with evil and it will not be long before we find it charming." - Marquis de Sade
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Amelie
post Jul 25 2008, 08:11 AM
Post #2


(Not the film)
Group Icon

Group: CodeGrrl Staff
Posts: 5,287
Joined: 14-January 05
From: UK
Member No.: 2,051



In vs.hive/functions.inc.php, find this code (line 788-800):

CODE
function addnewmember( $d ){
  global $_HIVEID;
  
  // default this value to no
  $d['memberEmailVis'] = empty( $d['memberEmailVis'] ) ? 'no' : $d['memberEmailVis'];
  
  // if we have no password, made up a random one
  $d['memberPass'] = empty( $d['memberPass'] ) ? substr( md5( rand() ), 0, 6 ) : $d['memberPass'];
  
  $str = "INSERT INTO `$_HIVEID[table]` ".
         "( siteKey, memberPass, memberName, memberEmail, memberURL, memberCodeURL, memberCountry, memberTxt2, memberEmailVis, memberTxt1 ) ".
         "VALUES ( '$_HIVEID[id]', MD5( '$d[memberPass]' ), '$d[memberName]', '$d[memberEmail]', '$d[memberURL]', '$d[memberCodeURL]', '$d[memberCountry]', ".
         "'$d[memberTxt2]', '$d[memberEmailVis]', '$d[memberTxt1]' );";


Change it to:

CODE
function addnewmember( $d ){
  global $_HIVEID;
  
  // default this value to no
  $d['memberEmailVis'] = empty( $d['memberEmailVis'] ) ? 'no' : $d['memberEmailVis'];
  
  // if we have no password, made up a random one
  $d['memberPass'] = empty( $d['memberPass'] ) ? substr( md5( rand() ), 0, 6 ) : $d['memberPass'];

  $e = array();
  foreach($d as $k => $v) {
    if (get_magic_quotes_gpc()) $v = stripslashes($v);
    $e[$k] = mysql_real_escape_string($v, $_HIVEID['dblink']);
  }

  $str = "INSERT INTO `$_HIVEID[table]` ".
         "( siteKey, memberPass, memberName, memberEmail, memberURL, memberCodeURL, memberCountry, memberTxt2, memberEmailVis, memberTxt1 ) ".
         "VALUES ( '$_HIVEID[id]', MD5( '$e[memberPass]' ), '$e[memberName]', '$e[memberEmail]', '$e[memberURL]', '$e[memberCodeURL]', '$e[memberCountry]', ".
         "'$e[memberTxt2]', '$e[memberEmailVis]', '$e[memberTxt1]' );";


That will work for members joining, but might not if you are editing them via the admin panel. This is for vs.hive 1.2 single by the way - the code may differ if you are using an older version or the multi version.


--------------------
-- Amelie

» N-N.net | RNM.com | NS.net
» Scripts | PHPAskIt fan?

"This is my signature. There are many others like it but only this one is mine."
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
morbid romantic
post Jul 26 2008, 02:05 AM
Post #3


Rank #5: Obsessed
*****

Group: Members
Posts: 274
Joined: 12-May 03
From: Hampton, Virginia
Member No.: 33



That worked wonderfully! Thank you so, so much. biggrin.gif


--------------------
"Let us aquaint ourselves with evil and it will not be long before we find it charming." - Marquis de Sade
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
corinne1261
post Aug 17 2008, 03:53 PM
Post #4


Rank #4: Advanced
****

Group: Members
Posts: 138
Joined: 11-November 06
Member No.: 5,454



It's resolved, but is there a way to do it for the multiple version? This way doesn't work.


--------------------
c0rinne.net: Web Log | Luve-Me Hosting: Web Host | Luvely Directories: Web Directory
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

- Lo-Fi Version Time is now: 9th February 2010 - 04:04 AM