PDA

View Full Version : about UCP


sscarface
04/07/2015, 10:56 PM
Does UCP works same as script?
I mean, Do i have to change UCP MYSQL version too?

Or it doesn't matter? idk much about uCP/ just reading some tuts. BUt i need this answer too. Thanks

rymax99
04/07/2015, 11:12 PM
If you plan on making a web application, you'd need to use something like Python or PHP. MySQL syntax would the the same, since SQL isn't specific to SA-MP, it is a whole different language - thus the 'L' in SQL. The version of the MySQL plugin you use on your SA-MP server is irrelevant.

Before creating a public-facing UCP, ensure you really know what you're doing, or I can guarantee you it'll be exploited by anyone that tries.

sscarface
04/07/2015, 11:18 PM
Well, I know something about php and i know html full. Also, reading some tuts and googling.
But I downloaded a simple login page from forum and using wamp to test it. But i get this error

"The mysql extension is deprecated and will be removed in the future: use mysqli or PDO "

What does this mean? Outdated or what?

rymax99
04/07/2015, 11:27 PM
Well, I know something about php and i know html full. Also, reading some tuts and googling.
But I downloaded a simple login page from forum and using wamp to test it. But i get this error

"The mysql extension is deprecated and will be removed in the future: use mysqli or PDO "

What does this mean? Outdated or what?

It means exactly what it said. It's saying the function while still works, is outdated, and is going to be removed. Use a better alternative.

sscarface
04/07/2015, 11:37 PM
Well, Can you update it? If you know about somthing php.


<?php

$connect = mysql_connect("My SQL Server Here", "Database User", "Database Password") or die("Can't Connect To the Server"); //connecting to mysql
mysql_select_db("Database Name") or die ("Database Not Found"); // database name

function sanitize($string) // unction for sanitize from xss and mysql and csrf.
{
$string = strip_tags($string);
$string = mysql_real_escape_string($string);
return $string;
}

?>

This is simple login page. I want to test it for my server. I would be your thankful. if you update it and i would like to see codes too.

SickAttack
04/07/2015, 11:44 PM
Well, Can you update it? If you know about somthing php.


<?php

$connect = mysql_connect("My SQL Server Here", "Database User", "Database Password") or die("Can't Connect To the Server"); //connecting to mysql
mysql_select_db("Database Name") or die ("Database Not Found"); // database name

function sanitize($string) // unction for sanitize from xss and mysql and csrf.
{
$string = strip_tags($string);
$string = mysql_real_escape_string($string);
return $string;
}

?>

This is simple login page. I want to test it for my server. I would be your thankful. if you update it and i would like to see codes too.

I would highly recommend converting that to use the PDO method and its attributes (low weight app).

Here's an example:
<?php
$database_host = "localhost";
$database_user = "root";
$database_pass = "";
$database_db = "something";

$connection = new PDO("mysql:host=$database_host;dbname=$database_db;char set=utf8", $database_user, $database_pass);
$connection -> setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

$query = $connection -> prepare("SELECT `something` FROM `something` WHERE `something` = :something");
$query -> bindParam(":something", $_GET['something']);

if($query -> execute())
{
if($response = $query -> fetch())
{
// query succeeded
}
else
{
// query failed
}
}
?>

Since you fully know html and other sums of stuff in php, then there would be no problem for you to do the rest, make it compatible and generically do what it should do.

However, you could create a dedicated file for the connection between the database and the host/user, and include/require that file to be added to the other pages you have so that editing it would be a breeze.

sscarface
05/07/2015, 12:00 AM
What should i write here? I didn't get it. I used to do html before an year so.

$query -> bindParam(":something", $_GET['something']);

and also how to describe nick in php?
$query = $connection -> prepare("SELECT `something` FROM `something` WHERE `something` = :something");
I mean here
= :something");

SickAttack
05/07/2015, 12:06 AM
What should i write here? I didn't get it. I used to do html before an year so.

$query -> bindParam(":something", $_GET['something']);

and also how to describe nick in php?
$query = $connection -> prepare("SELECT `something` FROM `something` WHERE `something` = :something");
I mean here
= :something");

It's PHP, sir. You should go do some more research about the matter. I ain't going to explain everything for you, plus this forum's generic purpose isn't for these type of matters.

sscarface
05/07/2015, 12:10 AM
Thanks!