Please HELP!!

This is a discussion on "Please HELP!!" within the PHP Forum section. This forum, and the thread "Please HELP!! are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Aug 30th, 2006, 05:31
JacobHaug's Avatar
SuperMember

SuperMember
Join Date: Dec 2005
Location: On Internet
Posts: 4,859
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to JacobHaug Send a message via MSN to JacobHaug
Cool Please HELP!!

OK I am working on a live flash chat room. But am having a problem with this one part. I know this is really easy so please help. Here is the code...

Code: Select all
<?php
    require_once('http://support.jbwebsitesolutions.com/FlashChat/inc/common.php');

    $id = 'flashchat';
    $params = array();

    $open = false;

    if($GLOBALS['fc_config']['liveSupportMode']) {
        $stmt = new Statement("SELECT * FROM {$GLOBALS['fc_config']['db']['pref']}connections WHERE userid IS NOT NULL");
        if($rs = $stmt->process()) {
            while($rec = $rs->next()) {
                if(ChatServer::userInRole($rec['userid'], ROLE_ADMIN)) {
                    $open = true;
                    break;
                }
            }
        }
    } 
?>

<?php if($open) { ?>onLoad="setFocus()" onUnload="doLogout()"<?php } ?>>


        <?php if($open) { ?>
<center>
<a href="http://support.jbwebsitesolutions.com/FlashChat/flashchat.php" target="_blank">
<img src="http://www.jbwebsitesolutions.com/Pictures/livechaton.gif" border="0" alt="Live Support Online"></a><br>
<br>
</center>
        <?php } else { ?>

<center>
<a href="http://www.jbwebsitesolutions.com/htmlindex/Browser/True-Code/Contact/Support.html" target="_blank">
<img src="http://www.jbwebsitesolutions.com/Pictures/livechatoff.gif" border="0" alt="Live Support Offline"></a><br>
</center>
        <?php } ?>
Ok, I am trying to change one part. I want this to be put onto an existing HTML page. If live chat is offline then display this picture. Like it is doing. If live chat is online then display this picture. I want the same code for the online as I have for offline except I want the name of the picture and link to change. The problem is it just displays both images in the HTML page. It is only supposed to display the current image. Please help I can't figure this out. But it I keep messing it all up. So please help me fix this problem. Thanks!!

Last edited by JacobHaug; Aug 30th, 2006 at 06:20.
Reply With Quote

  #2 (permalink)  
Old Aug 30th, 2006, 10:00
Rob's Avatar
Rob Rob is offline
Head Admin & CEO

SuperMember
Join Date: Jul 2003
Location: at my desk
Age: 34
Posts: 2,952
Blog Entries: 7
Thanks: 7
Thanked 4 Times in 4 Posts
Send a message via MSN to Rob Send a message via Skype™ to Rob
Re: Please HELP!!

Thats weird....

If it's showing both images, then I can only assume the php is not being parsed at all.....

Try putting all the php code in one block and using print statements to output everything. with just one php block, you should be able to track the flow of code a lot easier in and out of the conditional statements.....

To be honest, everything looks ok to me sematically, but like I said, it's almost like the PHP isnt being processed.
__________________
Rob - SEO Specialist
Owner & Founder of Webforumz.com

I am currently unavailable for private work
Reply With Quote
  #3 (permalink)  
Old Aug 30th, 2006, 12:36
JacobHaug's Avatar
SuperMember

SuperMember
Join Date: Dec 2005
Location: On Internet
Posts: 4,859
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to JacobHaug Send a message via MSN to JacobHaug
Cool Re: Please HELP!!

Here look at these pages...

Working Example
http://support.jbwebsitesolutions.com/

Failed Example

Shows Both Images
http://www.jbwebsitesolutions.com/ht...est_index.html

PHP Version Does Something Different
http://www.jbwebsitesolutions.com/ht...test_index.php

I need the working example to be working in the html page i have above. I have no ideal why it does not work. I made it a php page incause that was the problem still it did not work. I am stuck. Also the pages above will not work in IE. Don't try it nothing will happen. Must use Firefox or Netscape.
Reply With Quote
  #4 (permalink)  
Old Aug 30th, 2006, 13:21
Reputable Member
Join Date: Jul 2005
Location: Melksham, Wilts, UK
Posts: 293
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Please HELP!!

The PHP source code is coming through in your .html version; quite simply, the PHP isn't being parsed.

If you add
AddType application/x-httpd-php .html
to your .htaccess file, then that should cure that problem at least. Note - that's assuming that you're allowed overrides of this sort ... and that an alternative would be to do the same thing in your main Apache configuration file
Reply With Quote
  #5 (permalink)  
Old Aug 30th, 2006, 13:59
JacobHaug's Avatar
SuperMember

SuperMember
Join Date: Dec 2005
Location: On Internet
Posts: 4,859
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to JacobHaug Send a message via MSN to JacobHaug
Unhappy Re: Please HELP!!

I don't understand. It does not work in the PHP version either.

http://www.jbwebsitesolutions.com/ht...test_index.php

You said, "the PHP isn't being parsed" what do you mean i do not understand.
Reply With Quote
  #6 (permalink)  
Old Aug 30th, 2006, 14:07
moojoo's Avatar
Moderator
Join Date: Aug 2005
Location: Texas
Age: 31
Posts: 1,762
Blog Entries: 1
Thanks: 0
Thanked 18 Times in 18 Posts
Send a message via AIM to moojoo Send a message via MSN to moojoo Send a message via Yahoo to moojoo
Re: Please HELP!!

PHP is parsed to HTML or should be. if you can see the PHP code in the generated source something is wrong.
__________________
The internet is just a fad.
http://www.mevans76.com
Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)
Reply With Quote
  #7 (permalink)  
Old Aug 30th, 2006, 14:12
JacobHaug's Avatar
SuperMember

SuperMember
Join Date: Dec 2005
Location: On Internet
Posts: 4,859
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to JacobHaug Send a message via MSN to JacobHaug
Unhappy Re: Please HELP!!

Ok cool!! That makes since. Now i do not have a .htaccess file like she said. Or at least i don't think i do. Where can i put this code.

Code: Select all

AddType application/x-httpd-php .html
Can i place this in the html file? Or should i place it somewhere else?
Reply With Quote
  #8 (permalink)  
Old Aug 30th, 2006, 14:16
moojoo's Avatar
Moderator
Join Date: Aug 2005
Location: Texas
Age: 31
Posts: 1,762
Blog Entries: 1
Thanks: 0
Thanked 18 Times in 18 Posts
Send a message via AIM to moojoo Send a message via MSN to moojoo Send a message via Yahoo to moojoo
Re: Please HELP!!

You just have to edit the .htaccess file and add that line. You can always make a new .htaccess file if needed.

http://www.he.net/faq/mime_types.html
__________________
The internet is just a fad.
http://www.mevans76.com
Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)
Reply With Quote
  #9 (permalink)  
Old Aug 30th, 2006, 14:26
JacobHaug's Avatar
SuperMember

SuperMember
Join Date: Dec 2005
Location: On Internet
Posts: 4,859
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to JacobHaug Send a message via MSN to JacobHaug
Unhappy Re: Please HELP!!

OK great the problem is fixed. But new problem has occurred. PHP says I am offline but really I am online? Any ideals of what could be wrong?

PHP Page that works...
http://support.jbwebsitesolutions.com/

HTML Page that is Stupid...
http://www.jbwebsitesolutions.com/ht...est_index.html

PLEASE HELP!!
Reply With Quote
  #10 (permalink)  
Old Aug 30th, 2006, 15:09
JacobHaug's Avatar
SuperMember

SuperMember
Join Date: Dec 2005
Location: On Internet
Posts: 4,859
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to JacobHaug Send a message via MSN to JacobHaug
Re: Please HELP!!

OK guys & gals I am online please take a look and let me know what you think I should do to the code to make it work in the HTML page. Works in PHP just not HTML.
Reply With Quote
  #11 (permalink)  
Old Aug 30th, 2006, 15:19
JacobHaug's Avatar
SuperMember

SuperMember
Join Date: Dec 2005
Location: On Internet
Posts: 4,859
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to JacobHaug Send a message via MSN to JacobHaug
Red face Re: Please HELP!!

OK i found out what the problem is. Somewhere in my code i have not linked to the full URL. Because it is in a seprate dirctionary it should have a full URL link. But the problem is i do not see where i am missing this. Here is the code.

Code: Select all
<?php
    require_once('http://support.jbwebsitesolutions.com/FlashChat/inc/common.php');

    $id = 'flashchat';
    $params = array();

    $open = false;

    if($GLOBALS['fc_config']['liveSupportMode']) {
        $stmt = new Statement("SELECT * FROM {$GLOBALS['fc_config']['db']['pref']}connections WHERE userid IS NOT NULL");
        if($rs = $stmt->process()) {
            while($rec = $rs->next()) {
                if(ChatServer::userInRole($rec['userid'], ROLE_ADMIN)) {
                    $open = true;
                    break;
                }
            }
        }
    } 
?>


<?php if($open) { ?>onLoad="setFocus()" onUnload="doLogout()"<?php } ?>>

        <?php if($open) { ?>
<center>
<a href="http://support.jbwebsitesolutions.com/FlashChat/flashchat.php" target="_blank">
<img src="http://www.jbwebsitesolutions.com/Pictures/livechaton.gif" border="0" alt="Live Support Online"></a><br>
<br>
<font color="#000000" size="3pt">
<b>Live Support is Online!!</b><br> Please chat with the Support Department via the above picture.
</font>
</center>
        <?php } else { ?>

<center>
<a href="http://www.jbwebsitesolutions.com/htmlindex/Browser/True-Code/Contact/Support.html" target="_blank">
<img src="http://www.jbwebsitesolutions.com/Pictures/livechatoff.gif" border="0" alt="Live Support Offline"></a><br>
<br>
<font color="#000000" size="3pt">
Sorry, <b>Live Support is unavailable!!</b><br> Please email our Support Department via the above picture.
</font>
</center>
        <?php } ?>
What do you guys think? What have i missed?
Reply With Quote
  #12 (permalink)  
Old Aug 30th, 2006, 18:11
Reputable Member
Join Date: Jul 2005
Location: Melksham, Wilts, UK
Posts: 293
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Please HELP!!

Are you allowing remote access to require_once? There's a security issues about requiring files from other servers / with full URLs, and I would advise you to use a relatibe path not an http:// URL for this.

i.e
require_once("../Flashchat/inc/common.php");
(or with another ../ in the front if you're another directory down)

For further information about the remote access issues in require_once, see http://uk.php.net/manual/en/ref.file...llow-url-fopen
Reply With Quote
  #13 (permalink)  
Old Aug 30th, 2006, 18:18
JacobHaug's Avatar
SuperMember

SuperMember
Join Date: Dec 2005
Location: On Internet
Posts: 4,859
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to JacobHaug Send a message via MSN to JacobHaug
Re: Please HELP!!

YOU ROCK GRAHAME!!! THANK YOU SO MUCH!! Using a relative path worked great i would of never thought to do that. But it worked!! Thanks!!
Reply With Quote
Reply

Tags
help

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 11:50.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43