Witam ponownie szanownych kolegów.
Znów mam big problem.
Siedziałem dziś cały dzień i nie moge nic wymysleć :(
Chodzi o to jak zrobić aby przy usuwaniu słowa (hasla) w słowniku czyli "glossar" odejmowalo punkty.
W pliku "add_begriff.php" dodajemy tylko to:
//Punkty
if (EPS)
{
$przydzial = dbarray(dbquery("SELECT point_ammount from ".DB_PREFIX."eps_points WHERE point_id='7'"));
$result = dbquery("UPDATE ".DB_PREFIX."users SET points_normal=points_normal+".($przydzial['point_ammount'])." WHERE user_id='".$userdata['user_id']."'");
}
//Punkty
i jest ok, bo dodaje punkty ale schodzi sa jak chce aby je odejmowało.
W pliku "admin.php" słownika próbowałem dodać to:
//Punkty
$dane = dbarray(dbquery("SELECT user_id from ".$db_prefix."glossar WHERE id='$id'"));
$przydzial = dbarray(dbquery("SELECT point_ammount from ".DB_PREFIX."eps_points WHERE point_id='7'"));
if (EPS) $result = dbquery("UPDATE ".DB_PREFIX."users SET points_normal=points_normal-".($przydzial['point_ammount'])." WHERE user_id='".$dane['user_id']."'");
//Punkty
czyli kod wyglądałby tak:
<?
/*---------------------------------------------------+
| PHP-Fusion 6 Content Management System
+----------------------------------------------------+
| Copyright © 2002 - 2005 Nick Jones
| http://www.php-fusion.co.uk/
+----------------------------------------------------+
| Released under the terms & conditions of v2 of the
| GNU General Public License. For details refer to
| the included gpl.txt file or visit http://gnu.org
+----------------------------------------------------*/
if (file_exists(INFUSIONS."glossar/locale/".$settings['locale'].".php")) {
include INFUSIONS."glossar/locale/".$settings['locale'].".php";
} else {
include INFUSIONS."glossar/locale/English.php";
}
if (iADMIN)
{
if($katdel_id!=0)
{
if($katdelidja=="ja")
{
$glossar_result = dbquery("DELETE FROM ".$db_prefix."glossar WHERE cat_id=".$katdel_id);
$kat_result = dbquery("DELETE FROM ".$db_prefix."glossar_cat WHERE cat_id=".$katdel_id);
echo '<br><center><b>'.$locale['glo111'].'</b></center><br>';
}
else
{
echo '<br><center><b>'.$locale['glo110'].'<br><br><a href="'.INFUSIONS.'glossar/glossar.php?action=admin&katdel_id='.$katdel_id.'&&katdelidja=ja">'.$locale['glo112'].'</a></b></center><br>';
}
}
if($kat_neu)
{
if($katedit_id !=0)
{
$kat_result = dbquery("UPDATE ".$db_prefix."glossar_cat SET name='".$kat_name."', beschreibung='".$kat_beschreibung."' WHERE cat_id=".$katedit_id);
echo '<br><center><b>'.$locale['glo113'].'</b></center><br>';
}
else
{
$kat_result = dbquery("INSERT INTO ".$db_prefix."glossar_cat VALUES('', '".$kat_name."', '".$kat_beschreibung."')");
echo '<center><b><br>'.$locale['glo114'].'</b><br></center>';
}
}
if($beg_id)
{
$glossar_result = dbquery("SELECT * FROM ".$db_prefix."glossar WHERE id=".$beg_id);
if($delete OR $activate)
{
if($delete=="ok")
{
//Punkty
$dane = dbarray(dbquery("SELECT user_id from ".$db_prefix."glossar WHERE id='$id'"));
$przydzial = dbarray(dbquery("SELECT point_ammount from ".DB_PREFIX."eps_points WHERE point_id='7'"));
if (EPS) $result = dbquery("UPDATE ".DB_PREFIX."users SET points_normal=points_normal-".($przydzial['point_ammount'])." WHERE user_id='".$dane['user_id']."'");
//Punkty
$glossar_result = dbquery("DELETE FROM ".$db_prefix."glossar WHERE id=".$beg_id);
echo '<br><center><b>'.$locale['glo115'].'</b></center><br>';
}
if($activate=="ok")
{
$glossar_result = dbquery("UPDATE ".$db_prefix."glossar SET status='A' WHERE id=".$beg_id);
echo '<br><center><b>'.$locale['glo113'].'</b></center><br>';
}
}
else
{
$user_result = dbquery("SELECT * FROM ".$db_prefix."users WHERE user_id=".mysql_result($glossar_result, 0, "user_id"));
echo '<br>
<table cellpadding="3" cellspacing="1" align="center" width="75%" class="tbl-border">
<tr class="tbl2"><td colspan="2"><b>'.mysql_result($glossar_result, 0, "name").'</b></td></tr>
<tr><td class="tbl2">'.$locale['glo116'].'</td><td class="tbl1">'.mysql_result($glossar_result, 0, "beschreibung").'</td></tr>
<tr><td class="tbl2">'.$locale['glo117'].'</td><td class="tbl1">'.date("d.m.Y", mysql_result($glossar_result, 0, "datestamp")).'</td></tr>
<tr><td class="tbl2">'.$locale['glo118'].'</td><td class="tbl1">'.mysql_result($user_result, 0, "user_name").'</td></tr>
<tr><td class="tbl2">'.$locale['glo119'].'</td><td class="tbl1"><a href="'.INFUSIONS.'glossar/glossar.php?action=admin&delete=ok&beg_id='.mysql_result($glossar_result, 0, "id").'">'.$locale['glo120'].'</a> | <a href="'.INFUSIONS.'glossar/glossar.php?action=admin&activate=ok&beg_id='.mysql_result($glossar_result, 0, "id").'">'.$locale['glo121'].'</a></td></tr>
</table>
<br>';
}
}
echo '<br>
<table cellpadding="3" cellspacing="1" align="center" width="75%" class="tbl-border">
<tr class="tbl2"><td colspan="2"><b>'.$locale['glo133'].'</b></td></tr>
<tr><td class="tbl2">'.$locale['glo123'].'</td><td class="tbl2">'.$locale['glo122'].'</td></tr>
<tr><td class="tbl2">'.$locale['glo123'].'</td><td class="tbl1">';
$glossar_result = dbquery("SELECT * FROM ".$db_prefix."glossar WHERE status='D'");
$glossar_anz = dbrows($glossar_result);
if($glossar_anz == 0)
{
echo '<br><center><b>'.$locale['glo124'].'</b><br></center><br>';
}
else
{
for($a=0; $a<$glossar_anz; $a++)
{
echo '<a href="'.INFUSIONS.'glossar/glossar.php?action=admin&beg_id='.mysql_result($glossar_result, $a, "id").'">'.mysql_result($glossar_result, $a, "name").'</a><br>';
}
}
if($katedit_id)
{
$kat_result = dbquery("SELECT * FROM ".$db_prefix."glossar_cat WHERE cat_id=".$katedit_id);
$name=mysql_result($kat_result, 0, "name");
$beschreibung=mysql_result($kat_result, 0, "beschreibung");
}
echo '</td></tr>
<tr><td class="tbl2">'.$locale['glo125'].'</td><td class="tbl2">'.$locale['glo126'].'</td></tr>
<form action="'.INFUSIONS.'glossar/glossar.php?action=admin" method="POST">
<tr><td class="tbl2">'.$locale['glo129'].'</td><td class="tbl1"><input type="Text" name="kat_name" value="'.$name.'" size="50" maxlength="255" class="textbox"></td></tr>
<tr><td class="tbl2">'.$locale['glo116'].'</td><td class="tbl1"><textarea name="kat_beschreibung" cols="47" rows="10" class="textbox">'.$beschreibung.'</textarea></td></tr>
<tr><td class="tbl2">'.$locale['glo119'].'</td><td class="tbl1"><input type="hidden" name="katedit_id" value="'.$katedit_id.'"><input type="Submit" name="kat_neu" value='.$locale['glo170'].' class="button"></td></tr>
</form>
<tr><td class="tbl2">'.$locale['glo127'].'</td><td class="tbl1">';
$kat_result = dbquery("SELECT * FROM ".$db_prefix."glossar_cat ORDER BY name");
if(dbrows($kat_result)==0)
{
echo $locale['glo128'];
}
else
{
for($a=0; $a<dbrows($kat_result); $a++)
{
echo '<a href="'.INFUSIONS.'glossar/glossar.php?action=admin&katedit_id='.mysql_result($kat_result, $a, "cat_id").'"><b>'.mysql_result($kat_result, $a, "name").'</b></a> [<a href="'.INFUSIONS.'glossar/glossar.php?action=admin&katdel_id='.mysql_result($kat_result, $a, "cat_id").'">'.$locale['glo120'].'</a>]<br>';
}
}
echo '</td></tr>
</table>
<br>';
}
else
{
echo '<br><center><b>'.$locale['glo135'].'</b><br></center><br>';
}
?>
lecz niestety nie działa. Nie wiem juz sam próbowałem chyba wszystkiego już taka filozofia była u mnie, że...no ale niestety nic z tego ptk. dodają się ale z odejmowaniem już problem.
Poradzcie coś.
Z góry dzięki. |