Page 2 of 2 FirstFirst 12
Results 11 to 17 of 17

Thread: code adds my url to url for link?

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

    Default

    Honestly I have no idea. Clearly some part of the process, unknown to us, is doing something odd. All I can say is double check all the code and be sure that it isn't like that in the database. Can you export/backup the db and go trough it manually?
    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

  2. The Following User Says Thank You to djr33 For This Useful Post:

    I am Abby (08-25-2010)

  3. #12
    Join Date
    Apr 2010
    Location
    University of Illinois
    Posts
    86
    Thanks
    13
    Thanked 2 Times in 2 Posts

    Default

    It looks correct in the database.
    Well thanks for your time anyway

  4. #13
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    Quote Originally Posted by I am Abby View Post

    Code:
    this is it <a href=\"http://www.uiuc.edu\">U of I</a></p><p><strong>September 14, 2010</strong></p>
    But when you move the mouse over the link on the page it looks like
    Code:
    http://mysite.com/%22http://www.there.com
    In your source code, are the backslashes present before the doublequotes ( \" )?

    If something (some kind of server configuration, most likely) is automatically adding a base url to your links, it probably looks for href attributes that seem to be internal. The slashes (which shouldn't be there) might be interfering with that check...

    Maybe. ( ??? )

    Try running stripslashes() on the url the database returns and see if helps.
    PHP Code:
    while($r mysql_fetch_assoc($q)) {

    //  try it here - I think that'll catch it
    stripslashes($r);

    print_r($r);

    Also try adding an external url ( <a href="http://www.othersite.com">external</a> ) directly into your html and see if the base url is added or not.

    You could also contact your service provider and see if there is someway to turn that "feature" off.

  5. #14
    Join Date
    Apr 2010
    Location
    University of Illinois
    Posts
    86
    Thanks
    13
    Thanked 2 Times in 2 Posts

    Default

    one of my friends said because the urls in the source code has slashes
    Code:
    <a href=\"http://page.com\">link</a>
    I should do a remove slashes...so I tried

    Code:
    // Make a MySQL Connection
    mysql_connect("xxx.xxx.xxx.xx", "login", "password") or die(mysql_error());
    mysql_select_db("nlchdb") or die(mysql_error());
    
    // Retrieve all the data from the "webcalendar_events" table
    $result = mysql_query("SELECT * FROM webcalendar_events WHERE dt >= now() AND color='ffff00' ORDER BY dt")
    or die(mysql_error());  
    
    while($row = mysql_fetch_array($result, MYSQL_ASSOC))
    {
    //remove code we don't need to see for this.
    <snip>---</snip>
     list($year, $month, $day) = split('[/.-]', $row['dt']);
     $month = $monthnames[$month];
     $str = stripslashes($row['description'];
     echo "<p><strong>{$month} {$day}, {$year}</strong><br />".
     "Decription: {$str}</p>";
    and that didn't remove them.
    So I came back here and saw your post and tried...
    Code:
    // Make a MySQL Connection
    mysql_connect("xxx.xxx.xxx.xx", "login", "password") or die(mysql_error());
    mysql_select_db("nlchdb") or die(mysql_error());
    
    // Retrieve all the data from the "webcalendar_events" table
    $result = mysql_query("SELECT * FROM webcalendar_events WHERE dt >= now() AND color='ffff00' ORDER BY dt")
    or die(mysql_error());  
    
    while($row = mysql_fetch_array($result, MYSQL_ASSOC))
    {
     stripslashes($row);
    //remove code we don't need to see for this.
    <snip>---</snip>
     list($year, $month, $day) = split('[/.-]', $row['dt']);
     $month = $monthnames[$month];
     echo "<p><strong>{$month} {$day}, {$year}</strong><br />".
     "Decription: {$row['description']}</p>";
    Again it did not take the slashes out...is there another way to do it?

    I not only put
    <a href="http://www.othersite.com">external</a>
    on the page I also placed
    echo "<a href=\"http://www.othersite.com\">external</a>";
    within the code tags...both worked correctly.
    Last edited by I am Abby; 08-25-2010 at 03:34 PM.

  6. #15
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    You might try stripslashes() in the individual entry that holds the link - I just noticed that $r is the entire row. Try stripslahes($r['link']) (or whatever the column that holds the link is called).

    If you write a normal external link directly in your html, do you still get this problem? or is it limited to the links this script is generating?

  7. The Following User Says Thank You to traq For This Useful Post:

    I am Abby (08-25-2010)

  8. #16
    Join Date
    Apr 2010
    Location
    University of Illinois
    Posts
    86
    Thanks
    13
    Thanked 2 Times in 2 Posts

    Default

    Code:
     
     <snip>
     list($year, $month, $day) = split('[/.-]', $row['dt']);
     $month = $monthnames[$month];
     echo "<p><strong>{$month} {$day}, {$year}</strong><br />".
     "Decription: {stripslahes($row['description'])}</p>";
    }
    The above gave me an error
    Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING

    I tried that earlier and it's the reason I tried
    Code:
    <snip>
    $str = stripslashes($row['description'];
     echo "<p><strong>{$month} {$day}, {$year}</strong><br />".
     "Decription: {$str}</p>";
    which did not remove the slashes

  9. #17
    Join Date
    Apr 2010
    Location
    University of Illinois
    Posts
    86
    Thanks
    13
    Thanked 2 Times in 2 Posts

    Default

    It worked.
    Thanks Boys

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
  •