Unable to access fb.net forums

For other topics related to the FreeBASIC project or its community.
dodicat
Posts: 6547
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Unable to access fb.net forums

Postby dodicat » Jan 16, 2020 20:11

For fun here is a captcha thing.

Code: Select all

Type d2
    As Single mx,my
    As Single mw,dy
End Type

 Sub throughview(b As d2,a As Single=.5)
     #define A_R( c ) ( ( c ) Shr 16 And 255 )
     #define A_G( c ) ( ( c ) Shr  8 And 255 )
     #define A_B( c ) ( ( c )        And 255 )

    Static  As Ulong _colour(81,81),clr
    Static As Long result
    #macro rotate(pivotx,pivoty,px,py,a,scale)
    Var Newx=scale*((px-pivotx))+pivotx
    Var Newy=scale*((py-pivoty))+pivoty
    #endmacro
    #macro incircle(cx,cy,r,mx,my,a)
    If a<=1 Then
        result=a*(cx-mx)*a*(cx-mx) +1*(cy-my)*1*(cy-my)<= r*r*a*a
    Else
        result=a*(cx-mx)*a*(cx-mx) +1*(cy-my)*1*(cy-my)<= (r)*(r)
    End If
    #endmacro
    If b.mw=0 Then b.mw=1
    b.mw=Abs(b.mw)
    For x As Long=b.mx-40 To b.mx+40
        For y As Long=b.my-40 To b.my+40
            incircle(b.mx,b.my,40,x,y,a)
            If result Then
                clr=Point(x,y)
                _colour(x-b.mx+40,y-b.my+40)=Rgb(A_R(clr)*1,A_G(clr)*1,A_B(clr)*1)
            End If
        Next y
    Next x
    Static As Single dil
    For x As Long=b.mx-40 To b.mx+40
        For y As Long=b.my-40 To b.my+40
            incircle(b.mx,b.my,40,x,y,a)
            If result Then
                rotate(b.mx,b.my,x,y,0,dil)
                Var dist=Sqr((b.mx-newx)*(b.mx-newx)+(b.my-newy)*(b.my-newy))
                dil=(b.mw+(.5-b.mw)*dist/(40*b.mw))
                Line(NewX-dil/2,NewY-dil/2)-(NewX+dil/2,NewY+dil/2),_colour(x-b.mx+40,y-b.my+40),BF
            End If
        Next y
    Next x
   End Sub
   
 Sub rotateimage(Byref dest As Any Ptr=0,im As Any Ptr,angle As Single,shiftx As Long=0,shifty As Long=0,sc As Single=1,miss As Ulong=Rgb(255,0,255),fixedpivot As boolean=false)
    Static As Integer pitch,pitchs,xres,yres,runflag
    Static As Any Ptr row,rows
    Static As Integer ddx,ddy,resultx,resulty
    Imageinfo im,ddx,ddy,,pitch,row
    If dest=0 Then
    Screeninfo xres,yres,,,pitchS
    rowS=Screenptr
    Else
    If sc<>1 Then
        Dim As Integer x,y
        Imageinfo dest,x,y
    Imagedestroy dest:dest=0: dest=Imagecreate(x*sc,y*sc)
    End If
    Imageinfo dest, xres,yres,,pitchS,rows
    End If
    Dim As Long centreX=ddx\2,centreY=ddy\2
    Dim As Single sx=Sin(angle)
    Dim As Single cx=Cos(angle)
    Dim As Long mx=Iif(ddx>=ddy,ddx,ddy),shftx,shfty
    Var fx=sc*.7071067811865476,sc2=1/sc
    If fixedpivot=false Then
     shiftx+=centreX*sc-centrex
     shiftY+=centrey*sc-centrey
     End If
    For y As Long=centrey-fx*mx+1 To centrey+ fx*mx
        Dim As Single sxcy=Sx*(y-centrey),cxcy=Cx*(y-centrey)
        shfty=y+shifty
        For x As Long=centrex-mx*fx To centrex+mx*fx
                 If x+shiftx >=0 Then 'on the screen
                    If x+shiftx <xres Then
                        If shfty >=0 Then
                            If shfty<yres Then
            resultx=sc2*(Cx*(x-centrex)-Sxcy) +centrex:resulty=sc2*(Sx*(x-centrex)+Cxcy) +centrey
                If resultx >=0 Then 'on the image
                    If resultx<ddx Then
                        If resulty>=0 Then
                            If resulty<ddy Then
    Dim As Ulong u=*Cast(Ulong Ptr,row+pitch*((resultY))+((resultX)) Shl 2 ) 'point(image)
   If u<>miss Then *Cast(Ulong Ptr,rowS+pitchS*(y+shifty)+(x+shiftx) Shl 2)= u 'pset (screen)
                End If:End If:End If:End If
                End If:End If:End If:End If
        Next x
    Next y
End Sub

function create as string
    #define range(f,l) int(Rnd*((l+1)-(f))+(f))
    #define ic imagecreate(20,20)
    var ypos=60,x=40
    dim as any ptr i(1 to 9)={ic,ic,ic,ic,ic,ic,ic,ic,ic}
    dim as string s="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    s+=lcase(s)+"0123456789"
    dim as string acc
    for n as long=1 to 9
        var id=range(0,61)
        acc+=chr(s[id])
        draw string i(n),(0,0),chr(s[id]),rgb(rnd*255,rnd*255,rnd*255)
    next
    color ,rgb(255,255,255)
    cls
    dim as long xpos
    for n as long=1 to 9
        var s=1.5+(rnd*.5)
        var a=(rnd-rnd)/2
        rotateimage(,i(n),a,20*n+x,ypos,s,,0)
        if n=5 then xpos=20*n+x
    next n
     dim as d2 b =Type(xpos,ypos+8,1.5,0)
     throughview(b)
     for n as long=1 to 9
         imagedestroy(i(n))
         next
    return acc
    end function
  '===============
   randomize
   screenres 300,200,32
   width 300\8,200\16
   dim as string key
   do
  draw string (50,180),create,rgb(0,0,0)
  sleep
  cls
  key=inkey
  loop until key= chr(255)+"k" or key=chr(27)
   
   

Bye the way jj2007, you keep mentioning (C++ compilers) as the FreeBASIC driving force over in the masm forum, when it is actually uses gcc, which you have to flag up, otherwise it is GNU assembler as the default.
paul doe
Posts: 1244
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: Unable to access fb.net forums

Postby paul doe » Jan 16, 2020 20:24

@badidea: Hahaha pretty amusing. And I would certainly want to take a look at the code for a bot that cracks these, especially the first one. Makes me wonder how would I code one of such generators ;)
dodicat
Posts: 6547
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Unable to access fb.net forums

Postby dodicat » Jan 16, 2020 20:38

paul doe.
Answering your vanished post, It is probably the most important project on this forum just now and I foresee it taking much more prominence.
badidea
Posts: 2076
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: Unable to access fb.net forums

Postby badidea » Jan 16, 2020 20:40

Image wrote:
For fun here is a captcha thing.

Too easy for AI, I think.
jj2007
Posts: 1523
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: Unable to access fb.net forums

Postby jj2007 » Jan 17, 2020 0:27

dodicat wrote:Bye the way jj2007, you keep mentioning (C++ compilers) as the FreeBASIC driving force over in the masm forum, when it is actually uses gcc, which you have to flag up, otherwise it is GNU assembler as the default.
You have a point there, dodicat, but otoh far too many posts in this forum deal with the question "how do I have to tweak my C/C++ toolchain to get FB do its job".
dafhi
Posts: 1345
Joined: Jun 04, 2005 9:51

Re: Unable to access fb.net forums

Postby dafhi » Jan 17, 2020 0:52

i thought of a good question (imo). i'll email it

i think your original concept is decent, but i also would have entered "." Perhaps change it to that, and add a second auth question, possibly upping the amount of questions as bots get smarter

another safe bet: allow us 'oldbies' (active, and reg for at least a year) moderation to allow a newbie's intial 3 posts to go through

[edit]
love the captcha, dodicat!
dafhi
Posts: 1345
Joined: Jun 04, 2005 9:51

Re: Unable to access fb.net forums

Postby dafhi » Jan 17, 2020 1:57

just realized my posting concept isn't too helpful; the real problem is new member application. perhaps that too could be [eventually] offloaded onto forum members as an additional authentication step

[update] - my original question is also geared more for the future, so i'll keep my email to myself
jj2007
Posts: 1523
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: Unable to access fb.net forums

Postby jj2007 » Jan 17, 2020 2:20

dafhi wrote:allow us 'oldbies' (active, and reg for at least a year) moderation to allow a newbie's intial 3 posts to go through
It would discourage bots if new members simply were not allowed to enter any links for publicity, scams etc until they've reached one week of membership.
dafhi
Posts: 1345
Joined: Jun 04, 2005 9:51

Re: Unable to access fb.net forums

Postby dafhi » Jan 17, 2020 2:40

i frequently look at my post to see if i could word more effectively. anyway, jj that's a pretty solid idea! combined with my idea, if an acceptance moderator sees a post as relevant, it would immediately go through
jj2007
Posts: 1523
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: Unable to access fb.net forums

Postby jj2007 » Jan 17, 2020 9:32

The question is whether the forum software allows such a setting. Obviously, spammers want to place links here, and technically it's easy to parse a post for "http" to determine if it's legit or not. But I have no idea whether an admin can insert some code to prevent posting.
grindstone
Posts: 726
Joined: May 05, 2015 5:35
Location: Germany

Re: Unable to access fb.net forums

Postby grindstone » Jan 17, 2020 13:39

coderJeff wrote:As mentioned before, I will gladly accept suggestions for better question & answer.
What about a simple automatically generated mental arithmetic, maybe expressed in words instead of numbers, e.g. "Please enter the sum of fourty-five and twelve" ?
badidea
Posts: 2076
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: Unable to access fb.net forums

Postby badidea » Jan 17, 2020 19:16

paul doe wrote:Makes me wonder how would I code one of such generators ;)

I was thinking the same, but lets start a new topic for that :-)
Edit, a start: viewtopic.php?f=8&t=28268

Return to “Community Discussion”

Who is online

Users browsing this forum: No registered users and 4 guests