PDA

View Full Version : Added YouTube / GitHub / Steam to user profile



kung foo man
21st June 2016, 11:47
Hey all,

you can now add your YouTube / GitHub / Steam profile links to your user account. I had to add some regexes to prevent the input against XSS attacks, so this is what I came up with:



^(http|https)://(www.)?(youtube.com|youtu.be)/((c|channel|user)/)?(\+?)[a-zA-Z0-9_\-]+(/)?

http://youtube.com/YourGooglePlusName
http://youtube.com/+YourGooglePlusName
http://youtu.be/+YourGooglePlusName
https://youtube.com/c/KilltubeOrg
http://youtube.com/c/KilltubeOrg/
https://www.youtube.com/c/KilltubeOrg
https://www.youtube.com/channel/UCVuQk8dOOnP3NATrK_N4yHQ


^(http|https)://(www.)?steamcommunity.com/(id|profiles)/[a-zA-Z0-9_\-]+(/)?

https://steamcommunity.com/id/kungfoo_man123/
http://steamcommunity.com/id/kungfoo_man123/
https://www.steamcommunity.com/id/kungfoo_man123
http://www.steamcommunity.com/id/kungfoo_man123/
http://steamcommunity.com/profiles/NUMBERS_GO_HERE

^(http|https)://(www.)?github.com/[a-zA-Z0-9_\-]+(/)?

https://github.com/kungfooman/
http://www.github.com/kungfooman-asd


Great site for testing: http://www.phpliveregex.com/

If any valid link might not work, please tell me.

Are the any other sites which you wanna add to your profile?

Random ideas welcome aswell.

Edit #1: Added youtu.be, G+, and Steam /profiles/

IzNoGoD
21st June 2016, 12:29
Please add steamcommunity.com/profiles/NUMBERS_GO_HERE [optional slash]

serthy
21st June 2016, 12:45
Thanks

to YoutTube: you can also have a link one without any /c/ or /user/ dir in the URL (when you have a unique G+ url): http://youtube.com/YourGooglePlusName
, but its not that important :D

IzNoGoD
21st June 2016, 15:34
youtu.be anyone?

kung foo man
21st June 2016, 15:53
Thanks ^^ Added all variations now