Jump to content

Sharkadder

Members
  • Posts

    119
  • Joined

  • Last visited

Everything posted by Sharkadder

  1. Hi there, It is ok i sorted this now, happens that i had a parent outcome id field in my table and so each sub-outcome had a parent id which was linked to the main outcome ID. All i did was get the main outcome ID's from the database in ascending order, and then search for each sub-criteria who had that main outcome ID as their parent...then i was able to capture the information in the order i needed. Many thanks, Mark
  2. Hi there, I have an SQL table which has a field within it that holds data within a row. The field holds data for outcomes which can be listed as follows: Outcome 1 1.1 1.2 Outcome 2 2.1 2.2 1.3 Outcome 4 4.1 4.2 Outcome 3 3.1 1.4 etc. Basically, they are not in order as people have been typing them into the database table in a random order. Is there a way i can get it so that it shows everything to do with outcome 1 under outcome 1 etc. once i pull the rows from the database? e.g. Outcome 1 1.1 1.2 1.3 1.4 Outcome 2 2.1 2.2 etc. I have tried assending and decsending orders but they obviously show the numeric data first. Currently i am having to use several foreach loops in PHP to sort out the ordering and would like a more efficient way of doing this. Was not sure if i could do a command in MySQL direct. I am using MySQL 5.0 Many thanks
  3. Thanks dude i have added that code in now. I have got it all working and even the .value is now working which is really good since i modified the code to what you said. If i stumble across any other problems i shall post on here but i think it is sorted now, going to do some testing tomorrow on my script :-). Mark
  4. Hi dude, Thank you once again for the reply. Basically i have a loop which loops through all of the table rows from within a table, each iteration of the loop uses the number i which increments each time the loop goes around. This is why i have code such as: document.getElementsByTagName("tr") <---the i here is the TR element number for whichever iteration the loop is on. So if we look at what i am trying to achieve, I am trying to change the id and name of a select element and three input elements within TD tags using Javascript, alternatively i could use jQuery. I cannot use any server side languages as i allow people to add in a new row to the table by clicking on a button and so Javascript or Jquery is needed to re-number all of the ID's. e.g. i have a row which contains 4 cells, 1 is a select drop down box and the other three all contain an input box. Do you think that you could give me an example of how this could be achieved, and code which will work when using internet explorer? All i need to do is get the element from inside the TD tag and replace the ID and Name value from within it. Is there any way i can make use of GetElementbyID or GetelEmentByName and change the ID or name that way without innerHTML? Many thanks and hope you can help me with this problem..i try to stay away from Javascript and i mostly program in PHP but this has to be client side without needing to refresh the page, Mark
  5. Hi there and thank you for the reply. I have tried just about everything and silly internet explorer keeps kicking back error messages! Beginning to get frustrating now. Do you know of any function where i can pass it the tag name i am wanting to send HTML to e.g."document.getElementsByTagName("tr")" and to then replace the HTML to update the table row without innerHTML I have tried the following and it just does not work! //inside the head of the document function replaceHtml(el, html) { var oldEl = typeof el === "string" ? document.getElementById(el) : el; /*@cc_on // Pure innerHTML is slightly faster in IE oldEl.innerHTML = html; return oldEl; @*/ var newEl = oldEl.cloneNode(false); newEl.innerHTML = html; oldEl.parentNode.replaceChild(newEl, oldEl); /* Since we just removed the old element from the DOM, return a reference to the new element, which can be used to restore variable references. */ return newEl;}; //inside the body newHTML = document.getElementsByTagName("tr")[i].innerHTML.replace(document.getElementsByTagName("tr")[i].cells[j].childNodes[0].id,nameandid).replace(document.getElementsByTagName("tr")[i].cells[j].childNodes[0].name,nameandid).replace(document.getElementsByTagName("tr")[i].cells[j].childNodes[2].id,calendarid).replace(document.getElementsByTagName("tr")[i].cells[selecttdid].childNodes[0].name,selectname); //work around for innerHTMLdocument.getElementsByTagName("tr") = replaceHtml(document.getElementsByTagName("tr"),newHTML); IE just states an invalid procedure call on the line: var oldEl = typeof el === "string" ? document.getElementById(el) : el; Think you could amend my code to maybe work or perhaps tell me an alternative function. Many thanks, Mark
  6. Hi there, I have recently been trying some code out to replace the innerHTML contents from within a table row, i am now to discover that Internet Explorer which a lot of people still use insists of making innerHTML properties read only, although the code works flawlessly in Firefox and Google Chrome. The code i have currently got is shown below: document.getElementsByTagName("tr").innerHTML = document.getElementsByTagName("tr").innerHTML.replace(document.getElementsByTagName("tr").cells[j].childNodes[0].id,nameandid).replace(document.getElementsByTagName("tr").cells[j].childNodes[0].name,nameandid).replace(document.getElementsByTagName("tr").cells[j].childNodes[2].id,calendarid).replace(document.getElementsByTagName("tr").cells[selecttdid].childNodes[0].name,selectname); As you can see from the above code i am trying to tell a tag name TR which has an index of i innerHTML to change to itself but with some things replaced. You don't need to know what i am replacing inside the code as that code is all fine. What i would like to know is, what work around do i have to change the innerHTML using Javascript or JQuery? Some people have said to stick it into a Div tag but the problem is that the table is inside of a form and i am sending the elements from a form to a different page and so i would rather keep it inside the table row. I have also read that innerHTML can be used to modify specific cells from within a table i.e. contents inside a TD tag. Does anybody know how i can modify my code accordingly so that the debugger stops spitting out the "operation" error messages when i put debugging on due to trying to write to innerHTML? I have also tried using outerHTML and didn't seem to work either: document.getElementsByTagName("tr").outerHTML.replace(document.getElementsByTagName("tr").innerHTML,document.getElementsByTagName("tr").innerHTML.replace(document.getElementsByTagName("tr").cells[j].childNodes[0].id,nameandid).replace(document.getElementsByTagName("tr").cells[j].childNodes[0].name,nameandid).replace(document.getElementsByTagName("tr").cells[j].childNodes[2].id,calendarid).replace(document.getElementsByTagName("tr").cells[selecttdid].childNodes[0].name,selectname)); You will notice in the above i am trying to replace the innerHTML of an element(a TR tag at number i) with some things removed and again, because i am trying to modify the innerHTML...it was a no go again. Finally i have tried to modify a value property in internet explorer and this time it spits out a 5007 error saying that it is unable to set the value of the property, anybody know how i can get around this? My code again for this is below to what i currently tried: document.getElementById("unitstartdate"+totaltablerows).value = startdate; The ID's do exist and again this code worked fine in firefox and chrome, just not IE. I think i am more after a work around for both situations rather than you understanding what i am actually trying to replace etc. as the replace part of the code is fine, just will not write to HTML in Internet explorer using innerHTML, outerHTML or change a value of an element as mentioned. Any ideas are great. Mark
  7. Hi, I solved the problem with the following function, although it does require a loop. Not sure if there is a more efficent way but my page seems to load fine with it: //dropdown is the dropdown you selected and theForm is the formfunction checkselected(theForm, dropdown){for (i=0; i<theForm.length; i++) { //myval.options[myval.selectedIndex].innerHTML if (theForm.elements[i].type == "select-one") { if (dropdown.options[dropdown.selectedIndex].innerHTML == theForm.elements[i].options[theForm.elements[i].selectedIndex].innerHTML && theForm.elements[i].name != dropdown.name) { alert("You have already selected this unit. Please choose a different one."); //change index on selected dropdown back to zero dropdown.selectedIndex = 0; } }}}
  8. Hi there, I have 10 drop down boxes on a page where people can select some units they wish to study. Obviously people can pick more than one unit and so i want to avoid them from picking the same unit twice in each of the drop down boxes. I have looked into the disable function on drop down boxes but cannot figure out how i would go about disabling a drop down selection entry using Javascript. So far i have looked at the following jquery function below but it will not work on my php page as i do not have access to the head of the document on the platform i am on and just the body: $('select').change(function() { var ary = new Array(); $('select option:selected').each(function() { if ($(this).val().length > 0) { ary.push($(this).val()); } }); $('select option').each(function() { if ($.inArray($(this).val(), ary) > -1) { $(this).attr('disabled', 'disabled'); } else { $(this).removeAttr('disabled'); } });}); The example above is the sort of thing i am after but having studied the code, without it being in the head of the document it will not work and so it does not work when i change entry in the dropdown list. Does anybody have any modifications to the code or examples i can use to find out the values of all other dropdown's on a form and to then disable an index in the others where one is already selected on that index? Obviously i would need something to enable selections again. Even an alert box stating that the unit has already been picked and resetting back to original value would do. Many thanks, Mark
  9. w3fools sounds American to me...not to stereotype, most American's are decent people but it's normally a bored idiot from there who create websites slating other people. Do people have bothing better to do? If there is a problem on w3schools then why not just e-mail them/post on here and just say say "this, that and t'other is wrong, can you please fix it?" Why bother being so bored you want to create a new website just bsically causing chaos...somebody obviously has a lot of time on their hands.Besides, w3fools website doesn't even look good, looks like it was created in front page by some teenager who has clearly not grown up fully yet. How much vertical scrolling do they need? The only type of websites that can get away with that are forums, online stores, and social networking websites.I just don't see why they needed to create another website linking to other places when they could have just been helpful and posted on here any problems instead of slating a website millions of people use in order to learn the basics of website design/development. They're obviously just trying to trive traffic away or some rubbish, i think they should spend their time more wisely and create a website to do something useful.
  10. thanks dude it worked a charm...always helpful and full of the answers.I did contemplate a lookup table but this way works ok :-).
  11. Hi there,I currently have a mysql database which i would like to use to get values from a database. One of the columns in the database holds a value and if more than one value exists for an entry, the values are split up by commas for that row under the ClubID column. Here is a copy of my current query: $query="SELECT * FROM FootballPlayers WHERE ClubID LIKE '%$squad' COLLATE utf8_bin ORDER BY CASE WHEN Positions LIKE 'GK%' THEN 1 WHEN Positions LIKE 'RB%' THEN 2 WHEN Positions LIKE 'LB%' THEN 3 WHEN Positions LIKE 'SW%' THEN 4 WHEN Positions LIKE 'CD%' THEN 5 WHEN Positions = 'D' THEN 6 WHEN Positions LIKE 'RW%' THEN 7 WHEN Positions LIKE 'LW%' THEN 8 WHEN Positions LIKE 'DM%' THEN 9 WHEN Positions LIKE 'CM%' THEN 10 WHEN Positions LIKE 'AM%' THEN 11 WHEN Positions = 'M' THEN 12 WHEN Positions LIKE 'FW%' THEN 13 WHEN Positions LIKE 'ST%' THEN 14 WHEN Positions = 'A' THEN 15 ELSE 16 END"; Ok i would like the query above to search the database and to show items where ClubID is like $squad. $squad is always a number or more than one number split up by commas, e.g. 100 or 1,2,3,4 etc.The rest of the query is fine where it displays the rows depending on what playing position they equal. The problem is that if $squad is equal to a range of numbers split up by commas they it will not find anything and just show blank. e.g. if $squad = "2" and i am looking at ClubID column for a ClubID which contains "2" then nothing seems to get displayed as ClubID might say "1,2" or "2,8" etc. My question is, how can i search the database so that after the WHERE clause i can see if part of the string $squad is in the column ClubID for the current row.I have tried using LOCATE and FIND_IN_SET but i cannot appear to get them to work, maybe the right syntax is all i need :-). I am using mysql version 5.0 and the variable i search the database with is created using PHP. Any help is apprechiated.Thanks,Mark
  12. www.domain-website-hosting.com (the one im registered with)i am on the delux linux plan.you get 1 terrabyte transfer per month and 100gb of space per monthvery good and only costs me 4.50 per month.about £50 for the year and domains are only £3.99/year through them.supports php,.java,pearl,asp.net,mysql etc.also allows forwarding, sub domains, domain directory pointing etc.worth a check out
  13. EDITno i dont want the content from another page at the position you said in the previous post.what i want is content from another page called menu.htm to be imported at that position.sorry about using // for start of comments im used to commenting that way in another program lol.but yeh thats exactly where i want it as you said, i want the menu.htm code to be imported at that position in the left column.If its not possible by adding a link, ill just have to use a template in dreamweaver and update all my pages, just means i have to convert them all over to dreamweaver first.as for question 2 if anybody has a way to display the matrix style text next to a picture on same line that'd be great. <p><a href="http://sharkadder.com/mark/menuexample.html"><center><img src="/mark/htmlenter.jpg"style="padding:5px;border:5px solid white; width="250" height="200"/></a> <div id="matrix" "style=="display:inline"; "padding:5px;border:5px solid white; width="250" height="200">Sharkadder Software</div></center></p> <!-- the above code is the part of second page i am refering to -->
  14. yes i want the content at the position you said in the previous post.sorry about using // for start of comments im used to commenting that way in another program lol.but yeh thats exactly where i want the menu.htm code to be imported.If its not possible by adding a link, ill just have to use a template in dreamweaver and update all my pages, just means i have to convert them all over to dreamweaver first.as for question 2 if anybody has a way to display the matrix style text next to a picture on same line that'd be great. <p><a href="http://sharkadder.com/mark/menuexample.html"><center><img src="/mark/htmlenter.jpg"style="padding:5px;border:5px solid white; width="250" height="200"/></a> <div id="matrix" "style=="display:inline"; "padding:5px;border:5px solid white; width="250" height="200">Sharkadder Software</div></center></p> <!-- the above code is the part of second page i am refering to -->
  15. ok heres my sample code for the page, ive cut all the content out and just left it as i need, ive also commented the code:<html><head><link rel="stylesheet" type="text/css"href="2c-hd-lc-static-layout.css" /><link rel="stylesheet" type="text/css"href="2c-hd-lc-static-presentation.css" /><style type="text/css">A:link {text-decoration: none}A:visited {text-decoration: none}A:active {text-decoration: none}A:hover {font-size:24; font-weight:bold; color: red;}</style> </head><body><div id="hdr"> //layout for header from css layout file will go here</div><div id="lh-col"> // layout for menu section from ccs file will go here</div><div id="rh-col"> // layout for main content from css file will go here</div></body></html>thats my basic page layout, there it says "div id="lh-col"> thats where i am the content importing from menu.htm, although i can use the dreamweaver way.The code for my other page if you were refering to question 2 is as follows:<html><head><TITLE>Sharkadder Software,moto gp,Fast Food Fighter and Games Creation</TITLE><META name="description" content="Sharkadder,motogp,Fast Food Fighter,moto gp,Games,software Creation,Game Leagues and games downloads"><META name="keywords" content="Sharkadder,Sharkadder Software,FPS,Games,Software,game leagues,DarkBasic,Game Maker,Games Creation,Dark Basic,Game Downloads,downloads"><style type="text/css">.matrix { font-family:Lucida Console, Courier, Monotype; font-size:10pt; text-align:center; width:10px; padding:0px; margin:0px;}</style><script type="text/javascript" language="JavaScript"><!--var rows=11; // must be an odd numbervar speed=50; // lower is fastervar reveal=2; // between 0 and 2 only. The higher, the faster the word appearsvar effectalign="default" //enter "center" to center it.var w3c=document.getElementById && !window.opera;;var ie45=document.all && !window.opera;var ma_tab, matemp, ma_bod, ma_row, x, y, columns, ma_txt, ma_cho;var m_coch=new Array();var m_copo=new Array();window.onload=function() { if (!w3c && !ie45) return var matrix=(w3c)?document.getElementById("matrix"):document.all["matrix"]; ma_txt=(w3c)?matrix.firstChild.nodeValue:matrix.innerHTML; ma_txt=" "+ma_txt+" "; columns=ma_txt.length; if (w3c) { while (matrix.childNodes.length) matrix.removeChild(matrix.childNodes[0]); ma_tab=document.createElement("table"); ma_tab.setAttribute("border", 0); ma_tab.setAttribute("align", effectalign); ma_tab.style.backgroundColor="#000000"; ma_bod=document.createElement("tbody"); for (x=0; x<rows; x++) { ma_row=document.createElement("tr"); for (y=0; y<columns; y++) { matemp=document.createElement("td"); matemp.setAttribute("id", "Mx"+x+"y"+y); matemp.className="matrix"; matemp.appendChild(document.createTextNode(String.fromCharCode(160))); ma_row.appendChild(matemp); } ma_bod.appendChild(ma_row); } ma_tab.appendChild(ma_bod); matrix.appendChild(ma_tab); } else { ma_tab='<ta'+'ble align="'+effectalign+'" border="0" style="background-color:#000000">'; for (var x=0; x<rows; x++) { ma_tab+='<t'+'r>'; for (var y=0; y<columns; y++) { ma_tab+='<t'+'d class="matrix" id="Mx'+x+'y'+y+'"> </'+'td>'; } ma_tab+='</'+'tr>'; } ma_tab+='</'+'table>'; matrix.innerHTML=ma_tab; } ma_cho=ma_txt; for (x=0; x<columns; x++) { ma_cho+=String.fromCharCode(32+Math.floor(Math.random()*94)); m_copo[x]=0; } ma_bod=setInterval("mytricks()", speed);}function mytricks() { x=0; for (y=0; y<columns; y++) { x=x+(m_copo[y]==100); ma_row=m_copo[y]%100; if (ma_row && m_copo[y]<100) { if (ma_row<rows+1) { if (w3c) { matemp=document.getElementById("Mx"+(ma_row-1)+"y"+y); matemp.firstChild.nodeValue=m_coch[y]; } else { matemp=document.all["Mx"+(ma_row-1)+"y"+y]; matemp.innerHTML=m_coch[y]; } matemp.style.color="#33ff66"; matemp.style.fontWeight="bold"; } if (ma_row>1 && ma_row<rows+2) { matemp=(w3c)?document.getElementById("Mx"+(ma_row-2)+"y"+y):document.all["Mx"+(ma_row-2)+"y"+y]; matemp.style.fontWeight="normal"; matemp.style.color="#00ff00"; } if (ma_row>2) { matemp=(w3c)?document.getElementById("Mx"+(ma_row-3)+"y"+y):document.all["Mx"+(ma_row-3)+"y"+y]; matemp.style.color="#009900"; } if (ma_row<Math.floor(rows/2)+1) m_copo[y]++; else if (ma_row==Math.floor(rows/2)+1 && m_coch[y]==ma_txt.charAt(y)) zoomer(y); else if (ma_row<rows+2) m_copo[y]++; else if (m_copo[y]<100) m_copo[y]=0; } else if (Math.random()>0.9 && m_copo[y]<100) { m_coch[y]=ma_cho.charAt(Math.floor(Math.random()*ma_cho.length)); m_copo[y]++; } } if (x==columns) clearInterval(ma_bod);}function zoomer(ycol) { var mtmp, mtem, ytmp; if (m_copo[ycol]==Math.floor(rows/2)+1) { for (ytmp=0; ytmp<rows; ytmp++) { if (w3c) { mtmp=document.getElementById("Mx"+ytmp+"y"+ycol); mtmp.firstChild.nodeValue=m_coch[ycol]; } else { mtmp=document.all["Mx"+ytmp+"y"+ycol]; mtmp.innerHTML=m_coch[ycol]; } mtmp.style.color="#33ff66"; mtmp.style.fontWeight="bold"; } if (Math.random()<reveal) { mtmp=ma_cho.indexOf(ma_txt.charAt(ycol)); ma_cho=ma_cho.substring(0, mtmp)+ma_cho.substring(mtmp+1, ma_cho.length); } if (Math.random()<reveal-1) ma_cho=ma_cho.substring(0, ma_cho.length-1); m_copo[ycol]+=199; setTimeout("zoomer("+ycol+")", speed); } else if (m_copo[ycol]>200) { if (w3c) { mtmp=document.getElementById("Mx"+(m_copo[ycol]-201)+"y"+ycol); mtem=document.getElementById("Mx"+(200+rows-m_copo[ycol]--)+"y"+ycol); } else { mtmp=document.all["Mx"+(m_copo[ycol]-201)+"y"+ycol]; mtem=document.all["Mx"+(200+rows-m_copo[ycol]--)+"y"+ycol]; } mtmp.style.fontWeight="normal"; mtem.style.fontWeight="normal"; setTimeout("zoomer("+ycol+")", speed); } else if (m_copo[ycol]==200) m_copo[ycol]=100+Math.floor(rows/2); if (m_copo[ycol]>100 && m_copo[ycol]<200) { if (w3c) { mtmp=document.getElementById("Mx"+(m_copo[ycol]-101)+"y"+ycol); mtmp.firstChild.nodeValue=String.fromCharCode(160); mtem=document.getElementById("Mx"+(100+rows-m_copo[ycol]--)+"y"+ycol); mtem.firstChild.nodeValue=String.fromCharCode(160); } else { mtmp=document.all["Mx"+(m_copo[ycol]-101)+"y"+ycol]; mtmp.innerHTML=String.fromCharCode(160); mtem=document.all["Mx"+(100+rows-m_copo[ycol]--)+"y"+ycol]; mtem.innerHTML=String.fromCharCode(160); } setTimeout("zoomer("+ycol+")", speed); }}// --></script></head><body bgcolor="#000000"><p></p><span style="padding:5px;border:5px solid red; background: white"><center><img src="/mark/sharkadder.png"></center><p><center><img src="/mark/software.png"></center></p></span><p></p><br></br><p><a href="http://sharkadder.com/mark/menuexample.html"><center><img src="/mark/htmlenter.jpg"style="padding:5px;border:5px solid white; width="250" height="200"/></a> <div id="matrix" "style=="display:inline"; "padding:5px;border:5px solid white; width="250" height="200">Sharkadder Software</div></center></p><br><center><span style="color:#FFFFFF; font-size:20px">Last Update - 20th February 2007(Server back online/updates)</center><center><font size="2"><a href="http://www.addme.com">Add Me! - Search Engine Optimization</a></font> </center></html>for some reason the matrix style text just displays underneath the image, not next to it, but if i use 2 images they both show next to eachother.i could use a table but ive always been told not to use tables on website and try and avoid that approach.
  16. ok what are includes? and how do i set these up, i thin i like the look of dw templates so ill stick with this method.by the way i have another question, i might aswell ask it here.On my index page yeah its a sort of intro page and on it i want to have 2 things in the centre of the page.Now 1 is a clickable picture that links into the main site (which works and is in the correct place) and 1 is a <div> tag which is linked to some java script contents.everytime i put them next to one another the <div> contents just displays underneath, i know its possible because i used to have 2 pictures next to one another but later changed it to a matrix text java script. you may of seen it before.i was told to use style ="display:inline" but that didnt work, the div tag still displayed on the line underneath, i also tried using a span tag instead of a div tag and that did the same.how can i get the picture and the div tag to be displayed on the same line as one another?thanks, and that first question is now solved......if i have any more trouble with it ill post backjust second question now
  17. that looks like the best thing to do, the template page in dreamweaver, i now know how to do that.I will test it out and see how i do but i think i can now get it working.Just a case of modifying the file
  18. Ok basically i have been designing a website for about a year now which i currently hand code in notepad.I use html for the contents, css for the layout/presentation/menu layout and also some java script for the menu.Ok now on my website i have some <div> tags, i use these to display various css layouts at different parts of my site, these being header, left side of page(menu area) and right side of page(main contents area).My website currently has about 50 pages and i got sick of changing each page everytime i made a change to the menu.So i thought ill use frames, split the page into 2 and use 1 half for the menu and other half for the content. By doing this it allowed me to change some of the menu content and no matter what page i went onto the menu was always updated and the same. This idea worked really well.Now this is where i have a problem, i am going to start using a program to create a shopping cart on my website and i am NOT allowed to use frames otherwise it will not work properly.THE QUESTIONOk my question is this, i have created a page called menu.htm, how can i import the contents into a certain part of another page?e.g. within the <div> tag for the left hand side of the page, how can i add a link to display contents from another page?The advantage of this is whenever i update my menu page i wont have to change each individual page because it will be reading the data from menu.htm NOT its current page.Thanks, hope somebody can help, if i aint explained it ok then i can go more into detail.
  19. ok i still kinda like dont get it.i amended the HTML form code <br><form enctype="multipart/form-data" action="upload_class.php" method="POST"><input type="hidden" name="MAX_FILE_SIZE" value="100000" />Choose a file to upload: <input name="uploadedfile" type="file" /><br /><input type="submit" value="Upload File" /></form>The php code document now looks as follows (alot shorter than my previous 1)<html><head><title></title></head><body><?php$target_path = "uploads/";/* Add the original filename to our target path.Result is "uploads/filename.extension" */$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);$_FILES['uploadedfile']['tmp_name'];$target_path = "uploads/";$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $uploads/)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded";} else{ echo "There was an error uploading the file, please try again!";}?></body></html>Yes i know the code looks firmilular, its standard code but i am having trouble with the tempory thing still its a pain in the butt, i have set the folder to my "uploads" folder and i dont know what i need to do with tempory or whatever, i have read up on it and its lost me sorry.Basically i want the temp folder to be the same folder as "uploads" i.e where the end file is going to be placed.I run it in mozilla firefox 2.0 and it comes up blank, nothing appears on the screen, no file has not been uploaded or no file has been uploaded, nothing just blank once i press submit.where have i gone wrong justsomeguy? or whoever answers to this post
  20. Its not there, I created a folder on the website called "login" in there is the page which uploads a file, within that folder(login) i have another folder called "upload", when i run the required action in mozilla firefox it says it works sucessfully and the file is stored in "uploads/nameofimage.gif/jpeg.(as shown below)Upload: mozilla.gifType: image/gifSize: 12.5576171875 KbTemp file: d:\temp\php3167.tmpStored in: upload/mozilla.gifThis however does not work, i have an upload folder, the code is show below, absolutely nothing is wrong with my code and why does it say it has uploaded sucessfully if it hasnt?<html><head><title></title></head><body><?phpif (($_FILES["file"]["type"] == "image/gif")|| ($_FILES["file"]["type"] == "image/jpeg")&& ($_FILES["file"]["size"] < 100000)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />"; if (file_exists("upload/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]); echo "Stored in: " . "upload/" . $_FILES["file"]["name"]; } } }else { echo "Invalid file"; }?></body></html>That is the code, and yet still on internet explorer i just get page cannot bedisplayed :S, very strange
  21. Ok below is the BODY of my HTML file (the page where you type in the password NOT the username.<body><div id="hdr"><div style="font-weight:bold;font-size:12px;margin:6px 10px;"><span style="color:#FF0000; font-size:30px">Welcome To Sharkadder Software</a></span><span style="text-align:right;"><a href="contactus.html">contact us</a> |<a href="sitemap.html">site Map</a></span></div></span><img src="classic gaming.gif" alt="" border="0" width="450" height="40"/></div><div id="rh-col"><center><span style="color:#0000FF;font-weight:bold; font-size:15px">After the button below is clicked you will then be prompted for a password, type this in on the popup screen that appears.<align="center"></center><br><center><span style="color:#0000FF;font-weight:bold; font-size:15px">Please note you are required to press "submit password" not just press enter</center><center><script LANGUAGE="javascript"> <!--- Hide from tired old browsers var nifty_little_window = null; function gateKeeper() { nifty_little_window = window.open('gatekeep.html', 'theKeeper', 'width=350,height=200,resizable=1'); } // End hiding ---> </SCRIPT><form><input type="button" value="Click Here" onClick="gateKeeper()"</form></center></body></html>Ok now once that is run it allows the user onto the private are page, and the BODY of this pages code is shown below(this page is just HTML code)<body><div id="hdr"><div style="font-weight:bold;font-size:12px;margin:6px 10px;"><span style="color:#FF0000; font-size:30px">Welcome To Sharkadder Software</a></span><span style="text-align:right;"><a href="contactus.html">contact us</a> |<a href="sitemap.html">site Map</a></span></div></span><img src="classic gaming.gif" alt="" border="0" width="450" height="40"/></div><div id="rh-col"><center><span style="color:#FF0000;font-weight:bold; font-size:30px">Private File Download Area<align="center"></center></span></center><br><center><form action="upload_file.php" method="post"enctype="multipart/form-data"><label for="file">Filename:</label><input type="file" name="file" id="file" /> <br /><input type="submit" name="submit" value="Submit" /></form></center><br><center><span style="color:#0000FF;font-weight:bold; font-size:15px">Please note, this area is strictly private & confidential for downloading files with administrator privliges</center><br><center><span style="color:#0000FF;font-weight:bold; font-size:15px">click a link to download the required file<align="center"></center><br><br><span style="color:#0000FF;font-weight:bold; font-size:20px">17th November 2006<align="center"></center><br><span style="color:#000000;font-weight:bold; font-size:15px"><a href="login.txt">login notes + Terms and conditions<align="center"></center><br><br><span style="color:#0000FF;font-weight:bold; font-size:20px">17th November 2006<align="center"></center><br><span style="color:#000000;font-weight:bold; font-size:15px">Object Position V1.0 Code<align="center"></center></body></html>Now can you please amend the code to allow cookies, i looked up on it and wasnt sure where the cookies bit of code was suppost to code, any help will be brilliant, cheers.
  22. Below is my HTML code for the page i am trying to get the form to work on, i have included the code from the start of the <BODY> tag until the end of the form, this is shown below.<body><div id="hdr"><div style="font-weight:bold;font-size:12px;margin:6px 10px;"><span style="color:#FF0000; font-size:30px">Welcome To Sharkadder Software</a></span><span style="text-align:right;"><a href="contactus.html">contact us</a> |<a href="sitemap.html">site Map</a></span></div></span><img src="classic gaming.gif" alt="" border="0" width="450" height="40"/></div><div id="rh-col"><center><span style="color:#FF0000;font-weight:bold; font-size:30px">Private File Download Area<align="center"></center></span></center><br><center><form action="upload_file.php" method="post"enctype="multipart/form-data"><label for="file">Filename:</label><input type="file" name="file" id="file" /> <br /><input type="submit" name="submit" value="Submit" /></form></center><br>Now i could not see anything wrong with that code, below is a php file i created in notepad and then uploaded to my website, it is just to upload images as an example.The file is called "upload_file.php and this code is shown below.<html><head> <title></title></head><body><?phpif (($_FILES["file"]["type"] == "image/gif")|| ($_FILES["file"]["type"] == "image/jpeg")&& ($_FILES["file"]["size"] < 20000)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />"; if (file_exists("upload/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]); echo "Stored in: " . "upload/" . $_FILES["file"]["name"]; } } }else { echo "Invalid file"; }?></body></html>I run the test on mozilla and i get the following message:Upload: bannerbackground.jpgType: image/jpegSize: 7.8603515625 KbTemp file: d:\temp\php270F.tmpStored in: upload/bannerbackground.jpgWhat i have noticed its storing the info in tempory which isnt what i want, i want it saved onto the actual website not my D drive as it says its stored.everytime i try to run that page on IE it never works, i understand bits of the php code but im unsure how it is going to work, if somebody can amend the code to make it work that would be great or if i have missed a whole page of code out then let me know.Any help is apprechiated, thanks Mark
  23. well i already looked into it kind of so i understood some code, i know about limiting the file size and i have set it up numerious times by using forms in HTML but thats just the nice looks, its the mechanics underneath i could not get working, ill add it to my code and if it dont work ill tell you tomorrow along with my code, thanks for the reply.
  24. thanks pulpfiction, tomorrow i will send you some sample code of what the page looks like, then will you be able to midify my code so that it will ask for cookies? im relitevly new to java script so im still learning things
  25. ok in my website i have a passworded area, now as you know not all passworded areas are bullet proof but i have applied 2 ways of passwording the required page, 1 by typing a username in(which is easy to crack yes i know) and 1 where you have to know the name of the page you wish to open(which isnt so hard to crack as its not in the source code).now once somebody has typed in the username and proceeded and then the password they are granted permission in to the private area. The only problem is the user can save that page to there favourates and just click it and the page will come up.However i am wondering how i make it so that if the user has not logged in i.e just clicked that page in favourate or external link the page will redirect them to the login screen.Would you require to see my code for the 2 pages?So what i need is, if the user opens the "private area page" direct. instead of it just coming up because somebody could just get hold of the link, it will redirect them to the login page in which they will have to log in.i know i didnt explain it too well, but if you can help that would be great.Thanks
×
×
  • Create New...