Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2007
    Location
    London
    Posts
    1,577
    Tokens
    36

    Latest Awards:

    Default [PHP] Help with problem

    Hello,

    This is part of my PHP code:

    Code:
    <?php
    if($port != !$port)
    {
        $port = $_POST['port'];
        $handle = fopen('/home/XXXXXXXXXXX/public_html/players/'. $port .'.asx', "x+");
        $line1 = '<ASX version="3.0">'
        $line2 = '<title>Radio</title>'
        $line3 = '<entry>'
        $line4 = '    <title>Radio</title>'
        $line5 = '    <author>Tech-Hosts.co.uk</author>'
        $line6 = '    <ref href="http://shoutcasts.tech-hosts.com:'. $port .'/"/>'
        $line7 = '</entry>'
        $line8 = '</ASX>'
        
        fwrite($handle, $line1."\n")
        fwrite($handle, $line2."\n")
        fwrite($handle, $line3."\n")
        fwrite($handle, $line4."\n")
        fwrite($handle, $line5."\n")
        fwrite($handle, $line6."\n")
        fwrite($handle, $line7."\n")
        fwrite($handle, $line8."\n")
        fclose($handle);
    I get this error when simply opening the document ($port is nothing/not defined).

    Code:
    Parse error: syntax error, unexpected T_VARIABLE in /home/XXXXXXXX/public_html/playercode.php on line 45
    Line 45 is:

    Code:
        $line2 = '<title>Radio</title>'
    I'm not very good at PHP, I just pick things up as I go along and I've never spent time learning it. I'm trying to code a simple PHP script so I knew I'd need some real help along the way.

    +rep to the first person to give a correct solution.

    Thanks.
    Kind Regards,

    Guy
    __________________

    Since 2007. Unbelievable Uptime. Web hosting, resellers, master resellers, linux VPS, windows VPS, shoutcasts, at the lowest prices on the net.
    Tech-Hosts.co.uk.


  2. #2
    Join Date
    Aug 2005
    Location
    Newcastle
    Posts
    1,417
    Tokens
    0

    Latest Awards:

    Default

    PHP Code:
    <?php
    if($port != !$port)
    {
        
    $port $_POST['port'];
        
    $handle fopen('/home/XXXXXXXXXXX/public_html/players/'$port .'.asx'"x+");
        
    $line1 '<ASX version="3.0">';
        
    $line2 '<title>Radio</title>';
        
    $line3 '<entry>';
        
    $line4 '    <title>Radio</title>';
        
    $line5 '    <author>Tech-Hosts.co.uk</author>';
        
    $line6 '    <ref href="http://shoutcasts.tech-hosts.com:'$port .'/"/>';
        
    $line7 '</entry>';
        
    $line8 '</ASX>';
        
        
    fwrite($handle$line1."\n");
        
    fwrite($handle$line2."\n");
        
    fwrite($handle$line3."\n");
        
    fwrite($handle$line4."\n");
        
    fwrite($handle$line5."\n");
        
    fwrite($handle$line6."\n");
        
    fwrite($handle$line7."\n");
        
    fwrite($handle$line8."\n");
        
    fclose($handle);



  3. #3
    Join Date
    Nov 2007
    Location
    London
    Posts
    1,577
    Tokens
    36

    Latest Awards:

    Default

    Haha thanks, +rep. One last thing, my bit at the top isn't working properly:

    Code:
    if($port != !$port)
    {
    It's doing that code even if $port isn't defined. Is there any other way to do this? I want it so when they post a form on that page it does the code below that, but if they haven't then I just want it to ignore that section (don't want to use else, just one if will do).

    +rep to the person who can give me a correct solution fastest for that. Thanks.
    Kind Regards,

    Guy
    __________________

    Since 2007. Unbelievable Uptime. Web hosting, resellers, master resellers, linux VPS, windows VPS, shoutcasts, at the lowest prices on the net.
    Tech-Hosts.co.uk.


  4. #4
    Join Date
    Nov 2007
    Location
    London
    Posts
    1,577
    Tokens
    36

    Latest Awards:

    Default

    Sorry, can't edit, managed to work it out myself. Thanks. Thread closed.
    Kind Regards,

    Guy
    __________________

    Since 2007. Unbelievable Uptime. Web hosting, resellers, master resellers, linux VPS, windows VPS, shoutcasts, at the lowest prices on the net.
    Tech-Hosts.co.uk.


Posting Permissions

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