PHP - Why Might This Addtional Xml Code Stop Page From Loading?
<?xml-stylesheet href="/player.xsl" type="text/xsl"?> <config> <auto_start>false</auto_start> <player_skin>/test.swf</player_skin> <main_title>Test</main_title> <playlist_title>PLAYLIST</playlist_title> <time_text>TOTAL TIME</time_text> <pan_labels>L,R</pan_labels> <scroller_speed>1</scroller_speed> <scroller_marquee_content>#TRACK_NAME#</scroller_marquee_content> <repeat_is_enabled>false</repeat_is_enabled> <shuffle_is_enabled>false</shuffle_is_enabled> <default_volume>75</default_volume> <default_pan>0</default_pan> <play_list> <item>test.mp3;Test Soundtrack</item> </play_list> </config>Hi, The above code is from an XML file and I added the <?xml line of code to the XML file, but doing so causes the whole page to no longer display the track information (just blank). Is there there a way I could modify that text to try and call it another way? Thanks Edited by hexcode, 16 July 2014 - 02:52 PM. Similar TutorialsHi, I'm new. I have been searching for this, but couldn't find my answer ... I've got a form on page A, with its 'action' attribute set to page B.php. Page B does nothing but process the form data & put it in a database. At the bottom of B.php there's a header redirect to page C. My problem is that page B shows up briefly in the browser, looking all blank and weird. Is there a sensible way around this? I just want it to do its stuff in the background. I realise I should be Ajaxing it all but, apart from the fact that I struggle with Ajax operations longer than a couple of lines, it's important that the site should work without javascript. I HOPE this is a really easy one! Thanks I would like to add another count that after every 4 items, it loops and create a added piece of script, by adding <ul><li> tags after every 4 items. I want to addthis piece of code, every fours items after it close </div> Code: [Select] <ul> <li> <div class="box"> <!--All fields and information here--> </div> <div class="h2"></div> <div class="box"> <!--All fields and information here--> </div> <div class="h2"></div> <div class="box"> <!--All fields and information here--> </div> <div class="h2"></div> <div class="box"> <!--All fields and information here--> </div> <div class="h2"></div> </li> </ul> I currently have this piece of code, which builds a list per every <div class="box">, then closes the item </div> and start another one as same. SEE current CODE. Code: [Select] <?php $dealList = $this->dealList; if(count($dealList)==0) echo '<h3>'.JText::_('NO_DEAL_MESSAGE').'</h3>'; $count = 1; foreach ( $dealList as $row): $link = 'index.php?xxx=' . $row->id; if(!Helper::is_urlEncoded($row->pic_dir)) { $imageUrl = $row->pic_dir; } else { $imageUrlArr= unserialize(urldecode($row->pic_dir)); $imageUrl = str_replace("\\","/",$imageUrlArr[0]); } ?> <div class="box"> information fields here </div> <?php if ($count%2==1){?> <div class="h2"></div> <?php } else if($count%2==0){?> <div class="h3"></div> <?php }$count++ ; endforeach;?> How do I added the Additonal count for efter four items <div class=box"> it places and start over with Code: [Select] <ul> <li> <div class="box"> information fields </div> </li> </ul> Friends, I have a code to filter out stopwords (from text file) out of a string supplied. Seems its not filtering out the stop words. Code: [Select] <?php $CommonWords = file_get_contents('http://minimate.co.uk/stopwords.txt'); $CommonWords = explode("\n", $CommonWords); $keywords = 'This is did samle a as any ass'; $search_keywords = strtolower(trim($keywords)); $arrWords = explode(' ', $search_keywords); $arrWords = array_unique($arrWords); foreach ($arrWords as $word) { if (!in_array($word, $CommonWords) && (trim($word) != '')) { $searchWords[] = $word; } } print_r($searchWords); ?> Output is: Quote Array ( => this [1] => is [2] => did [3] => sample [4] => a [5] => as [6] => any [7] => ass ) So the output is not filtering out any words from that text file. Can someone help me with this? Cheers Natasha T Hi I have an include page full of functions in a secure folder with htaccess. My problem is if the include file does not exsist, I get the following. Warning: include(secure/SecureFunctions.php) [function.include]: failed to open stream: No such file or directory in /home/fhlinux190/d/otoole.co.uk/user/htdocs/streetangels/index.php on line 3 Warning: include(secure/SecureFunctions.php) [function.include]: failed to open stream: No such file or directory in /home/fhlinux190/d/otoole.co.uk/user/htdocs/streetangels/index.php on line 3 Warning: include() [function.include]: Failed opening 'secure/SecureFunctions.php' for inclusion (include_path='.:/usr/share/pear-php5') in /home/fhlinux190/d/otoole.co.uk/user/htdocs/streetangels/index.php on line 3 TIA Desmond. Fatal error: Call to undefined function session_init() in /home/fhlinux190/d/des-otoole.co.uk/user/htdocs/streetangels/index.php on line 6 Is there any way to suppress this as it is giving hackers information. how can i use die but still continue with the html in the rest of code instead of stopping all codes from where die is initiated. i want to die (insert into database) but then still allow the html codes below the die function to work still. \= i have a form with two buttons, one is for submitting the form while button is for generating a random a code and placing it in a textfield. this works fine but the problem is anytime i click on the generate button, it refreshes the page thereby validating the form , which i don't want. How do i make it perform the function without refreshing the page.... Hello everyone, I'm not a php coder so I really need help on a simple question... I am trying to direct users to a page in my mySQL database (http://www.educatorsoverseas.com/index.php?section=teacher&act=registration) via the button form below: <FORM METHOD="LINK" ACTION="http://www.educatorsoverseas.com/index.php?section=teacher&act=registration" target="_blank"> <INPUT TYPE="submit" VALUE="Sign Up"> </FORM> But when when users click on the button it is directing instead to the mySQL authentication page (http://www.educatorsoverseas.com/index.php?section=auth). I don't know why this is happening but can anyone tell me how to make it go to the proper page? When I copy and paste the correct page it works, so I am at a loss as to what to do. Hi guys, basically my problem is I have a jquery pop out window that holds a login form using the "require_once" function but when I enter my login details and send them, if there is another another form on the page e.g contact form it will send that form aswell so it will come up for the errors for the register form because they are empty. can anyone tell me how to stop this from happening? Hi Guys, Im trying to create a registration form so users can sign up to my website, however i have noticed that when the page is refreshed the form automatically submits. Please could somebody help me stop this? Thanks <body> <form name="registration_form" method="post" onsubmit="return Validate();"> First Name: <input type="text" name="first_name"><br /> Last Name: <input type="text" name="last_name"><br /> Email: <input type="text" name="email"><br /> Confirm Email: <input type="text" name="confirm_email"><br /> Username: <input type="text" name="username"><br /> Password: <input type="password" name="password"><br /> Confirm Password: <input type="password" name="confirm_password"><br /> <input type="submit" value="Register"> </form> <?php $connect=mysql_connect("localhost","leemp5_admin","p7031521"); mysql_select_db("leemp5_database",$connect) or die (mysql_errno().":<b> ".mysql_error()."</b>"); $insert_query = 'insert into users (username,first_name,last_name,email,password) values ( "' . $_POST['username'] . '", "' . $_POST['first_name'] . '", "' . $_POST['last_name'] . '", "' . $_POST['email'] . '", "' . $_POST['password'] . '" )'; mysql_query($insert_query); ?> </body> Hi All, Is there any way that PHP can detect if a page has been refreshed? Basically I have a form that when submitted, inserts a row in to a database, but I am finding that when I refresh the page, it repeats the insert statement. Any ideas? Thanks Matt i have a problem i just noticed....i've built a shopping cart that totals quantities of items and shipping etc then a submit button to a payment page... but if a user refreshes the same page after first coming to the cart page it messes up all the totals and data..... i know this has to be a common problem with webpages... does anyone have any advice on combating this issue? any advice is much appreciated..thanks! I seem to have a problem with a PHP page I made. When executed on the server, it loads with a filesize 0 and for some browsers, says it does not exist. I believe that the cause is because it is not parsing due to a syntax error. I've busted my @$$ over this code, trying to find the issue, but cannot find it. Here is the whole page's code on pastie: http://pastie.org/1064160 When I run this code it takes longer then I want to load the search results. I thought by only loading the first 30 rows it catches it would speed things up. Any ideas? I changed the $db to be 30, but only my first page painted and it was not much faster.... Code: [Select] if(!empty($keyword) && $keyword!='Zip Code') $sql="SELECT profiles.*,zipCode FROM profiles LEFT JOIN area_served ON area_served.profileId = profiles.profileId WHERE profileType!='HO' AND profiles.status='Y' $qrystr GROUP BY profiles.profileId $orderby CASE zipCode $zips_order_str , companyName asc "; else $sql="SELECT * FROM profiles LEFT JOIN area_served ON area_served.profileId = profiles.profileId WHERE profileType!='HO' and status='Y' $qrystr GROUP BY profiles.profileId $orderby "; //echo $sql; $db->query($sql); $numRows=$db->numRows(); $page->set_page_data($_SERVER[PHP_SELF],$numRows,$listing,10,true,false,true); $page->set_qry_string("searchFor=$searchFor&cat=$cat&state=$state&keyword=$keyword&distance=$distance&sorting=$sorting&listing=$listing"); $res=$db->query($page->get_limit_query($sql)); $smarty->assign('numResult',$numRows); /* show pagination */ while($row=$db->fetchAssoc($res)) { if($row['thumbnailPhoto']=='personalPhoto' || $row['thumbnailPhoto']==''){ if(!empty($row['personalPhoto'])){ $personalPhoto="profiles/".$row['personalPhoto']; $rimg->setImage($personalPhoto); $row['personalPhoto']=$rimg->resize(75,75,substr($personalPhoto,0,strpos($personalPhoto,"."))."_search"); }else{ $row['personalPhoto']="images/my-photo.gif"; } }else{ if(!empty($row['logo'])){ $personalPhoto="profiles/".$row['logo']; $rimg->setImage($personalPhoto); $row['personalPhoto']=$rimg->resize(75,75,substr($personalPhoto,0,strpos($personalPhoto,"."))."_search"); }else{ $row['personalPhoto']="images/my-photo.gif"; } } if(count($cat>0)){ $row['cat']=@implode(", ",$cat); } if(strlen($row['companyInfo'])>90){ $concat="..."; } else{ $concat=""; } I have some issue with the website just created specifically http://ecolandscaping.co/index.php?m=3 and hosted on the 000webhosting.com. It loads the page slowly. Things what i have consideredto trie to improve better performance: * optimized CSS files * optimized MySQL queries with specifying the rows wanted (SELECT ID, IMAGE.....) * avoid to select an image saved as blob if not necessary etc. * made different image retrieving php files P.S. the website is small of size approx 700KB for loading. Problem is that not all the images (saved in MYSQL BLOB) are loaded successfully. Could anyone have a look and advice what else could cause the performance issue. P.S.S. I do take in account that this isthe free hosting and may cause some problems I have a script which registers people to a database, however it doing something very strange. Whenever I place it into even a single CSS div it adds the registration to the dabase but stops loading the next page (index.php) I find this totally bizarre as I haven't seen anything like this behave before. With CSS affecting how PHP works. Especially when the CSS is not inside the <php> of <form> tags. Code: [Select] <?php include("connect.php"); if($_POST['submit']) { $username = mysql_real_escape_string(trim($_POST['username'])); $password = trim($_POST['password']); $password2 = trim($_POST['password2']); $email = mysql_real_escape_string(trim($_POST['email'])); $error = false; if(!isset($username) || empty($username)) { $error = "You need to enter a username."; } $query = mysql_query("SELECT id FROM users WHERE username = '".$username."' LIMIT 1"); if(mysql_num_rows($query) > 0 && !$error) { $error = "Sorry, that username is already taken!"; } if((!isset($password) || empty($password)) && !$error) { $error = "You need to enter a password."; } if((!isset($password2) || empty($password2)) && !$error) { $error = "You need to enter your password twice."; } if($password != $password2 && !$error) { $error = "The passwords you entered did not match."; } if((!isset($email) || empty($email)) && !$error) { $error = "You need to enter an email."; } if(preg_match("/[a-zA-Z0-9-.+]+@[a-zA-Z0-9-]+.[a-zA-Z]+/", $email) == 0 && !$error) { $error = "The email you entered is not valid."; } $query = mysql_query("SELECT id FROM users WHERE email = '".$email."' LIMIT 1"); if(mysql_num_rows($query) > 0 && !$error) { $error = "Sorry, that email is already in use!"; } if(!$error) { $query = mysql_query("INSERT INTO users (username, password, email) VALUES ('".$username."', '".mysql_real_escape_string(md5($password))."', '".$email."')"); if($query) { $message = "Hello ".$_POST['username'].",\r\n\r\nThanks for registering! We hope you enjoy your stay.\r\n\r\nThanks,\r\nJohn Doe"; $headers = "From: ".$website['name']." <".$website['email'].">\r\n"; mail($_POST['email'], "Welcome", $message, $headers); setcookie("user", mysql_insert_id(), $time); setcookie("pass", mysql_real_escape_string(md5($password)), $time); header("Location: index.php"); } else { $error = "There was a problem with the registration. Please try again."; } } } ?><html> <head> <title>Register</title> </head> <body> <form action="" method="post"> <?php if($error) echo "<span style=\"color:#ff0000;\">".$error."</span><br /><br />"; ?> <label for="username">Username: </label> <input type="text" name="username" value="<?php if($_POST['username']) echo $_POST['username']; ?>" /><br /> <label for="password">Password: </label> <input type="password" name="password" value="<?php if($_POST['password']) echo $_POST['password']; ?>" /><br /> <label for="password2">Retype Password: </label> <input type="password" name="password2" value="<?php if($_POST['password2']) echo $_POST['password2']; ?>" /><br /> <label for="email">Email: </label> <input type="text" name="email" value="<?php if($_POST['email']) echo $_POST['email']; ?>" /><br /><br /> <input type="submit" name="submit" value="Register" /> </form> </body> I have a PHP Page. It is doing a lot of site crawling, throughout a lot of loops. Basically it's getting a massive array together and it's huge. However, it's so big that PHP times out beyond belief. I mean there is no error or nothing. Google throws a major error about page not found, IE shows an internet connection error. It really times out big time. Even though it's not really "A LOT". Any advice on what to do in that situation. I can't show the site/code because of NDA, but was curious if someone had ever done that much work on a PHP page before to have it do that? This should be an easy one but I'm looking for a bit of help. I'm using a php framework and using includes to bring different pieces of a website togethor onto the page. The top of the page uses a flash banner, then there are some simple text sections below. The banner is in it's own php file as well. Wondering if it's possible to have the banner NOT replay after each page load? I'm not sure if this is something I need to setup in the flash file, or if there is a way to do it in the php files? Basically, the banner is the same for all of the pages, and I want it (once loaded) to stay on the page while the details on the bottom change, WITHOUT going through the entire animation again. Make sense? here's the page as it stands now so you can get a better idea what I'm trying to do. http://www.getmoreimpact.com/index.php again not sure if this needs to be done in the flash side, or the php? Any ideas are better than what I've got! Thanks in advance What I'm trying to do is get a php file with content to load into my basic page template based on the page id, however it's not loading anything, however there are no errors coming up. I've looked everywhere I could find, and tried everything I could think of. I really could use some help on this. Below is the page template code and the code I'm trying to use to get the content to load up. page_templ.php Code: [Select] <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" > <link rel="stylesheet" type="text/css" href="templates/content/style.css" > <!--This is the css used for IE because we need to correct some things for it.--> <!--[if IE]> <style type="text/css"> @import 'templates/content/styleIE.css'; </style> <![endif]--> </head> <body> <?php //We need to load our language files with our common text varibles require("content/langeng.php"); ?> <div id="header"> <? //Lets show the header. I use html where I can so smartphones load as little advanced code as possible require_once("header.php"); ?> </div> <div id="menu"> <?//Now our menu. require_once("menu.php"); ?> </div> <div id="mbody"> <?//Now the primary site content. //Load up our postvars.php file require_once("content/postvars.php"); ?> </div> </body> </html> postvars.php Code: [Select] <?php $id = $_POST["id"]; if ( $id == "home" ) { include 'main_c.php'; } elseif ( $id == "guides" ) { include 'guides_c.php'; } elseif ( $id == "trips" ) { include 'trips_c.php'; } ?> So long story short im trying to read a text file line by line and do a cpl db tests agains that one line my file size is about 1300 lines long so I cut it down to 600 and the page is stil stuck loading, can anyone tell me why, my code is below.: (it was working fine I must have just changed something without knowing it) Code: [Select] <?php include ("include/session.php"); $file_handle = fopen ( "To Do.txt", "rb" ); while ( ! feof ( $file_handle ) ) { $line_of_text = fgets ( $file_handle ); $parts = explode ( '=', $line_of_text ); //get the course infomation //Examples: //$Course_info[0] = GEOL //$Course_info[1] = 1002 //$title = Introduction To Geology $Course_info = explode ( ' ', $parts [0] ); $length = strlen ( $Course_info [0] ) + strlen ( $Course_info [1] ) + 2; $title = substr ( $parts [0], $length ); //check to see if this course is already in the database $sql = "SELECT * FROM courses WHERE course = '$Course_info[0]' AND code = '$Course_info[1]'"; $res = mysql_query ( $sql ) or die ( mysql_error () ); if (mysql_num_rows ( $res ) == 0) { //course doesnt exist //lets get the program ID for this course $id_sql = "SELECT id FROM catagories WHERE code = '$course_info[0]'"; $res = mysql_query($id_sql) or die (mysql_error()); $row = mysql_fetch_array ( $res ); echo $row ['code']; } else { //course is already in the database } exit (); } Hello Coders, Iam in a confused situation. I made a php script & in that script i want to check how much time (in seconds) the page is taking to fetch the content from the server. If the time is greater than to i defined time then i want to show a error message to the users. Anybody can give me ideas ..................... ?? |