Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

Stuff form

Asked Modified Viewed 1,386 times
W
Wyciokazz
W
  • Junior Member, joined since
  • Contributed 18 posts on the community forums.
  • Started 8 threads in the forums
  • Started this discussions
asked
Junior Member

Hello everyone when i'm post to add member to stuff i'm getting errors:

Undefined index: vedejas on line 90
Undefined index: laida on line 87

[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]<?php
require_once "../../maincore.php";
require_once THEMES."templates/admin_header.php";

if (file_exists(INFUSIONS."komanda/locale/".$settings['locale'].".php"wink)
{
include INFUSIONS."komanda/locale/".$settings['locale'].".php";
}
else
{
include INFUSIONS."komanda/locale/Lithuanian.php";
}


function showmessage($message){
opentable("Informacija"wink;
echo "<center><b>".$message."</b></center>";
closetable();
}

$error = "";

if (!checkrights("KOM"wink || !defined("iAUTH"wink || !isset($_GET['aid']) || $_GET['aid'] != iAUTH) { redirect("../index.php"wink; }

$editlist = ""; $sel = "";
$result2 = dbquery("SELECT * FROM ".$db_prefix."komanda_cats ORDER BY cat_name"wink;
if (dbrows($result2) != 0) {
while ($data2 = dbarray($result2)) {
$editlist .= "<option value='".$data2['cat_id']."'$sel>".$data2['cat_name']."</option>\n";
}
}
$userlist = ""; $useriai = "";
$result3 = dbquery("SELECT * FROM ".$db_prefix."users ORDER BY user_name"wink;
if (dbrows($result3) != 0) {
while ($data3 = dbarray($result3)) {
$userlist .= "<option value='".$data3['user_id']."'$useriai>".$data3['user_name']."</option>\n";
}
}

if(isset($_POST['do']) && $_POST['do'] == "doadd"wink{

if(!$_POST['slapyvardis']){
showmessage($locale['a21']);
$error = 1;
}else if(!$_POST['amzius']){
showmessage($locale['a22']);
$error = 1;
}else if(!$_POST['miestas']){
showmessage($locale['a23']);
$error = 1;
} else if(!$_POST['pareigos']){
showmessage($locale['a24']);
$error = 1;
}

if ($error == ""wink {
$sndyra = mktime(date("H"wink,date("i"wink,date("s"wink,date("m"wink,date("d"wink,date("Y"wink);
$newavatar = $_FILES['nuotrauka'];
if (!empty($newavatar['name']) && is_uploaded_file($newavatar['tmp_name'])) {
$avatarext = strrchr($newavatar['name'],"."wink;
$avatarname = substr($newavatar['name'], 0, strrpos($newavatar['name'], "."wink);
if (preg_match("/^[-0-9A-Z_\[\]]+$/i", $avatarname) && preg_match("/(\.gif|\.GIF|\.jpg|\.JPG|\.png|\.PNG)$/", $avatarext) && $newavatar['size'] <= 1024*10000) {
$avatarname = $avatarname."[".$userdata['user_id'].$sndyra."]".$avatarext;
$set_avatar = $avatarname;
move_uploaded_file($newavatar['tmp_name'], IMAGES."komanda/".$avatarname);
chmod(IMAGES."komanda/".$avatarname,0644);
if ($size = @getimagesize(IMAGES."komanda/".$avatarname)) {
if ($size['0'] > 120 || $size['1'] > 120) {
unlink(IMAGES."komanda/".$avatarname);
$set_avatar = "";
}
} else {
unlink(IMAGES."komanda/".$avatarname);
$set_avatar = "";
}
}
}

if($set_avatar == ""wink{
showmessage($locale['a25']);
}else{
$slapyvardis = $_POST['slapyvardis'];
$amzius = $_POST['amzius'];
$miestas = $_POST['miestas'];
$pareigos = $_POST['pareigos'];
$kontaktai = $_POST['kontaktai'];
$laida = $_POST['laida'];
$cat_id = $_POST['catid'];
$user_id = $_POST['userid'];
$vedejas = $_POST['vedejas'];
$nuotrauka = $set_avatar;
$result = dbquery("INSERT INTO ".$db_prefix."komanda (slapyvardis, amzius, miestas, pareigos, kontaktai, laida, cat_id, user_id, nuotrauka, vedejas) VALUES ('".$slapyvardis."', '".$amzius."', '".$miestas."', '".$pareigos."', '".$kontaktai."', '".$laida."', '".$cat_id."', '".$user_id."', '".$nuotrauka."', '".$vedejas."'wink"wink;
showmessage($locale['a31']);
}
}
}

if(isset($_POST['do']) && $_POST['do'] == "del"wink{
$img = dbarray(dbquery("SELECT * FROM ".$db_prefix."komanda WHERE id = '".$_POST['id']."'"wink);
$qery = dbquery("DELETE FROM ".$db_prefix."komanda WHERE id = ".$_POST['id'].""wink;
unlink(IMAGES."komanda/".$img['nuotrauka']);
showmessage($locale['a32']);
}

if(isset($_POST['do']) && $_POST['do'] == "edit"wink{
$komandosas = dbarray(dbquery("SELECT * FROM ".$db_prefix."komanda WHERE id = '".$_POST['id']."'"wink);
$sel = ($komandosas['cat_id'] == $data2['cat_id'] ? " selected" : ""wink;
$useriai = ($komandosas['user_id'] == $data3['user_id'] ? " selected" : ""wink;
if(!$komandosas){
showmessage($locale['a26']);
}else{
opentable($locale['a13']);
echo '
<form method="POST" action="admin.php'.$aidlink.'" enctype="multipart/form-data">
<input type="hidden" name="do" value="doedit">
<input type="hidden" name="id" value="'.$komandosas['id'].'">
<table border="0" cellpadding="1" cellspacing="1" align="center">
<tr>
<td>'.$locale['a01'].'</td>
<td><input type="text" class="textbox" name="slapyvardis" value="'.$komandosas['slapyvardis'].'"></td>
</tr>
<tr>
<td>'.$locale['a02'].'</td>
<td><input type="text" class="textbox" name="amzius" value="'.$komandosas['amzius'].'"></td>
</tr>
<tr>
<td>'.$locale['a03'].'</td>
<td><input type="text" class="textbox" name="miestas" value="'.$komandosas['miestas'].'"></td>
</tr>
<tr>
<td>'.$locale['a04'].'</td>
<td><input type="text" class="textbox" name="pareigos" value="'.$komandosas['pareigos'].'"></td>
</tr>
<tr>
<td>'.$locale['a05'].'</td>
<td><input type="text" class="textbox" name="kontaktai" value="'.$komandosas['kontaktai'].'"></td>
</tr>
<tr>
<td>'.$locale['a06'].'</td>
<td><input type="text" class="textbox" name"laida" value="'.$komandosas['laida'].'"></td>
</tr>
<tr>
<td>'.$locale['a17'].'</td>
<td><input type="text" class="textbox" name"vedejas" value="'.$komandosas['vedejas'].'"></td>
</tr>
<tr>
<td>'.$locale['a11'].'</td>
<td><select name="userid" class="textbox">'.$userlist.'</select></td>
</tr>
<tr>
<td>'.$locale['a12'].'</td>
<td><select name="catid" class="textbox">'.$editlist.'</select></td>
</tr>
<tr>
<td>'.$locale['a11'].'</td>
<td><input type="file" name="nuotrauka" class="textbox" size="20"></td>
</tr>
<tr>
<td colspan="2" align="center"><input class="button" type="submit" value="'.$locale['a15'].'" name="B1"></td>
</tr>
</table>
</form>';
closetable();
}
}

if(isset($_POST['do']) && $_POST['do'] == "doedit"wink{
$komandosas = dbarray(dbquery("SELECT * FROM ".$db_prefix."komanda WHERE id = '".$_POST['id']."'"wink);

if(!$_POST['id'] or !$_POST['slapyvardis']){
showmessage($locale['a26']);
}else if($_FILES["nuotrauka"]["error"] > 0){
$result = dbquery("UPDATE ".$db_prefix."komanda SET slapyvardis='".$slapyvardis."', amzius='".$amzius."', miestas='".$miestas."', pareigos='".$pareigos."', kontaktai='".$kontaktai."', laida='".$laida."', cat_id='".$cat_id."', user_id='".$user_id."', vedejas='".$vedejas."' WHERE id='".$_POST['id']."'"wink;
showmessage($locale['a33']);
}else{
if ($error == ""wink {
$sndyra = mktime(date("H"wink,date("i"wink,date("s"wink,date("m"wink,date("d"wink,date("Y"wink);
$newavatar = $_FILES['nuotrauka'];
if (!empty($newavatar['name']) && is_uploaded_file($newavatar['tmp_name'])) {
$avatarext = strrchr($newavatar['name'],"."wink;
$avatarname = substr($newavatar['name'], 0, strrpos($newavatar['name'], "."wink);
if (preg_match("/^[-0-9A-Z_\[\]]+$/i", $avatarname) && preg_match("/(\.gif|\.GIF|\.jpg|\.JPG|\.png|\.PNG)$/", $avatarext) && $newavatar['size'] <= 1024*$goldsettings['maxbanner120x120size']) {
$avatarname = $avatarname."[".$userdata['user_id'].$sndyra."]".$avatarext;
$set_avatar = $avatarname;
move_uploaded_file($newavatar['tmp_name'], IMAGES."komanda/".$avatarname);
chmod(IMAGES."komanda/".$avatarname,0644);
if ($size = @getimagesize(IMAGES."komanda/".$avatarname)) {
if ($size['0'] > 120 || $size['1'] > 120) {
unlink(IMAGES."komanda/".$avatarname);
$set_avatar = "";
}
} else {
unlink(IMAGES."komanda/".$avatarname);
$set_avatar = "";
}
}
}

}


if($set_avatar == ""wink{
showmessage($locale['a25']);
}else{
$result = dbquery("UPDATE ".$db_prefix."komanda SET slapyvardis='".$slapyvardis."', amzius='".$amzius."', miestas='".$miestas."', pareigos='".$pareigos."', kontaktai='".$kontaktai."', laida='".$laida."', cat_id='".$cat_id."', user_id='".$user_id."', vedejas='".$vedejas."', nuotrauka='".$set_avatar."' WHERE id='".$_POST['id']."'"wink;
unlink(IMAGES."komanda/".$komandosas['nuotrauka']);
showmessage($locale['a31']);
}



}


}

opentable($locale['a14']);
echo '
<form method="POST" action="admin.php'.$aidlink.'" enctype="multipart/form-data">
<input type="hidden" name="do" value="doadd">
<table border="0" cellpadding="1" cellspacing="1" align="center">
<tr>
<td>'.$locale['a01'].'</td>
<td><input type="text" class="textbox" name="slapyvardis"></td>
</tr>
<tr>
<td>'.$locale['a02'].'</td>
<td><input type="text" class="textbox" name="amzius"></td>
</tr>
<tr>
<td>'.$locale['a03'].'</td>
<td><input type="text" class="textbox" name="miestas"></td>
</tr>
<tr>
<td>'.$locale['a04'].'</td>
<td><input type="text" class="textbox" name="pareigos"></td>
</tr>
<tr>
<td>'.$locale['a05'].'</td>
<td><input type="text" class="textbox" name="kontaktai"></td>
</tr>
<tr>
<td>'.$locale['a06'].'</td>
<td><input type="text" class="textbox" name"laida"></td>
</tr>
<tr>
<td>'.$locale['a17'].'</td>
<td><input type="text" class="textbox" name"vedejas"></td>
</tr>
<tr>
<td>'.$locale['a07'].'</td>
<td><select name="userid" class="textbox">'.$userlist.'</select></td>
</tr>
<tr>
<td>'.$locale['a12'].'</td>
<td><select name="catid" class="textbox">'.$editlist.'</select></td>
</tr>
<tr>
<td>'.$locale['a11'].'</td>
<td><input type="file" name="nuotrauka" class="textbox" size="20"></td>
</tr>
<tr>
<td colspan="2">
<p align="center">
<input type="submit" class="button" value="'.$locale['a09'].'"></td>
</tr>
</table>
</form>
';

closetable();


opentable($locale['k00']);
if(dbcount("(*)", DB_PREFIX."komanda"wink > 0){
if(dbcount("(*)", DB_PREFIX."komanda", "cat_id=1"wink > 0) {
$kad = dbquery("SELECT * from ".DB_PREFIX."komanda WHERE cat_id = '1'"wink;

while($kads = dbarray($kad)) {
echo '
<table border="0" cellpadding="1" cellspacing="1" align="center">
<tr>
<td class="tbl2" colspan="3" align="center"><h2>Administracija</h2></td>
</tr>
<tr>
<td class="tbl2" colspan="3" align="center"><table border=0>';

echo '<tr>
<td><img src="'.IMAGES.'komanda/'.$kads['nuotrauka'].'" height="120" align="right"></td>
<td>';

echo $locale['k01'].' <a href="'.($kads['user_id'] == "" ? "#" : $kads['user_id']).'">'.$kads['slapyvardis'].'</a><br />';
echo ($kads['amzius'] == "" ? "" : "".$locale['k02']." ".$kads['amzius']."<br />"wink;
echo ($kads['miestas'] == "" ? "" : "".$locale['k03']." ".$kads['miestas']."<br />"wink;
echo ($kads['laida'] == "" ? "" : "".$locale['k06']." ".$kads['laida']."<br />"wink;
echo $locale['k04'].' '.$kads['pareigos'].'<br />';
echo $locale['k05'].' '.$kads['kontaktai'].'<br />';
echo '</td>
</tr>';

echo '</table></td>
</tr>
<tr>
<td class="tbl2" align="center"><form method="POST" action="admin.php'.$aidlink.'"><input type="hidden" name="id" value="'.$kads['id'].'"><input type="hidden" name="do" value="edit"><input type="submit" value="'.$locale['a15'].'" class="button"></form></td>
<td class="tbl2" align="center"><form method="POST" action="admin.php'.$aidlink.'"><input type="hidden" name="id" value="'.$kads['id'].'"><input type="hidden" name="do" value="del"><input type="submit" value="'.$locale['a16'].'" class="button"></form></td>
</tr>
</table>
';
}
} else {
echo "<center>".$locale['a35']."</center>";
}

if(dbcount("(*)", DB_PREFIX."komanda", "cat_id=2"wink > 0) {
$kdj = dbquery("SELECT * from ".DB_PREFIX."komanda WHERE cat_id = '2'"wink;
while($kdjs = dbarray($kdj)) {
echo '
<table border="0" cellpadding="1" cellspacing="1" align="center">
<tr>
<td class="tbl2" colspan="3" align="center"><h2>Administracija</h2></td>
</tr>
<tr>
<td class="tbl2" colspan="3" align="center"><table border=0>';

echo '<tr>
<td><img src="'.IMAGES.'komanda/'.$kdjs['nuotrauka'].'" height="120" align="right"></td>
<td>';

echo $locale['k01'].' <a href="'.($kdjs['user_id'] == "" ? "#" : $kdjs['user_id']).'">'.$kdjs['slapyvardis'].'</a><br />';
echo ($kdjs['amzius'] == "" ? "" : "".$locale['k02']." ".$kdjs['amzius']."<br />"wink;
echo ($kdjs['miestas'] == "" ? "" : "".$locale['k03']." ".$kdjs['miestas']."<br />"wink;
echo ($kdjs['laida'] == "" ? "" : "".$locale['k06']." ".$kdjs['laida']."<br />"wink;
echo $locale['k04'].' '.$kdjs['pareigos'].'<br />';
echo $locale['k05'].' '.$kdjs['kontaktai'].'<br />';
echo '</td>
</tr>';

echo '</table></td>
</tr>
<tr>
<td class="tbl2" align="center"><form method="POST" action="admin.php'.$aidlink.'"><input type="hidden" name="id" value="'.$kdjs['id'].'"><input type="hidden" name="do" value="edit"><input type="submit" value="'.$locale['a15'].'" class="button"></form></td>
<td class="tbl2" align="center"><form method="POST" action="admin.php'.$aidlink.'"><input type="hidden" name="id" value="'.$kdjs['id'].'"><input type="hidden" name="do" value="del"><input type="submit" value="'.$locale['a16'].'" class="button"></form></td>
</tr>
</table>
';
}
} else {
echo "<center>".$locale['a36']."</center>";
}
}else{
echo "<center>".$locale['a34']."</center>";
}
closetable();

require_once THEMES."templates/footer.php";
?>[/syntaxhighlighter]
Edited by MarcusG on 10-07-2012 20:30,
0 replies
There are no post found.

Labels

None yet

Statistics

  • Views 0 views
  • Posts 0 posts
  • Votes 0 votes
  • Topic users 1 member

1 participant

W
W
  • Junior Member, joined since
  • Contributed 18 posts on the community forums.
  • Started 8 threads in the forums
  • Started this discussions

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet