Jump to content

khan.sikki

Members
  • Posts

    14
  • Joined

  • Last visited

Posts posted by khan.sikki

  1. unable to understand why black image is getting, please check the code and assist in generating the optimised image from file input :)

    <html>
    <head>
      <script src="jquery-3.4.1.min.js"></script>
      <title>Image Optimization</title>
    </head>
    <body>
      <div>
          <input type="file" id="imgFile" accept="image/*" capture="user">
      </div>
      <div id ="test">
          <img id="optImg" alt="optmisied Image">
      </div>
    </body>
    </html>
    <script>
    $("#imgFile").change(function(){
       const File = this.files[0];
       const fileURL = URL.createObjectURL(File);
       const cvs = document.createElement("canvas");
       let ctx = cvs.getContext("2d");
       const imgFile = new Image();
       imgFile.src = fileURL;
       imgFile.onload = function(){
          ctx.drawImage(imgFile,0,0);
       }
       const cvsURL = cvs.toDataURL(File.type, 0.3);
       $("#optImg").attr('src',cvsURL).css('width',80)
    });
    </script>

    please assist

  2. How to avoid form resubmission 

    <?php require_once('../Connections/localhost.php'); ?>
    <?php
    //initialize the session
    if (!isset($_SESSION)) {
      session_start();
    }
    
    // ** Logout the current user. **
    $logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
    if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
      $logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
    }
    
    if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
      //to fully log out a visitor we need to clear the session varialbles
      $_SESSION['MM_Username'] = NULL;
      $_SESSION['MM_UserGroup'] = NULL;
      $_SESSION['PrevUrl'] = NULL;
      unset($_SESSION['MM_Username']);
      unset($_SESSION['MM_UserGroup']);
      unset($_SESSION['PrevUrl']);
    	
      $logoutGoTo = "../app/index.php?la=r";
      if ($logoutGoTo) {
        header("Location: $logoutGoTo");
        exit;
      }
    }
    ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
    {
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      }
    
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
    
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;    
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      }
      return $theValue;
    }
    }
    
    $colname_teachers = "-1";
    if (isset($_SESSION['MM_Username'])) {
      $colname_teachers = $_SESSION['MM_Username'];
    }
    mysql_select_db($database_localhost, $localhost);
    $query_teachers = sprintf("SELECT * FROM teachers WHERE employee_id = %s", GetSQLValueString($colname_teachers, "text"));
    $teachers = mysql_query($query_teachers, $localhost) or die(mysql_error());
    $row_teachers = mysql_fetch_assoc($teachers);
    $totalRows_teachers = mysql_num_rows($teachers);
    
    $colname_school = "-1";
    if (isset($row_teachers['school_id'])) {
      $colname_school = $row_teachers['school_id'];
    }
    mysql_select_db($database_localhost, $localhost);
    $query_school = sprintf("SELECT * FROM schools WHERE id = %s", GetSQLValueString($colname_school, "int"));
    $school = mysql_query($query_school, $localhost) or die(mysql_error());
    $row_school = mysql_fetch_assoc($school);
    $totalRows_school = mysql_num_rows($school);
    date_default_timezone_set("Asia/kolkata");?>
    <!doctype html>
    <html lang="en">
    <head>
    <meta http-equiv="Refresh" content="1600">
    <meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="../app/css/app.css" type="text/css">
    <?php include('../app/includes/favicon.php'); ?>
    <meta name="Description" content="Andhra Pradesh Department of School Education Teacher & Student online Attendence  with Photo Geo Tagging ">
    <title>Location Check</title>
    	<!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    </script>
    <![endif]-->
    </head>
    <body>
    	
    <?php include('../app/includes/header.php'); ?>
    	<marquee direction="left">
    	  <h2>DEPARTMENT OF SCHOOL EDUCATION</h2>
    	</marquee>
    <main>
    	<nav>
    	<ul>
    	  <li><a href="../app/teacher1.php">HOME</a></li>
    	  <li><a href="../app/test.php">MDM</a></li>
    	  <li><a href="<?php echo $logoutAction ?>">Logout</a></li>
    	  <li></li>
    	</ul>
    	</nav>
    	<article>
    		
    		<fieldset>
    			<legend>Local Storage Test</legend>
    		<form id="geotag" method="post" enctype="multipart/form-data" action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']); ?>">
    			<table width="auto" align="center">
    				<tbody>
    					<tr>
    						<td><label class="cameraikon" for="image"></label></td>
    					</tr>
    					<tr>
    						<td>
    							<input id="image" type="file" name="image" accept="image/*" capture="camera" onChange="this.form.submit()">
    						</td>
    					</tr>
    					<tr><td><input type="button" id="upload" value="upload"></td></tr>
    					<tr><td><div id="loader" style="display: none"></div></td></tr>
    					<tr><td height="auto" style="margin-top: 50px;">
    						<?php 
    		if(isset($_FILES['image']['name'])){
    		$img = $_FILES['image']['tmp_name'];
    		$targDir="../app/geotagged_imgs/";
    		$imgExtension= strtolower(pathinfo(basename($_FILES['image']['name']),PATHINFO_EXTENSION));
    		$imgname = "APEDU_".date('d-m-Y_h|i|s').".".$imgExtension;
    		$tmpimg=imagecreatefromjpeg($img);
    		imagejpeg($tmpimg,$targDir.$imgname,50);
    		// move_uploaded_file($_FILES['image']['tmp_name'],$targDir.$imgname);				
    		echo '<p id = "result">'.$imgname.'<br>UPLOADED SUCCESSFULLY.</p><br>';
    		imagedestroy($tmpimg);
    		echo '<br><img src="../app/geotagged_imgs/'.$imgname.'" class="thumbnail"><br>';
    		empty($_FILES['image']['name']);
    		empty($_FILES['image']['tmp_name']);
    		print_r($_FILES['image']['name']);
    			
    	}
    		?>
    						</td></tr>
    				</tbody>
    			</table>
    		</form>
    		</fieldset>
    	</article>
    </main>
    <footer> ™ and © 2019 A M Productions. All rights reserved. Property of Sikander. Use of this website (including any and all parts and components) constitutes your acceptance of these Terms and Conditions and Privacy Policy. Ad Choices. The materials on this website are not to be sold, traded or given away. Any copying, manipulation, publishing, or other transfer of these materials, except as specifically provided in the terms and conditions of use, is strictly prohibited. Smoking Policy</footer>
    </body>
    </html>
    	<script>
    		y = document.getElementById("upload").addEventListener("click",sikki);
    		function sikki() {
    			document.getElementById("loader").style.display = "block";
    		}
    		</script>
    <?php
    mysql_free_result($teachers);
    
    mysql_free_result($school);
    ?>

     

  3. Hello frns,

    i learnt how to get the gps coordinates from w3school tutorials but a small question how to alter the user if he blocks the gps access request through code 

    <script>
    var x = document.getElementById("gpsloc");
    
    function getLocation() {
      if (navigator.geolocation) {
        navigator.geolocation.getCurrentPosition(showPosition, showError);
      } else { 
        x.value = "Geolocation is not supported by this device.";
      }
    }
    
    function showPosition(position) {
      x.value = position.coords.latitude + 
      "," + position.coords.longitude;
    }
    
    function showError(error) {
      switch(error.code) {
        case error.PERMISSION_DENIED:
          x.value = "User denied the request for Geolocation."
          break;
        case error.POSITION_UNAVAILABLE:
          x.value = "Location information is unavailable."
          break;
        case error.TIMEOUT:
          x.value = "The request to get user location timed out."
          break;
        case error.UNKNOWN_ERROR:
          x.value = "An unknown error occurred."
          break;
      }
    }
    </script>

    what i want to make is page should check the state of permission and if permission is denied  page should alert or keep re-request permission to allow

    please assist 

  4. i solved it bro thank you here is the code 

    <?php
    			if(isset($_POST['submit'])){
    				// insert attendence to database
    				$q= "INSERT INTO attendence(date,school_id,class,period,teacher,student_id,status) VALUES";
    				//creating arrary to receview multiple rows values
    				for ($a=1;$a<=$totalRows_students;$a++){
    					//assigning multiple values to inset into values
    					$q .="('".$_GET['date']."','".$_GET['school']."','".$_GET['class']."','".$_POST['period']."','".$_POST['teacher']."','".$_POST['student_id'][$a]."','".$_POST['status'][$a]."'),";
    				}
    				//removing "," from statement 
    				$q=rtrim($q,",");
    				mysql_select_db($database_localhost, $localhost);
    				mysql_query($q, $localhost) or die(mysql_error());
    				// displaying result
    				echo '<p align ="center"class="alert">'.strtoupper($row_teachers['name']).' గారు మీరు వేసిన హాజరు జతచేతయబడినది ఫోటో జియోట్యగ్ ప్రక్రియను పూర్తి చేయండి</p>';
    			}
    			?>

     

  5. Hello I am Sikandar 

    need assistance in inserting multiple data  which was fetched from a recordset in a table

    
    $editFormAction = $_SERVER['PHP_SELF'];
    if (isset($_SERVER['QUERY_STRING'])) {
      $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
    }
    
    if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "add_trips")) {
      $insertSQL = sprintf("INSERT INTO trips (trip_date, trip_no, hab_id) VALUES (%s, %s, %s)",
                           GetSQLValueString($_POST['trip_date'], "date"),
                           GetSQLValueString($_POST['trip_no'], "int"),
                           GetSQLValueString($_POST['hab_id'], "int"));
    
      mysql_select_db($database_conn_db, $conn_db);
      $Result1 = mysql_query($insertSQL, $conn_db) or die(mysql_error());
    
      $insertGoTo = "u_home.php?trip=t";
      if (isset($_SERVER['QUERY_STRING'])) {
        $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
        $insertGoTo .= $_SERVER['QUERY_STRING'];
      }
      header(sprintf("Location: %s", $insertGoTo));
    }

     

  6. Thank you very much for the reply brother

    i think forum is here to solve the complex things by discussing

    i am not asking to prepare this design, where as i am asking to assist where i stuck, as i designed the site learnng from w3schools

     

    asking to help as i was confused a bit in generating seat layout dynamically (front end)

     

    how to dynamically generate the seat layout based on the rows retrieved from the seats DB table

     

    here screen, rows and columns details will in seats table, screen details will be in screens table and booking info will be in booking table

     

    regards

  7. i learned php, mysql and css from w3schools and designed my personal website www.sikki.in

     

    and got stuck-ed at complex part of designing cinema online ticket reservation system to multiple located screens for exhibitor and producer.

    i am using php and mysql for Back end, but problem in designing Front end system like generating seats dynamically and mapping seats with rows and column

     

    please assistance in making a "how to" for this

     

    details :

    in screen table all the particulars of screen will present like no. of classes in screen, no. seats in each class, screen location, ticket price etc

    booking table will have all the details of ticket booking details like movie name, screen name, show date, show time, booking status, reserved by(exhibitor username) etc

    seats table will have all the details of screen_id, no_rows now of columns

×
×
  • Create New...