Jump to content

laPistola

Members
  • Posts

    245
  • Joined

  • Last visited

    Never

Everything posted by laPistola

  1. is the character the same on all account numbers??
  2. Indeed <Option> <Name> Scotia </Name> <Value> 102 </Value> <ParentValue> 101 </ParentValue> <Type> place </Type> </Option> <Option> <Name> Hampton </Name> <Value> 103 </Value> <ParentValue> 101 </ParentValue> <Type> place </Type> </Option> <Option> <Name> Furman </Name> <Value> 104 </Value> <ParentValue> 101 </ParentValue> <Type> place </Type> </Option> Not formatted correctly so hard to follow i find, its from a company i am integrating a site with.
  3. The problem area is $type = $xml->Option[$i]->Type; // when i echo this it prints place if($type=="place") { even though $type when echo'd is place it don't see it as a match?? Thanks you in advance
  4. My opinion is sessions are always more secure but to have "stay logged in" you will need to use cookies or store there IP address in the DB which as IP's can change i see that as a big security risk now what i do with cookies: Set 3 1- an auth code generated at login which has say there name in md5 then random stuff then there location in md5 then random then there second name in md5 then md5 the lot. this gets inserted into the DB aswell 2- there username or email depending on the details required to login 3- there IP address (no stored in DB) Then when they visit a page upon returning to the site it checks there is a username or email of ....... from cookie then makes sure the auth code matches from db to cookie then make sure the IP address matches. anyone fails your booted out. I tend to use the same method as you for password resets (i make sure the email gets sent to the email address they signed up with not just supplied) but i always do it all with SSL cert installed. All my passwords are md5 stored but salt would be more secure combined with md5 or even a combination with sha1.
  5. if (mysql_num_rows($query) < 1) { echo "No records returned"; }
  6. Hello im trying to quickly populate a DB with locations in a XML file (there are over 45000 locations). The trouble im having is a condition that filters so only a certain type will be inserted into the DB. The code: <?php include_once('../Connections/qwork.php'); $xml = simplexml_load_file('locations-BB.xml'); for($i=0; $i < 10; $i++) { // currently set at 10 to not take time processing all 45k while testing this script $type = $xml->Option[$i]->Type; // when i echo this it prints place if($type=="place") { $locsArr = array('39493','40533','40643','41110'); $sid = NULL; if(in_array($xml->Option[$i]->ParentValue,$locsArr)) { $sid = 1; } mysql_select_db($database_qwork, $qwork); $sql = "INSERT INTO `cities` (`sid`,`bbid`,`city`) VALUES('".$sid."','".$xml->Option[$i]->Value."','".$xml->Option[$i]->Name."')"; // mysql_query($sql, $qwork) or die(mysql_error()); echo $type." "; // just for testing to see if the script passed the first condition } } ?> now its prints place if i echo the $type var i thought trying to force $type into a string (which it should already be) but no look? thank you in advance!
  7. Funny you should say i was just coming back to click solved. The XML output on empty fields from the DB was just <fieldname/> not <fieldname></fieldname> which i knew but forgot (been at this project for hours), the thing that was throwing me was the FF FireBug console wasn't showing errors so i have just changed the PHP script to insert NULL between XML tags if field is empty or NULL then changed the JS to if (val!=NULL) { and its working perfectly Thank you for reply anyway.
  8. Hello The AJAX call is to a PHP script that returns an XML of the contacts details from the DB (name, company, address etc) This then inturn displays the contacts details on the page. However as i don't need all the details i have an array with only the xml tag names the page uses. here is the script function doContact() { if (xhr.readyState == 4) { if (xhr.status == 200) { if (xhr.responseXML) { // build address details field var addArr = Array("company","name","address1","address2","town","postcode","country"); var addCode = ""; var tags = xhr.responseXML.getElementsByTagName('contact'); for ( var i=0; i < addArr.length; i++) { var val = getVal(tags[0],addArr[i]); if (val!="") { addCode += "<input name=\""+addArr[i]+"\" type=\"text\" class=\"invoiceField\" id=\""+addArr[i]+"\" maxlength=\"255\" style=\"width:95%\" onfocus=\"changeC(this,'fieldAddFocus');changeH(this,'in');\" onblur=\"changeC(this,'invoiceField');changeH(this,'out');\" value=\""+val+"\" />"; if (i<6) { addCode += "<br />\n"; } } } document.getElementById('address_details').innerHTML = addCode; } } else { alert("AJAX Failed at doContactfunction code " + xhr.status); } } function getVal(theData,theTag) { return theData.getElementsByTagName(theTag)[0].firstChild.nodeValue; } } Now it works fine if all the details have been filled in for the contact, but if say the company name is missing or even address2 it will not display anything at all. Thank you
  9. Thank you all for your input. Thinking about it more the quick fix i was thinking was a JS function haha Didn't see DanielO till just now but my fix was $anl = strlen($an_result); $an_result++; $an = str_pad($an_result, $anl, "0", STR_PAD_LEFT); Thank you PFMaBiSmAd
  10. I have had this issue before but have forgot the fix and will hit my head once im reminded.. I have this string // $an_result currently = 00001297 $an = $an_result + 1; // which outputs 1298 What i need is all if any zero's before the number to stay. the number before the +1 could have up to 7 zero's in front or as little as 1 or none Thanks
  11. Try <?php echo $value[1]." x <a class=\"q".$value[3]."\" href=\"javascript:;\" onmouseover=\"".$WowheadPower."showTooltip('event', '".$value[4]."', '".$value[5]."') onmousemove=\"".$WowheadPower."moveTooltip(event)\" onmouseout=\"".$WowheadPower."hideTooltip();""\">".$reward_texts[$langs[$set_lang][2]][$key]."</a>"; ?>
  12. Wow, what an t**t i am FORM should have been FROM, works now. bathled how i missed that till i posted here?
  13. Hello i have writen a script that handles $_POST vars to return a set of data form a search form but i get this error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'jobs WHERE (location = 'East Midlands') AND (salary BETWEEN '10.000' AND '20.000' at line 1 The code is: <?php if ((isset($_POST)) && (!empty($_POST['location']))) { mysql_select_db($database_qwork, $qwork); // Find location or area search $loc_sql = "SELECT sid FROM cities WHERE cid = '".$_POST['location']."'"; $loc_query = mysql_query($loc_sql, $qwork) or die(mysql_error()); $loc = mysql_fetch_assoc($loc_query); // build the sql $sVals = explode('-',$_POST['salary']); $s_sql = "SELECT title, jid, location, area, salary, description FORM jobs WHERE "; if ($loc['sid']==1) { $s_sql .= "(area = '".$_POST['location']."')"; } else { $s_sql .= "(location = '".$_POST['location']."')"; } if ($_POST['salary']!='All') { $s_sql .= " AND (salary BETWEEN '".$sVals[0]."' AND '".$sVals[1]."')"; } if (!empty($_POST['keyword'])) { $s_sql.= " AND (title = '%".$_POST['keyword']."%')"; } $s_sql .= " ORDER BY salary DESC"; // work out number of pages $s_pages_query = mysql_query($s_sql, $qwork) or die(mysql_error()); $s_pages_num = mysql_num_rows($s_pages_query); $s_pages = ceil($s_rows_num / 10); $s_page = 0; if (isset($_POST['page'])) { $s_page = $_POST['page']; } $s_page = ceil($s_page * 10); // query DB $s_sql .= " LIMIT ".$s_page.", 10"; $s_query = mysql_query($s_sql, $qwork) or die(mysql_error()); $s_rows = mysql_fetch_assoc($s_query); } ?> The form posts these vars $_POST['keyword'] = which is blank in this query $_POST['salary'] = 10.000 - 20.000; $_POST['location'] = East Midlands; Thank you for any help
  14. Basic im doing tabs for the links in my clients website but z-index isn't doing anything at all??? when the page loads im trying to change the layer order of the tabs as they over lap but not in the order i would like them. here is here the code <div id="mainNav"> <a href="../index.php" title="Owen Williams Loughborough Home Page" onmouseover="rollOver('homeImg',0)" onmouseout="rollOver('homeImg',1)"><img src="../images/homeButt.png" alt="Owen Williams - Joinery and Building Services" name="homeImg" width="77" height="30" id="homeImg" style="z-index:400;" /></a> <a href="../services.php" title="Owen Williams Loughborough Home Page" onmouseover="rollOver('servicesImg',0)" onmouseout="rollOver('servicesImg',1)"><img src="../images/servicesButt.png" alt="Owen Williams - Joinery and Building Services" name="servicesImg" width="96" height="30" id="servicesImg" style="z-index:3;" /></a> <a href="../testi.php" title="Owen Williams Loughborough Home Page" onmouseover="rollOver('testiImg',0)" onmouseout="rollOver('testiImg',1)"><img src="../images/testiButt.png" alt="Owen Williams - Joinery and Building Services" name="testiImg" width="128" height="30" id="testiImg" style="z-index:3;" /></a> <a href="../contact.php" title="Owen Williams Loughborough Home Page" onmouseover="rollOver('contactImg',0)" onmouseout="rollOver('contactImg',1)"><img src="../images/contactButt.png" alt="Owen Williams - Joinery and Building Services" name="contactImg" width="113" height="30" id="contactImg" style="z-index:1; margin-right:30px" /></a> </div> Nothing anywhere is controlling the z-index, i have even taken out the zIndex in my JS script. Thank you before hand.
  15. after looking around the net for a work around it came to my attention that its a bug in IE and a work around was to use span tags around all the table cells and use some display css, as that wasn't a fix for me it gave me an idea though CSS .hiddenToU { position:absolute; left:-30000px; } .revealToU { visibility:visible; } Thank you for any help
  16. further more i have just put some text inside the div that gets hidden but not in the table and this shows fine??
  17. Thank you, have tried that but no luck, im 100% sure it has something to do with the css rule height. I set the height to 0px so it don't leave the spaces between buildings names but if i don't use the height rule at all in the hiddenToU class it works fine other then leaving the space where the div/table should be which looks messy. On reveal i cant specify a height for it to then use as each building will have a different amount of units under it.
  18. Thinking about it this is probably more a CSS issue, if a mod would kindly move this thread to the css section i would be greatful Thank you
  19. Thank you but this just did the same as my code, just what the images show
  20. So image one is how it looks in IE7 while the units data are hidden before you click to view more units This is what it looks like when you click view units This is what it should look like and is working on FF3, IE8 and others hope this helps more
  21. Once you click the link to open up what units are in the building buy pressing the "Click here to view units" javascript changes the class of the hidden div so it reveals what units are available in that business building, in IE7 when you click it makes the space for the hidden data but don't display it.
  22. Hello I have this problem with a class change script. basicly on page load there is hidden sections under there building names and when you click a link javascript changes the class name to reveal what was hidden onload which is a div that contants a table that lists units available in the building see http://www.units-to-let.co.uk/searchResults.php?pc=NG6+0EB the first listing Testing 2 click the link "Click here to view units" and see what i mean, it works fine in IE8, firefox and other browers but not IE7 (strange thing is when i clicked print preview in IE7 it shown what it wasnt showing on the webpage in the print preview) To make things easier below is the code. CSS .hiddenToU { visibility: hidden; height: 0px; } JS <script type="text/javascript"> <!-- function hideReveal(id) { var getDir = document.getElementById(id).className; if(getDir=='hiddenToU') { document.getElementById(id).className = ""; } else { document.getElementById(id).className = "hiddenToU"; } } //--> </script> HTML <div id="<?php echo $row_buildingsRS['bid']; ?>" class="hiddenToU"> <table width="330" border="0" style="margin-left:42px;border:1px dashed #2C5380;"> <tr> <th width="74" align="center"> </th> <th width="49" align="center" bgcolor="#2C5380">Unit</th> <th width="110" align="center" bgcolor="#2C5380">Size</th> <th width="80" align="center" bgcolor="#2C5380">Rent</th> </tr> <?php $bid = $row_buildingsRS['bid']; echo getUnits($database_utl, $utl, $bid); ?> </table> </div> If i remove the height:0; from the CSS it shows what it should do on screen in IE7 but you get the large gaps between names where the hidden data should be when hidden which looks messy and is the reason i put height:0; in Any help would be great thank you.
  23. Hello Im trying to build a way of checking for empty fields on large form where you dont have to enter every input name it needs to check This is my code: function checkF() { var allInputs = document.getElementsByTagName('input'); for (var i=0; i<allInputs.length; i++) { var fValue = allInputs.item(i).innerHTML; if (fValue=="") { // here i need to exclude say field1 , field 3 and field 10 from being checked return false; alert("Required field(s) are empty, please make sure all required fields are entered.") } else { return true; } } } what i would like is where i made the comment in the above code a way of excluding curtain fields by there name being checked if there empty, not sure its possible but a way using the .item() must be. Any help would be great thank you
  24. ahh i see, i used back ticks incase the user used a reserved word, id the function that can check for them?
×
×
  • 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.