Jump to content

jason310771

Members
  • Posts

    101
  • Joined

  • Last visited

Everything posted by jason310771

  1. i would not know, i have only just been told that some data was inserted at all and I had the data emailed to me prior to it being inserted and found that one of the fields filled in had the dreaded ' so check the code and found the guy who coded it had not escaped anything. why does the line have the { } , can i lose these and just use mysql_real_escape_string($_SESSION['customerName']) or will the session not work ?
  2. could i just do this... $addRequest = mysql_query("INSERT INTO requests (`request_id`, `datetime_added`, `customer_name`, `customer_email`) VALUES ('".mysql_real_escape_string($requestID)."', '".mysql_real_escape_string($datetime_added)."', '".mysql_real_escape_string($_SESSION['customerName'])."', '".mysql_real_escape_string($_SESSION['customerEmail'])."')"); or do the $_SESSION['customerName'] need to have the { }
  3. without having to create a new variable for each of the SESSION variables how should I change the following example to securly insert data? the $requestID and $datetime_added were already made safe using mysql_real_escape_string, it is the session data that I am not sure about. $addRequest = mysql_query("INSERT INTO requests (`request_id`, `datetime_added`, `customer_name`, `customer_email`) VALUES ('$requestID', '$datetime_added', '{$_SESSION['customerName']}', '{$_SESSION['customerEmail']}')"); just tried to use a foreach on each SESSION variable but this causes problems with other session variables not to used in the storing of data in mysql and there are to many to filter out, and to many session variable to create a new variable ($variablename) for each.
  4. I have been using the following code for ages and now wish to only have one flash movie play once and stop on the last frame. <script type="text/javascript">AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','442','height','292','src','images/TEST_002','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','images/TEST_002' ); //end AC code</script> <noscript> <div><object type="application/x-shockwave-flash" data="images/TEST_002.swf" width="442" height="292"><param name="movie" value="images/TEST_002.swf"></object></div> </noscript> The following Javascrip is unaltered from when I first got it and works, I am only having trouble knowing how to prevent the movie repeating. AC_FL_RunContent //v1.7 // Flash Player Version Detection // Detect Client Browser type // Copyright 2005-2007 Adobe Systems Incorporated. All rights reserved. var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false; var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false; var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false; function ControlVersion() { var version; var axo; var e; // NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry try { // version will be set for 7.X or greater players axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7"); version = axo.GetVariable("$version"); } catch (e) { } if (!version) { try { // version will be set for 6.X players only axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6"); // installed player is some revision of 6.0 // GetVariable("$version") crashes for versions 6.0.22 through 6.0.29, // so we have to be careful. // default to the first public version version = "WIN 6,0,21,0"; // throws if AllowScripAccess does not exist (introduced in 6.0r47) axo.AllowScriptAccess = "always"; // safe to call for 6.0r47 or greater version = axo.GetVariable("$version"); } catch (e) { } } if (!version) { try { // version will be set for 4.X or 5.X player axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3"); version = axo.GetVariable("$version"); } catch (e) { } } if (!version) { try { // version will be set for 3.X player axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3"); version = "WIN 3,0,18,0"; } catch (e) { } } if (!version) { try { // version will be set for 2.X player axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash"); version = "WIN 2,0,0,11"; } catch (e) { version = -1; } } return version; } // JavaScript helper required to detect Flash Player PlugIn version information function GetSwfVer(){ // NS/Opera version >= 3 check for Flash plugin in plugin array var flashVer = -1; if (navigator.plugins != null && navigator.plugins.length > 0) { if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) { var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : ""; var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description; var descArray = flashDescription.split(" "); var tempArrayMajor = descArray[2].split("."); var versionMajor = tempArrayMajor[0]; var versionMinor = tempArrayMajor[1]; var versionRevision = descArray[3]; if (versionRevision == "") { versionRevision = descArray[4]; } if (versionRevision[0] == "d") { versionRevision = versionRevision.substring(1); } else if (versionRevision[0] == "r") { versionRevision = versionRevision.substring(1); if (versionRevision.indexOf("d") > 0) { versionRevision = versionRevision.substring(0, versionRevision.indexOf("d")); } } var flashVer = versionMajor + "." + versionMinor + "." + versionRevision; } } // MSN/WebTV 2.6 supports Flash 4 else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4; // WebTV 2.5 supports Flash 3 else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3; // older WebTV supports Flash 2 else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2; else if ( isIE && isWin && !isOpera ) { flashVer = ControlVersion(); } return flashVer; } // When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision) { versionStr = GetSwfVer(); if (versionStr == -1 ) { return false; } else if (versionStr != 0) { if(isIE && isWin && !isOpera) { // Given "WIN 2,0,0,11" tempArray = versionStr.split(" "); // ["WIN", "2,0,0,11"] tempString = tempArray[1]; // "2,0,0,11" versionArray = tempString.split(","); // ['2', '0', '0', '11'] } else { versionArray = versionStr.split("."); } var versionMajor = versionArray[0]; var versionMinor = versionArray[1]; var versionRevision = versionArray[2]; // is the major.revision >= requested major.revision AND the minor version >= requested minor if (versionMajor > parseFloat(reqMajorVer)) { return true; } else if (versionMajor == parseFloat(reqMajorVer)) { if (versionMinor > parseFloat(reqMinorVer)) return true; else if (versionMinor == parseFloat(reqMinorVer)) { if (versionRevision >= parseFloat(reqRevision)) return true; } } return false; } } function AC_AddExtension(src, ext) { if (src.indexOf('?') != -1) return src.replace(/\?/, ext+'?'); else return src + ext; } function AC_Generateobj(objAttrs, params, embedAttrs) { var str = ''; if (isIE && isWin && !isOpera) { str += '<object '; for (var i in objAttrs) { str += i + '="' + objAttrs[i] + '" '; } str += '>'; for (var i in params) { str += '<param name="' + i + '" value="' + params[i] + '" /> '; } str += '</object>'; } else { str += '<embed '; for (var i in embedAttrs) { str += i + '="' + embedAttrs[i] + '" '; } str += '> </embed>'; } document.write(str); } function AC_FL_RunContent(){ var ret = AC_GetArgs ( arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" , "application/x-shockwave-flash" ); AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs); } function AC_SW_RunContent(){ var ret = AC_GetArgs ( arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000" , null ); AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs); } function AC_GetArgs(args, ext, srcParamName, classid, mimeType){ var ret = new Object(); ret.embedAttrs = new Object(); ret.params = new Object(); ret.objAttrs = new Object(); for (var i=0; i < args.length; i=i+2){ var currArg = args[i].toLowerCase(); switch (currArg){ case "classid": break; case "pluginspage": ret.embedAttrs[args[i]] = args[i+1]; break; case "src": case "movie": args[i+1] = AC_AddExtension(args[i+1], ext); ret.embedAttrs["src"] = args[i+1]; ret.params[srcParamName] = args[i+1]; break; case "onafterupdate": case "onbeforeupdate": case "onblur": case "oncellchange": case "onclick": case "ondblClick": case "ondrag": case "ondragend": case "ondragenter": case "ondragleave": case "ondragover": case "ondrop": case "onfinish": case "onfocus": case "onhelp": case "onmousedown": case "onmouseup": case "onmouseover": case "onmousemove": case "onmouseout": case "onkeypress": case "onkeydown": case "onkeyup": case "onload": case "onlosecapture": case "onpropertychange": case "onreadystatechange": case "onrowsdelete": case "onrowenter": case "onrowexit": case "onrowsinserted": case "onstart": case "onscroll": case "onbeforeeditfocus": case "onactivate": case "onbeforedeactivate": case "ondeactivate": case "type": case "codebase": case "id": ret.objAttrs[args[i]] = args[i+1]; break; case "width": case "height": case "align": case "vspace": case "hspace": case "class": case "title": case "accesskey": case "name": case "tabindex": ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1]; break; default: ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1]; } } ret.objAttrs["classid"] = classid; if (mimeType) ret.embedAttrs["type"] = mimeType; return ret; }
  5. I have tried the following which I found via Google, in Firefox, IE 8 and IE 9 but only Firefox allows the page to work correctly. http://view.jquery.com/trunk/plugins/autocomplete/demo/ Reasons I can not work with Jquery.
  6. so i need to remove all the class="**" and replace with style="****" and put the css code in here instead ? or could i just place all the css in an external files and link it in the email code ?
  7. I have created my email layout in Dreamweaver using html with doctype, html, head and body tags and it shows ok in IE and Firefox and in Windows Live Mail I have placed all of the CSS inside the email code inside the head tags. When this is emails to someone with Outlook, Outlook completely changed the html and the CSS section ?! How do I prevent this from happening or better still how to code this so that Outlook does not have to change anything.
  8. Thank you for your reply and suggestion about using Jquery, I spent over two months trying to learn how to add Jquery to the site so it would use al the existing functions we have but could not get my head around it and as the code we had all worked i thought why fix what is not broken. the only function that seems to have a problem for most browsers is the dropdown list that shows when one of the images are clicked to make a quick selection, when you click the list shows and when an item is clicked it enters it correctly, what i can not get to work is the keyboard arrow keys to scroll down the list. firefox allows this to be done but not other browsers. here is the latest version i am working on. [redacted]/new_2011-04/booking.php can anyone suggest what i could change in my code to allow other browsers to do the same, other than recoding the whole site in Jquery.
  9. This is my full code I have added in echo lines to display the content of the full query that is being used to get the data from mysql this is the output of these two lines. echo("<br><br>".$requestIDs."<br><br>"); shows 0 and echo("SELECT * FROM requests WHERE `customer_email`='{$_SESSION['FM_user']}' AND `request_id` IN ({$requestIDs})"); shows SELECT * FROM requests WHERE `customer_email`='me@email.com' AND `request_id` IN (0) <?PHP session_start(); // viewPreviousRequests.php if(!isSet($_SESSION['FM_user'])) { $_SESSION['error'] = 'You must be logged in to view that page.'; header('Location: login.php'); exit; } else { include('includes/connection.php'); $user = mysql_query("SELECT * FROM customers WHERE email='{$_SESSION['FM_user']}' LIMIT 1"); $user = mysql_fetch_assoc($user); } include('includes/header.php'); ?> <body> <div class="headerBar"> <? include('includes/navigation.php');?> </div> <div class="headerSpace"></div> <div class="content"> <div class="widthLimiter contentStyle"> <? if(isSet($thisError)) { echo '<div class="errorDiv">',$thisError,'</div>'; } ?> <? if(isSet($thisSuccess)) { echo '<div class="successDiv">',$thisSuccess,'</div>'; } ?> <div class="formWrapper" style="width: 940px;"> <? if ($_POST['PRINTSELECTED'] == "PRINT SELECTED") { // PRINT SELECTED ?>PRINT SELECTED<br> <ul> <li class="field" style="font-size:10px;"> <div class="customerRequestIDSpacer"><strong>Request ID:</strong></div><div class="customerListSpacer"> </div> <div class="customerNameSpacer"><strong>Customer:</strong></div><div class="customerListSpacer"> </div> <div class="customerMobileSpacer"><strong>Mobile No:</strong></div><div class="customerListSpacer"> </div> <div class="customerPaymentMethodSpacer"><strong>Payment Method:</strong></div> <br style="clear:both"> </li> <? $requestIDs = implode(',', array_map('intval', $_POST['request'])); echo("<br><br>".$requestIDs."<br><br>"); $getRequests = mysql_query("SELECT * FROM requests WHERE `customer_email`='{$_SESSION['FM_user']}' AND `request_id` IN ({$requestIDs})"); echo("SELECT * FROM requests WHERE `customer_email`='{$_SESSION['FM_user']}' AND `request_id` IN ({$requestIDs})"); while($request = mysql_fetch_assoc($getRequests)) { echo '<li class="field" style="font-size:10px; border-bottom: 0.1em solid #D0D0D0"> <div class="customerRequestIDSpacer"> <em>',$request['request_id'],'</em> </div><div class="customerListSpacer"> | </div> <div class="customerNameSpacer"> <em>',$request['customer_name'],'</em> </div><div class="customerListSpacer"> | </div> <div class="customerMobileSpacer"> <em>',$request['customer_mobile'],'</em> </div><div class="customerListSpacer"> | </div>'; if ($request['paymentMethod'] != "Other") { $howTheyWantToPay = $request['paymentMethod']; } else { $howTheyWantToPay = $request['altpaymentMethod']; } echo '<div class="customerPaymentMethodSpacer"> <em>',$howTheyWantToPay,'</em> </div> <br style="clear:both"></li>'; } ?> </ul> <? } else { ?> <form method="post" action=""> <ul> <li class="field" style="font-size:10px;"> <div class="customerViewEditLink"></div><div class="customerListSpacer"> </div> <div class="customerRequestIDSpacer"><strong>Request ID:</strong></div><div class="customerListSpacer"> </div> <div class="customerNameSpacer"><strong>Customer:</strong></div><div class="customerListSpacer"> </div> <div class="customerMobileSpacer"><strong>Mobile No:</strong></div><div class="customerListSpacer"> </div> <div class="customerPaymentMethodSpacer"><strong>Payment Method:</strong></div> <br style="clear:both"> </li> <? $getRequests = mysql_query("SELECT * FROM requests WHERE `customer_email`='{$_SESSION['FM_user']}'"); while($request = mysql_fetch_assoc($getRequests)) { echo '<li class="field" style="font-size:10px; border-bottom: 0.1em solid #D0D0D0"> <div class="customerViewEditLink"> <input type="checkbox" name="request[]" value="',$request['request_id'],'"> </div> <div class="customerRequestIDSpacer"> <em>',$request['request_id'],'</em> </div><div class="customerListSpacer"> | </div> <div class="customerNameSpacer"> <em>',$request['customer_name'],'</em> </div><div class="customerListSpacer"> | </div> <div class="customerMobileSpacer"> <em>',$request['customer_mobile'],'</em> </div><div class="customerListSpacer"> | </div>'; if ($request['paymentMethod'] != "Other") { $howTheyWantToPay = $request['paymentMethod']; } else { $howTheyWantToPay = $request['altpaymentMethod']; } echo '<div class="customerPaymentMethodSpacer"> <em>',$howTheyWantToPay,'</em> </div> <br style="clear:both"></li>'; } ?> </ul> <input type="submit" name="PRINTSELECTED" value="PRINT SELECTED"> </form> <? } ?> </div> </div> </div> <? include('includes/footer.php');?> </body> </html>
  10. the input field is in the sixth line <input type="checkbox" name="request[]" value="',$request['request_id'],'">
  11. this is the code that shows the initial form they select from <form method="post" action=""> <ul> <? while($request = mysql_fetch_assoc($getRequests)) { echo '<li class="field" style="font-size:10px; border-bottom: 0.1em solid #D0D0D0"> <div class="customerViewEditLink"> <input type="checkbox" name="request[]" value="',$request['request_id'],'"> </div> <div class="customerRequestIDSpacer"> <em>',$request['request_id'],'</em> </div><div class="customerListSpacer"> | </div> <div class="customerNameSpacer"> <em>',$request['customer_name'],'</em> </div><div class="customerListSpacer"> | </div> <div class="customerMobileSpacer"> <em>',$request['customer_mobile'],'</em> </div><div class="customerListSpacer"> | </div> <br style="clear:both"> </li>'; } ?> </ul> <input type="submit" name="PRINTSELECTED" value="PRINT SELECTED"> </form>
  12. hey thank you, yes that makes sense, but using this causes all records to show still.
  13. how to cross reference $_POST array 'checkboxes[]' with mysql field I have a form that is submitted so the user can select which results to print. but I am having problems getting the results to show correctly. how do I correctly cross reference the form data with the mysql $getRequests = mysql_query("SELECT * FROM requests WHERE `customer_email`='{$_SESSION['FM_user']}'"); while($request = mysql_fetch_assoc($getRequests)) { if (!in_array($request['request_id'],array($_POST[request]))) { echo '<li style="font-size:10px; border-bottom: 0.1em solid #D0D0D0"> <div class="leftfloat"> <input type="checkbox" name="request[]" value="',$request['request_id'],'"> </div> <div class="leftfloat"> <em>',$request['request_id'],'</em> </div><div class="leftfloat"> | </div> <div class="leftfloat"> <em>',$request['customer_name'],'</em> </div><div class="leftfloat"> | </div> <br style="clear:both"> </li>'; } }
  14. unable to scroll down an ajax dropdown box in IE. as doing so causes the dropdown box to hide. I have been told that I need to have a different DOCTYPE but using a 'scrict' doctype causes the menu to scroll downwards with each item on its own line and not across the top of the page. This is the working folder I have created with just the bar bones of the page that are affected. [redacted]/select/ Can anyone suggest how I can get this to work on most if not all browsers. oh, i have previously been told that I should use Jquery for this and the other functions on the page but I tried this at the first stages of setting the page up and it failed to work correctly. So looking to get a fix for this if possible.
  15. Please can someone advise how I remove the | characters from a string? I tried the following but get errors that... Warning: preg_replace() [function.preg-replace]: No ending delimiter '|' $value = preg_replace("|", "", $value);
  16. I have tried using Microsofts translator widget but it messes up my menu that I wish it to sit beside, the widget is almost twice the height if my menu bar. I am after a widget that is just text and the user clicks it to open up a select language box. Does anyone have other widgets they use that is based on a single line selector not more than say 15px high or some thing like that ?
  17. i have added the following line to my .htaccess AddType application/x-httpd-php .xml so the server executes the xml file as php but the resulting xml file shows is the original php file itself and not the xml song list. <?xml version="1.0" encoding="UTF-8"?> <songs> <?php $originalArray = array ( "Test1" => array ( "Test1", "Twodded Band", "songs/test1.mp3" ), "Test2" => array ( "Test2", "P2L Band", "songs/test2.mp3" ), "Test3" => array ( "Test3", "Fast_N_Furios", "songs/Fast_N_Furios.mp3" ), "Test4" => array ( "Test4", "Titanic", "songs/Titanic.mp3" ), "Test5" => array ( "Test5", "Welcome", "songs/Welcome_To_Hollywood.mp3" ), "Test6" => array ( "Test6", "VODAFONE", "songs/Vodafone_New_Ad.mp3" ) ); // randomize the order of the array in to a new array $newArray foreach ($originalArray as $na) { echo('<song name ="' . $na[0] . '" band ="' . $na[1] . '" file="' . $na[2] . '" />'); } ?> </songs>
  18. to start with the basic will do for the site as i do not want to add in to many javascripts from jquery, i done this before on a site and the whole site was messed up as some of the jquery javascript functions are also names of my own, and the time to change them all was too long, i gave up on this project using jquery and a bit shy to use again. how would i place the box in the center of the viewpoint of the browser using javascript and the ID of the boxes ?
  19. Please can someone take a look at my code and advise how I place the 'helpContainer' just below the red icon that was clicked. Been messing around a lod of other codes from various calendar scripts that i have, but nothing seems to be working for me. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Overlay test</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <style type="text/css"> #helpOverlay { border: 1px solid blue; background-color: #ccffcc; display: none; margin-left: 40px; position: absolute; width: 400px; height: 200px; visibility: visible } #helpContainer{ border: 1px solid green; color: black; background-color: #0ff; text-align: center; position: absolute; width: 100%; overflow: visible; visibility: visible; display: block } </style> <script type="text/javascript">//<![CDATA[ function hideHelpContent() { document.getElementById('helpOverlay').style.display = 'none'; var helpContent = document.getElementById('helpContent'); helpContent.innerHTML = ''; } function showHelpContent(layer) { var xmlhttp; document.getElementById('helpOverlay').style.display = 'block'; if(window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest(); } else { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if(xmlhttp.readyState==4 && xmlhttp.status==200) { if(xmlhttp.responseText == ''){ //document.getElementById('passengerID').value='0'; //document.getElementById('results').style.display='none'; } else { helpFieldId = document.getElementById(layer); alert(layer); // tmp = helpFieldId.offsetParent; alert(tmp); // tttt = helpFieldId.offsetParent; alert(tttt); helpContent = document.getElementById('helpContent'); helpContent.innerHTML = ''; // Move the help container! the_left = ds_getleft(helpFieldId); the_top = ds_gettop(helpFieldId);// + helpContent.offsetHeight; helpContent.style.left = the_left + 'px'; helpContent.style.top = the_top + 'px'; helpContent.innerHTML = xmlhttp.responseText; } } } xmlhttp.open("GET","getHelpText.php?name="+layer,true); xmlhttp.send(); } // Get the left and the top of the element. function ds_getleft(el) { var tmp = el.offsetLeft; el = el.offsetParent while(el) { tmp += el.offsetLeft; el = el.offsetParent; } return tmp; } function ds_gettop(el) { var tmp = el.offsetTop; el = el.offsetParent while(el) { tmp += el.offsetTop; el = el.offsetParent; } return tmp; } //]]></script> </head> <body> <div id="helpContainer"><div id="helpOverlay"><a href="#" onclick="hideHelpContent();" style="float: right;">close</a><div id="helpContent"></div></div></div> <br /> <br /> <br /> <br /> <br /> <br /> <img id="helpA" alt="" onclick="showHelpContent('helpA')" src="../images/newsimage39.gif"> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <img id="helpB" alt="" onclick="showHelpContent('helpB')" src="../images/newsimage39.gif"> </body> </html>
×
×
  • 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.