Need some php and asp help (pretty simple)

Started by Ride, July 21, 2004, 04:22:02 PM

Previous topic - Next topic

Ride

I have 2 sites.  The main site is on a windows machine and SMF is on a linux machine.   I've been running the php include on my windows machine just fine to display the latest topics.  The one problem is that if the SMF machine goes down (it gets a lot of traffic) the php errors on my windows machine all show up cuz it obviously can't connect.  What do I put in the php code on the windows machine that displays nothing when there is an error or says something like "forum currently down."  My other questions is, is there a way to use asp to display the latest topics?  I'm trying to get away from using php altogether on the windows machine.  Thanks for any help!

Aquilo

#1
if your using the include function then this should be what your looking for. the ASP thing dono sorry someone else might know.

<?php
[...]
if (!@include 'http://www.example.com/forum/SSI.php?blah=blah')
{
echo 'The forum is currently down';
}
[...]
?>

Vinoth

php would work on windows server, but as not so perfect as in linux though.

and that is not possible to show your recent topics in SMF using ASP. you can't.

Vinoth And Sachin ( SpecHackers Team )
The Best  Way to Help Poor Is not Becoming One Of Them.

Tony Reid

Quote from: SpecHackers on July 22, 2004, 10:08:51 AM
and that is not possible to show your recent topics in SMF using ASP. you can't.


It IS possible, its only a DB lookup.

Tony Reid

Ride

#4
Quote from: Aquilo on July 22, 2004, 12:36:04 AM
if your using the include function then this should be what your looking for. the ASP thing dono sorry someone else might know.

<?php
[...]
if (!@include 'http://www.example.com/forum/SSI.php?blah=blah')
{
echo 'The forum is currently down';
}
[...]
?>


Thanks for that.  One other question regarding that....How do I display a custom message like the above if the ssi.php comes back with errors? (like if it can't connect to the db or something). 

For the second thing, I've decided to use an iframe which has a html file from the smf server that displays the topics.  Are most browsers compatible with iframe?

Aquilo

the way that example is it will output what ever the server sends out, except error headers like "403, 404 not found" don't know about 500 but you get the idea, so a MySQL error written to the output page will be retrieved by "include" SO you should get db errors or any other error the script writes to the body.

Vinoth

DB Is in mysql, and  <%  Asp dos not supports %>
Vinoth And Sachin ( SpecHackers Team )
The Best  Way to Help Poor Is not Becoming One Of Them.

Tony Reid

Tony Reid

Ride

What I'm asking is can you put an if statement in there that will say "forum down" instead of displaying the errors.  Basically I want to be covered if a)the forum server completely goes down i.e. 404 errors and b)the forum gets messed up causing the ssi.php to display errors.  Thanks.

[Unknown]


Ride

Quote from: Hector Gonsales on July 23, 2004, 06:12:23 PM
ASP or ASP.NET?

-[Unknown]

I'm using php for this since the file will be on the forum server and displayed using an iframe.  So how can that be done in php?  Thanks.

[Unknown]

Using an iframe will make this problem unavoidable.

-[Unknown]

Ride

Quote from: [Unknown] on July 26, 2004, 04:46:48 PM
Using an iframe will make this problem unavoidable.

-[Unknown]

I don't think the iframe has anything to do with it.  Let's just say I have a simple php page with the ssi include on it.  If errors occur, there is no way to keep them from showing up?  I'd rather have nothing come up then a huge list of errors.

[Unknown]

If you include with SSI, the error message is not optional.  Unless you have a special "uber configurable" shtml engine, which I don't think exist, you simply cannot get around it.  Using an iframe leaves it up to the browser - and, if the server is down they will ALWAYS display an error message in this case.

So, the only way you could do anything about it is with PHP, Perl, ASP, or ASP.NET.  Javascript could also do it.

-[Unknown]

Ride

I guess I had 2 questions in one.  The iframe calls a php page which has a php include on it. 

#1 If the database goes down but not the forum server, I want to hide the php errors it'll generate.

#2 If the iframe can't be displayed (the forum server goes down thus the page is missing for it to show) I'd love some sort of script (java or asp) to display something else instead.


What do ya think?  For #2 basically a code that says this  "if I can't find 'forumserver/pagewith ssi.php' then display 'errorpage.html'

[Unknown]

Quote from: Royce on July 29, 2004, 08:51:40 PM
I guess I had 2 questions in one.  The iframe calls a php page which has a php include on it. 

#1 If the database goes down but not the forum server, I want to hide the php errors it'll generate.

#2 If the iframe can't be displayed (the forum server goes down thus the page is missing for it to show) I'd love some sort of script (java or asp) to display something else instead.


What do ya think?  For #2 basically a code that says this  "if I can't find 'forumserver/pagewith ssi.php' then display 'errorpage.html'

Ah, so I was misunderstanding you.  Here's what I read:

Server A             <----->           Server B
ASP/etc.                               PHP
Site                                   iframe


If Server B went down, you would no longer be able to access the iframe or PHP, and the error message would be up to the browser.

For this reason, I would recommend using ASP.NET to include a file from Server B, or use the MySQL (yes they exist!) assemblies that are available to just access the data directly.

-[Unknown]

Ride

Quote from: [Unknown] on July 30, 2004, 04:25:49 PM
Quote from: Royce on July 29, 2004, 08:51:40 PM
I guess I had 2 questions in one.  The iframe calls a php page which has a php include on it. 

#1 If the database goes down but not the forum server, I want to hide the php errors it'll generate.

#2 If the iframe can't be displayed (the forum server goes down thus the page is missing for it to show) I'd love some sort of script (java or asp) to display something else instead.


What do ya think?  For #2 basically a code that says this  "if I can't find 'forumserver/pagewith ssi.php' then display 'errorpage.html'

Ah, so I was misunderstanding you.  Here's what I read:

Server A             <----->           Server B
ASP/etc.                               PHP
Site                                   iframe


If Server B went down, you would no longer be able to access the iframe or PHP, and the error message would be up to the browser.

For this reason, I would recommend using ASP.NET to include a file from Server B, or use the MySQL (yes they exist!) assemblies that are available to just access the data directly.

-[Unknown]


I guess I was hoping there was some type of javascript that could say "if ya can't find the iframe file, show this layer instead"  Is that possible?

Advertisement: