I want to be able to take user inputted text in a comment field and check for URL type expression, and if it exists, add an anchor tag (to url) when the comment is displayed. I am using PHP on the server-side, and Javascript (with jQuery) on client, so should I wait to check for URL until right before it
Tag: php
Detecting Ajax in PHP and making sure request was from my own website
I use my PHP back-end to detect AJAX requests by checking for a value in $_SERVER[‘HTTP_X_REQUESTED_WITH’]. This gives me a reliable detection, making sure the request is made utilizing AJAX techniques. How can I make sure the request came from my own domain, and not an external domain/robot? www.…
Blind SQL Injection using acunetix
I’m using acunetix to test my website. The problem is with this script http://boedesign.com/blog/2007/02/18/ajax-star-rating/ acunetix doesn’t show any message, but when I test for blind SQL I can get values like in the rating_id mysql column, I want to only allow numbers in there, so I made a lit…
What are the differences between ADOdb and PDO in PHP?
Both seem to try making it simpler using a database in PHP. Both seem to provide an abstraction over different database types like MySQL, SQLite, etc. What are the differences between both ADOdb and PDO? Answer PDO is standard in PHP as of version 5.1. (It is also available with a PECL extension in PHP 5.0) M…
Sending SMS from PHP [closed]
It’s difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 9 years ago. How to send an SMS f…
Convert command line cURL to PHP cURL
I’ve never done any curl before so am in need of some help. I’ve tried to work this out from examples but cannot get my head around it! I have a curl command that I can successfully run from a linux(ubuntu) command line that puts a file to a wiki through an api. I would need to incorporate this cu…
PHP remove HTTP header
Something, I think Apache, adds these HTTP headers to all responses generated by PHP scripts: Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 This works ok for actual dynamic pages, but I have some page that, while generated by PHP, are most…
PHP substring extraction. Get the string before the first ‘/’ or the whole string
I am trying to extract a substring. I need some help with doing it in PHP. Here are some sample strings I am working with and the results I need: I want to get the string till the first /, but if no / is present, get the whole string. I tried, I think it says – get the position
PHP comments: # vs. //
Lately I’ve been using # instead of // for doing single line comments inside my code. However, I see most of the people prefer //. Is there a particular reason for preferring them instead of #? Performance? File weight? Anything? Answer It doesn’t change a single thing, I’d say ; it’s …
PHP: What is the fastest and easiest way to get the last item of an array?
What is the fastest and easiest way to get the last item of an array whether be indexed array , associative array or multi-dimensional array? Answer prints “1”