DevPinoy.org
A Filipino Developers Community
      

captcha addon anyone?

rated by 0 users
This post has 4 Replies | 1 Follower

Top 10 Contributor
Posts 1,100
Points 17,955
jokiz Posted: 08-21-2006 6:34 PM
anyone here who is experiencing a number of blog spam comments?  i am for captcha add-on, what's your stance?
Top 10 Contributor
Posts 1,964
Points 39,155

jokiz:
anyone here who is experiencing a number of blog spam comments?  i am for captcha add-on, what's your stance?

i'm in the process of evalutaing several addons. consider your request granted. :)

devpinoy sig

  • | Post Points: 20
Top 10 Contributor
Posts 1,100
Points 17,955
thanks, i'm plagued by these spam comments
  • | Post Points: 20
Top 10 Contributor
Posts 1,964
Points 39,155
i have updated some skins already! whew! 10 more to go :) btw, only non registered users will see this so logout to view this

devpinoy sig

Top 10 Contributor
Posts 1,964
Points 39,155

Testing the new FTB control...

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
using System;
using System.ComponentModel;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;

namespace KeithRull.CS.WebControls
{
[DefaultProperty("Text")]
[ToolboxData("<{0}:RandomImageControl runat=server></{0}:RandomImageControl>")]
public class RandomImageControl : WebControl
{
[Bindable(true)]
[Category("Appearance")]
[DefaultValue("")]
[Localizable(true)]
public string FolderPath
{
get
{
String s = (String)ViewState["FolderPath"];
return ((s == null) ? String.Empty : s);
}

set
{
ViewState["FolderPath"] = value;
}
}

protected override void CreateChildControls()
{
Image imagePlaceholder = new Image();

//create a new session variable if the variable does not exist
if (ViewState["RandomImageIndex"] == null)
ViewState["RandomImageIndex"] = 0;

//the path of our image folder
string folderPath = FolderPath;
//read the directory information
DirectoryInfo directoryInfo = new DirectoryInfo(folderPath);
//get a list of files contained in our image directory
FileInfo[] fileInfos = directoryInfo.GetFiles("*.jpg");
//get the number of files read in the directory
int fileCount = fileInfos.Length;

//check whether there is a file or not
if (fileCount != 0)
{
//our random number generator
Random randomGenerator = new Random((fileCount * DateTime.Now.Second) + DateTime.Now.Millisecond);
//get the random number
int randomImageIndex = randomGenerator.Next(fileCount);
//get the stored value in our session variable
int storedImageIndex = int.Parse(ViewState["RandomImageIndex"].ToString());
//compare the current and stored values to see if they are the same

while (storedImageIndex == randomImageIndex)
{
//generate a new random number if the stored value is the same as the current one.
randomImageIndex = randomGenerator.Next(fileCount);
}
//the full path of the image
string fullName = fileInfos[randomImageIndex].FullName;

//assign the random number to our session
ViewState["RandomImageIndex"] = randomImageIndex;
//assign the file path to our image control
imagePlaceholder.ImageUrl = fullName;

}

this.Controls.Add(imagePlaceholder);
}
}
}

devpinoy sig

  • | Post Points: 5
Page 1 of 1 (5 items) | RSS

Copyright DevPinoy 2005-2008