[Release]Simple clear inventory Script
Loginpage.php
Code:
<html>
<head>
<title>login page</title>
</head>
<body>
<form method="POST" action="loginproc.php">
<p>username: <input type=”text" name="username" size="20"/></p>
<p>password: <input type=”text" name="password" size="20"/></p>
<input type="submit" />
</form>
</body>
</html>
loginproc.php
PHP Code:
<?php
session_start();
$server = "localhost";
$username = "xxx";
$password = "xxx";
$db_name = "maplestory";
$db = mysql_connect($server,$username,$password) or DIE("Connection to database failed, perhaps the service is down !!");
mysql_select_db($db_name) or DIE("Database name not available !!");
$login = mysql_query("select * from users where (username = '" . $_POST['username'] . "') and (password = '" . $_POST['password'] . "')",$db);
$rowcount = mysql_num_rows($login);
if ($rowcount == 1) {
$_SESSION['username'] = $_POST['username'];
header("Location: securedpage.php");
}
else
header("Location: loginpage.php");
?>
securedpage.php
PHP Code:
<?
session_start();
if (!isset($_SESSION['username'])) {
header("Location: loginpage.php");
}
?>
<html>
<head>
<title>secured page</title>
</head>
<body>
<p><?php include("clear.php");?> Please type in your character Name</p>
<p><?php include("clear2.php");?> Please type in your username / pass and Character ID </p>
</body>
</html>
search.php
PHP Code:
<?php
// Get the search variable from URL
$var = @$_GET['q'] ;
$trimmed = trim($var); //trim whitespace from the stored variable
// rows to return
$limit=10;
// check for an empty string and display a message.
if ($trimmed == "")
{
echo "<p>Please enter a search...</p>";
exit;
}
// check for a search parameter
if (!isset($var))
{
echo "<p>We dont seem to have a search parameter!</p>";
exit;
}
//connect to your database ** EDIT REQUIRED HERE **
mysql_connect("localhost","root",""); //(host, username, password)
//specify database ** EDIT REQUIRED HERE **
mysql_select_db("maplestory") or die("Unable to select database"); //select which database we're using
// Build SQL Query
$query = "select * from Characters where name like \"%$trimmed%\"
order by name"; // EDIT HERE and specify your table and field names for the SQL query
$numresults=mysql_query($query);
$numrows=mysql_num_rows($numresults);
// If we have no results, offer a google search as an alternative
if ($numrows == 0)
{
echo "<h4>Results</h4>";
echo "<p>Sorry, your search: "" . $trimmed . "" returned zero results</p>";
// google
echo "<p><a href=\"http://www.google.com/search?q="
. $trimmed . "\" target=\"_blank\" title=\"Look up
" . $trimmed . " on Google\">Click here</a> to try the
search on google</p>";
}
// next determine if s has been passed to script, if not use 0
if (empty($s)) {
$s=0;
}
// get results
$query .= " limit $s,$limit";
$result = mysql_query($query) or die("Couldn't execute query");
// display what the person searched for
echo "<p>You searched for: "" . $var . ""</p>";
// begin to show results set
echo "". $var . " ID number";
// now you can display the results returned
while ($row= mysql_fetch_array($result)) {
$title = $row["ID"];
echo "$count $title" ;
$count++ ;
}
$currPage = (($s/$limit) + 1);
//break before paging
echo "<br />";
// next we need to do the links to other results
if ($s>=1) { // bypass PREV link if s is 0
$prevs=($s-$limit);
print " <a href=\"$PHP_SELF?s=$prevs&q=$var\"><<
Prev 10</a>  ";
}
// calculate number of pages needing links
$pages=intval($numrows/$limit);
// $pages now contains int of pages needed unless there is a remainder from division
if ($numrows%$limit) {
// has remainder so add one page
$pages++;
}
// check to see if last page
if (!((($s+$limit)/$limit)==$pages) && $pages!=1) {
// not last page so give NEXT link
$news=$s+$limit;
echo " <a href=\"$PHP_SELF?s=$news&q=$var\">Next 10 >></a>";
}
$a = $s + ($limit) ;
if ($a > $numrows) { $a = $numrows ; }
$b = $s + 1 ;
echo "<p>Showing results $b to $a of $numrows</p>";
?>
Clear2.php
Code:
<html>
<head>
<title>login page</title>
</head>
<body>
<form method="post" action="clear_.php">
<p>Username <input type="text" name="username" size"20"/></p>
<p>Password <input type ="password" name="password" size="20"/></p>
<p>CharacterID :<input type ="text" name="text" size="10"/></p>
<input type="submit" /><input type="reset" />
</form>
</body>
</html>
Clear_.php
PHP Code:
<?php
session_start();
$server = "localhost";
$username = "root";
$password = "";
$db_name = "maplestory";
$db = mysql_connect($server,$username,$password) or DIE("Connection to database failed, perhaps the service is down !!");
$charid = $_POST['text'];
$name = $_POST['username'];
$pass = $_POST['password'];
mysql_select_db($db_name) or DIE("Database name not available !!");
$sel_ = mysql_query("select * from users where (username = '" . $_POST['username'] . "') and (password = '" . $_POST['password'] . "')",$db);
if($name == ""){
echo ' No username inputted ';
exit();
}elseif($pass == "") {
echo ' No Password inputted ';
exit();
}elseif($charid == ""){
echo ' No character ID inputted ';
exit();
}else{
$rowcount = mysql_num_rows($sel_);
if ($rowcount == 0) {
echo 'Username/Password incorrect!';
}else{
$login = ' Delete from equip where (charid = '. $_POST['text'] .')';
mysql_query($login) OR die (mysql_error());
echo " Inventory Cleared for $name - Character ID $charid ";
}
}
?>
UPDATE CLEAR.php
PHP Code:
<form name="form" action="search.php" method="get">
<input type="text" name="q" />
<input type="submit" name="Submit" value="Search" />
</form>
Loginpage.php - Log's into the Script and makes sure you have an account , and that the user/pass are correct
Loginproc.php - is the coding side of the loginpage.php
securedpage.php - is the page that is shown when you are successfully logged in.
search.php - is used to obtain your CharacterID
clear2.php -is where you input your info again to make sure its still correct
clear_.php - is the actual script that clears your inventory out.
Credits : To superfun stole some of this off your register script , Not all but a few parts.
Re: [Release]Simple clear inventory Script
if this works ill love you forever
Re: [Release]Simple clear inventory Script
Re: [Release]Simple clear inventory Script
wait php files do i make em or what. and in what folder.
1 Attachment(s)
Re: [Release]Simple clear inventory Script
Here you go , Place them in Anyfolder Wth in your web folder.
Re: [Release]Simple clear inventory Script
Umm your search script doesnt seem to have a search box
Re: [Release]Simple clear inventory Script
on your securedpage.php instead of:
Code:
<p><?php include("clear2.php");?> Please type in your username / pass and Character ID </p>
it needs to be:
Code:
<p><?php include("clear_.php");?> Please type in your username / pass and Character ID </p>
Re: [Release]Simple clear inventory Script
Re: [Release]Simple clear inventory Script
Quote:
Originally Posted by
CCoffee
on your securedpage.php instead of:
Code:
<p><?php include("clear2.php");?> Please type in your username / pass and Character ID </p>
it needs to be:
Code:
<p><?php include("clear_.php");?> Please type in your username / pass and Character ID </p>
Nope because , clear2.php is where you enter your User/pass and Character ID then you hit Submit and it clears your Inventory with out clear2.php it wouldn't know what CharacterID to empty its inventory.
Edit I'd appreciate it if you'd read the FILES before you Post stupid crap like that.
Re: [Release]Simple clear inventory Script
Re: [Release]Simple clear inventory Script
Unknown column 'ggggg' in 'where clause'
getting this when i type in my char id
Re: [Release]Simple clear inventory Script
I installed this and edited the script to match my servers info but I get
Quote:
Warning: include(clear.php) [
function.include]: failed to open stream: No such file or directory in
C:\MapleStory Server\database\xampp\htdocs\dcfix\securedpage.php on line
12
Warning: include() [
function.include]: Failed opening 'clear.php' for inclusion (include_path='.;C:\MapleStory Server\database\xampp\php\pear\') in
C:\MapleStory Server\database\xampp\htdocs\dcfix\securedpage.php on line
12
when I get to secure page for clear 2 and I am sure my information is correct but anyway if you ignore the database errors you can get to the character in slot 1 cleared inventory but it does not actually clear.
Any ideas?
Re: [Release]Simple clear inventory Script
Make sure you put all These Files together.
Re: [Release]Simple clear inventory Script
First , you have to enter your character name into the search Function then get your Character ID and enter it in there.
Re: [Release]Simple clear inventory Script
I got it to work I never knew the ID was actually character ID in the database I thought it was slot ID as in 1-3
In this case is there any way you could code in so when it asks for the character ID it shows all your character names as well as their ID's needed to reset?