PHP - Php As Virtual Include (.shtml) Displays 0
Howdy!
A client's web page is .shtml and includes various PHP files via standard virtual include: Code: [Select] <!--#include virtual="session.php" --> These PHP includes worked fine until recently, when PHP files that produce no visible output began displaying a 0 (zero). For instance, the session.php file above is here in it's entirety: Code: [Select] <?php session_start(); ?> The include is on the first line of the .shtml file, and includes that bit of code, but displays a 0 in the browser. If I echo anything at all the 0 goes away, but of course we don't want to echo anything before the <html> tag in the .shtml file. The short-term and unacceptable solution is to echo an empty HTML comment, as follows: Code: [Select] <?php session_start(); echo "<!-- -->"; ?> As noted, this causes the 0 to disappear but now we have <!-- --> before the HTML. Repeat: This was not happening when the .shtml and PHP was installed, and the files have not changed. Therefore, it seems that this problem is caused by a change in PHP and/or Apache configuration. Has anyone seen this and/or can anyone explain what's going on? Thanks! Similar TutorialsHi all, I have a strange issue going on. It may be server related, but I don't know what to look for. I have a .php page with a few Virtual Includes: Code: [Select] <?php virtual ("nav.shtml"); ?> ...throughout it. I have also a parser that is displaying XML data in a table form. The parser works with the standard: Code: [Select] <?php include ('parser.php'); ?> ...however, if I have the Virtual above the include, the parser doesn't work. Or at least it will not "find the file" however, the file is there and it works ABOVE the virtual, displaying it fine... For example, this works: Code: [Select] <?php include ('parser.php'); ?> <?php virtual ('file.shtml'); ?> This doesn't: Code: [Select] <?php virtual ('file.shtml'); ?> <?php include ('parser.php'); ?> Any thoughts? Hello to everyone.
I have a php website, in which i would like to integrade a virtual keyboard in any text boxes I have on it, including in google custom search.
I found in a website a virtual keyboard which is free for integrade in javascript code.
But when I am trying to use it, It appears the text box and the keyboard together.
I would like to know if there is any way to catch and use only the virtual keyboard in the existing text boxes in my page, I would like to take only the keyboard from the set of these both text box and keyboard and use it in my site.
I don't know if I am being understandable, if no please tell me.
Thanks in advance.
The keyboard, is from the website: http://www.greywyver...script/keyboard
Thank you very much !!!
This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=347966.0 Alright so I'm going to try to explain this as best I can.. Basically right now to access a specific row in a DB the url is ?id=1 The page uses the $_GET to search for the row where id=1, blah blah blah But I have another script that cannot use ?id= on url, it needs to be a static url like index.php or /dir/ or index.html, if that makes sense.. So if I had a url index.php?id=1 the script only allows index.php, thus it doesn't find the right content because without the ?id it just shows all rows, not that specific one.. So basically I need some way to make a virtual link, for example test.com/id/1 do the same as index.php?id=1 without actually creating hundreds of dir's and pages =/ Any ideas? A lot of bigger websites do this but I'm not sure how so any help would be greatly appreciated My current code (see below) uses 147MB of virtual memory! My provider has allocated 100MB by default and the process is killed once run, causing an internal error. The code is utilising curl multi and must be able to loop with more than 150 iterations whilst still minimizing the virtual memory. The code below is only set at 150 iterations and still causes the internal server error. At 90 iterations the issue does not occur. How can I adjust my code to lower the resource use / virtual memory whilst still maintaining lightning fast speed for executing the URL and receiving the results? Alternatively, Is there an example where I am able to do overlapping HTTPS requests (rather than the below) while getting the results as they arrive. Language which supports threads to do this? Thanks! <?php function udate($format, $utimestamp = null) { if ($utimestamp === null) $utimestamp = microtime(true); $timestamp = floor($utimestamp); $milliseconds = round(($utimestamp - $timestamp) * 1000); return date(preg_replace('`(?<!\\\\)u`', $milliseconds, $format), $timestamp); } $url = 'https://www.testdomain.com/'; $curl_arr = array(); $master = curl_multi_init(); for($i=0; $i<150; $i++) { $curl_arr[$i] = curl_init(); curl_setopt($curl_arr[$i], CURLOPT_URL, $url); curl_setopt($curl_arr[$i], CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl_arr[$i], CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($curl_arr[$i], CURLOPT_SSL_VERIFYPEER, FALSE); curl_multi_add_handle($master, $curl_arr[$i]); } do { curl_multi_exec($master,$running); } while($running > 0); for($i=0; $i<150; $i++) { $results = curl_multi_getcontent ($curl_arr[$i]); $results = explode("<br>", $results); echo $results[0]; echo "<br>"; echo $results[1]; echo "<br>"; echo udate('H:i:s:u'); echo "<br><br>"; usleep(100000); } ?> i want to make virtual money (credits, tokens) whatever you want to call it but make no mistake this is not for profit at this point but i like the concept of visitors having something to do with other members of site for example to kill bordom and create a reason to play games, compete in competetions, it will have to conversion to real money at this point but i wish to do this script using php and mysql and have very basic coding skills in these areas anyone please help me make this script... reply and let me know if you like this idea please help me as this is achievable as fb has it and more sites are moving toward these same ideas, even tho fb is real money it is more to do with fun at this point until we do this stage another stage canot proceed it. This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=347820.0 Hi. I am pretty new to this and am having difficulty looping through rows. I have the code below which first selects a name based upon the id sent from a GET on a separate page. It then has a second select query to get the data from all rows which have this name. I then want it to display the name, and city once but all of the comments. The code below only shows one of each though. Thanks in advance Code: [Select] <?php $id = $_GET['id']; // Retrieve data from database $sql="SELECT landlord_name AS name FROM $tbl_name WHERE id=$id"; $query=mysql_query($sql); //loop through the rows while ($rows = mysql_fetch_array($query)){ $name = $rows['name']; } $sql2="SELECT city, landlord_name, landlord_comments FROM $tbl_name WHERE landlord_name= '$name'"; $query2=mysql_query($sql2) or die(mysql_error()); while ($data = mysql_fetch_array($query2)){ ?> <table width="600" border="1" cellspacing="0" cellpadding="0" align="center"> <tr> <div id="name"><? echo $name ?></div> <div id="city"><? echo $data['city']; ?></div> <div id="comments"><? echo $data['landlord_comments']; ?></div> </tr> </table> <? } //End While ?> Hi There, I have the following code: two arrays: $user_body_group & $DB_Seconday_muscles I want to look up the "$DB_Seconday_muscles" Array and search for the elements in the "$user_body_group" array The result would be displaying a checkbox list with only the items in the "$user_body_group" array checked: foreach($DB_Seconday_muscles as $value) { echo "<input name=\"colors[]\" type=\"checkbox\" value=\"$value\""; if (in_array($value,$user_body_group)) { echo "CHECKED"; } echo "> $value "; } BUT... When i run thi script i only get the first element in the searched array ticked. Can anyone help! Many Thanks! Leatfield I must be mixing apples and oranges here or something trying to get two columns/fields of MySQL data to display.
The basic HTML page display OK and there are no MySQL Connection errors (finally resolved those).
<HTML snipped> <?php require '...<URL snipped>...'; if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $sql="SELECT `name`, `id` FROM `roster`"; $result = mysqli_query($con,$sql); $num=mysqli_num_rows($result); mysqli_close($con); ?> <table border="0" cellspacing="2" cellpadding="2"> <tr> <td> <font face="Arial, Helvetica, sans-serif">NAME</font> </td> <td> <font face="Arial, Helvetica, sans-serif">ID</font> </td> </tr> <?php function mysqli_result($res, $row, $field=0) { $res->data_seek($row); $datarow = $res->fetch_array(); return $datarow[$field]; } $i=0; while ($i < $num) { $f1=mysqli_result($result,$i,$datarow[$field]); $f2=mysqli_result($result,$i,$datarow[$field]); ?> <tr> <td> <font face="Arial, Helvetica, sans-serif"><?php echo $f1; ?></font> </td> <td> <font face="Arial, Helvetica, sans-serif"><?php echo $f2; ?></font> </td> </tr> <?php $i++; } ?> </table> <?php ?> <HTML snipped>Any assistance is appreciated. Thanks very much. - FreakingOUT I have set up two directories in www which reflect two domains I have using uniform server z which is a wamp package.
I have set up Vhosts also.
The sever is accessible from the internet The directories hold a simple hello world page ( one index HTML and one index.php) I set these up on uniform server z to test access as I have previously had problems getting virtual host to work on coral 6.8 I can test the IP address fine and ping the sever. I can access the two addresses from the net (not on my local network) How ever when I access either site externally I get the Index of/ My DirectoryIndex in the main apache config allows index.php & index.html. I also have that in the .htaccess and in the Vhosts ht access. The Index of however only shows a favicon and not the index.html/php Any help appreciated. CanI put one INCLUDE statement INSIDE of another INCLUDE statement? Hi Guys.. Merry Christmas Im kinda new to this fantastic world of PHP and i have a little problem i hope you can help me with. Im trying to build a website where I use include() to genereate my content. On my index.php i have a menu which includes content in a content div from external .php pages, my structure kinda goes like this.. (simplified) site/ index.php content/ fronpage.php products.php contact.php The HTML looks like this. <div id="menu"> <ul> <li><a href="index.php?page=frontpage">frontpage</a></li> <li><a href="index.php?page=products">frontpage</a></li> <li><a href="index.php?page=contact">frontpage</a></li> </ul> </div <div id="main"> <?php include('/content/'.$_GET['page'].'.php'); ?> </div> This all works very fine, but my problem is, can I have a include inside an already included page? I would like to have a menu on my products.php site, but that page is already included from above, and i would like the menu on the products.php site to stay as the content from the nested include changes with input from the /products folder. my idea was something like this. site/ index.php content/ frontpage.php products.php contact.php products/ product1.php product2.php the HTML on the index.php is the same as above and then i would add the include() on the products.php page, so its kinda the same thing, but one inside the other. HTML inside the products.php folder <div id="sub_menu"> <ul> <li><a href="#">frontpage</a></li> <li><a href="#">frontpage</a></li> <li><a href="#">frontpage</a></li> </ul> </div <div id="sub_main"> <?php include('/content/products'.$_GET['#'].'.php'); ?> </div> I dont know how to link to the new files so they will be included while the first include still stays on the page. Any of you know how and if this can be done? Or maybe at better way to do it? Hope this made sense, my first PHP question Thanks Hi Still a new comer when it comes to PHP. I have a situation where I want to use an include within an include and I am having trouble with my file paths. My main header include, includes everything for each page of my site, beyond the opening of the body to incorporate my navigation etc conditionally loading in css, and loading in titles and meta data etc depending on the page in question. This header needs to reference another include called the-pod.php which is required for every page, the only trouble is I want to use / to reference the root of the server and this is breaking my code. I can't use ../../ etc as its a different path depending on where the master file is located. So my question is how do I get around this? Can the root of the server or path to the root be stored in a variable? and if so how would I write this. Any tips / advice will be greatly appreciated. First, I would like to say when i tried to recover my account from this website, I took me 10 attempts to get the captcha right and then finally it said it sent me an email to my gmail account. I checked spam folder and everything there was no such email from this site. Then I decided to create a new account, well, it took me another 10 attempts to get the captcha right and finally when it was submitted, the page was loading for around 3 minutes before it signed me in.
My question is about the php date() function. It accepts a format to display a time. In the following example I use F for full representation of month, d for 2-digit day of month with leading zeros, Y for full year, g for 12-hour format without leading 0s, s for seconds and A for meridiem. It uses the correct format, but it gives me the wrong time. My local time is 4:43 and it prints out 4:12:
<?php echo "<p>order processed on " . date("F d, Y g:sA") . "</p>"; ?> Why is it 30 minutes behind?
Hi, I need code that reads from the roles database and then selects which file from these 3 which I want. For example, the user.php file would be loaded if the user has UName = user, Pass = 124, and Roles = User added to the database. But the admin.php and boss.php files would not appear to him.
<?php session_start(); if(!(isset($_SESSION['User']))) { header("Location: index.php"); exit(0); } ?> <!DOCTYPE html> <html> <body> <?php include "config.php"; ?> <!--show for User--> <?php include 'user.php';?> <!--show for Admin--> <?php include 'admin.php';?> <!--show for Boss--> <?php include 'boss.php';?> </body> </html>
Hi I have a list of states using the array method in a form. The drop down menu works fine. I want to save the user choice,if the form is re-displayed due to a blank field or pattern mismatch. I know I can use the selected=selected, but don't know wher to put the statement: My array is: state_province = array ("list of states", "provinces") Var in my labels array is "state"=>"state" Here is my code for the select/option statement: { if($field == "state") { echo "<div class='province_state'><label for='state' size='10'>* Province/State</label><select>"; foreach($state_province as $state) { echo "\n<option value='$state_province' /> "; echo $state ; echo "</option>"; } echo "</select></div>\n"; } ?Is this the correct code to add and where would I add it? if(@$_POST['state'] == $value) { echo "selected='selected' "; } When I put this above all else in my document and test it offline, all I see is code in the browser. But when I test it on my web server, I can view the markup and whatnot. Does anyone know why this is? |