Jump to content

jac.kock

Members
  • Posts

    52
  • Joined

  • Last visited

Everything posted by jac.kock

  1. Can some help me with this problem??? thnx all
  2. oke thnx i see what you mean now, but how do i call this function and how do i make this function universial to call and set 1. timers 2. file to load 3. div name to refresh? thnx alot already:)
  3. oke that i find logical, however i dont understand ajax and jquery very wel i understand it a bit im a newbee about those languages :| can you write the proper code for this and i understan wath you mean with the timer problems and thats no issue because the most times a div wil be refreshed is not at the same time's some take 30 sec some 5 min ect. thnx for your fine answer and i'll hope that you will help me with the code!
  4. hi, so it is 2014 and this solves my problem, this is youre help??? I said i 'm not very good or good with this! so please explain how i gonna solve this with 'Jquery' or how to implement this in the file? all i need is one simple function to call trough out the website formthe div's i want to refresh and set a different refresh rate (seconds) to them!! so please help me if tryed to change it for weeks and i can seem to get i right! thnx
  5. hi all, i'm not very good whit AJAX and i cant seem to get it to work properly i have a ajax script that i use in my website and it works fine for one div to refresh, i want to edit the script so i can use it for more div's to refresh so i need to make it ready to more than 1 instance of the script. now i have edit the script and now the both div's ( more in the future) refresh every second and not at the specified time's i included both the original and edit script! Can some please help me to get it to work? PHP to call the script: <?php ?> <style type="text/css"> .head-tr { border-color: #FF2A2A; } .head-td { border-width: 7px; border-style: outset; border-color: #FF2A2A; } </style> <table width="200"> <tr> <td valign="top" align="top" bgcolor="#BE1F1F"> <script type="text/javascript"><!-- // orginal script call refreshdiv(); // --> </script> <div id="shownews"></div> </td> </tr> </table> <table width="200"> <tr> <td valign="top" align="top" bgcolor="#BE1F1F"> <script type="text/javascript"><!-- // edited script call refreshdiv(30,'mynews','table.php'); // --> </script> <div id="mynews"></div> </td> </tr> </table>  Script orginal: // Customise those settings var seconds = 30; var divid = "shownews"; var url = "table.php"; //////////////////////////////// // // Refreshing the DIV // //////////////////////////////// function refreshdiv(){ // The XMLHttpRequest object var xmlHttp; try{ xmlHttp=new XMLHttpRequest(); // Firefox, Opera 8.0+, Safari } catch (e){ try{ xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); // Internet Explorer } catch (e){ try{ xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ alert("Your browser does not support AJAX."); return false; } } } // Timestamp for preventing IE caching the GET request fetch_unix_timestamp = function() { return parseInt(new Date().getTime().toString().substring(0, 10)) } var timestamp = fetch_unix_timestamp(); var nocacheurl = url+"?t="+timestamp; // The code... xmlHttp.onreadystatechange=function(){ if(xmlHttp.readyState==4){ document.getElementById(divid).innerHTML=xmlHttp.responseText; setTimeout('refreshdiv()',seconds*1000); } } xmlHttp.open("GET",nocacheurl,true); xmlHttp.send(null); } // Start the refreshing process var seconds; window.onload = function startrefresh(){ setTimeout('refreshdiv()',seconds*1000); } Script edited: // Customise those settings //////////////////////////////// // // Refreshing the DIV // //////////////////////////////// function refreshdiv(mysec,mydiv,myurl){ var seconds = mysec; var divid = mydiv; var url = myurl; // The XMLHttpRequest object var xmlHttp; try{ xmlHttp=new XMLHttpRequest(); // Firefox, Opera 8.0+, Safari } catch (e){ try{ xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); // Internet Explorer } catch (e){ try{ xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ alert("Your browser does not support AJAX."); return false; } } } // Timestamp for preventing IE caching the GET request fetch_unix_timestamp = function() { return parseInt(new Date().getTime().toString().substring(0, 10)) } var timestamp = fetch_unix_timestamp(); var nocacheurl = url+"?t="+timestamp; // The code... xmlHttp.onreadystatechange=function(){ if(xmlHttp.readyState==4){ document.getElementById(divid).innerHTML=xmlHttp.responseText; setTimeout(refreshdiv(mysec,mydiv,myurl),seconds*1000); } } xmlHttp.open("GET",nocacheurl,true); xmlHttp.send(null); } // Start the refreshing process var seconds; window.onload = function startrefresh(){ setTimeout(refreshdiv(mysec,mydiv,myurl),seconds*1000); } PHP witch shows the page: <?php if(file_exists("../../support/connect.dat")) // user,pass and database file { include("../../support/connect.dat"); // database connection file } //################ connect to database ############## $link=mysql_connect($host, $user, $pass) or die(mysql_error()); mysql_select_db($data); $res=''; $res1=''; $sql="Select * from headlights where delete_tab='0' ORDER BY RAND() LIMIT 1"; // get only the none deleted! $res1=mysql_query($sql); $res=mysql_fetch_array($res1); $hltxt=$res["krant_item"]; if($hltxt=='') { $hltxt="Geen nieuws items gevonden."; } ?> <!-- show the selected one --> <table width="100%"> <tr> <td class="head-td" valign="top" align="top" bgcolor="#FF2A2A"> <font color="white" size="6px">Nieuws:</font> </td> </tr> <tr> <td class="head-td" height="150px" valign="top" align="top"> <font color="white"><? echo $hltxt; // show the none deleted item?></font> </td> </tr> </table> thnx all!
  6. hi all, i have on my site a style that creates a button like style from the TR and TD butt, now after the update from IE 9 tot 11 i only see a black border and not the raised gray whit border i used to see? this is my css style used in the index can someone help me to get it working agian? <style type="text/css"> .button-tr { border-width: 3px; border-style: outset; border-collapse: collapse; } .button-td { border-width: medium; border-style: outset; } </style> thanx all
  7. hi all, I have a opensource wysiwyg editor on my site for posting messages and making pages, i work with IE and i noticed that the java script wont work in Google Chrome! I have tryed to look at it but its to complex for me i hope that there is someone how can and will help me to make the script compatible with Chrome. I have attached the file that is yhe core of the editor if anyone needs more i will make it avalible. thanx all. wysiwyg.js.txt
  8. thnx all i get a reding so i can continu
  9. hi, i want to use 1 form for more options so i have named them differant. I wnat to review the POST to see witch action must be taken there exp: if del then del_user if add then add_user if abuse then abuse_report do you know what i mean? can you help me to get the right steps?
  10. how can help me to get the post in my code i been try'ng for days:( my code: <?php if($_POST['Submit']) { echo "Submit here"; } if($_POST['del']) { echo "del here"; } if($_POST['add']) { echo "add here"; } ?> <table width="100%" align="top" border="1"> <tr> <td align="top" valign="top"> <!-- START: profile photo and options --> <table width="100%"> <tr> <td align="center" valign="center"> <img src="upload/users/<?=$x['user_photo'];?>" width="140px" height="187px" alt="<?=$x['user_name'];?>" /> </td> </tr> <tr> <td align="top" valign="left"> <form name="proinfo" action="?<?=$_SERVER['QUERY_STRING'];?>" method="post" enctype="multipart/form-data"> <input type="hidden" id="abuseid" name="abuseid" value="<?=$x['user_id'];?>"/> <input type="hidden" id="fromid" name="fromid" value="<?=$log['user_id'];?>"/> <input name="abuse" type="image" id="abuse" value="Submit" src="modules/community/abuse.png" alt="" width="20" height="20" border="0" align="absmiddle"> report<br /> <input name="add" type="image" id="add" value="add" src="modules/community/abuse.png" alt="" width="20" height="20" border="0" align="absmiddle"> add<br /> <input name="del" type="image" id="del" value="del" src="modules/community/abuse.png" alt="" width="20" height="20" border="0" align="absmiddle"> del<br /> </form> </td> </tr> </table> <!-- END: profile photo and options --> </td> </tr> </table> i can't seem to get the post what am i doing wrong? pls help
  11. like this jessica? <?php if(file_exists("../../support/connect.dat")) // user,pass and database file { include("../../support/connect.dat"); // database connection file } //################ connect to database ############## $link=mysql_connect($host, $user, $pass) or die(mysql_error()); mysql_select_db($data); $sql="Select * from headlights where delete_tab='0' ORDER BY RAND()"; // get only the none deleted! $res1=mysql_query($sql); $res=mysql_fetch_array($res1); ?> <!-- show the selected one --> <table width="100%"> <tr> <td class="head-td" height="150px" valign="top" align="top"> <? echo $res["krant_item"]; // show the none deleted item?> </td> </tr> </table> or is this the wrong way? thnx jassica
  12. oke i get what you mean but i have no idea how to do this will you edit my code to what youre saying? thnx jessica!
  13. what i mean is i want to display 0ne and not all of the none deleted ones!!! thats why i use rnd how can i show only the selected one by rnd?
  14. type of delete_tab = int(1) so it state 1 or 0, 1 = deleted! i want to kown the proper code to solve this, sorry for my bad english please edit my code so it will work jessica!?? thnx
  15. hi jessica, i have tryed everything i could think off and i dont know anymore! gan you please show me how to solf this please?? thnx jessica
  16. hi all, i have a headlights table where only the items that arrend deleted should be displayed, but it shows also the deleted items! i know that im doing something wrong but i can seem to figure out what my code : <?php if(file_exists("../../support/connect.dat")) // user,pass and database file { include("../../support/connect.dat"); // database connection file } //################ connect to database ############## $link=mysql_connect($host, $user, $pass) or die(mysql_error()); mysql_select_db($data); $sql="Select * from headlights where delete_tab='0'"; // get only the none deleted! $res1=mysql_query($sql); $row=mysql_num_rows($res1); $item=rand('1',$row); // have multiple rows so random because every time the same is boring $sql="Select * from headlights where krant_id='$item'"; // select the none deleted $res=mysql_query($sql); $resl=mysql_fetch_array($res); ?> <!-- show the selected one --> <table width="100%"> <tr> <td class="head-td" height="150px" valign="top" align="top"> <? echo $resl["krant_item"]; // show the none deleted item?> </td> </tr> </table> can someone say how to fix this ??? thnx,
  17. i dont need ugg only help with this problem please can someone help me???????
  18. hello all, im a newbee with ajax and i have a simple function to refresh an information block on my site. when the page loads it gets the string from de sql_db and displays it correctly, however when i wait to refresh i see that only the (debug) time stamp gets refreshed and the string stays the same even after 1 houre the codes and places i submit hopely someone can get me on the right path to continu this project of mine code voor de head section: <?php ?> <!-- before the </head> --> <script type="text/javascript"> function loadXmlHttp(url, id) { var f = this; if (loadXmlHttp.xmlHttp){ f.xmlHttp = loadXmlHttp.xmlHttp(); f.el = document.getElementById(id); f.xmlHttp.open("GET", url, true); f.xmlHttp.onreadystatechange = function(){f.stateChanged();}; f.xmlHttp.send(null); } else alert('Your browser does not support AJAX!'); // substitute your desired request object unsupported code here } loadXmlHttp.xmlHttp = null; loadXmlHttp.re = /^http/.test(window.location.href); /*@cc_on @*/ // used here and below, limits try/catch to those IE browsers that both benefit from and support it /*@if(@_jscript_version >= 5) // prevents errors in old browsers that barf on try/catch & problems in IE if Active X disabled try {loadXmlHttp.ie = window.ActiveXObject}catch(e){}; @end @*/ if (window.XMLHttpRequest && (!loadXmlHttp.ie || loadXmlHttp.re)) loadXmlHttp.xmlHttp = function(){return new XMLHttpRequest();}; // Firefox, Opera 8.0+, Safari, others, IE 7+ when live - this is the standard method else if (/(object)|(function)/.test(typeof createRequest)) loadXmlHttp.xmlHttp = createRequest; // ICEBrowser, perhaps others else { loadXmlHttp.xmlHttp = null; // Internet Explorer 5 to 6, includes IE 7+ when local // /*@if(@_jscript_version >= 5) try{loadXmlHttp.xmlHttp = function(){return new ActiveXObject("Msxml2.XMLHTTP");};} catch(e){try{loadXmlHttp.xmlHttp = function(){return new ActiveXObject("Microsoft.XMLHTTP");};}catch(e){}} @end @*/ } loadXmlHttp.prototype.stateChanged = function(){ if (this.xmlHttp.readyState == 4 && (this.xmlHttp.status == 200 || !loadXmlHttp.re)){ this.el.innerHTML = this.xmlHttp.responseText; if(this.success){ this.success(); } } } </script> the code in the page to call ajax to display and set auto refresh: <style type="text/css"> .head-tr { border-color: #FF2A2A; } .head-td { border-width: 7px; border-style: outset; border-color: #FF2A2A; } </style> <table width="100%"> <tr> <td valign="top" align="top"> <div id="headlights"></div> <script type="text/javascript"> (function(){ var statsrequest = new loadXmlHttp('modules/headlights/table.php?item=<? echo get_krant(); ?>&stamp=' + new Date().getTime(), 'headlights'), repeat = arguments.callee; statsrequest.success = function(){setTimeout(repeat, 10000);}; /* refresh after 30 sec. */ })(); </script> </td> </tr> </table> the code of the table.php file: <table width="100%"> <tr> <td class="head-td" height="150px" valign="top" align="top"> <!-- start debug to see if we get something THIS REFRESH WELL OTHER NOT --> <i>[ <?=$_GET['stamp'];?> ]</i><br> <!-- end debug to see if we get something --> <?=$_GET['item'];?> </td> </tr> </table> and finaly the code of the function get_krant() <?php function get_krant() { $res=""; $res1=""; $row=""; $item=""; $resl=""; $sql="Select * from headlights where delete_tab='0'"; $res1=mysql_query($sql); $row=mysql_num_rows($res1); $item=rand('1',$row); $sql="Select * from headlights where krant_id='$item'"; $res=mysql_query($sql); $resl=mysql_fetch_array($res); return $resl["krant_item"]; } ?> i hope that someone can tell me what im doing wrong :| thnx all,
  19. thanx but can you give it like a code because i cant to seem to get it right it will help me to understand where i go wrong thnx jessica,
  20. hi all, i want to know how to calculate the percentage for each total but i looked around and i cant seem to find it. lets say i have a bar which is 100% and i want to show in the bar someting like this: value 1 = 19 value 2 = 33 value 3 = 12 value 4 = 5 value 5 = 129 i want for each of the value's a percentage which add's up to 100 % like: value 1 = 6% value 2 = 18% value 3 = 4% value 4 = 1% value 5 = 71% can someone help me to calculate this ??? thnx in advance,
  21. hello people, I need some help with my code, i made a form to display all files in a folder and de files in the subfolder(S) of teh main folder! I can get the file name from the query and de full path of the query but i can't seem to get the folder and subfolder path from this query My code of the file : <?php /* Copyright by j.kock, pc-hulp-online info@pc-hulp-online.nl http://www.pc-hulp-online.nl */ ?> <script language="javascript"> function check() { if(document.XXXXXXX.XXXXXXX.value=="") { alert("Leeg veld niet toegestaan"); return; } else { this.edit_user.submit(); } } </script> <?php if($_POST['Submit']) { } ?> <table align="center" width="98%"> <tr> <th></th> </tr> <tr> <th align="center" class="text">Verwijderen upload bestanden</th> </tr> <tr> <th><hr /></th> </tr> <?php if($_POST['Submit']) { if($res) { echo '<tr><th align="center">Succesvol geüpdate</th></tr>'; } else { echo '<tr><th align="center">Error updating</th></tr>'; } } ?> <tr> <td> <form name="del_upload" action="?admin=del_upload" method="post" enctype="multipart/form-data"> <table width="100%" align="center"> <tr> <td width="25%" align="left" bgcolor="#007FFF"> bestand: </td> <td width="25%" align="left" bgcolor="#007FFF"> Folder: </td> <td width="50%" align="left" bgcolor="#007FFF"> Verwijder: </td> </tr> <?php /** * Get an array that represents directory tree * @param string $directory Directory path * @param bool $recursive Include sub directories * @param bool $listDirs Include directories on listing * @param bool $listFiles Include files on listing * @param regex $exclude Exclude paths that matches this regex */ function directoryToArray($directory, $recursive = true, $listDirs = false, $listFiles = true, $exclude = '') { $arrayItems = array(); $skipByExclude = false; $handle = opendir($directory); if ($handle) { while (false !== ($file = readdir($handle))) { preg_match("/(^(([\.]){1,2})$|(\.(svn|git|md))|(Thumbs\.db|\.DS_STORE))$/iu", $file, $skip); if($exclude){ preg_match($exclude, $file, $skipByExclude); } if (!$skip && !$skipByExclude) { if (is_dir($directory. DIRECTORY_SEPARATOR . $file)) { if($recursive) { $arrayItems = array_merge($arrayItems, directoryToArray($directory. DIRECTORY_SEPARATOR . $file, $recursive, $listDirs, $listFiles, $exclude)); } if($listDirs){ $file = $directory . DIRECTORY_SEPARATOR . $file; $arrayItems[] = $file; } } else { if($listFiles){ $file = $directory . DIRECTORY_SEPARATOR . $file; $arrayItems[] = $file; } } } } closedir($handle); } return $arrayItems; } $dirs=directoryToArray("upload"); for($dd = 0; $dirs[$dd] <> ""; $dd++) { $uploadfile1=explode(DIRECTORY_SEPARATOR,$dirs[$dd]); $count=count($uploadfile1); $path=""; $cd=0; for($cd > $count; $uploadfile1[$cd]; $cd++) { $path=$path.$uploadfile1[$cd]."/"; } $file=$uploadfile1[count($uploadfile1)-1]; ?> <tr> <td width="25%" align="left"> <? echo $file; ?> </td> <td width="25%" align="left"> <? echo $path; ?> </td> <td width="50%" align="left"> <? echo $dirs[$dd]; ?> </td> </tr> <? } ?> <tr> <td colspan="3" align="center"> <!--<input type="submit" name="Submit" value="Opslaan" >--> <!--<input type="submit" name="Submit" value="Opslaan" onclick="check();">--> </td> </tr> </table> </form> </td> </tr> </table> the output looks like this: bestand: Folder: Verwijder: no_avatar.gif upload/users/no_avatar.gif/ upload/users/no_avatar.gif Picture 4.jpg upload/users/Picture 4.jpg/ upload/users/Picture 4.jpg eula.txt upload/eula.txt/ upload/eula.txt README.txt upload/README.txt/ upload/README.txt tmp.txt upload/tmp.txt/ upload/tmp.txt blank.txt upload/blank.txt/ upload/blank.txt empty.txt upload/empty.txt/ upload/empty.txt intro.txt upload/intro.txt/ upload/intro.txt nope.jpg upload/images/category_images/nope.jpg/ upload/images/category_images/nope.jpg nope.jpg upload/images/product_images/nope.jpg/ upload/images/product_images/nope.jpg add_menu.php upload/images/product_images/admin/add_menu.php/ upload/images/product_images/admin/add_menu.php add_page.php upload/images/product_images/admin/add_page.php/ upload/images/product_images/admin/add_page.php add_submenu.php upload/images/product_images/admin/add_submenu.php/ upload/images/product_images/admin/add_submenu.php add_upload.php upload/images/product_images/admin/add_upload.php/ upload/images/product_images/admin/add_upload.php clients.php upload/images/product_images/admin/clients.php/ upload/images/product_images/admin/clients.php del_menu.php upload/images/product_images/admin/del_menu.php/ upload/images/product_images/admin/del_menu.php del_page.php upload/images/product_images/admin/del_page.php/ upload/images/product_images/admin/del_page.php del_submenu.php upload/images/product_images/admin/del_submenu.php/ upload/images/product_images/admin/del_submenu.php i want that in the 2e col it shows the path like: upload/images/category_images/ can someone tell me what i'm doing wrong? thnx all,
  22. hi all, for my website i want to make a module and to prevent that error's i want to define some value's butt when i start my site the error is: undefined variable: module_one in..... so i don't know what im doing wrong this is my code where i need help with: $module='statistics';[/size][/font][/color] [color=#000000][font=Arial, Courier, serif, sans-serif][size=1]$array =array("one" = > "first value", "two" => "2nd value", "three" => "8" );[/size][/font][/color] [color=#000000][font=Arial, Courier, serif, sans-serif][size=1]extract( $array, EXTR_PREFIX_ALL, $module."_" );[/size][/font][/color] [color=#000000][font=Arial, Courier, serif, sans-serif][size=1]echo "module = ".$module_one;[/size][/font][/color] [color=#000000][font=Arial, Courier, serif, sans-serif][size=1] can somebody help me so i can make a nice module? thnx
×
×
  • 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.