cilaes's Profile
Reputation: 9
Worker
- Group:
- Active Members
- Active Posts:
- 72 (0.14 per day)
- Joined:
- 12-December 11
- Profile Views:
- 994
- Last Active:
Nov 30 2012 08:11 PM- Currently:
- Offline
Previous Fields
- Country:
- US
- OS Preference:
- Windows
- Favorite Browser:
- Chrome
- Favorite Processor:
- Who Cares
- Favorite Gaming Platform:
- XBox
- Your Car:
- Jeep
- Dream Kudos:
- 0
Posts I've Made
-
In Topic: I Had A Security Problem-PHP/MYSQL On My Site How Can I Prevent This?
Posted 8 Oct 2012
Your original problem didn't have to do with not using prepared statements, though. Just bad model design.DELETE FROM `table` WHERE `ID`='$id' && `user_ID`='$uid'
-
In Topic: Similar to HTMLAgilityPack for CSS?
Posted 29 Aug 2012
Skydiver, on 29 August 2012 - 01:42 PM, said:Use the @ string prefix to make things a little bit more readable. Also use a more descriptive variable name.
string urlPattern = @"url\(\'?(.*[^\'])\'?\)";
A quick note about converting everything to lowercase: don't. Just use the option in regular expressions to ignore case. That way you won't have to deal with:
- incorrect conversion of a URL that is supposed to be mixed case.
- the Turkish-I problem in case there is a Turkish I is the HTML that stored raw rather than encoded.
- the overhead of now having 2 copies of your HTML in memory.
Thanks for the tips. I was using the IgnoreCase option when I had the Regex and Match split into two parts before I discovered MatchCollections and put them together on the same line. I thought that maybe it'd give me issues and I was at the point of just finding the minimum viable solution to put me on the right path.
I was also wondering why the escaping in a string had to be doubled up, but now I know it's not taken as verbatim literal until the @ is applied. Valuable information.
I'm also doing some reading up on my regular expressions (I can't count how many times I've been through this)... because that .* wild card isn't very secure at all. -
In Topic: Similar to HTMLAgilityPack for CSS?
Posted 29 Aug 2012
I've been fighting this for a while and have finally found a plausible solution. I wanted to share it so that if anyone searches for the same they'll have somewhere to start.
I know there are many flaws with my REGEX, however it gets the job done right now. A big thing I want to point out that had me hung up for a long time is MatchCollection. I was just using Match and was looking for a problem in my regex for not matching recursively, and MatchCollection is what did the trick.
public List<string> listStyleImages() { List<string> lstStyleImages = new List<string>(); string theHTML = this.strHTML.ToLower(); string re2 = "url\\(\\'?(.*[^\\'])\\'?\\)"; MatchCollection matches = Regex.Matches(theHTML, re2); foreach (Match match in matches) { lstStyleImages.Add(match.Groups[1].Value); } return lstStyleImages; }
I am very open to suggestions on improving this tidbit. -
In Topic: Similar to HTMLAgilityPack for CSS?
Posted 23 Aug 2012
I got a notification of a reply, where'd it go!? -
In Topic: Show hidden form1 with code in form2
Posted 11 May 2012
Are you using WPF or Windows Forms?
My Information
- Member Title:
- D.I.C Head
- Age:
- Age Unknown
- Birthday:
- May 25
- Gender:
-
- Location:
- United States
- Years Programming:
- 8
- Programming Languages:
- PHP, C#
Contact Information
- E-mail:
- Private
- Skype:
-
altschulec
Friends
|
|


Find Topics
Find Posts
View Reputation Given


|
Comments
cilaes has no profile comments yet. Why not say hello?