05.08.2009, 16:27
Fixed, I had stored the config
but forgot to make it check IP and Database.
but forgot to make it check IP and Database.
Originally Posted by Chrham_2
Hello.
I want to have a page where they can quit the job. I made this: Код:
<?php require_once("config.php"); $sql = "UPDATE `samp`.`players` SET `Job` = \'0\' WHERE `players`.`id` = 1 LIMIT 1;"; ?> |
<?php require_once("config.php"); $sql = "UPDATE `samp`.`players` SET `Job` = \'0\' WHERE `player`.`name` = '$username' LIMIT 1;"; ?>
Originally Posted by Anarkien
Quote:
First of all.. Why are you using `players`.`id`. And won't this only update "ID 1"'s job?? You should make your control panel so that the users can't be in-game while trying to edit their stats, like their job. Rather do something like this: Your in-game name is Che_Guevara. You go to the UCP and write in Che_Guevera + your username in order to log in. In the UCP you'll be able to change your job with a certain "job id". job id 1 = farmer job id 2 = police etc.. Get the session ID from the login (which should be "Che_Guevara"). Like.. $_SESSION['user'], or whatever your session is called. Eventually you can just do: $username = $_POST['username'] in order to get the username (Che_Guevara) written from the database. Then the $username will be a variable which holds the $_POST. Now, when the user tries to update, is should be something like this: Код:
<?php require_once("config.php"); $sql = "UPDATE `samp`.`players` SET `Job` = \'0\' WHERE `player`.`name` = '$username' LIMIT 1;"; ?> And by the way, this script will make the job ID 0. By replacing "0" with "$jobid" or something similar, you can allow the user to write the job ID themselves through a form. I guess this became a pretty long post, and if you don't have any experience in MySQL, it might be a bit hard to understand what I mean. |
Originally Posted by Anarkien
Are you hosting the website on localhost, or on a remote host (on the Internet)?
By the way, are you Norwegian? Might be easier to help you then... |
Originally Posted by Chrham_2
Quote:
|