SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Zealot
    Join Date
    Jan 2005
    Location
    USA
    Posts
    128
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    why php can't read the link the have ' quote ?

    Hello


    i have some problem with my script

    The script after you add the link example


    title : The Club2share's community
    links : http://Club2share.com

    the url going to be link The Club2share's community

    but here is the problem the link became

    The Club2shares community


    the problem is because of the ['] if i remove it it work fine.. so is there any trick to get rid of this ?

    here is some code


    PHP Code:
                //$link = str_replace("&", "&"  , $link);
                //$link = str_replace("["    , "%5b", $link);
                //$link = str_replace("]"    , "%5d", $link);
                //$link = preg_replace("/javascript:/i", "java script: ",$link);
                //$link = str_replace("<br />"    , "", $link);

                              
    $link str_replace("&amp;""&" $link); 
                              
    $link str_replace("[" "%5b"$link); 
                              
    $link str_replace("]" "%5d"$link); 
                              
    $link str_replace("<br />" ""$link); 
                              
    $link preg_replace("/\s/","",$link); 
                              
    $link preg_replace("/javascript:/i""java script: ",$link); 


                if (
    $skip_it == 1)
                {
                    return 
    $link;
                }
                else
                {
                    
    $info = array();
                    
    $info explode("|",$link);
                    
    $info[2] = urldecode($info[2]);
                    
    $ext = array();
                    
    $ext explode(".",$info[2]);
                    
    $finext $ext[count($ext)-1];
                    
    $totsize += $info[3];
                    
    $size $this->bytec($info[3]);
                    
    $class = ($i 2) ? 'emulegrey' 'emulewhite';
                    
    $test .= "<tr><td class='euleleft' width='2%' ondblclick='check_check({$num}, this, {$i})'><input type='checkbox' name='links[{$i}]' value='{$link}' style='cursor:pointer;cursor:hand' onclick='check_check({$num}, this)' /></td><td class='emain' width='68%'><span class='{$class}'><a href='{$link}' target='_blank'>{$info[2]}</a></span> (<span class='postdetails'>Type: {$finext}</span>)</td>";
                    
    $test .= "<td class='eulemain' width='30%'>{$size}</td></tr>";
                } 

    i hope someone can help me with this

    Thankyou
    Last edited by Dream On; Dec 14, 2005 at 18:04.
    Favorite Site : xProxy

  2. #2
    SitePoint Zealot
    Join Date
    Jan 2005
    Location
    USA
    Posts
    128
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    anyone please ?
    Favorite Site : xProxy

  3. #3
    Non-Member melancholic's Avatar
    Join Date
    Nov 2004
    Location
    Australia
    Posts
    447
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    add a slash in This Site's point community.

    PHP Code:
    $text 'This Site\'s point community';
    echo 
    $text
    or use double quotes for strings (which parses variables as opposed to single quotes also - but that's another matter).

    PHP Code:
    $text "This Site's point community";
    echo 
    $text
    hope this helps.

  4. #4
    SitePoint Zealot
    Join Date
    Jan 2005
    Location
    USA
    Posts
    128
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello


    Sorry but that dose not help me

    example if i post the link

    The Site's Community : http://club2share.com

    it should be replace and show the link

    The Site's Community

    with chickable .. but if i use quote it dont add full link i post my code .. is there any idea how to fix this ?
    Last edited by Dream On; Dec 14, 2005 at 18:05.
    Favorite Site : xProxy

  5. #5
    Non-Member melancholic's Avatar
    Join Date
    Nov 2004
    Location
    Australia
    Posts
    447
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    can you show me what the HTML output is?
    paste it here and we'll sort it out.

    'gards,

    'cholic.

  6. #6
    SitePoint Member
    Join Date
    Nov 2005
    Location
    North Carolina
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The data you're trying to print on the page, is it being extracted from a database? If so, you may need to addslashes() before inserting the data and then stripslashes() when extracting it.


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
  •