Page 1 of 3 123 LastLast
Results 1 to 10 of 25

Thread: How do I insert PHP into HTML page?

  1. #1
    Join Date
    Jul 2007
    Location
    England
    Posts
    41
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default How do I insert PHP into HTML page?

    Hi. Before I start, I am a TOTAL newbie at PHP. Infact, I'm not even 100% sure that the code below IS PHP.

    Anyway, I have the following code, as you can see. All I need to know is how to insert it into an HTML page!

    Also, could someone just run through this an check for any errors please, if at all possible?

    ;RuneScape Stats script by Daveoh
    on 1:LOAD:{
    var %i = 1
    while ($gettok(%rsuserlist,%i,32)) {
    .timerrsstats.daily. $+ $v1 00:01 0 1 rsstats $v1 nochan day
    .timerrsstats.hour. $+ $v1 0 3600 rsstats $v1 nochan hour
    .timerrsstats.update. $+ $v1 1 $r(1,60) rsstats $v1 nochan hour
    inc %i
    } }
    on 1:UNLOAD:{
    .timerrsstats* off
    }
    on *:TEXT:!rsstats*:#:{ if (%rsstats.spam) halt | set -u5 %rsstats.spam 1
    if (!$2) { msg $chan !rsstats usage: !rsstats [user] }
    else rsstats $2 $chan
    }
    alias rsstats {
    set %rsuser $1
    set %rsop $3
    set %rschan $2
    if (!$sock(rsstats)) sockopen rsstats hiscore-web.runescape.com 80
    else .timer 1 60 rsstats $1-
    }
    alias -l htmlfree {
    var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x,&,$chr(9))
    return %x
    }
    on *:SOCKOPEN:rsstats:{
    sockwrite -n $sockname GET /lang/en/aff/runescape/hiscorepersonal.ws?user1= $+ %rsuser HTTP/1.1
    sockwrite -n $sockname Host: hiscore-web.runescape.com
    sockwrite -n $sockname Connection: close
    sockwrite -n $sockname $crlf
    }
    on *:SOCKREAD:rsstats:{
    if ($sockerr > 0) return
    sockread %temp
    if ($sockbr == 0) return
    if (%i > 1) { dec %i }
    elseif (%i == 1) {
    if (*does not feature* iswm %temp) { if (%rschan != nochan) msg $v1 $gettok(%temp,1,46) | .timer*. $+ %rsuser off | goto unset }
    set %rsuser. $+ %rsuser $+ .curexp $htmlfree(%temp)
    if (!%rsuser. $+ %rsuser $+ .hourexp) || (%rsop == hour) set %rsuser. $+ %rsuser $+ .hourexp $htmlfree(%temp)
    if (!%rsuser. $+ %rsuser $+ .dayexp) || (%rsop == day) set %rsuser. $+ %rsuser $+ .dayexp $htmlfree(%temp)
    if (!$istok(%rsuserlist,%rsuser,32)) set %rsuserlist %rsuserlist %rsuser
    if (!$timer(rsstats.daily. $+ %rsuser)) .timerrsstats.daily. $+ %rsuser 00:01 0 1 rsstats %rsuser nochan day
    if (!$timer(rsstats.hour. $+ %rsuser)) .timerrsstats.hour. $+ %rsuser 0 3600 rsstats %rsuser nochan hour
    if (%rschan != nochan) {
    msg $v1 Current XP for %rsuser = $eval($+(%,rsuser.,%rsuser,.curexp),2) $+ , earned in last hour = $regsubex($calc($remove($eval($+(%,rsuser.,%rsuser,.curexp),2),$chr(44)) - $remove($eval($+(%,rsuser.,%rsuser,.hourexp),2),$chr(44))),/(?<=\d)(?=(\d{3})+$)/g,$chr(44)) $+ , in last day = $regsubex($calc($remove($eval($+(%,rsuser.,%rsuser,.curexp),2),$chr(44)) - $remove($eval($+(%,rsuser.,%rsuser,.dayexp),2),$chr(44))),/(?<=\d)(?=(\d{3})+$)/g,$chr(44))
    }
    :unset
    sockclose rsstats
    unset %rsuser | unset %i | unset %rsop | unset %rschan | unset %temp
    }
    if (Overall == %temp) { set %i 4 }
    }

    I'm sure this is a very simple question is you know PHP, so I will thank you in advance =).

    MrRSMan.
    Last edited by MrRSMan; 07-22-2007 at 12:00 PM.

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    That's not PHP. I've no idea what it is.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    That code looks like complete nonsense to me. Certainly not PHP. First thought was it might be ASP, but it's too weird for that. There are some other options, but if Twey doesn't know, that's just strange.

    Where did you get the code, and what purpose does it serve? I'm almost positive there's a better way.


    Now, to insert PHP into an html page, you need the page to have a .php extension instead of .html (this will not change how the page functions, at all, but be sure to update links to it, etc.), and enclose the code in PHP tags: <?php ...CODE HERE... ?>

    Following the same logic, whatever that language is, if it is valid, would require tags and an extension... probably. So, if the language is ABC, then there's some chance it would be a ".abc" extension and "<?abc ?>". ...Or something like that. More likely, though, the tags would be <&#37; %>, since that is used by several languages.
    But, really, this is all just random guesses.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    After a quick Google, I think that's mIRC script.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  5. #5
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    In which case what I said above is probably irrelevant, and I'm confused as to why you would want to use this script.
    My best guess is that you would want to embed an object of some sort, and this script would go in an external file.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  6. #6
    Join Date
    Jul 2007
    Location
    England
    Posts
    41
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    The code is supposed to be a high-score lookup for the game RuneScape (http://hiscore.runescape.com/index.ws).

    Is there a better way to acomplish this?

  7. #7
    Join Date
    Jun 2007
    Posts
    64
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Talking

    after a quick google, i found this ->

    http://runearchives.net/derrick/?p=6

    its php...


    btw.: you cant add php to html.. but other way round.. u can add html to a php page..
    so its better to rename your script from maybe index.htm to index.php ..
    now u can work with html and php on 1 page..

    just place php code inside the php tags -> <?php ..CODE.. ?>
    everything outside will be handled as normal html..
    Last edited by kobo1d; 07-22-2007 at 04:05 PM.

  8. #8
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Huh?

    You can add PHP to html all you want. Just, as you said, put it in PHP tags...
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  9. #9
    Join Date
    Jul 2007
    Location
    England
    Posts
    41
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    OK, thank you everyone =)

    If you have any other ideas, I would really appreciate them!

  10. #10
    Join Date
    Jul 2007
    Location
    England
    Posts
    41
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    So the page would look like this? index.PHP

    <head>text</head>

    <body>more text

    <?php

    Code here...

    ?>

    More text</body>

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •