doudouwen2763 2016-04-14 03:14
浏览 76

如何创建PHP表单来验证和验证用户提交的链接?

I've a community site. All members have registered their personal website links in their member profiles on the community site. On a form of the site, they can submit the details of their personal website's page or post. This is done in a field where they fill in the link to their page or post.

I want to validate and verify that the member-submitted link is valid and originates from the member's website as listed in the community site's member profile and is not a third party link. I know this is possible but I don't know how. My programming knowledge is nearly nil.

[This is not necessary but just an idea]>> Is there any way to achieve like what Google does in its "fetch as Google" section of the Search Console, where the first part of the link (http://example.com/) is taken from the website link in the user's profile and cannot be changed, whereas the user can only fill in the later part of the link or only the slug of the page or post in an editable field. The resultant output on a page should be a combined and full link that can be clicked.

Edited and added for clarity:

Required steps:

Step 1 - Validate: Check if the submitted URL is valid.

If valid, go to the next step. Else, return an error.

Step 2 - Verify: Check if the root domain of the submitted link matches the root domain of the existing URL in the member's profile.

If yes, allow submit. Else, return an error.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 R语言Rstudio突然无法启动
    • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
    • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
    • ¥15 用windows做服务的同志有吗
    • ¥60 求一个简单的网页(标签-安全|关键词-上传)
    • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
    • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
    • ¥100 为什么这个恒流源电路不能恒流?
    • ¥15 有偿求跨组件数据流路径图
    • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值