Jump to content

acctman

Members
  • Posts

    582
  • Joined

  • Last visited

Everything posted by acctman

  1. can unlink be used with a wildcard to delete a file? ie. unlink ("/200_*.jpg"); The files i'm deleting will always start and end with 200_ and .jpg
  2. thanks for all the advice... with the help of find and replace i changed all code to run off of one function.
  3. Why would you define two functions that did the same thing? That makes no sense at all. i have a script of function that is used on multiple site. to avoid conflicts and going through multiple files renaming functions I thought it would just be easier to have a function with multiple names
  4. is it possible to set multiple names for a function? something like this... would that work? or does each function have to be separate function test1($blah), test2($blah) { do something } [/php
  5. i'm using the following two functions to delete all directories and to delete a single file. Can someone assist me with a function that will search all subdirectories for a specific file then delete it? function usr_del_dir($usrdir) { if (is_dir($usrdir)) $dir_handle = opendir($usrdir); if (!$dir_handle) return false; while($file = readdir($dir_handle)) { if ($file != "." && $file != "..") { if (!is_dir($usrdir."/".$file)) @unlink($usrdir."/".$file); else usr_del_dir($usrdir.'/'.$file); } } closedir($dir_handle); rmdir($usrdir); return true; } function usr_del_file($usrfile) { if(is_file($usrfile)) { @unlink($usrfile); } }
  6. this is a great easy to follow example : http://www.captain.at/howto-ajax-form-post-get.php
  7. i'll just keep searching for examples. i honestly do not want to spend to much time on this. i just wanted at add a quick lookup feature. not worth buying books or spending hours learning js. thanks though... i'll do some more search real quick.
  8. i have this ajax.js script is this the same? also do you know of a complete example i can look at... this is a lot more complex than i thought. I'm not thats good with js so a lot of this is foreign // here we define global variable var ajaxdestination=""; function getdata(what,where) { // get data from source (what) try { xmlhttp = window.XMLHttpRequest?new XMLHttpRequest(): new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { /* do nothing */ } document.getElementById(where).innerHTML ="<center><img src='/simgs/ajax-loader.gif'></center>"; // we are defining the destination DIV id, must be stored in global variable (ajaxdestination) ajaxdestination=where; xmlhttp.onreadystatechange = triggered; // when request finished, call the function to put result to destination DIV xmlhttp.open("GET", what); xmlhttp.send(null); return false; } function triggered() { // put data returned by requested URL to selected DIV if (xmlhttp.readyState == 4) if (xmlhttp.status == 200) document.getElementById(ajaxdestination).innerHTML =xmlhttp.responseText; } [code]
  9. when the page loads the test example that i have set in csearch.php appears perfectly. Now i want to attach csearch.php to a form submit and have the results appear in the "chub" div id. what do i need to do to make this happen. <form method=post enctype="multipart/form-data" name="clookup" id="form" action="hub/csearch.php"> <input id="look" size="20" type="text"> <input type="submit" name="submit" value="submit" /> </form> <!-- results --> <script type="text/javascript" src="/js/ajax.js"></script> <div id="chub" style="width:260px;height:182px;margin-left:35px;"></div> <script>getdata(/csearch.php','chub');</script> <!--/results -->
  10. $ = function(e) {return document.getElementById(e);}; should be $(e) {return document.getElementById(e);};
  11. The two scripts below are have a conflict with each other. Script 1 is generating an error in script 2. If i remove script 1 everything works fine in script2. Script 2 is more important that script1 which just display a headline every fee seconds. is there anything i can do to fix script 1 and stop it for throwing an error This script which is not related to another scriipt is causing an error. Script 1 <input id="foo" size="60" type="text"> <script type="text/javascript"> $ = function(e) {return document.getElementById(e);}; var display = function(el) { var msg = [ "Test1.", "Test2.", "No Advertising of other Sites."], e = $(el), c = "count", timer = 6500; if (typeof e[c] == "undefined") { e[c] = -1; }; if (e[c] > msg.length-2) { e[c] = 0; } else { ++e[c]; }; e["value"] = msg[e[c]]; var t = setTimeout(function() {display(el);}, timer); }; display("foo"); </script> 'null' is null not an object Line2 Char2 Script 2 $(document).ready(function() { $("#open").click(function(){ $("div#panel").slideDown("slow"); return false; }); // Collapse Panel $("#close").click(function(){ $("div#panel").slideUp("slow"); return false; }); $("#toggle a").click(function () { $("#toggle a").toggle(); }); });
  12. can anyone assist me with info on how to create a ajax search where the result are show on the same page without refreshing?
  13. thanks for helping me out again. you really know your stuff.
  14. the 'delnewguy' button is an actually onSet/ajax type button... where its not submiting the FORM but if its clicks it sets the value for 'delnewguy' so when the FORM submit button is click its processes 'delnewguy'
  15. would !isset($_POST['delnewguy']) tell me if $_POST['delnewguy'] was not clicked? or will it be set regard if its clicked or not since it apart of the form if ($prev[$status] == 0 && (!isset($_POST['delnewguy']))) {
  16. how do i fix this error Syntax error unexpected '' expecting & or T_Variable function drop_player ( video, drop_location ) { player_html = '<embed style="margin: 5px;" id="flash_player" src="/flvplayer.swf" width="<?php=$video_width;?>" height="<?php=$video_height;?>" allowfullscreen="true" flashvars="&file='+video+'&height=<?php=$video_height;?>&width=<?php=$video_width;?>&location=/flvplayer.swf"" /></embed>'; $(drop_location).innerHTML = player_html; }
  17. thanks, you solved my problem again =)
  18. i'm trying to do a one like IF statement combining to functions... but i'm getting an unexpected ; error. if (file_exists(unlink($imgpath . date("Y", $en['m_date']) . '/' . date("m", $en['m_date']) . '/' . $en['m_id'] . "/tmb/" . $filename));
  19. sorry about that, i thought i typed in the HTML /HTML ... add[pass] is for my php post script, its part of an array some fields are set with edit[city] it just helps separate the post entries
  20. I've been trying to get this code below to work but it seems to display the message box regardless if the passwords are the same or now. <input type=password id='pass' name=add[pass] size=20 /> <input type=password id='pass_confirm' name='pass_confirm' size=20 onblur="return checkPasswords()"/> <script language="javascript"> function checkPasswords() { passone = document.getElementById('pass'); passtwo = document.getElementById('pass_confirm'); if (passone.value != passtwo.value) { alert("Password & Confirm Password must match.") } } </script>
  21. thanks that worked perfectly
  22. i have a mysql field that is format for DATE 0000-00-00 i was using the code below to added the date but it's not inserting error: Fatal error: Call to undefined function: curdate() mysql_query("INSERT INTO rate_referrals (ref_by,ref_mem,ref_set,ref_status,ref_date) VALUES ({$row['m_id']},'$id','$points',0,'".CURDATE()."')");
  23. hi i'm trying to reverse the order of the output, its displaying 1930 -> 1991 in the selectbox. i'd like would like to have the output display from 1991 -> 1930 <?php for ($k = 1930; $k <= (date("Y") - 18); $k++) echo '<option value='.$k.'>'.$k.'</option>'; ?>
  24. Yes, if you want your system to enforce a change in the user's status (suspended/banned...) on any page request. Would that cause much stress on the server doing that though even if there's a few hundred people on at once. actually surprisingly it doesn't... sql queries are exteremly fast depending on how they're written and if you're not doing a wildcard of everything. i've done queries of over 10,000+ records and it only takes .5secs or less.. so no worries
×
×
  • 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.