Nice Work 9/10
Thanks , 10/10
I am so sick of this...
i have this kind of message's at every released php site.
Warning: odbc_connect() [function.odbc-connect]: SQL error: [Microsoft][ODBC SQL Server Driver][SQL Server]De aanmelding voor gebruiker SA is mislukt. De gebruiker is niet gekoppeld aan een vertrouwde SQL Server-verbinding., SQL state 28000 in SQLConnect in C:\Program Files (x86)\EasyPHP-5.3.2i\www\index.php on line 23
Can't connect the MSSQL server.
Translation
Warning: odbc_connect () [function.odbc-connect]: SQL error: [Microsoft] [ODBC SQL Server Driver] [SQL Server] The login failed for user SA. The user is not associated with a trusted SQL Server connection., SQL state 28000 in SQLConnect in C: Program Files (x86) EasyPHP-5.3.2iwwwindex.php on line 23
Can not connect the MSSQL server.
Easy, check you ODBC if it's connection with browser of sql or not... if you need help please feel free to contact with me, ak-staff@hotmail.com ; or ; progunzsoul@hotmail.com, any way the both of messenger is online![]()
hi i have this error can you help me?
Fatal error: Uncaught Error: Call to undefined function sql_regcase() in C:\xampp\htdocs\odbc\index.php:27 Stack trace: #0 C:\xampp\htdocs\odbc\index.php(105): antisql('180.190.163.54') #1 {main} thrown in C:\xampp\htdocs\odbc\index.php on line 27
You are probably using newer versions of PHP, sql_regcase() function was DEPRECATED in PHP 5.3.0, and REMOVED in PHP 7.0.0.
preg_match() and preg_quote() are alternatives to this function.
Here: https://www.php.net/manual/en/function.sql-regcase.php
The error also says that the function is undefined.
i'm just using XAMPP latest version. :(
XAMPP version has nothing to do with PHP version.
XAMPP is an application which allows you to setup a web server and database server instantly without any additional configuration. Whereas, PHP is a scripting language used to develop websites.
Also, I've gave you the solution, just use one of the alternative functions above instead of sql_regcase()
After Applying sir. i got this error..Fatal error: Uncaught Error: Call to undefined function odbc_connect() in C:\xampp\htdocs\index.php:23 Stack trace: #0 {main} thrown in C:\xampp\htdocs\index.php on line 23
You are probably using newer versions of PHP, sql_regcase() function was DEPRECATED in PHP 5.3.0, and REMOVED in PHP 7.0.0.
preg_match() and preg_quote() are alternatives to this function.
Here: https://www.php.net/manual/en/function.sql-regcase.php
The error also says that the function is undefined.![]()
The error is occurring because you're not providing all the function's required parameters, as preg_match() has two required parameters and you're providing only one (the rest of the parameters are optional).
The first required parameter for preg_match() is a regular expression (a set of characters that define a search pattern), and the second required parameter is the input string.
So basically the code will be like that:
Make sure you have an i at the end of the regular expression, it means case-insensitive (uppercase and lowercase letters would be considered equivalent).Code:preg_match("/(from|select|insert|delete|where|drop table|show tables|#|--|\\\\)/i", $sql)
Hope this solves the problem
Last edited by Tannous; 22-08-20 at 03:23 PM.
im am very appreciate your effort but sorry sir i did copy your code and this is the display. what is the problem with this? í ½í¸”
Parse error: syntax error, unexpected '$sql' (T_VARIABLE) in C:\xampp\htdocs\index.php on line 28
@Tannous you're right.
a simple comment to this topic: extremely old register, using functions no longer existing in current versions of php (like preg_match, your error @trygun182). It is highly recommended that you look for something more up to date and obviously more secure.
this weekend i will code a simple registration page using more modern and updated standards, you are not the first to search for this type of content and you cannot find it.
im just vey noob with syntax sir. :(
Edit:
With me explaining, I forgot something important, pay attention that the function preg_match() returns 1 or 0, and we're using it inside preg_replace(), which is wrong, we need to have a regular expression there.
The whole point of preg_match is to detect SQL queries even if they're using uppercase or lowercase letters, you could solve that by using the 3rd parameter of preg_match(). However, to avoid all confusion, just get rid of preg_match(), and use only preg_replace() with more specific regular expression.
Replace the whole line with this:
This will cover all the possibilities.Code:preg_replace("/([Ff][Rr][Oo][Mm]|[Ss][Ee][Ll][Ee][Cc][Tt]|[Ii][Nn][Ss][Ee][Rr][Tt]|[Dd][Ee][Ll][Ee][Tt][Ee]|[Ww][Hh][Ee][Rr][Ee]|[Dd][Rr][Oo][Pp] [Tt][Aa][Bb][Ll][Ee]|[Ss][Hh][Oo][Ww] [Tt][Aa][Bb][Ll][Ee][Ss]|#|--|\\\\)/" , "", $sql);
Now I hope this solves it.