Jump to content

ztimer

Members
  • Posts

    64
  • Joined

  • Last visited

About ztimer

  • Birthday 02/15/1986

Profile Information

  • Gender
    Male
  • Location
    Estonia

ztimer's Achievements

Member

Member (2/5)

0

Reputation

  1. Wow. It worked out of box. Thanks. I did not realize to use "this" and not to call it again .. Lesson learned. First use class and then use this You can't believe how happy this made me. I can continue now with the code. Thanks for this..
  2. Yes I get alert with different value for each entry.
  3. I have trouble calling timepicker with class and passing data-values to the script. So what i have so far is one loop that for each entry it will create foreach($data as $value){ $min_hour = $value['minhour']; // returns value from DB like 7 to 12 echo '<td><input type="text" value="" class="schedule-timepicker" data-minhour="'.$min_hour.'" data-minminutes="30" data-maxhour="17" data-maxminutes="00"></td>'; } Then in js file I have $(document).ready(function(){ $('.schedule-timepicker').timepicker({ timeFormat: 'HH:mm:ss', minDate: new Date(1, 1, 1, $('.schedule-timepicker').data('minhour'), 00), maxDate: new Date(1, 1, 1, $('.schedule-timepicker').data('maxhour'), 00), }); }); Problem is that the timepicker is called out and works but every input has the same minimum hours value as the first one. Please help how to resolve this. Thanks.
  4. I got it working. Did all the things mentioned here and still multiple entries. So I went crazy and started chopping out code "includes" like header sidebar and footer and still multiple entries. Then I went to the actual main.php file and on top there was include 'modules/topbar.php'; Took that away and all was well. It had only the code below inside. As Im using a template to build it on i have not yet managed to get to that part but What is making insert to make two or three entris in this part of the code. At the moment I removed Search , tasks and messages and now the code works and does not loop or request twice. <!-- START X-NAVIGATION VERTICAL --> <ul class="x-navigation x-navigation-horizontal x-navigation-panel"> <!-- TOGGLE NAVIGATION --> <li class="xn-icon-button"> <a href="#" class="x-navigation-minimize"><span class="fa fa-dedent"></span></a> </li> <!-- END TOGGLE NAVIGATION --> <!-- SEARCH --> <li class="xn-search"> <form role="form"> <input type="text" name="search" placeholder="Search..."/> </form> </li> <!-- END SEARCH --> <!-- SIGN OUT --> <li class="xn-icon-button pull-right"> <a href="#" class="mb-control" data-box="#mb-signout"><span class="fa fa-sign-out"></span></a> </li> <!-- END SIGN OUT --> <!-- MESSAGES --> <li class="xn-icon-button pull-right"> <a href="#"><span class="fa fa-comments"></span></a> <div class="informer informer-danger">4</div> <div class="panel panel-primary animated zoomIn xn-drop-left xn-panel-dragging"> <div class="panel-heading"> <h3 class="panel-title"><span class="fa fa-comments"></span> Messages</h3> <div class="pull-right"> <span class="label label-danger">4 new</span> </div> </div> <div class="panel-body list-group list-group-contacts scroll" style="height: 200px;"> <a href="#" class="list-group-item"> <div class="list-group-status status-online"></div> <img src="#" class="pull-left" alt="John Doe"/> <span class="contacts-title">John Doe</span> <p>Praesent placerat tellus id augue condimentum</p> </a> <a href="#" class="list-group-item"> <div class="list-group-status status-away"></div> <img src="#" class="pull-left" alt="Dmitry Ivaniuk"/> <span class="contacts-title">Dmitry Ivaniuk</span> <p>Donec risus sapien, sagittis et magna quis</p> </a> <a href="#" class="list-group-item"> <div class="list-group-status status-away"></div> <img src="#" class="pull-left" alt="Nadia Ali"/> <span class="contacts-title">Nadia Ali</span> <p>Mauris vel eros ut nunc rhoncus cursus sed</p> </a> <a href="#" class="list-group-item"> <div class="list-group-status status-offline"></div> <img src="#" class="pull-left" alt="Darth Vader"/> <span class="contacts-title">Darth Vader</span> <p>I want my money back!</p> </a> </div> <div class="panel-footer text-center"> <a href="pages-messages.html">Show all messages</a> </div> </div> </li> <!-- END MESSAGES --> <!-- TASKS --> <li class="xn-icon-button pull-right"> <a href="#"><span class="fa fa-tasks"></span></a> <div class="informer informer-warning">3</div> <div class="panel panel-primary animated zoomIn xn-drop-left xn-panel-dragging"> <div class="panel-heading"> <h3 class="panel-title"><span class="fa fa-tasks"></span> Tasks</h3> <div class="pull-right"> <span class="label label-warning">3 active</span> </div> </div> <div class="panel-body list-group scroll" style="height: 200px;"> <a class="list-group-item" href="#"> <strong>Phasellus augue arcu, elementum</strong> <div class="progress progress-small progress-striped active"> <div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100" style="width: 50%;">50%</div> </div> <small class="text-muted">John Doe, 25 Sep 2014 / 50%</small> </a> <a class="list-group-item" href="#"> <strong>Aenean ac cursus</strong> <div class="progress progress-small progress-striped active"> <div class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="80" aria-valuemin="0" aria-valuemax="100" style="width: 80%;">80%</div> </div> <small class="text-muted">Dmitry Ivaniuk, 24 Sep 2014 / 80%</small> </a> <a class="list-group-item" href="#"> <strong>Lorem ipsum dolor</strong> <div class="progress progress-small progress-striped active"> <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="95" aria-valuemin="0" aria-valuemax="100" style="width: 95%;">95%</div> </div> <small class="text-muted">John Doe, 23 Sep 2014 / 95%</small> </a> <a class="list-group-item" href="#"> <strong>Cras suscipit ac quam at tincidunt.</strong> <div class="progress progress-small"> <div class="progress-bar" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width: 100%;">100%</div> </div> <small class="text-muted">John Doe, 21 Sep 2014 /</small><small class="text-success"> Done</small> </a> </div> <div class="panel-footer text-center"> <a href="pages-tasks.html">Show all tasks</a> </div> </div> </li> <!-- END TASKS --> </ul> <!-- END X-NAVIGATION VERTICAL -->
  5. Ok so i set my index to if(__FILE__ == $_SERVER['SCRIPT_FILENAME']) exit('Restricted!'); include 'config/config.inc.php'; session_start(); if(!isset($_SESSION['Username'])){ header("Location: login.php"); return; //or exit(), or die() } include 'modules/header.php'; ini_set('display_errors',1); ini_set('display_startup_errors',1); error_reporting(-1); if(isset($_GET['app'])){ if(!@include('modules/'.$_GET['app']."/main.php")){ include 'modules/error.php'; } }else{ include 'modules/main.php'; } include 'modules/footer.php'; Now i have 3 same entries .. not two. any ideas.
  6. Ok. Sorry I lost you there can you be more specific. Code example or something . Thanks. Im clearly not at the level you are on yet. Still learning new tricks. How could i fix this. I would really love to leave my index base layout like it is. It seems promising to me.. And I really appreciate your help.
  7. Noooooooo..... Ok its too late to debug this today but yes. I just made a test.php to the root of the web dir and yes. it does insert one entry. Thanks for this .. Seems it is indeed in the coding but now lets talks some more. I have the index page buidup like if(__FILE__ == $_SERVER['SCRIPT_FILENAME']) exit('Restricted!'); include 'config/config.inc.php'; session_start(); if(!isset($_SESSION['Username'])){ header("Location: login.php"); } include 'modules/header.php'; ini_set('display_errors',1); ini_set('display_startup_errors',1); error_reporting(-1); if(isset($_GET['app'])){ if(!@include('modules/'.$_GET['app']."/main.php")){ include 'modules/error.php'; } }else{ include 'modules/main.php'; } include 'modules/footer.php'; and the page that was tested is in modules and main.php requested as http://address?app=test how to prevent this of happening. If you are still willing.. Well im happy to get at least some lead for tomorrow so thanks for this @mac_gyver but if you have some fix for me i would love to read and continue from there tomorrow.. Thanks again for pointing to the right direction.
  8. Ok so this made me suspicious and I am desperate so I went to the logs and deleted them all. Made one try to load the page and one request is loged. Sorry .. This is not the case. Ps. Did try just in case with multiple browsers also. Same thing.
  9. I don't believe this. This has never happened in my history of code before. But no. I have not checked this .. It is not probable. Sorry
  10. Hi all, Its been a long time since last help request from real professional from here but I'm again in trouble with a much more spectacular plan I'm working on. For those who are interested in the plan then here it is: My Idea was to make a new build starting from scratch and make it as dynamical as possible. So my goal is not to make almost anything fixed in the code. I have made a decision to make a one supper large table for multiple different entries so no more joining and no more views for me.! In this help request I'm having trouble with Posting values to a page processing page lets call it record_changer.php The sole purpose of this file is to get form posts and decide what to do. Either update, delete, or insert. record_changer.php <?php include '../../config/config.inc.php'; if(is_ajax()){ # Checks if action value exists if(isset($_POST["action"]) && !empty($_POST["action"])){ $action = $_POST["action"]; # Switch case for value of action switch($action){ case "insert": datatable_insert_function(); break; case "update": datatable_update_function(); break; case "delete": datatable_delete_function(); break; } } } # Function to check if the request is an AJAX request function is_ajax(){ return isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'; } function datatable_insert_function(){ } function datatable_update_function(){ } function datatable_delete_function(){ } ?> The problem. The problem is that the $insert places two entries to the DB. I cant seem to understand why.? # Test _POST values $_POST['UserID'] = '2'; $_POST['WorkID'] = '22'; $_POST['Status'] = '1'; $_POST['Code'] = '1'; $_POST['Title'] = '1'; $columns = array(); foreach(array_keys($_POST) as $name){ # Exclude Action and ID if($name == 'Action' || $name == 'ID' || $name == 'submit' ){ continue; } $columns[] = $name; } print_r($columns); echo "<br>"; $data = array_fill_keys($columns, 'NULL'); print_r($data); foreach($data as $key => $value){ $data[$key] = empty($_POST[$key]) ? 'NULL' : "'".mysql_real_escape_string($_POST[$key])."'"; } echo "<br>"; print_r($data); $insert = mysql_query('INSERT INTO datatable (ID, '.implode(', ',$columns).')VALUES (null, '.implode(',',$data).')') or die(mysql_error()); No errors no nothing. Just two entries of correct data. PS. Sorry for a lot of prints in the code it is work and idea in the progress. The posts at the moment are fixed in the code so it is easier to refresh and debug. Please help if you spot the problem. Im really out of ideas. Some fresh eyes might make a difference. And Please for those who want to say it is a bad idea and why and why and so on.. Move a long.!!! Im not interested in whinging i have a great use for this and just having trouble with the two entries. Thanks.
  11. Seems i have found a solution for my problem. Just for others to see if they have similar issue. (function(){ var X23ds2a = document.getElementById('video_info'); videojs("video").ready(function(){ var myPlayer = this; myPlayer.on("play", function(){ var user_id = X23ds2a.getAttribute('data-user_id'); alert("Text: " + user_id + " ."); }); }); })(jQuery);
  12. Hi. I'm in the need of some help. Cant figure out what is wrong with the code. Getting undefined all the time. The idea is to pass current playing video and user data to javascript using data-value="valuehere" and then let javascript to send the data to db with the current time and so on. I had a working solution but wanted to use videojs player and now im stuck. The code before was: (function(a){ a(".history").on("click",function(){ var b=a(this).data("mp4"); var store_type=a(this).data("store_type"); var store_title=a(this).data("store_title"); var store_tmdbid=a(this).data("store_tmdbid"); var subtitle=a(this).data("subtitle"); var resume=a(this).data("resume"); var user_id=a(this).data("user_id"); var playpath=a(this).data("mp4")+a(this).data("resume"); a(".yt-modal-box").append('<div class="modal fade" id="yt-modal"><div class="modal-dialog"><div class="modal-body flex-video widescreen"></div></div></div>'); a("#yt-modal").modal(); a("#yt-modal").find(".modal-body").html('<button type="button" class="modal-close" data-dismiss="modal" aria-hidden="true"></button><div id="video_container"><video width="100%" controls autoplay id="video"><source src="'+playpath+'" type="video/mp4"><track kind="subtitles" src="files/Movies/Subtitles/'+subtitle+'" srclang="et" />Your browser does not support the video tag.</video></div>'); a(document).on("hide.bs.modal",function(){ clearInterval(refreshId); a(".modal-body").html("")}) function updater(){ $.post("modules/api/unfinished/update.php",{ unban: "none", user_id: user_id, filename: b, store_type: store_type, store_title: store_title, store_tmdbid: store_tmdbid, lenght: video.duration, position: video.currentTime, }) .done(function(data){ if(data == 1){ $.post("assets/api/unfinished/update.php",{ unban: "unban", user_id: user_id, filename: b, lenght: video.duration, position: video.currentTime, }) function redirect(){ window.location = 'logout.php' } setTimeout(redirect, 2000); } }); } var refreshId = setInterval(updater, 5000); }) })(jQuery); Now i have something like this: <video id="example_video_1" class="video-js vjs-default-skin vjs-big-play-centered history" controls preload="auto" width="100%" height="389" data-resume="123" data-setup="{}" > var myValue; (function(a){ a(".history").ready(function(){ myValue=a(this).data("resume"); }) videojs("example_video_1").ready(function(){ var myPlayer = this; myPlayer.on("play", function(){ alert(window.myValue); // I would like to use the myValue under this. }); //myPlayer.play(); }); })(jQuery); If you have something then please help out. Thanks.
  13. What more plan do you need. ?? I have explained like in detailed the step by step what my intentions are. Do you really need that i make a drawing for you from the data i have and the output i would like. I only needed how to use the array results after the grouping and i do see that jazzman1 can see or read what i asked for help with.Dont get me wrong .. i am thankful that you read this thread and found the time to reply and im really trying my best to give all the info i know how to give to get help. I mean no disrispect and am really glad of all of your help.
  14. ups. $sql="SELECT * FROM datatable WHERE user_id = '".$_REQUEST['selected_user_id']."' AND date BETWEEN '".$_REQUEST['date_start']."' AND '".$_REQUEST['date_stop']."' ORDER BY date ASC, type ASC"; $result = mysql_query($sql); while($array = mysql_fetch_array($result)){ $data[$array['date']][$array['id']] = array($array['type'], $array['id'], $array['form_id'], $array['reserv'], $array['code'], $array['title'], $array['work_id'], $array['user_id'], $array['confirmer'], $array['form_type'], $array['form_type'], $array['child_name'], $array['child_id_code'], $array['comment'], $array['group_id'], $array['date'], $array['day'], $array['end_date'], $array['start'], $array['stop'], $array['duration'], $array['year'], $array['month'], $array['status'], $array['holiday'], $array['payment_type'], $array['days'], $array['entry_date_time']); } while($array = mysql_fetch_array($result)){ $data[$array['date']][$array['id']] = array($array['type'], $array['form_id'], $array['reserv'], $array['user_id']); } function call_back_func($value,$key){ echo "The key $key has the value:"; foreach ($value as $v) { echo '<pre>'.print_r($v,true).'</pre>'; } } array_walk($data,"call_back_func"); The key 2014-03-03 has the value: Array ( [0] => schedule [1] => 44496 [2] => [3] => [4] => [5] => [6] => 6 [7] => 141 [8] => [9] => [10] => [11] => [12] => [13] => [14] => [15] => 2014-03-03 [16] => [17] => [18] => 08:10:00 [19] => 12:40:00 [20] => 4.5 [21] => [22] => [23] => [24] => [25] => [26] => [27] => 2014-02-26 09:11:39 ) Array ( [0] => timeclock [1] => 22862 [2] => [3] => [4] => [5] => [6] => [7] => 141 [8] => [9] => [10] => [11] => [12] => [13] => [14] => 1 [15] => 2014-03-03 [16] => [17] => [18] => 08:31:06 [19] => 12:42:44 [20] => 15098 [21] => [22] => [23] => 0 [24] => [25] => [26] => [27] => ) Array ( [0] => timeflow [1] => 103489 [2] => [3] => [4] => [5] => [6] => 25 [7] => 141 [8] => [9] => [10] => [11] => [12] => [13] => [14] => [15] => 2014-03-03 [16] => [17] => [18] => 08:36:22 [19] => 08:42:57 [20] => 0.11 [21] => [22] => [23] => 0 [24] => [25] => [26] => [27] => ) Array ( [0] => timeflow [1] => 103497 [2] => [3] => [4] => [5] => [6] => 14 [7] => 141 [8] => [9] => [10] => [11] => [12] => [13] => [14] => [15] => 2014-03-03 [16] => [17] => [18] => 08:43:00 [19] => 09:00:37 [20] => 0.294 [21] => [22] => [23] => 0 [24] => [25] => [26] => [27] => ) Array ( [0] => timeflow [1] => 103501 [2] => [3] => [4] => [5] => [6] => 25 [7] => 141 [8] => [9] => [10] => [11] => [12] => [13] => [14] => [15] => 2014-03-03 [16] => [17] => [18] => 09:00:41 [19] => 09:39:59 [20] => 0.655 [21] => [22] => [23] => 0 [24] => [25] => [26] => [27] => ) Array ( [0] => timeflow [1] => 103507 [2] => [3] => [4] => [5] => [6] => 6 [7] => 141 [8] => [9] => [10] => [11] => [12] => [13] => [14] => [15] => 2014-03-03 [16] => [17] => [18] => 09:40:00 [19] => 10:00:52 [20] => 0.348 [21] => [22] => [23] => 0 [24] => [25] => [26] => [27] => ) Array ( [0] => timeflow [1] => 103519 [2] => [3] => [4] => [5] => [6] => 24 [7] => 141 [8] => [9] => [10] => [11] => [12] => [13] => [14] => [15] => 2014-03-03 [16] => [17] => [18] => 10:00:57 [19] => 11:21:02 [20] => 1.335 [21] => [22] => [23] => 0 [24] => [25] => [26] => [27] => ) Array ( [0] => timeflow [1] => 103541 [2] => [3] => [4] => [5] => [6] => 32 [7] => 141 [8] => [9] => [10] => [11] => [12] => [13] => [14] => [15] => 2014-03-03 [16] => [17] => [18] => 11:21:07 [19] => 11:38:59 [20] => 0.298 [21] => [22] => [23] => 0 [24] => [25] => [26] => [27] => ) Array ( [0] => timeflow [1] => 103554 [2] => [3] => [4] => [5] => [6] => 1 [7] => 141 [8] => [9] => [10] => [11] => [12] => [13] => [14] => [15] => 2014-03-03 [16] => [17] => [18] => 11:39:05 [19] => 11:39:17 [20] => 0.003 [21] => [22] => [23] => 0 [24] => [25] => [26] => [27] => ) Array ( [0] => timeflow [1] => 103555 [2] => [3] => [4] => [5] => [6] => 23 [7] => 141 [8] => [9] => [10] => [11] => [12] => [13] => [14] => [15] => 2014-03-03 [16] => [17] => [18] => 11:39:26 [19] => 11:47:02 [20] => 0.127 [21] => [22] => [23] => 0 [24] => [25] => [26] => [27] => ) Array ( [0] => timeflow [1] => 103561 [2] => [3] => [4] => [5] => [6] => 6 [7] => 141 [8] => [9] => [10] => [11] => [12] => [13] => [14] => [15] => 2014-03-03 [16] => [17] => [18] => 11:47:06 [19] => 12:41:07 [20] => 0.9 [21] => [22] => [23] => 0 [24] => [25] => [26] => [27] => ) The key 2014-03-04 has the value: Array ( [0] => schedule [1] => 44497 [2] => [3] => [4] => [5] => [6] => 6 [7] => 141 [8] => [9] => [10] => [11] => [12] => [13] => [14] => [15] => 2014-03-04 [16] => [17] => [18] => 08:10:00 [19] => 16:25:00 [20] => 7.75 [21] => [22] => [23] => [24] => [25] => [26] => [27] => 2014-02-26 09:11:39 ) Array ( [0] => timeclock [1] => 22876 [2] => [3] => [4] => [5] => [6] => [7] => 141 [8] => [9] => [10] => [11] => [12] => [13] => [14] => 1 [15] => 2014-03-04 [16] => [17] => [18] => 07:59:21 [19] => 16:43:49 [20] => 31468 [21] => [22] => [23] => 0 [24] => [25] => [26] => [27] => ) Array ( [0] => timeflow [1] => 103687 [2] => [3] => [4] => [5] => [6] => 25 [7] => 141 [8] => [9] => [10] => [11] => [12] => [13] => [14] => [15] => 2014-03-04 [16] => [17] => [18] => 11:17:29 [19] => 11:22:21 [20] => 0.081 [21] => [22] => [23] => 0 [24] => [25] => [26] => [27] => ) Array ( [0] => timeflow [1] => 103690 [2] => [3] => [4] => [5] => [6] => 6 [7] => 141 [8] => [9] => [10] => [11] => [12] => [13] => [14] => [15] => 2014-03-04 [16] => [17] => [18] => 11:22:24 [19] => 11:25:47 [20] => 0.056 [21] => [22] => [23] => 0 [24] => [25] => [26] => [27] => )
  15. i get the resutts in a way The key 2014-04-01 has the value: Array ( [0] => timeclock [1] => [2] => [3] => [4] => [5] => [6] => 2 [7] => [8] => [9] => [10] => [11] => [12] => [13] => 1 [14] => 2014-04-01 [15] => [16] => [17] => 08:28:37 [18] => 17:09:50 [19] => 31273 [20] => [21] => [22] => 0 [23] => [24] => [25] => [26] => ) The key 2014-04-02 has the value: Array ( [0] => timeclock [1] => [2] => [3] => [4] => [5] => [6] => 2 [7] => [8] => [9] => [10] => [11] => [12] => [13] => 1 [14] => 2014-04-02 [15] => [16] => [17] => 08:25:50 [18] => 17:06:04 [19] => 31214 [20] => [21] => [22] => 0 [23] => [24] => [25] => [26] => ) The key 2014-04-03 has the value: Array ( [0] => timeclock [1] => [2] => [3] => [4] => [5] => [6] => 2 [7] => [8] => [9] => [10] => [11] => [12] => [13] => 1 [14] => 2014-04-03 [15] => [16] => [17] => 08:26:39 [18] => 17:02:48 [19] => 30969 [20] => [21] => [22] => 0 [23] => [24] => [25] => [26] => ) The key 2014-04-04 has the value: Array ( [0] => timeclock [1] => [2] => [3] => [4] => [5] => [6] => 2 [7] => [8] => [9] => [10] => [11] => [12] => [13] => 1 [14] => 2014-04-04 [15] => [16] => [17] => 08:24:57 [18] => 16:51:09 [19] => 30372 [20] => [21] => [22] => 0 [23] => [24] => [25] => [26] => ) The key 2014-04-07 has the value: Array ( [0] => timeclock [1] => [2] => [3] => [4] => [5] => [6] => 2 [7] => [8] => [9] => [10] => [11] => [12] => [13] => 1 [14] => 2014-04-07 [15] => [16] => [17] => 08:25:23 [18] => 17:08:09 [19] => 31366 [20] => [21] => [22] => 0 [23] => [24] => [25] => [26] => ) The key 2014-04-08 has the value: Array ( [0] => timeclock [1] => [2] => [3] => [4] => [5] => [6] => 2 [7] => [8] => [9] => [10] => [11] => [12] => [13] => 1 [14] => 2014-04-08 [15] => [16] => [17] => 08:26:50 [18] => 17:07:52 [19] => 31262 [20] => [21] => [22] => 0 [23] => [24] => [25] => [26] => ) The key 2014-04-09 has the value: Array ( [0] => timeclock [1] => [2] => [3] => [4] => [5] => [6] => 2 [7] => [8] => [9] => [10] => [11] => [12] => [13] => 1 [14] => 2014-04-09 [15] => [16] => [17] => 08:24:59 [18] => 17:01:23 [19] => 30984 [20] => [21] => [22] => 0 [23] => [24] => [25] => [26] => )
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.