Jump to content

everettcomstock

Members
  • Posts

    12
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

everettcomstock's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi everybody, I solved my issue in the previous post, however now, I am facing a new issue. This script work in Firefox and Opera, but does not work in IE 6 or IE 7. Can anyone see any obvious problems with my code that would keep it from running in IE? Code : function createRequestObject() { var req; if(window.XMLHttpRequest){ // Firefox, Safari, Opera... req = new XMLHttpRequest(); } else if(window.ActiveXObject) { // Internet Explorer 5+ req = new ActiveXObject("Microsoft.XMLHTTP"); } else { // There is an error creating the object, // just as an old browser is being used. alert('Problem creating the XMLHttpRequest object'); } return req; } // The Target DIV is labeled rightSection function handleDivTag(divtag) { var divtag; return divtag; } // Make the XMLHttpRequest object var http = createRequestObject(); // Create the Divtag Handler -- Mainly an IE 6 Fix var divhandler = new handleDivTag(null); function sendRequest(divtag) { // Open PHP script right.php for requests http.open('get', 'right.php'); http.onreadystatechange = handleResponse; divhandler.divtag = divtag; http.send(null); } function handleResponse() { if(http.readyState == 4 && http.status == 200){ // Text returned FROM the PHP script var response = http.responseText; if(response) { // UPDATE ajaxTest content document.getElementById(divhandler.divtag).innerHTML = response; } } } Thanks again for your time. Everett
  2. Hi Guys, I should probably be able to figure this one out, but for some reason it is really kickin' my ass. I have a div (rightSection), that I want to reload every 60 seconds. I do not want to reload the entire page because I have some embedded video clips that will stop playing if an entire page load is started. I know the name of the div, the name will not change and does not need to be dynamic. The source code that I want to load into the div I have separated into another PHP file so that the proper image headers will be returned. This file will also never change. But for some reason, I cannot seem to write a javascript / ajax function that will simply reload "right.php" into "rightSection" div. Here is what I have put together. I personally think it is way to much code for what I am trying to do. function refresh() { // Reload the page every 60 seconds function createRequestObject() { var req; if(window.XMLHttpRequest){ // Firefox, Safari, Opera... req = new XMLHttpRequest(); } else if(window.ActiveXObject) { // Internet Explorer 5+ req = new ActiveXObject("Microsoft.XMLHTTP"); } else { // There is an error creating the object, // just as an old browser is being used. alert('Problem creating the XMLHttpRequest object'); } return req; } // The Target DIV is labeled rightSection function handleDivTag(rightSection) { var divtag; return divtag; } // Make the XMLHttpRequest object var http = createRequestObject(); // Create the Divtag Handler -- Mainly an IE 6 Fix var divhandler = new handleDivTag(null); function sendRequest(rightSection) { // Open PHP script right.php for requests http.open('get', 'right.php'); http.onreadystatechange = handleResponse; divhandler.divtag = divtag; http.send(null); } function handleResponse() { if(http.readyState == 4 && http.status == 200){ // Text returned FROM the PHP script var response = http.responseText; if(response) { // UPDATE ajaxTest content document.getElementById(divhandler.divtag).innerHTML = response; } } } setTimeout("refresh();",60000); Any help or direction with this issue would be greatly appreciated. Thank you, Everett }
  3. Thanks for all of the help guys! I now know what I need to do. Everett
  4. Hi Everyone,       I am trying to create a site where the main header and footer images will show random images from a "theme" folder. The problem that I am running into is that once the "Theme" images load, I would like for them to then stay static while other images (like my random photo from my photo gallery and album cover from my radio station) are able to "refresh".       Would you recommend that I use sessions or maybe pass a variable that sets the "theme." I am not looking for specific scripting help, mainly just ideas of what you think would work the best, and what would be the "cleanest" method for the script. Sorry for all of the apostrophes! Thanks for all of your help! Everett
  5. Hi Evereyone,   I also just noticed, that my scripts actually work in Firefox. It seems to be IE 6.0 (and possibly other versions) where I experience the problem. If this triggers any ideas, pleaselet me know! Thanks! Everett
  6. Hi Everyone,       Sorry to bother you all, but I have a problem that is just driving me nuts. I am a novice PHP programmer, and I have programmed two different sites to display an album cover. The first site is www.otteradio.com. This site shows the currently playing album cover and song name. I have a personal website (www.everettcomstock.com) that shows the same album cover and song name. The otterradio.com site always displays the cover picture correctly, but my personal site will not show pictures if the title includes and apostrophe. I am not using a database like MySQL, and the links are all Raw URL Encoded. I am going to post a little bit of my script in hopes that it will help any of you who are interested in this problem. I use a separate file to actually display the image and image header (image.php) I call it from a URL embedded in am IMG tag: <?php $path = $_GET[path]; $image = imagecreatefromjpeg("$path\folder.jpg"); header("Content-Type: image/jpeg"); imagejpeg($image); ?> I have a separate file where I gather current song information (getsonginfo.php) to create the link for the URL used to call image.php: <?php $info = file("D:\Webroot\everett\otterradio\history\songhistory.html"); $Artist = array("$info[0]", "$info[4]", "$info[8]", "$info[12]", "$info[16]", "$info[20]", "$info[24]", "$info[28]", "$info[32]", "$info[36]"); $Song = array("$info[1]", "$info[5]", "$info[9]", "$info[13]", "$info[17]", "$info[21]", "$info[25]", "$info[29]", "$info[33]", "$info[37]"); $Album = array("$info[2]", "$info[6]", "$info[10]", "$info[14]", "$info[18]", "$info[22]", "$info[26]", "$info[30]", "$info[34]", "$info[38]"); $File = array("$info[3]", "$info[7]", "$info[11]", "$info[15]", "$info[19]", "$info[23]", "$info[27]", "$info[31]", "$info[35]", "$info[39]"); $y=0; While ($y != '10'){                          $filepath = pathinfo($File[$y]);  //File Path $dirpath = $filepath[dirname]; //Convert to Directory Path $rawencode = rawurlencode($dirpath); //Raw Encode the path to HTTP URL $Path[$y] = $rawencode; //Store Path Variable $y++; } $x=0; While ($x != '10'){ if ($x=="0"){ $imagepath = "<img class='npcover' src='http://otterradio.com/songinfo/image.php?path=$Path[$x]'>";                           } else { $imagepath = "<img class='cover' src='http://otterradio.com/songinfo/image.php?path=$Path[$x]'>"; } $Image[$x] = $imagepath; $x++; } ?> And finally, I include the getsonginfo.php file on both pages and place the $Image[0] variable where I want the cover art to be displayed. Again, for some reason, it works great at otterradio.com, but at everettcomstock.com, the art does not display when the artist name or song title has an apostrophe in it.   Sorry for posting so much code. Thanks for all of the help. And, if you have any suggestions outside of my question, I would love to hear them. Everett
  7. Hi Hitman,       I actually considered using the file() function, but the problem I encountered was that all of the empty lines in my original file were entered into the array. If you know of a way I could use that function, and strip all of the blank lines from my input text, I would appreicate the knowledge. I am currently using html like sperating characters to tag the information that is in the input file. If there is an artists name it is encased in <ARTIST></ARTIST>, or if it is a song it is encased in <SONG></SONG>. So... I believe I could use the file_get_contents function and possibly even trim the blank entries using the trim function. However, I am also unsure as to how I would then take the individual strings (ie."<ARTIST>311<?ARTIST>") and then build arrays suchas $artist[], $album[], and $song[]. As always, much thanks for everyone who contributes to this forum. You guys are lifesavers for those of us who are still learning. Everett
  8. Hi Everyone,       I posted to this forum earlier this evening and I was instantly helped by numerous people. Thanks again for your time. I am now noticing some odd behavior from the script that I am attempting to write. It is acting as if it is "timing out" or possibly reaching the FEOF in different parts of the script. Specifically, the script starts a Foreach loop that outputs the variables of an array to the screen. When I refresh the page it may output 275 values or it may output 308 values. The input varibles do not change but the amount of output seems to be random (Between 275 and the entire file output). I ave checked my PHP.ini, and I do not believe the script is timing out, but I have not ruled out that possibility. I believe the FEOF is being reached because I have multiple fields where there is no data in the file. Here is the script, and if you have any thoughts, I would love to hear them. Thanks! <?php $file = "playlist.txt"; $fileopen = fopen($file,"r"); $filearray = array(); while (!feof($fileopen)) { $temp = fgets($fileopen); $trimtemp = trim($temp);       if (!empty($trimtemp)) $filearray[] = $trimtemp; } foreach ($filearray as $key => $value){ echo"$key - $value <br>"; } fclose($fileopen); ?> example output: 0 - 1 - !!!Otter Radio Rocks!!! 2 - ...And You Will Know Us by the Trail of Dead 3 - 10,000 Maniacs 4 - 30 Seconds To Mars 5 - 30 Seconds to Mars 6 - 311 7 - 3rd Bass 8 - A Perfect Circle 9 - A Tribe Called Quest 10 - Aaliyah 11 - Aaliyah feat. DMX 12 - Aaron Lewis/Sevendust 13 - Afroskull 14 - All Mighty Senators 15 - American Football 16 - Archie Eversole 17 - Art Tatum 18 - Ashanti ..... .......................And So On.............
  9. Hey Everybody, thanks for all of the help. And thanks for passing on some knowledge to a newbie. Have a good one. Everett
  10. Hi, I am fairly new to PHP and I was wondering if someone could help me out with a script I am attempting to write. I am trying to read a file into an array. PHP makes that very easy with the file() function. However, the text file that I am reading has multiple lines that are completely blank. Is there a way to use fgets instead of file() to create an array that will not have blank entries? Or... is there a way to clean the array made by file so that all blank values are erased and all empty keys are deleted and re-numbered? Thanks for all of the help! <?php $file = file("playlist.txt"); print_r(array_values($file)); OR...... $filearray = array(); $y = "0"; $fp = "playlist.txt"; $file = fopen($fp,"r"); while (!feof($file)) { $temp = fgets($file, 4096); $trimtemp = trim($temp); $filearray[$y] = $trimtemp; $y++; } print_r(array_values($filearray)); ?>
  11. Hi Barand, Thanks for the reply. And thanks for helping me clean up my code. I visted the PHP.net site after I read your reply and looked up some of the functions that you used, and agreee my original code needed improvement. After much tinkering around, and some modification to my code, I actually found that the reason Firefox and Opera were not submitting entries correctly was because of the window configuration I was using. I was submitting the info from a child window that also closed itself when the submit button was pressed. Firefox and Opera close the window so fast, the information was never submitted to the database. I have fixed the window and everything works great. Thanks again for all of the help. I would have been looking in the wrong direction for days I'm sure. Cheers, Everett
  12. Hi Guys, Sorry for the Newb question, but this is stumping me, and I am not finding any posts similar to my problem. I have created a simple PHP/MySQL guestbook on my website, and it actually works when you use IE. But I tried it using Firefox the other day and I got a "Couldn't Execute Query" (from my code) error. Here is the code: <?php $host="localhost"; $user="root"; $password=""; $database="guest"; $connection=mysql_connect($host,$user,$password) or die ("Couldn't connect to server"); $db=mysql_select_db($database,$connection) or die ("Couldn't select database"); if ($button == "Submit") { foreach ($HTTP_POST_VARS as $value) { $query="INSERT INTO entry (name,comment) VALUES ('$name','$comment')"; $result=mysql_query($query) or die ("Couldn't Execute Query."); } } ?> The code is sent three POST variables - $button, $name and $comment. My database has a table named entry. Entry has three fields - time, name, comment. Time is a TIMESTAMP field with the default value set to NULL so that MySQL will insert a value. Time is also the primary key. Name is setup as a STRING, and Comment is setup as LONGTEXT. I believe my error is just the format that I am using for my INSERT string, but I am not yet skilled enough with PHP or MySQL to determine what I am doing wrong. Any help would be greatly appreciated! Thank you, Everett
×
×
  • 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.