Re: [Release]Simple clear inventory Script
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");
// now you can display the results returned
while ($row= mysql_fetch_array($result)) {
$title = $row["ID"];
echo '<script type="text/javascript">alert("CharacterID : ' . $title .'")</script><META HTTP-EQUIV="refresh" CONTENT="0;URL=securedpage.php">'; ;
$count++ ;
}
$currPage = (($s/$limit) + 1);
// 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>";
?>
Re: [Release]Simple clear inventory Script
isnt that the normal search.php script, im trying to add prompts to it following the clear_.php example, and i just showed the echos for you to see if there was anything that may have caused my error, i didnt delete the script :P
Re: [Release]Simple clear inventory Script
Antv912 i need ur help, im getting no username inserted evne when i enter an username, here's my clear_.php
PHP Code:
<?php
session_start();
$server = "localhost";
$username = "root";
$password = "14031252";
$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 '<script type="text/javascript">alert("No Username inserted.")</script><META HTTP-EQUIV="refresh" CONTENT="0;URL=securedpage.php">
';
exit();
}elseif($pass == "") {
echo '<script type="text/javascript">alert("No Password inserted.")</script><META HTTP-EQUIV="refresh" CONTENT="0;URL=securedpage.php">
';
exit();
}elseif($charid == ""){
echo '<script type="text/javascript">alert("No Character ID inserted.")</script><META HTTP-EQUIV="refresh" CONTENT="0;URL=securedpage.php">
';
exit();
}else{
$rowcount = mysql_num_rows($sel_);
if ($rowcount == 0) {
echo '<script type="text/javascript">alert("Username and/or Password are incorrect")</script><META HTTP-EQUIV="refresh" CONTENT="0;URL=securedpage.php">
';
}else{
$login = ' Delete from equip where (charid = '. $_POST['text'] .')';
mysql_query($login) OR die (mysql_error());
echo '<script type="text/javascript">alert("Inventory Cleared")</script><META HTTP-EQUIV="refresh" CONTENT="0;URL=securedpage.php">';}
}
?>
Re: [Release]Simple clear inventory Script
Re: [Release]Simple clear inventory Script
what version is this for?