egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[SOLVED] count url

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
Fire-Fox
Master


Joined: 23 Sep 2006
Posts: 270
Location: /dev/null

PostPosted: Sat Mar 03, 2012 5:16 pm    Post subject: [SOLVED] count url Reply with quote

what is wrong here :

Code:
   #Url
   set sqlsiteurl "SELECT COUNT(DISTINCT(siteurl)) FROM home WHERE siteurl='siteurl'"
   set siteurl [mysqlsel $mysql_(handle) $sqlsiteurl -flatlist]

_________________
GreatZ
Fire-Fox | Denmark

Scripts: Relay | Store Text | TvMaze


Last edited by Fire-Fox on Sat Mar 03, 2012 7:28 pm; edited 1 time in total
Back to top
View user's profile Send private message MSN Messenger
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sat Mar 03, 2012 5:38 pm    Post subject: Reply with quote

Well, that'd depend on the database structure and contents, as well as the expected results...
Anyhow...
Code:
SELECT COUNT(DISTINCT(siteurl))

Return the number of unique siteurl's from the filtered set.
Code:
WHERE siteurl='siteurl'

Filter the results to only return rows where the field siteurl is equal to the string "siteurl".

If you expect this to return anything other than 0 or 1, then you need to rethink your query.
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
Johannes13
Halfop


Joined: 10 Oct 2010
Posts: 46

PostPosted: Sat Mar 03, 2012 6:23 pm    Post subject: Reply with quote

sql injection ftw. Make sure you escape the user given variables
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sat Mar 03, 2012 6:28 pm    Post subject: Reply with quote

Johannes13, since there are no variable substitutions within the query of the posted code, I don't see the relevance of sql injections.
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
Fire-Fox
Master


Joined: 23 Sep 2006
Posts: 270
Location: /dev/null

PostPosted: Sat Mar 03, 2012 6:43 pm    Post subject: Reply with quote

Thanks nml375 Smile
Did it like this :
Code:
#Url
set sqlsiteurl "SELECT COUNT(DISTINCT(siteurl)) FROM pred"
set siteurl [mysqlsel $mysql_(handle) $sqlsiteurl -flatlist]

and returned 715 urls Smile
_________________
GreatZ
Fire-Fox | Denmark

Scripts: Relay | Store Text | TvMaze
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber