Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Page Not Read By Conditional When In Sub Folder


I'm using some php conditionals in included footer.

I identify some pages at the top with -

$page='alt_footer'

then have a conditional in the footer.php, like -

if ($page!='alt_footer') {

All works great, but if I put the page in a sub directory (making path adjustments for the includes), it is not recognized as having $page='alt_footer'

All path relationships between the page (in sub folder) and the includes (in folder at same level as sub folder) work fine, just the conditional (from the include to the page) is not recognized.




View Complete Forum Thread with Replies

Related Forum Messages:
Read Folder Structure
I need to create a form which allows the user to create directories within a specific folder that I would specify (for example /public_html/mydocs/). I have seen on certain ISP control panels, a list box that displays the current folder structure of a particular folder (or entire server for that matter) and I would like to know how to achieve this.

My idea would be to have the user type the name of the directory to be created into a text field and then select the folder it needs to be created within from this list box - if someone could help me out with the population/creation of the list box part I would greatly appreciate it.

View Replies !
How To Read From A Folder And Display It As An Image?
How is it you can read from a folder, loop through what is there and display it as an image? My knowledge of this is limited to databases so far, so it'd be interesting just to find out how you do the same with folders.

View Replies !
Read Folder Content And Insert Into Db Checking For Dups
I need to read the content of a local folder, which contains pdfs and insert all the file names into a database. is this possible? If so can someone point me in the right direction?

View Replies !
Pass The Variable From 1st Page And Read It With Other Name On 2nd Page
I am new to this and learning slowly, but I was hoping someone could give me some quick advice on how to create a variable on one page and have it passed to another to be read as an ID for a mySQL database.

I want to pass the variable "varRevID" from one page and have it read as "reviews_id" on the other.

My database is pulling from just the first record and I would liek to designate from the pointing page which record to pull from.

View Replies !
Creating A Folder And Page
im is create a php script which when you register (registrationlogin script already made) it will create a folder where it gets the name from the username field and password the folder with the password from the password field it will then create a page in the folder called index.php (i can make the page i just need help with the script to make the folder and page).

View Replies !
Is It Possible To Read ASP.NET Web Page In PHP?
Is it possible to read another web page in PHP?
If is ASP.NET, the code would be
------------
WebRequest req=WebRequest.Create("http://www.microsoft.com");
WebResponse res=req.GetResponse();
StreamReader sr = new StreamReader(res.GetResponseStream());
String Output=sr.ReadToEnd();
Response.Write("The content is : " + Output);
--------

View Replies !
Read A Web Page
i want to store(read) the contents of a "web page" into a file. how can i do it in PHP. Please help me. The web page contains a table. i want to fetch & store the contents of that table into a file.

View Replies !
Read A Web Page And Then Display
I'd like to read a webpage, the parse it and display a small part of
it. Here is what I've tired. It isn't working.

<?php
$handle = fopen("http://www.yahoo.com/", "r");
$contents = fread($handle, filesize($filename));
echo $contents;
?>

View Replies !
Q: Read Text With VBA From A PHP Web-page
I created a page on our intranet that shows a number and that
increases for every time the page is opened. It is similar to a
visitors-counter.
When I look at the page with Internet Explorer it works just fine.

Now I want to read this web-page from a MS-Word macro and include the
number as a company wide unique id in my MS-Word document.
Unfortunately, the PHP script doesn't update the counter when I call
it from my MS-Word macro.

How can I force PHP to update my counter when I call it from a VBA
macro?

I am using the following code:

View Replies !
Read An HTML Page
It may sound kind of crazy, but I'm trying to see if there's a way php code can 'read' contents of a static HTML page and store the contents into a variable. Is it possible? If so, how?

View Replies !
Load Page Then Read
Is there a way to completely load the page of its HTML elements then read all those elements into a string? For example, I have a PHP page that get its HTML content from the database. I want that page to completely loads, ie., get the content from the database, then write all of that page's text and html elements into a string so I can modify it (ie. remove all the links) to display it in another page.

View Replies !
Read Previous Page Url
I have a query regarding browser url.Let me narrate the exact scenario which i need. I would like to expire my session when a person enters different url in the navigator bar other than my url and comes back to my url. For example if i visit example.com and then i type gmail in the same navigator bar and then move back to my url example.com through browserback button then i have to end the session of my client i mean he has no more access to my site. The same scenario is there for icicibank.com. I wanna the code using php and javascript.

View Replies !
Read Page To Variable
I have tried tons of functions but none works the way I want. I have a page foo.php. Then in that I set a couple of variables. Now, if I include foo.inc.php that file can use all of these variables. Code:

View Replies !
Code To Read A Web Page
How can I read another web page in php. I tried:

$url = 'http://www.yahoo.com'
$contents = file_get_contents($url);
echo $contents;

but I get an error: The specified CGI application misbehaved by not returning a complete set of HTTP headers.

View Replies !
Which Function Do I Need To Read The Page Through Http?
I need read the html page through http and extract the links from it. Which function is better to use for this purpose: fopen() + fread(), file_get_contents(), or fsockopen()?

View Replies !
Read Data From External Page?
I have tried to think of a solution to this problem, but i can't find it. My question is: If possible, how do you from your own page confirm that a form has been send from an external page?

View Replies !
Can't Read Remote Web Page From Local Apache/PHP
I'm trying to read the contents of any Web page on another
host. I'm finding that...

echo file_get_contents( 'http://www.php.net' );

.... works fine if I upload the PHP script to my Web host, and run it
there. But if I run it on my PC, which is running Apache 1.3.33
(Win32) and PHP 5.0.5, then it always times out, and gives me the error
message...

[error] PHP Warning: file_get_contents(http://www.php.net) [<a
href='function.file-get-contents'>function.file-get-contents</a>]:
failed to open stream: A connection attempt failed because the
connected party did not properly respond after a period of time, or
established connection failed because connected host has failed to
respond.

I get the exact same results using...

$fh = fopen( 'http://www.php.net', 'r' ) or die( $php_errormsg );
while (! feof($fh)) {
$page .= fread($fh,1048576);
}
fclose($fh);
echo $page;

Anyone know what could cause this to happen?

View Replies !
Read The Page Of The Site & Rerturn The Contents Of MEMBERS_URL & MEMBERS_NUMBER
a line on my site reads MEMBERS_URL="my2ndsite.com" MEMBER_NUMBER="12345" . Im Trying to read the page of the site & rerturn the contents of MEMBERS_URL & MEMBERS_NUMBER, but i cant get it to work can anyone suggest where ive gone wrong please PHP Code:

$myfile = file("http://www.mysite.com");
foreach ($myfile as $row=>$data) {
if (preg_match('/MEMBERS_URL="(.*?)" MEMBERS_NUMBER="(.*?)"/',$data)) {
echo $data[1];
echo $data[2];
}
}

View Replies !
When A Search Engine Spiders A Page Does It Read The Raw Code Or The Parsed Html?
When a search engine spiders a page does it read the raw code or the parsed html? I ask as I want to confirm if any text retrieved from a database is 'read' not the php code that gets the data.

View Replies !
Drag Files From One Folder To Another Folder (copy) .. Possible?
Is it possible to write codings PHP or Javascript.. GUI representation
of File handling (ie. Drag files from one folder to another folder (copy)
like our windows).. pls give me some reference codings like this..

View Replies !
Creates A Temporary Folder And A File Within The Folder.
I have a PHP script which creates a temporary folder and a file within the folder.

I have a problem when trying to remove the file and folder using my FTP program. The ownership and group are set to NOBODY. I cannot change the permissions on either the file or the folder.

I have tried chmod and chgrp and chown but for some reason I cannot change permissions.

View Replies !
Email With Attachment - Annot Be Accessed. The File May Be Read-only, Or You May Be Trying To Access A Read-only Location.
It is a basic email with an attachment. The email and attachment are getting sent and received ok. When the recipient tries to open the attachment, the right application opens (eg. Excel) but then throws up an error. I am using base64 encoding. For example:

.xls file with base64 encoding:
'testing.xls' cannot be accessed. The file may be read-only, or you may be trying to access a read-only location. Or, the server the document is stored on may not be responding.

.pdf file with base64 encoding:
There was an error opening this document. The file is damaged and could not be repaired.
so the file isn't being decoded right. I have tested on Yahoo and Outlook. PHP Code:

View Replies !
Fgetcsv Returns False In Dynamic Read Vs. Hard-coded Read ??
I am working with directories in PHP for the first time. I have code
that I've changed multiple times to try different things. I would think
this is pretty standard fare so I'm not sure why I can't seem to get it
right.

What I would like to see happen:

The code opens the directory and loops through the files, opening them
and processing them.

What is happening:

If I hard code the name of one particular file (it is always the same
file) in my test setting, fgetcsv does not return false and the code
runs fine. The file is parsed and all is well. However, if I let the
code open a directory and then loop through the files, this one
particular txt file does not work. For debug purposes, I have it
displaying each file name and it can display the name, it just won't
process it.

I've even tried setting a for loop and hard coding each file name
(since right now I know the names - I won't in the future) and the file
is processed. It is only when it is set to my $file var dynamically
rather than being hard coded.

Here is the code:
$handle_dir = opendir('../directory_name');
/* loop over the directory. */
$countfile=0;
while (false !== ($file = readdir($handle_dir))) {
$countfile++;
$filevalues = "";
//Skip the first two files that where found because they are
"." and ".."
if ($countfile 2) {
//echo $file;
//begin loop through each file name
$handle = fopen($file, "r");
echo "Filename is: $file<BR>";//at this point the
code can print the file name
if (false == ($filevalues =
fgetcsv($handle,6021,','))){
echo 'problems<br>'//for one particular file,
this always displays
}

View Replies !
Read File - Limit The Number Of Lines To Read
How can I open a file and then limit the number of lines I want to read? say I have a text file and I only want to read line one to get the title of the text within?

View Replies !
Read (and ONLY Read) A Multi-sheets Excel File With PHP.
I want to read (and ONLY read) a multi-sheets Excel file with PHP.
I found so many scripts on the net that I finally don't know what to choose
so... could experimented users help me to directly find the one that I need
?

Here are the two obvious things the script must match :
- free
- can read multi-sheets Excel files

View Replies !
Remove From $name (folder)/(folder)/[x]/ <-- If Exists To Just Get [x].
I'll be quite honest. I don't have the faintest idea
how to do this, while I can do other php without a problem. Once I
know how to go about it I'll be okay.
It's two things I think?
1. see if there's a trailing slash and delete it.
2. Remove the preceding path to /x, the folders and slashes, and
delete them.
and then I have x.

X by the way is the final folder in a website and this grabs it for
me.

<?
$name = $REQUEST_URI;
?>

View Replies !
Get /folder/ To Redirect To /folder/index.php ?
I have a link www.example.com/folder/ but when people visit this i want it to go to www.example.com/folder/index.php because then it will log the page visit. Any ideas using mod rewrite i can get /folder/ to redirect to /folder/index.php ?

View Replies !
File In Folder Above Root Folder
I have a .php script in a folder one level above my website root, and I'd like to include it in pages in various website subfolders, some below the root. Can I use ($_SERVER['DOCUMENT_ROOT'] in the path in some way.

View Replies !
Read Contents Of An External XML Page And Then Parse Its Contents
I have a URL that generates an XML page. I'm trying to read its contents and parse the information. But, I keep receiving these error messages: Code:

View Replies !
How To Read Up To A Point And Assign The Read Value To An Array.
Open a text file which will look something like this:

QuoteLink 1 http://www.blahblah.com/1651561
Link 2 http://www.etc.com/34324
Link 3 http://www.sdfkjsdf.com/12343423

basically its a "Link n" text followed by a URL text in the format of "http://www.page.com/random numbers"

What I would like the php script to do is to read "Link n" text and output it with the a http link to the URL which follows it. That is it should look something like this in the output:

Link 1
Link 2
Link 3

I have learned how to read a text file with php so far but I have no idea how to make it read up to a point and assign the read value to an array.

View Replies !
Conditional
I am having an issue here that no matter what happens, my else statement is always displayed with my if! Can someone help me, I can't seem to find where I messed up. PHP Code:

if ($_GET['cat'] == "wired") {
    $f_p = "iframe_wired.php";
    echo "<iframe src="$f_p" name="$f_n" scrolling="$f_s" frameborder="$f_b" align="$f_a" height="$f_h" width="$f_w">
    </iframe>";
} else {
    exit();
}

    if ($_GET['cat'] == "wireless") {
        $f_p = "iframe_wireless.php";
        echo "<iframe src="$f_p" name="$f_n" scrolling="$f_s" frameborder="$f_b" align="$f_a" height="$f_h" width="$f_w">
..........................

View Replies !
Conditional Loop
I have one table, "players" that has player info including start season (year). I then have a table for each season with player stats, i.e. games played etc called stats200X where X is the year obviously.

I have no problem with extracting data from the current year, but what I would like to do is get data from previous years too. I was thinking about doing something like:

(year) - (startyear), which for example could be 3.

I don't know where to begin, but I want to be able to loop though previous years so that, if tables exist of course, I could do

select * from stats{Y -1}
display
select * from stats{Y -2}
etc

Would I need to hard code this or is there a way of doing this though a conditional loop?


View Replies !
Conditional Login..
I have a form with a username & password field along with 3 radio buttons.

What I basically want to achieve is if radio button A is checked it will post the username & pass to a.php, If button B is checked it will post the username & pass to b.php and so on for button C.

View Replies !
Checkboxes,conditional
Basically I have what seems to be a very small problem but I am driving ny self mad trying to figure out what the problem is. Here is what I have: I have a form with two checkboxes:

<input type="checkbox" name="medicalcheck" >
<input type="checkbox" name="dentalcheck" >

the form is posting the a php file, decision.php, that simple checks to see if the boxes have been checked and performs an operation in either case. Here is the code:

View Replies !
Once Conditional Causes Error, The Other Doesn't...why?
There are 2 if statements at the beginning of this code snippet.  The one that is currently commented out works while the one that is not commented out yields this error

Parse error: syntax error, unexpected '{' in C:xampphtdocsench2index4.php on line 106

I am just not seeing why. Code:

View Replies !
Conditional Structures
I am wondering about conditional structures and the depth of nesting allowed, if at all. For example I know I can do this: Code:

View Replies !
Conditional Form
I want to condtionally display an HTML form. I havnt got a clue how it can be done, I suppose its the same way as putting html tables in php, but I cant get it to work. Here is the condtion:

<?php 
 if (!empty($pk))
  {    

And here is the form:

<form action="google.php" method="GET" name="deleteForm" >
<input type="hidden" name="pk" value="<? echo $pk;?>">
<input type="submit" value="Delete">
</form>

View Replies !
PHP Conditional Include
I just set up a perl script that outputs a single html file. Works great, but I need to be able to customize that one file for different sections of the site. Specifically I need different navigation and heading on the page.

I'm not a programmer, but this sounds like I want a conditional include to show what I want when I want, right? If so, can anyone give me any idea how to get started with something like this? I figured I'd try with PHP because it sounds easier than fooling with perl.

Also, doesn't a conditional statement generally work from a variable or something else in the page that changes? If so, what do I do when the page stays the same and doesn't include variables?

View Replies !
Include In Conditional
Why does this not work?

if (!$artnr) {
include "./smalltable.php";
}
else {
include "./bigtable.php";
}

Is this the best php group for this sort of question?

View Replies !
If/Else Conditional Statment
I just started php yesterday and found a site with a good tutorial but there's a problem, the "If/Else" statment doesn't seem to work, don't know if it's wrong in the tutorial or what. Code:

View Replies !
Conditional Redirection
I understand the header thing but wanna redirect to different pages based on values entered on the previous page.

View Replies !
OR Conditional Statement
I am trying to do this. But for some reason or does not work. How do you do an or statement with PHP?

if ($var == 8 or $var == 9) {
print "is eight or nine";
} else {
print "not eight or nine";
}

View Replies !
More Than 1 Conditional In A Function
This is a great function I use to echo timestamps as "how long ago" timeframe. This function rounds up the time to the smallest hour, so that 2:55 echos "2 hours ago". The only conditional in this function is Code:

if($difference != 1) $periods[$j].= "s";
and what it does is to add an "s" if the second, minute, hour... is not 1 (pluralization).

I need now to add another conditional so that for anytime greater than 5 hours and less than 24 hours it will echo just the word "Today". I tried many possibilities without much success. Code:

View Replies !
Conditional Against A Variable
what is wrong with this statement? The $ session is defined on the page. $session;

if($row_test['P_ID'] = $session){echo'show value'}
elseif($row_test['P_ID'] <> $session){echo'do not value'}

View Replies !
Conditional Submit
I'm creating a subscription form and i like to know how to create an interactive submit button. What i want is a submit button which only can be used when they agree with the terms of conditions by checking a checkbox.

View Replies !
Conditional Expression
I am trying to list products that are greater than $100 and less than $250. Yet the expression isn't working.

if ( $price >= "$100" ) && ( $price <= "$250" ) echo "$item<br> "; else echo " ";

Obviously if I set my query to

$query = "SELECT * FROM products WHERE price > '$100' AND price < '$250' ORDER BY id ASC";

it works.

View Replies !
Conditional Echoes
I need to place all this within the the echo, but get nothing but a blank page when doing so. (so this only shows when values are present.) Code:

View Replies !
Conditional Processing
imagine i have the following code PHP Code:

if($var == 12)
{
echo 'blah'
echo 'blah'
echo 'blah'
echo 'blah'
echo 'blah'
echo 'blah'
echo 'blah'
echo 'blah'
echo 'blah'
echo 'blah'
}
else
{
echo 'blah'
}

lets imagine that if $var is 12 the page takes 5 seconds to load. if $var isnt 12 will the page still take 5 seconds to load? I need to know if the unused code in conditionals are still processed, or maybe processed before the conditionals.

View Replies !
Conditional Formating
im working with a calendar script called phpicalendar, my install is here. I'm trying to get the cell background to change according to the text in the days event.

ie different class for cell bg I have figured out how to change the html in the template but im not sure how to carry this accross. Code:

View Replies !
Conditional Statement
I have made pages to create databases and the db gets created, but if i specify a not null auto_increment ,primary key the script ignores it and just makes the column a int column. Code:

View Replies !
Perform Conditional
I'd like to check these two conditions:

if ((is_page() or ($category->cat_ID === $cat)){
do something
}

but keep getting an "unexpected {..." error. If I do this, it works fine:

if ($category->cat_ID === $cat){
do something
}


View Replies !
Conditional Onclick
<input type=button value="<?php echo $button_caption ?>" onclick="if (verifyChange() == true) {location.href=$_SERVER['PHP_SELF'].'?homeinclude=member&pageaction=signupok'}">

I get the "missing name after . operator" error.

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved