$Brief_subject = $_POST['Brief_subject'];
$photo = $_FILES['Topic_Content_file']['tmp_name'];
$Topic_Content = $_FILES['Topic_Content_file']['name'];
$photo_size = $_FILES['Topic_Content_file']['size'];
$photo_type = $_FILES['Topic_Content_file']['type'];
if ($_POST['btnsubmit'] != '') {
    $sql = "select * from {$table_topic} where Book_id='{$Book_id}' AND Topic_Topicid='{$Topic_Topicid}' AND Topic_Lessonid='{$Topic_Lessonid}' ";
    $query = mysql_query($sql) or die("error");
    $num = mysql_num_rows($query);
    if ($num > 0) {
        $_SESSION['Book_id'] = $Book_id;
        $_SESSION['Topic_Topicid'] = $Topic_Topicid;
        $_SESSION['Topic_Lessonid'] = $Topic_Lessonid;
        $_SESSION['Topic_Name'] = $Topic_Name;
        echo "<script>alert('หัวข้อที่ป้อนซ้ำกัน');window.location='index.php?frm=add_topic';</script>";
    } else {
        if ($_FILES['Topic_Content_file']['name'] != '') {
            $Topic_Content = date("Y-m-d") . "-" . $Topic_Content;
            copy($photo, "file_lession/" . $Topic_Content);
        }
        unset($_SESSION['Book_id']);
        unset($_SESSION['Topic_Topicid']);
        unset($_SESSION['Topic_Lessonid']);
        unset($_SESSION['Topic_Name']);
        $result = adddata($table_topic);
    }
}
?>
</body>
</html>
                copy($_FILES["picture"]["tmp_name"], "picture_teacher/{$T_Pic}");
                // copy($photo,"picture_teacher/".$T_Pic);
            }
            $T_Birth = $day . "-" . $mount . "-" . $year;
            $result_add_teacher = adddata($table_teacher);
            $max = 0;
            $que = select("{$table_teacher}");
            $ll = 0;
            while ($rww = mysql_fetch_array($que)) {
                $teacher_id[$ll] = $rww['ID'];
                $ll++;
            }
            for ($tes = 0; $tes < count($teacher_id); $tes++) {
                if ($max < $teacher_id[$tes]) {
                    $max = $teacher_id[$tes];
                }
            }
            $T_id = $max;
            for ($i = 0; $i < count($_POST["place"]); $i++) {
                if (trim($_POST["place"][$i]) != "") {
                    $P_id = $_POST["place"][$i];
                    adddata($table_easy_place);
                }
            }
        }
    }
    //else
}
?>
</html>
                    unset($_SESSION['DateE']);
                    echo "<script>alert('กรุณาตรวจสอบวัน เดือน ปี ที่ป้อน (วัน เดือน ปี เริ่มต้น ต้องมากกว่า วัน เดือน ปี สิ้นสุด)');window.location='index.php?frm=add_holiday';</script>";
                } else {
                    $query = select($table_holiday);
                    while ($row = mysql_fetch_array($query)) {
                        $dbdateb = explode("/", $row['Date_begin']);
                        $dbdatee = explode("/", $row['Date_end']);
                        if ($db[0] >= $dbdateb[0] && $db[1] >= $dbdateb[1] && $db[2] >= $dbdateb[2] && ($de[0] <= $dbdatee[0] && $de[1] <= $dbdatee[1] && $de[2] <= $dbdatee[2])) {
                            $_SESSION['NameH'] = $Name_holiday;
                            echo "<script>alert('วัน เดือน ปี ที่ป้อนซ้ำกัน');window.location='index.php?frm=add_holiday';</script>";
                            $k = 1;
                        }
                    }
                    if ($k != 1) {
                        unset($_SESSION['NameH']);
                        unset($_SESSION['DateB']);
                        unset($_SESSION['DateE']);
                        $result_t = adddata($table_holiday);
                    }
                }
            }
        }
    }
}
?>
</body>
</html>



Exemple #4
0
<?php

include "config/connect.php";
include "config/function_db.php";
include "config/function_gen.php";
$location_name = $_GET['location_name'];
$address = $_GET['address'];
$result = adddata($table_place);
if ($result) {
    echo "y";
}
?>
 
<?php

session_start();
require '../include/config.php';
require '../functions/functions_checkuser.php';
header("Content-type:text/html;charset=UTF-8");
$select = isset($_GET['select']) ? $_GET['select'] : '';
switch ($select) {
    case 'add':
        adddata();
        break;
    case 'edit':
        editdata();
        break;
    case 'del':
        deldata();
        break;
    case 'delimg':
        delimg();
        break;
    default:
        header('Location: ../index.php');
        break;
}
/*
    Add a user
*/
function adddata()
{
    require '../include/config.php';
    $name = $_POST['txtname'];
                        <label for="T_surname">นามสกุลผู้ดูแลระบบ :</label></dt>
                        <dd><input type="text" name="Surname" id="Surname" size="40"  class="text"/></dd>
					</dl>
					<dl>
            <dt><label for="T_Email">อีเมลล์ :</label></dt>
                        <dd><input type="text" name="Email" id="Email" size="40"  class="text"/></dd>
                    </dl>
					<dl>
                        <dt>
                          <input type="submit" name="submit" id="submit" value="บันทึก" class="NFButton"/>
                     </dt>
					</dl>
</form>
		       </fieldset>   
         </div>  
</body>
<?php 
if ($_POST['submit'] != '') {
    //$test
    //$T_id=$_POST['T_id'];
    $Username = $_REQUEST['Username'];
    $Password = $_REQUEST['Password'];
    $prefix_name = $_REQUEST['prefix_name'];
    $Name = $_REQUEST['Name'];
    $Surname = $_REQUEST['Surname'];
    $Email = $_REQUEST['Email'];
    $result_add_admin = adddata($table_admin);
}
?>
</html>
                    </dl>
					  </dl>
                     <dl class="submit">
                    <input type="submit" name="btnsubmit" id="btnsubmit" value="บันทึก" class="btn"/>
                     </dl>   
		 </fieldset>  
		 </form> 
</div>  
<?php 
if ($_POST['btnsubmit'] != '') {
    $T_id = $_POST['id_teacher'];
    for ($p = 0; $p < $l; $p++) {
        if ($tpc_th[$p] == $T_id) {
            $sql = "delete from {$table_aptitude} where T_id='{$T_id}' ";
            mysql_query($sql) or die("Error sql delete");
        }
    }
    for ($i = 0; $i < count($_POST["interests"]); $i++) {
        if (trim($_POST["interests"][$i]) != "") {
            $Topic_id = $_POST["interests"][$i];
            $id = '';
            adddata($table_aptitude);
        }
    }
    fn_alert('แก้ไขข้อมูลเสร็จเรียบร้อย');
    window_location("index.php?frm=edit_aptitude");
}
?>
</body>
</html>
Exemple #8
0
    createtable($pageid);
} else {
    die("local data loaded");
}
/*foreach($graphArray['posts'] as $post)
  {$date_formal = new DateTime($post['created_time']['date']);
  if(!isset($post['message'])){ $post['message']=''; $inclination=2;} else 
  $inclination=findsenti($post['message']);
  $qr="INSERT INTO `$pageid` (`post_id`,`text`,`time`,`report`) VALUES (\"".$post['id']."\",\"".$post['message']."\",\"".$date_formal->gettimestamp()."\",$inclination)";
  //echo $qr=mysqli_real_escape_string($mysqli,$qr);
  //echo'<br>';
  //exit;
  mysqli_query($mysqli,$qr);
	//echo '<tr><td>'.$post['id'].'</td><td>'.$post['message'].'</td><td>'.$inclination.'</td><td>'.$date_formal->gettimestamp().'</td></tr>';
  }
    //echo '</table>';
	
	nexturl($pageid,$meta);
	$count=getmaxid ($pageid);
	docomments($pageid,$count);

	//header('Location: ../report.php?id='.$pageid);
	*/
adddata($pageid, 51);
addlv2data($pageid, 100);
$time_post = microtime(true);
$exec_time = $time_post - $time_pre;
echo "time taken=" . $exec_time;
//$userNode = $response->getGraphUser();
//var_dump($response);
//echo 'Logged in as ' . $userNode->getName();