Jump to content

ToonMariner

Members
  • Posts

    3,342
  • Joined

  • Last visited

Everything posted by ToonMariner

  1. you are limited on the size of files you can upload via this method. Have a look for a script to upload large files on google
  2. You said it won't upload a 150k file? then you say it will upload a 1M file but not a 20M file? If that is true you have answered your own question!!!!!
  3. what message does your script put out? does it say successful but no file is there or does it say file is too big?
  4. why not get rid of the external div - its not really needed in the html.. just set the border to border: 3px double #f00;
  5. if you are sending html format I always use 640 width - don't ask me why I just do but there is no 'standard' as far as I am aware.
  6. what is on line 7? plus yous should create the resource handle... have $conn = mysql_connect($host,$dbuser,$dbpass) or die(mysql_error()); // Select the database. $db = mysql_select_db($dbname) or die(mysql_error());
  7. Yeah I know but I just like standards - if the doctype is strict then I think just CHECKED will fail!
  8. make sure that the file you are trying to upload is not bigger than the max file size allowed in the php.ini file (default is 8M i believe) If it is then you either have to change the setting or use ftp protocols.
  9. make sure the path to the file in your include statment is correct
  10. ???? you are checking in your 1st connect script for a connection that isn't established until you leave the connect script! stick mysql_connect($host,$dbuser,$dbpass) or die(mysql_error()); // Select the database. mysql_select_db($dbname) or die(mysql_error()); straight after $host  = "localhost"; $dbuser = "my user name to db is here"; $dbpass = "this is where i have typed my pass"; $dbname = "my db name is here"; or die("Could not connect."); in your connect script
  11. ok have a look at your source... Is CHECKED being echoed out? If not then there is something amiss in the code if it IS then... swap echo " CHECKED" for echo " checked=\"checked\""; and DO make sure the input tag is closed
  12. the " on the end of the line in your while loop!!!!! delete it.
  13. OK... the ajax controller.... [code] function GetXmlHttpObject(handler) { var objXmlHttp=null if (navigator.userAgent.indexOf("MSIE")>=0) { var strName="Msxml2.XMLHTTP" if (navigator.appVersion.indexOf("MSIE 5.5")>=0) { strName="Microsoft.XMLHTTP" } try { objXmlHttp=new ActiveXObject(strName) objXmlHttp.onreadystatechange=handler return objXmlHttp } catch(e) { alert("Error. Scripting for ActiveX might be disabled") return } } if (navigator.userAgent.indexOf("Mozilla")>=0) { objXmlHttp=new XMLHttpRequest() objXmlHttp.onload=handler objXmlHttp.onerror=handler return objXmlHttp } }[/code] I have this in its own .js file and include it on every page driven by ajax..... In this eaxmple I have a select group like so [code] <div id="sections"> <select name="cat" id="cat" onChange="getInfo(this.value,'cat');"> <option value="0"></option> <option value="1">Sec 1</option> <option value="2">Sec 1</option> </select> </div> [/code] Ok the call.... When that selectbox changes the getInfo function is called.. [code] function getInfo(sec,id) { var url= "/admin/includes/ajax/ssscripts/sections.php?sec=" + sec + "&id=" + id; xmlHttp=GetXmlHttpObject(getInfoDone); xmlHttp.open("GET", url , true); xmlHttp.send(null); } [/code] This calls a script (located at the specified url) and passes the parameters to it for processing. Now ajax handles what the script prints out. So the php scritp selects all the sub categories of that cat and generates a single string that can be split by js one it is returned... Now the php is from My own script so you will have to modify accordingly... [code] <?php require_once($_SERVER['DOCUMENT_ROOT'] . '/admin/includes/config/cmsconfig.php'); require_once($_SERVER['DOCUMENT_ROOT'] . '/admin/connection/dbcon.php'); function getSecs () { $qry = " SELECT * FROM `section_management` ORDER BY `table_driver` ASC, `section_root` ASC, `section_par` ASC, `section_title` ASC "; $qry = mysql_query($qry); $secarr = array(); while ($row = mysql_fetch_assoc($qry)) { foreach ($row as $key => $val) { $secarr[$key][] = $val; } } return $secarr; } $action = $_GET['action']; if ( !isset ( $_GET['sec'] ) ) { exit(); } $id = $_GET['id']; $secarr = getSecs(); $sec = $_GET['sec']; $secstring = NULL; if ( $sec > 0 ) { $nextsec = $sec; $key = array_keys($secarr['section_id'],$nextsec); $root = $secarr['section_root'][$key[0]]; $par = $secarr['section_par'][$key[0]]; if ( $type == 'new' ) { $title = NULL; $root = $secarr['section_root'][$key[0]] != 0 ? $secarr['section_root'][$key[0]] : $secarr['section_id'][$key[0]]; $par = $secarr['section_id'][$key[0]]; $temp = array_keys($secarr['section_par'],$sec); } else { $title = stripslashes($secarr['section_title'][$key[0]]); $root = $secarr['section_root'][$key[0]]; $par = $secarr['section_par'][$key[0]]; } $i = 0; do { $tkey = array_keys($secarr['section_id'],$nextsec); $tkey = $tkey[0]; $tpar = $secarr['section_par'][$tkey]; $troo = $secarr['section_root'][$tkey] == 0 ? $secarr['section_id'][$tkey] : $secarr['section_root'][$tkey]; $nextsec = $tpar; } while ($tpar != 0); } else { $sec = 0; $root = 0; $par = 0; $key = 0; $title = NULL; } //create list of subsections. $options = "\r\n\t\t<option value=\"" . $sec . "\"></option>"; $optionsie6 = $sec . ":"; $keys = array_keys($secarr['section_par'],$sec); foreach ($keys as $key => $value) { $options .= "\r\n\t\t<option value=\"" . $secarr['section_id'][$value] . "\">" . stripslashes($secarr['section_title'][$value]) . "</option>"; $optionsie6 .= "##" . $secarr['section_id'][$value] . ":" . stripslashes($secarr['section_title'][$value]); } echo $sec . "||" . $root . "||" . $par . "||" . $options . "||" . $optionsie6 . "||" . $title . "||"; } ?>[/code] Now i have edited a bit that you won't need hopefully it won't confuse too much, BUT the part you are really intersted in is how $options and $optionsie6 is generated. My script actually only updates one select box and places links to the previous levels - a breadcrumb. I did this to aide building the slect box and to prevent a few things happening that I am not going to tell as the solutios where far to cleaver to divulge ;) BUT the output of the $options is just html to build a selectbox and $optionsie6 look like this. SEC_ID:SEC_TITLE##SUBSEC_ID:SUBSEC_TITLE ad nauseaum..... they are parameters 4 and 5 in the '||' separated string i produce (just so you can see where I grab them in the js) Bakc to the js. The response handler declared as getInfoDone in our function so here it is (I have removed thebits you don't need - you will have to build the new select box - but that will be easy - this shows you how to populate it) [code] function getInfoDone() { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { params=xmlHttp.responseText.split('||'); if ( browserName == "Microsoft Internet Explorer" && browserVer <= 6 ) { document.getElementById("cat").options.length = 0; opts = params[5].split('##'); i = 0; for (x in opts) { val = opts[x].split(':'); document.getElementById("cat").options[i] = new Option(val[1],val[0]); i++; } } else { document.getElementById("cat").innerHTML=params[4]; } } } [/code] Again that shows you how to populate a selectbox - and that is the 'hardest' part. You can figure how to generate the new select boxes - but if you get stuck feel free to bounce some ideas of me.
  14. use the parameters set in the url to query the database for the relevant info.... you have already done so for 'id' do the same for 'p'. You will need to use if statements based on which parameters are set and adjust the queries accordingly.
  15. I think the fact that what AndyB and I suggest (variations on a theme - but Andy's is easier to police) doesn't need any further discussion nor faces any issues with which ports you have available and already provides the alternative to infinitely looping scripts etc etc. should speak volumes......
  16. Becareful! Peoples IP addresses change so what you are attempting to do could potentially never allow a user to access their account again once their ISP has renewed addresses.
  17. There are a million and one ways to do something - the fact you used the words 'could do' speaks volumes. If you are going to create a forum - make one that you would love to use - find the thing(s) you don't like about another forum and change it to you liking....
  18. BE CAREFUL of the script presented by Tom... Many hosts limit you to 50 queries per script.Switch doc was correct in that a join could be used... But the script above would fail if 50 records were returned from teh first query (on MOST hosting packages - unless you have extended rights and can remove any restrictiosn on your site.) The alternative is loading ALL the contents of each table into an array (one array for each table) and then using hash tables to grab the correct results (no where near as pretty as the queries IMO but won't fail like that scritp could)
  19. not exactly sure what you are after BUT if $info has to contain the entire string that you generate (i.e. var point = ....) just do this.... $info =  "var point = new GLatLng(" . $location . ");"; $info .= "var marker = createMarker(point,\"$name\",'<div id=\"infowindow\" style=\"white-space: nowrap;\">"   . addslashes($row['name'])   . $spacer   . addslashes($row['address'])   . $spacer   . addslashes($row['city'])   . $comma   . $space   . addslashes($row['state'])   . $spacer   . addslashes($row['zipcode'])   . $doublespacer   . addslashes($row['description']) . "</div>');\n"; $info .= "map.addOverlay(marker);\n"; $info .= "\n"; echo $info; now you have all that in info and can passs it anywhere you like.
  20. it queries a second time. JS calls a php script and waits for it to return a string (a string you can format in php). You can then split that string up and use it to generate/replace html
  21. OK.. try this set fee as a hidden field that is NOT disabled. Replace <input name="fee" type="text" id="fee" size="10" disabled="disabled" /> with <span id="dis_fee"></span> and alter this... if(group!=""){         str=group.split("/");         total=parseInt(str[1])+ parseInt(url_price);         document.form1.fee.value=total;         return true;       }     if(county!=""){                 total=parseInt(county_price)+parseInt(url_price);         document.form1.fee.value=total;       return true;   } to if(group!=""){         str=group.split("/");         total=parseInt(str[1])+ parseInt(url_price);         document.form1.fee.value=total;         document.getElementById('dis_fee').innerHTML = "£ " + total;         return true;       }     if(county!=""){                 total=parseInt(county_price)+parseInt(url_price);         document.form1.fee.value=total;         document.getElementById('dis_fee').innerHTML = "£ " + total;       return true;   }
  22. HUMPTY what you are looking for is AJAX. That is what you described... The only things you need is a script that will accept the value of the cat/subcat and select all the cats beneath that.  I have a bit of ajax that does a similar job AND has the js to create the next select box in IE (IE6< doesn't like using innerHTML for select inputrs!!!!!) If you need it just holla
  23. sorry matey i used $_POST... you r sending via get so replace $_POST with $_GET
×
×
  • 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.