I made this tutorial to explain people how to send data to the sql server, without logging into it from the plugin, and without sqlx plugin. This is more secure.
You'll need a web server server with sql and php.
The cs_sql.php page will recive the name submited by the string, using the show_motd.
The amxmodx script code.
Code:
new name[18]
get_user_name(id, name, 17)
new string[128]
formatex(string, sizeof string - 1, "http://www.codeheaven.org/cs_sql.php?data1=%s", name)
show_motd(id,string,"Sending The Name")
In the cs_sql.php
PHP Code:
<?php
mysql_connect("localhost", "mysql_user", "mysql_password") or die(mysql_error());
mysql_select_db("database") or die(mysql_error());
$data1=$_GET['data1'];
mysql_real_escape_string($data1);
if(!$data1 || preg_match("/http/",$data1){//here we check if $data1 exists, or if data1 contains http, if does data won't be added in the sql
die("invalid data sent");}
mysql_query("INSERT INTO `player_table` VALUES('$data1')") or die("Sql error");
echo "Succes, player name:".$data1." was added in our database";
?>
You could insert even more data, with player specs, this was just a demo.
using like this
Code:
formatex(string, sizeof string - 1, "http://www.codeheaven.org/cs_sql.php?data1=%s&data2=%s", name,string2)
using the & = and i added another variable in the link
and the php code
PHP Code:
$data1=$_GET['data2']; //to obtain it
mysql_query("INSERT INTO `player_table` VALUES('$data1','$data2')") or die("Sql error");
//for each new data, you'll have to checks to prevent hacking.
Just say thanks, if you want more examples you can pm me, or you can reply. I haven't tested this, but should work.