vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Country Flag Hack v2.0 (https://vborg.vbsupport.ru/showthread.php?t=27485)

scsa20 05-02-2002 05:49 PM

I keep getting this:

Quote:

Database error in vBulletin 2.2.5:

Invalid SQL: SELECT country FROM user WHERE userid=1
mysql error: Unknown column 'country' in 'field list'

mysql error number: 1054

Date: Thursday 02nd of May 2002 02:36:08 PM
Script: http://forums.simon-soft.com/member....on=editprofile
Referer: http://forums.simon-soft.com/usercp.php?
how do I fix this??

wot-Mike 05-02-2002 06:45 PM

Looks like you didn't run a querie. The user table needs to be altered, the country field needs to be added.

Look inside the install.txt for that info :)
It's step 1 I believe...

scsa20 05-02-2002 07:18 PM

doh, stupid me, all I look for is the code to put in, plus the beging part of the install.txt file is nothing but info about it...maybe I should open up my eyes more :rolleyes:

Sketch 05-02-2002 10:31 PM

okay, all is hitchless for me except one thing. In the memberlist, the flag is not displayed. Everywhere else it is displayed okay.

Here is a link to where it is not showing---http://www.livetheworship.com/vb/memberlist.php?s=

Here is a link to where it is showing---
http://www.livetheworship.com/vb/sho...s=&threadid=89

Here is my memberlistbit (fragment):
Code:

<tr align="center">
        <td bgcolor="{firstaltcolor}">$flag</td>
        <td bgcolor="{secondaltcolor}" align="left">
<span style="font-size: 11px;">
<a href="member.php?s=$session[sessionhash]&action=getinfo&userid=$userinfo[userid]">$userinfo[username]</a>
</td>

Any ideas why it won't show up here?

Sketch

scsa20 05-03-2002 02:34 AM

did you add $flag ??

DWZ 05-03-2002 09:39 AM

Can someone tell me how I can make it so a users must select a flag when they sign up?

ie. You get a message saying "You must select a country to register" if they keep the box blank.

Thanks :)

DWZ 05-07-2002 01:19 AM

Quote:

Originally posted by DWZ
Can someone tell me how I can make it so a users must select a flag when they sign up?

ie. You get a message saying "You must select a country to register" if they keep the box blank.

Thanks :)

http://members.optushome.com.au/mega...orums/BUMP.gif

DWZ 05-12-2002 11:26 PM

awww... come on, please, anyone?

DWZ 05-18-2002 11:52 AM

Quote:

Originally posted by DWZ
awww... come on, please, anyone?
it isn't that hard... is it?

webhost 05-18-2002 04:24 PM

In register.php find this
PHP Code:



if ($action=="register") {

  if (!
$allowregistration) {

    eval(
"standarderror(\"".gettemplate("error_noregister")."\");");

    exit;

  }



  if (
$bbuserinfo[userid]!=and !$allowmultiregs) {

    
$getuser=$DB_site->query_first("SELECT username FROM user WHERE userid='$bbuserinfo[userid]'");

    
$username=$getuser[username];



    eval(
"standarderror(\"".gettemplate("error_alreadyregistered")."\");");



    exit;

  } 


After it put this


PHP Code:


" if($country==""){
    eval("
standarderror('Please select your country.');");
    exit;
 }" 


DWZ 05-18-2002 09:25 PM

Quote:

Originally posted by webhost
In register.php find this
PHP Code:



if ($action=="register") {

  if (!
$allowregistration) {

    eval(
"standarderror(\"".gettemplate("error_noregister")."\");");

    exit;

  }



  if (
$bbuserinfo[userid]!=and !$allowmultiregs) {

    
$getuser=$DB_site->query_first("SELECT username FROM user WHERE userid='$bbuserinfo[userid]'");

    
$username=$getuser[username];



    eval(
"standarderror(\"".gettemplate("error_alreadyregistered")."\");");



    exit;

  } 


After it put this


PHP Code:


" if($country==""){
    eval("
standarderror('Please select your country.');");
    exit;
 }" 


Great :D

Thanks for that :)

But just to check, should those " at the start and end be there in the code I'm puting in be there?

webhost 05-18-2002 09:33 PM

PHP Code:

if($country==""){ 
eval(
"standarderror('Please select your country.');"); 
exit; 



DWZ 05-18-2002 11:59 PM

Quote:

Originally posted by webhost
PHP Code:

if($country==""){ 
eval(
"standarderror('Please select your country.');"); 
exit; 



yep, thats what I thought :)

Will test it now

DWZ 05-19-2002 12:05 AM

OK, just tried it, didn't work :(

As soon as I hit the register link, it says "Please select your country."

I hadn't even got to the signup page yet before it said it...

Any ideas?

webhost 05-19-2002 01:28 AM

remove that and place here.

Find
PHP Code:

// Country Hack

  
$country trim($country);
// Country Hack End 

and place this after it

PHP Code:

if($country==""){
    eval(
"standarderror('Please select your country.');");
    exit;
 } 


so it should like this when finished

PHP Code:

// Country Hack

  
$country trim($country);
if(
$country==""){
    eval(
"standarderror('Please select your country.');");
    exit;
 }
// Country Hack End 


DWZ 05-19-2002 01:41 AM

That worked great :D

Thanks for all your help webhost.

refertech 06-03-2002 01:49 AM

Great work man. I would it be possible to see the country name in the users profile. I dont reconize alot of the flags.
Installed great for me in 2.2.6. :)

aldamon 06-07-2002 02:31 PM

I'm so attached to this hack that I probably won't upgrade to vB 3.0 until it is ported.

freehtml 06-08-2002 01:24 PM

I can't seems to find find:
$templatesused .= "register_birthday,modifyprofile_customtext,regist er_customfields,usercpnav,modi fyprofile";

In my member.php (version 2.2.6)...

ciscoman 07-07-2002 09:22 PM

It should be this
$templatesused = 'register_birthday,modifyprofile_customtext,regist er_customfields,usercpnav,modi fyprofile';

freehtml 07-14-2002 12:35 AM

thanks, I think I will not install any hack till vB 3 is out

MarkG 07-16-2002 06:05 PM

great hack

two errors: europe flag is not there(but it's here http://apolyton.net/forums/images/flags/Europe.gif) and Tajikistan.gif is mispelled

streamzone 07-26-2002 11:16 PM

k...

Hack works wonderfully - EXCEPT. It displays the flag everywhere it's supposed to except under or next to my members name when showing threads. I've checked and rechecked the code so many times in postbit template... everything looks fine. Any idea what the problem could be? Thanks in advance.

Jean147 08-09-2002 01:10 AM

Quote:

Originally posted by streamzone
k...

Hack works wonderfully - EXCEPT. It displays the flag everywhere it's supposed to except under or next to my members name when showing threads. I've checked and rechecked the code so many times in postbit template... everything looks fine. Any idea what the problem could be? Thanks in advance.

same problem for me here. :( Hack works great in memberlistbit and getinfo. But the flag is not shwon in the postbit template, although $flag is in.

Any help would be really apreciated. :)

Congrats on this hack. It is really great. Just fix the problem please. :p :D

Jean147 08-09-2002 01:29 AM

The user.php code also does not work. I really tried everything :(

Parse error: parse error in /homepages/15/d42020741/htdocs/gtn/forums/admin/user.php on line 391

ExAvIoUr 08-09-2002 09:10 PM

1 - Add to database-Table user, field named: country
properties: ( country varchar(50) NOT NULL )

i don't get that.

does it mean that the name is Table and the field is country?

Erwin 08-10-2002 12:06 AM

No, the table name is "User" - add a field called "Country" with those variables using phpmyadmin.

ExAvIoUr 08-10-2002 12:10 AM

how do i do that in phpmyadmin?

Erwin 08-10-2002 12:20 AM

In the query box, run this:

ALTER TABLE user ADD country VARCHAR (50) NOT NULL

Jean147 08-10-2002 11:59 AM

maybe somone may help me too with my problem?

carpman 08-23-2002 12:38 PM

i can get this to work for admin but registered users just see blank space where country list/menu should be!!

note this is only in user cp, is ok when they register!!

any ideas

carpman 08-24-2002 05:43 PM

ok i have a problem in user.php, it says to add:

// $DB_site->query("UPDATE user SET birthday='".addslashes($birthday)."',signature='". addslashes($signature)."',cust omtitle='".intval($customtitle)."',usertitle='".ad dslashes($customtext)."',email ='".addslashes(htmlspecialchars($email))."',parent email='".addslashes(htmlspecia lchars($parentemail))."',coppauser='$coppauser',ho mepage='".addslashes(htmlspeci alchars($homepage))."',icq='".addslashes(htmlspeci alchars($icq))."',aim='".addsl ashes(htmlspecialchars($aim))."',yahoo='".addslash es(htmlspecialchars($yahoo))." ',usergroupid='$bbuserinfo[usergroupid]',country='".addslashes($country)."' WHERE userid='$bbuserinfo[userid]'");

But i already have user away hack installed which changed this entry to:

$DB_site->query("UPDATE user SET away='$away',awaydate=$awaydate,returndate='$retur ndate',awayreason='".addslashe s(htmlspecialchars($awayreason))."',birthday='$bir thday',options='$options',user groupid='$usergroupid',username='".addslashes(html specialchars($ausername))."'$p wdinclude,email='".addslashes(htmlspecialchars($em ail))."',styleid='$userstyleid ',parentemail='".addslashes(htmlspecialchars($pare ntemail))."',coppauser=$coppau ser,homepage='".addslashes(htmlspecialchars($homep age))."',icq='".addslashes(htm lspecialchars($icq))."',aim='".addslashes(htmlspec ialchars($aim))."',yahoo='".ad dslashes(htmlspecialchars($yahoo))."',signature='" .addslashes($signature)."',adm inemail=$adminemail,showemail=$showemail,invisible =$invisible,usertitle='".addsl ashes($usertitle)."',customtitle=$customtitle,join date=$joindate,cookieuser=$coo kieuser,nosessionhash=$nosessionhash,daysprune='$d aysprune',lastvisit=$lastvisit ,lastactivity=$lastactivity,lastpost=$lastpost,pos ts='$posts',timezoneoffset='$t imezoneoffset',emailnotification=$emailnotificatio n,receivepm='$receivepm',email onpm='$emailonpm',ipaddress='".addslashes($aipaddr ess)."',pmpopup=IF(pmpopup=2 AND $pmpopup=1,pmpopup,'$pmpopup') WHERE userid=$userid");

i have looked but am unclear as to changes i should make?

anyone help?

carpman 08-24-2002 07:01 PM

i am going to try this, any feedback?

$DB_site->query("UPDATE user SET away='$away',awaydate=$awaydate,returndate='$retur ndate',awayreason='".addslashe s(htmlspecialchars($awayreason))."',birthday='".ad dslashes($birthday)."',options ='$options',usertitle='".addslashes($customtext)." ',usergroupid='$bbuserinfo[usergroupid]',username='".addslashes(htmlspecialchars($auserna me))."'$pwdinclude,email='".ad dslashes(htmlspecialchars($email))."',styleid='$us erstyleid',parentemail='".adds lashes(htmlspecialchars($parentemail))."',coppause r=$coppauser,homepage='".addsl ashes(htmlspecialchars($homepage))."',icq='".addsl ashes(htmlspecialchars($icq)). "',aim='".addslashes(htmlspecialchars($aim))."',ya hoo='".addslashes(htmlspecialc hars($yahoo))."',signature='".addslashes($signatur e)."',adminemail=$adminemail,s howemail=$showemail,invisible=$invisible,usertitle ='".addslashes($usertitle)."', customtitle='".intval($customtitle)."',country='". addslashes($country)."',joinda te=$joindate,cookieuser=$cookieuser,nosessionhash= $nosessionhash,daysprune='$day sprune',lastvisit=$lastvisit,lastactivity=$lastact ivity,lastpost=$lastpost,posts ='$posts',timezoneoffset='$timezoneoffset',emailno tification=$emailnotification, receivepm='$receivepm',emailonpm='$emailonpm',ipad dress='".addslashes($aipaddres s)."',pmpopup=IF(pmpopup=2 AND $pmpopup=1,pmpopup,'$pmpopup') WHERE userid='$bbuserinfo[userid]'");

carpman 08-24-2002 07:51 PM

hello, modifyprofile_country tempate is set to -1 but users still cannot see the drop down list of coutries in their user-cp, they can when they register though

the code should be ok as when logged in as admin i can see and change country from user-cp

could use some help, only thing not sure of is user.php editing see above posts

carpman 08-26-2002 09:12 PM

hello, back again.

I have been through re-install of hack, except database entries as not sure if i should duplicate them.

I have done all php pages and tempates and have run the change_template.php, checked with myphadmin and it is set to -1

New users can register with flag and is displays everwhere it should.

However, older user and current users (withflag) cannot access country list via user_cp, it is just blank space.

The other problem is in admin cp, when i try and edit a user the user ID 1 (admin) gets set to the user details (name, profile etc) of who i was trying edit, so i end with two users with same name but different ID.

The the only thing i can think of is a conflick with 'leave away message' which also has changes to entries $DB_site->query("UPDATE user SET

the two pages affected are member.php and user.php below is what i have for each page, i have tried to compare and get things as should be, but might have missed something.

help really appreciated

member.php
$DB_site->query("UPDATE user SET birthday='".addslashes($birthday)."',signature='". addslashes($signature)."',cust omtitle='".intval($customtitle)."',usertitle='".ad dslashes($customtext)."',email ='".addslashes(htmlspecialchars($email))."',parent email='".addslashes(htmlspecia lchars($parentemail))."',coppauser='$coppauser',ho mepage='".addslashes(htmlspeci alchars($homepage))."',icq='".addslashes(htmlspeci alchars($icq))."',aim='".addsl ashes(htmlspecialchars($aim))."',yahoo='".addslash es(htmlspecialchars($yahoo))." ',usergroupid='$bbuserinfo[usergroupid]',country='".addslashes($country)."' $awaysql WHERE userid='$bbuserinfo[userid]'");

admin/user.php
$DB_site->query("UPDATE user SET away='$away',awaydate=$awaydate,returndate='$retur ndate',awayreason='".addslashe s(htmlspecialchars($awayreason))."',birthday='".ad dslashes($birthday)."',options ='$options',usertitle='".addslashes($customtext)." ',usergroupid='$bbuserinfo[usergroupid]',username='".addslashes(htmlspecialchars($auserna me))."'$pwdinclude,email='".ad dslashes(htmlspecialchars($email))."',styleid='$us erstyleid',parentemail='".adds lashes(htmlspecialchars($parentemail))."',coppause r=$coppauser,homepage='".addsl ashes(htmlspecialchars($homepage))."',icq='".addsl ashes(htmlspecialchars($icq)). "',aim='".addslashes(htmlspecialchars($aim))."',ya hoo='".addslashes(htmlspecialc hars($yahoo))."',signature='".addslashes($signatur e)."',adminemail=$adminemail,s howemail=$showemail,invisible=$invisible,usertitle ='".addslashes($usertitle)."', customtitle='".intval($customtitle)."',country='". addslashes($country)."',joinda te=$joindate,cookieuser=$cookieuser,nosessionhash= $nosessionhash,daysprune='$day sprune',lastvisit=$lastvisit,lastactivity=$lastact ivity,lastpost=$lastpost,posts ='$posts',timezoneoffset='$timezoneoffset',emailno tification=$emailnotification, receivepm='$receivepm',emailonpm='$emailonpm',ipad dress='".addslashes($aipaddres s)."',pmpopup=IF(pmpopup=2 AND $pmpopup=1,pmpopup,'$pmpopup') WHERE userid='$bbuserinfo[userid]'");

DWZ 09-03-2002 04:52 AM

I tried to run the SQL command[sql]UPDATE template SET templatesetid="-1" where title="modifyprofile_country"[/sql]With FireFly's run sql query from admin cp hack and I get a database error:
Quote:

Database error in vBulletin Control Panel 2.2.7:

Invalid SQL: UPDATE template SET templatesetid=
mysql error: You have an error in your SQL syntax near '' at line 1

mysql error number: 1064

Date: Tuesday 03rd of September 2002 05:50:41 AM
Script: http://www.consoleradar.com/forums/f...dmin/query.php
Referer: http://www.consoleradar.com/forums/admin/query.php
Is that his hack or this hack that is having this problem? :confused:

kira 09-03-2002 08:42 PM

Just wanted to say I installed this hack on 2.2.6 and it worked flawlessly. I did take care to tweak the syntax in the hack that, as I think HellSatan mentioned earlier, seems to have been made for an older version of vB -- maybe some of you who are having problems the code can make sure you do the same?

In the instructions relating to member.php, make note of these changes:

When the instructions tell you to ...
Quote:

find:
$templatesused .= "register_birthday,modifyprofile_customtext,regist er_customfields,usercpnav,modifyprofile";

Replace it with
// Country Hack Replace
// $templatesused .= "register_birthday,modifyprofile_customtext,regist er_customfields,usercpnav,modifyprofile";
$templatesused .= "register_birthday,modifyprofile_customtext,modify profile_country,register_customfields,usercpnav,mo difyprofile";
// Country Hack End


Do this instead:

Quote:

find:
$templatesused = "register_birthday,modifyprofile_customtext,regist er_customfields,usercpnav,modifyprofile";

Replace it with

// Country Hack Replace
// $templatesused = "register_birthday,modifyprofile_customtext,regist er_customfields,usercpnav,modifyprofile";
$templatesused = "register_birthday,modifyprofile_customtext,modify profile_country,register_customfields,usercpnav,mo difyprofile";
// Country Hack End
and (also in the member.php instructions) where it says to:

Quote:

find:
eval("\$customtext.= \"".gettemplate("modifyprofile_customtext")."\";") ;
}
}

Below it add:
// Country Hack
if (!$getcountry = $DB_site->query_first("SELECT country FROM user WHERE userid=$bbuserinfo[userid]")) {
$country="";
$ctrdefaultselected = "selected";
} else {
$country="$getcountry[country]";
$countryalt = str_replace("%20"," ",$country);
$countrysel = str_replace("%20","_",$country);
$flag="<img src=\"images/flags/$country.gif\" alt=\"$countryalt\" align=\"absmiddle\" border=\"0\">";
$ctryname = "ctry".$countrysel."selected";
$$ctryname = "selected";
}
eval("\$countrytext. = \"".gettemplate("modifyprofile_country")."\";") ;
// Country Hack End
instead of that, do this...

Quote:

find:
eval("\$customtext= \"".gettemplate("modifyprofile_customtext")."\";") ;
}
}

Below it add:
// Country Hack
if (!$getcountry = $DB_site->query_first("SELECT country FROM user WHERE userid=$bbuserinfo[userid]")) {
$country="";
$ctrdefaultselected = "selected";
} else {
$country="$getcountry[country]";
$countryalt = str_replace("%20"," ",$country);
$countrysel = str_replace("%20","_",$country);
$flag="<img src=\"images/flags/$country.gif\" alt=\"$countryalt\" align=\"absmiddle\" border=\"0\">";
$ctryname = "ctry".$countrysel."selected";
$$ctryname = "selected";
}
eval("\$countrytext = \"".gettemplate("modifyprofile_country")."\";") ;
// Country Hack End
Hope this makes sense and is correct. Basically, there were extra dots that didn't need to be there. Maybe the instructions could be updated?

Anyway, great hack, thank you very much!

DWZ 09-09-2002 07:01 AM

Quote:

Originally posted by DWZ
I tried to run the SQL command[sql]UPDATE template SET templatesetid="-1" where title="modifyprofile_country"[/sql]With FireFly's run sql query from admin cp hack and I get a database error:Is that his hack or this hack that is having this problem? :confused:
*bump*

AJR 10-22-2002 08:52 AM

DWZ... try using apostrophes (') instead of quotes (") around the -1 in the query.

DWZ 10-22-2002 09:04 AM

Quote:

Originally posted by AJR
DWZ... try using apostrophes (') instead of quotes (") around the -1 in the query.
that worked!

thanks!


All times are GMT. The time now is 08:37 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01695 seconds
  • Memory Usage 1,874KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (9)bbcode_php_printable
  • (13)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete