PHP - Php Link Problem
I'm having a problem with make my links work. I have a link saved in a session variable but when I print it to the screen it doesn't seem to work. What happens is instead of the link taking you to "www.google.com" it will but the currently directory first so for example if would be "www.example.com/folder/www.google.com".
I have checked the page source and it appears to be fine so I'm not sure what's happening. I've copied my code below. echo("<h3 class=\"left\"><a href=\"" . $_SESSION['submit_content_link'] . "\" class=\"linker\" title=\"1\" target=\"_blank\">" . $_SESSION['submit_content_title'] . "</a></h3>"); Thanks for any help. Similar Tutorialsif i put a link in to go to google say, <a href='www.google.com'>link1</a> it goes to www.mysite.co.uk/www.google.com can any1 help? cheers mat I'm having a problem with including a list of clickable links. They keep including my website address before the web address instead of the the web address alone. Here is the code I'm using for it. The $item_url is the web address from the database. $content .="<table width=\"700\" height=\"50\" border=\"0\"><tr><td width=\"500\" class=\"titles\"><a href=$item_url target=\"_blank\">$item_title</a></td></tr><tr> <td width=\"400\" class=blackfont>Location: {$item_city}, {$item_state}</td></tr><tr><td class=blackfont>Country: {$item_country}</td></tr><br /> </table>"; when i upload a link using the form below it adds \ into it like this <a href=\"http://www.google.co.uk\" target=\"_blank\">test</a> and the link is unusable with them any way to stop this <?php include("dbinfo.inc.php"); mysql_connect($localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query="SELECT * FROM News WHERE id='$id'"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); $i=0; while ($i < $num) { $News=mysql_result($result,$i,"News"); ?> <form action="updated.php"> <input type="hidden" name="ud_id" value="<? echo "$id"; ?>"> News:<br> <TEXTAREA NAME="ud_News" COLS=40 ROWS=6><? echo "$News"?></TEXTAREA><br> <input type="Submit" value="Update"> </form> <?php ++$i; } ?> Hi, This is a image tooltip from database. but I have got the problem, Not Working! How can i fix it. <a href="index.php?MD=urundetay&resimid=<?php echo $row_uruns['resimid']; ?>"><img src="urun_resim/<?php echo $row_image['image']; ?>" width="150" border="0" /></a> Hi guys. Im not sure if this is normal in php. But if someone could help. Its much appreciated! I try to do an anchor link on another page, here is my example: <a name="testi"></a> //somewhere above the code below <a href='$targetpage?page=$prev#testi'>prev</a> //anchor link When i click on "prev" link, it direct me to another page correctly. But my page name/title which is: <title>Testimonials | Ten International</title> //page name appears to be Testimonials | Ten International#testi How do i actually make the word #testi in my page name/title disappear of hidden? I'm trying to figure out a way to incorporate multiple sorts on my php page. On the page of products, I want users to have three choices of links: one by date, one by price - low to high and one by price - high to low. I know how to perform ASC & DESC sorts in MySql but I'm not sure how to go about this sort with the three choices without creating more pages. I would really like it to stay with the same page. Is this even possible?? How would I go about it? Here is the section of code : $get_items_sql = mysql_query("SELECT id, thumb, username, sub_id, title, ROUND(price,2) AS price, date FROM product WHERE CURDATE() <= relist_date AND inactive IS NULL AND sold IS NULL AND cat_id = '1' ORDER BY date ") or die(mysql_error());; if (mysql_num_rows($get_items_sql) < 1) { $content = "<p><em>Sorry, no items in this category.</em></p>\n"; } else { $col = 0; $content .= "<ul>\n"; while ($items = mysql_fetch_array($get_items_sql)) { $item_url = "items3.php?id={$items['id']}&username={$items['username']}"; $item_title = stripslashes($items['title']); $item_price = $items['price']; $item_photo = $items['thumb']; $item_username = $items['username']; $item_date = $items['date']; $content .= ""; list($width) = getimagesize("image_files/{$item_photo}"); // set the maximum width of the image here $maxWidth = 100; if ($width > $maxWidth); $content .= "<table width=\"693\" border=\"0\" class=anotherfont><tr><td width=\"101\"> <a href=\"{$item_url}\"> <img alt=\"{$item_title}\" border=0 width=\"{$maxWidth}\" src=\"image_files/{$item_photo}\" /></a><td width=\"200\"> <a href=\"{$item_url}\">{$item_title}</a></td> <td width=\"109\">{$item_username}</td><td width=\"101\"> {$item_date}</td><td width=\"99\">\${$item_price} USD </td></tr></table>"; $content .= "\n"; I found a function online to auto link any variable containing text. It looks for http:// or www. in the text and then automatically adds the HTML code to turn it into a link. I have a problem though.. I have some html already in some of the variables that contain IMG tags. This function tries to link the url of the image.. so I get something like this: Code: [Select] <img src="<a rel="nofollow" href="IMAGEURL" target="_blank">IMAGEURL</a>" border="0" /> This creates a problem and the images don't load! Is there anyway to stop it from doing this? function auto_link($text) { $pattern = '#\b(([\w-]+://?|www[.])[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/)))#'; return preg_replace_callback($pattern, 'auto_link_callback', $text); } function auto_link_callback($matches) { $max_url_length = 50; $max_depth_if_over_length = 2; $ellipsis = '…'; $url_full = $matches[0]; $url_short = ''; if (strlen($url_full) > $max_url_length) { $parts = parse_url($url_full); $url_short = $parts['scheme'] . '://' . preg_replace('/^www\./', '', $parts['host']) . '/'; $path_components = explode('/', trim($parts['path'], '/')); foreach ($path_components as $dir) { $url_string_components[] = $dir . '/'; } if (!empty($parts['query'])) { $url_string_components[] = '?' . $parts['query']; } if (!empty($parts['fragment'])) { $url_string_components[] = '#' . $parts['fragment']; } for ($k = 0; $k < count($url_string_components); $k++) { $curr_component = $url_string_components[$k]; if ($k >= $max_depth_if_over_length || strlen($url_short) + strlen($curr_component) > $max_url_length) { if ($k == 0 && strlen($url_short) < $max_url_length) { // Always show a portion of first directory $url_short .= substr($curr_component, 0, $max_url_length - strlen($url_short)); } $url_short .= $ellipsis; break; } $url_short .= $curr_component; } } else { $url_short = $url_full; } return "<a rel=\"nofollow\" href=\"$url_full\" target=\"_blank\">$url_short</a>"; } Hello, I am having a problem with a link text when ever there is a text that has multiple words. (e.g. 2 Cor prints out with the white space but when I click on the text the url is printed without the text as 2Cor and so it doesn't find a match) here is my code: Code: [Select] <?php if($_GET['book'] == ''){ $books = $wpdb->get_results(" SELECT book_name FROM {$wpdb->prefix}sb_books_sermons LEFT JOIN {$wpdb->prefix}sb_books ON {$wpdb->prefix}sb_books_sermons.book_name = name GROUP BY book_name ORDER BY {$wpdb->prefix}sb_books.id ASC "); foreach($books as $book){ echo '<li><div class="droidlist"><a href="bible/?book='.htmlentities($book->book_name).'">'.$book->book_name.'</a></div></li>'."\n\t"; } } On my website, I have links to another website. The problem is, when I clink on the link for the first time, the target website gives me the error "Your session has expired". Then I have two options: Close that window and click on the link again: this will load the page without any problem. Refresh the window with the error message, again page loads with no issues. This is not very convenient for my users. I wonder if there is any way to fix this problem from my end using some coding? Not sure how. Thanks in advance. Hi, I have one webhost (A) that supports no PHP and has unlimited bandwidth. I have a second webhost (B) that does support PHP, but has limited bandwidth. The website is on host A and contains a 5mb file that people can download and I'd like to count the downloads. But now I need to use host B to count the downloads. I'm using this small script on host B to count the downloads. <?php $hits=file("count.txt"); $hits[0]++;$fp=fopen("count.txt","w"); fputs($fp,$hits[0]); fclose($fp); header("Location: http://webhost-A.com/files/download.zip"); ?> The download link people see on my website is: http://webhost-B.com/download.php Generally this works fine, but I found out that people can still find the direct link with download managers and then put that direct link on their website, which prevents me from counting those downloads. A solution I found is to use ReadFile. But the problem is that when using ReadFile, host B first downloads the file from host A and then sends it to the user and that's exactly what I don't want. Is it possible to let people download the file directly from host A without showing the direct download link in any way and also count the downloads? Hey guys im having a problem with emailing a link using local host mail. I'm using out look express with Mercury. I shorten the email below as much as possible. Its really wierd the target for the link is correct but clicking on it gives me this res ieframe.dll res://ieframe.dll/syntax.htm#http//localhost/stargate/users/account_settings.php? npd=82b1e0df295ee681f1fa2f213ade823d $to = $_POST['resendemail']; $from = "stargate@localhost.com"; $subject = "Stargate System Lords Password Recovery"; $message = "<html> <body background=\"#4B4B4B\"> <h1>Stargate System Lords Password Recovery</h1> Dear ".$users1['name'].", <br> <center> <a href="localhost/stargate/users/account_settings.php?npd=$new_password ">Log In</a> <p> <br /> </font> </body> </html>"; $headers = "From: Stargate Game Password Recovery <stargate@localhost.com>\r\n"; $headers .= "Content-type: text/html\r\n"; mail($to, $subject, $message, $headers); Hello.
I have a bit of a problem. When I fetch the link field from the database.i don't see an actual link on the page.
One more thing, what type of field should I use to store the link in the database? Probably there is where I went wrong.
All help is
Hi I've got this database I created with fields ProductId ProductName Image I've managed to get it to list the ID,productname, and Image urls in a list. My next step is to have the image field actually display an image and make it clickable: heres what I've done so far: Code: [Select] <?php $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("productfeed", $con); $result = mysql_query("SELECT * FROM productfeeds"); echo "<table border='0'> <tr> <th>Firstname</th> <th>Lastname</th> <th>Image</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['ProductID'] . "</td>"; echo "<td>" . $row['ProductName'] . "</td>"; echo "<td>" . $row['ImageURL'] . "</td>"; echo "</tr>"; } echo "</table>"; mysql_close($con); ?> Heres what I want to do: Code: [Select] while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['ProductID'] . "</td>"; echo "<td>" . $row['ProductName'] . "</td>"; // my changes beneath echo "<td>" . <a href="<?php echo $row['ImageURL'];?>"> <img src="<?php echo $row['LinkURL']; ?>"> </a>. "</td>"; echo "</tr>"; } echo "</table>"; mysql_close($con); ?> Can you guys point me in the right direction? Many thanks Hi Support, I have a form, where it collects user description input. I can collect the inputs and store it with newline. The issue is - how to collect the http link to actual hyperlink ref during display. The following is my code: <textarea name="description" cols="50" rows="10" id="description"><?php echo str_replace("<br>", "\n", $description);?></textarea></td> For example, User input: Hi, Check it out - http://www.google.com/ I would like to display google link as href so that Viewers can click the link and go to the page. Right now, it is not href and user need to copy the link to new tabs or pages and then it can come. Thanks for your help. Regards, Ahsan here's my code that i've used to send an email. Code: [Select] $link = "<a href=\"http://www.example.com/" . $num . "\">" . $num . "</a>"; $query = "SELECT content FROM emails"; $result = mysql_query($query) or die(); $email_content = mysql_result($result, 0); $email = sprintf($email_content, $first, $name, $from, $link, $record, $rec, $inc, $max); $email_body = stripslashes(htmlentities($email, ENT_QUOTES, 'UTF-8')); // this is sent to another php script via post.... $subject = $_POST['subject']; $message = nl2br(html_entity_decode($_POST['email_body'])); $to = "me@whatever.com"; $charset='UTF-8'; $encoded_subject="=?$charset?B?" . base64_encode($subject) . "?=\n"; $headers="From: " . $userEmail . "\n" . "Content-Type: text/html; charset=$charset; format=flowed\n" . "MIME-Version: 1.0\n" . "Content-Transfer-Encoding: 8bit\n" . "X-Mailer: PHP\n"; mail($to,$encoded_subject,$message,$headers); in the db, emails.content is of the text type and contains several lines of text with %4$s which inserts the value of $link into the body. when the email arrives, there is a link and it appears fine, with the value of $num hyperlinked. however when you click on it it doesn't go anywhere. when copying the link location from the email it gives me x-msg://87/%22http://www.example.com/16 what is x-msg? how can i get this to work properly? hi hope you all are fine. i have been working on a Email Form (like user fills up the form which send the information to our email) but i was having problem with (URL field i created) link of form is (http://services.shadowaura.com/allquotations/static.php) field which is not working is "Inspirational Website:" when i submit the form it says (Forbidden You don't have permission to access /allquotations/staticworking.php on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.) Can some one help me out ????????????? code behind this form is: Code: [Select] <?php /* Email Variables */ $emailSubject = 'Shadow Aura Contact Info!'; $webMaster = '*****@shadowaura.com'; /* Data Variables */ $Name = $_POST['Name']; $email = $_POST['email']; $Cell = $_POST['Cell']; $Phone = $_POST['Phone']; $CompanyName = $_POST['CompanyName']; $TypeOfBusiness = $_POST['TypeOfBusiness']; $Address = $_POST['Address']; $YourBudget = $_POST['YourBudget']; $HaveDomain = $_POST['HaveDomain']; $RunningWeb = $_POST['RunningWeb']; $WebLink = $_POST['WebLink']; $Inspiration1 = $_POST['Inspiration1']; $Inspiration2 = $_POST['Inspiration2']; $NumberPages = $_POST['NumberPages']; $UseFlash = $_POST['UseFlash']; $TimeFrame = $_POST['TimeFrame']; $Provided = $_POST['Provided']; $Comments = $_POST['Comments']; $body = <<<EOD <h1> Static Website Quotation </h1> <br> <b>Name of Client:</b>$Name<br> <b>Your Email:</b>$email<br> <b>Cell Number:</b>$Cell<br> <b>Line Phone Number:</b>$Phone<br> <b>Company Name:</b>$CompanyName<br> <b>Type of Business:</b>$TypeOfBusiness<br> <b>Address:</b>$Address<br> <b>Your Budget:</b>$YourBudget <br> <b>Do you have Domain:</b>$HaveDomain<br> <b>Your Site is Running:</b>$RunningWeb <br> <b>Website Link:</b><a href="$WebLink">$WebLink</a><br> <b>Inspiration:</b>$Inspiration1<br> <b>2nd Inspiration:</b>$Inspiration2<br> <b>Number of Pages:</b>$NumberPages<br> <b>Use Flash:</b>$UseFlash <br> <b>Time Frame:</b>$TimeFrame<br> <b>You will provide:</b>$Provided<br> <b>Comments:</b>$Comments<br> EOD; $headers = "From: $email\r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail($webMaster, $emailSubject, $body, $headers); /* Results rendered as HTML */ $theResults = <<<EOD <html> <head> <title>sent message</title> <meta http-equiv="refresh" content="3;URL=http://services.shadowaura.com/"> <style type="text/css"> <!-- body { background-color: #8CC640; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 20px; font-style: normal; line-height: normal; font-weight: normal; color: #fec001; text-decoration: none; padding-top: 200px; margin-left: 150px; width: 800px; } --> </style> </head> <div align="center">Your email will be answered soon as possible! You will return to <b>Shadow Aura Services</b> in a few seconds !</div> </div> </body> </html> EOD; echo "$theResults"; ?> Hi guys, I'm using a twitter script that grabs the title and publishings it like so: "Title - Read More at..." I was wondering how i would be able to post the direct link into twitter.. like news.php?id=1 for example. Code: [Select] $tweet->post('statuses/update', array('status' => ''.$_POST[title].' - more at MY URL')); This part is in the script to publish automatically when the users adds to the news database. How am i able to get the ID just after the posting of the news? Thanks! I have a line like this it prints text link but I prefer image link how should i edit it I would appreciate some feedback Code: [Select] $templates['etiket'] = array('name' => t('ETİKET'), 'module' => 'uc_invoice_pdf', 'path' => $templates_uc_invoice_pdf_path, 'pdf_settings' => $pdf_settings); This link dnt seem to work. Can someone help? echo "<td><a href =" . $rows['url'] .">"</a>"</td>"; Thankz. Hello dear friends, Let say we have Code: [Select] $space ="hello world"; then remove spaces between the words by using Code: [Select] $title = str_replace(' ', '-', trim($space)); so it would be here as "hello-world" and let say we have stored title,article text...whever in an database table that call back all this using id then for an article with id=1 its link will be Code: [Select] site.com/index.php?id=1 it is clear that the Code: [Select] echo "$id"; //<--- 1 now some wordpress or/and blogs using rewrite .htaccess to make the link as Code: [Select] site.com/$title-$id (as our example site.com/hello-world-1) then how they know its $id = 1 to get any variables from database that needs the id i've tried but never works and only works if i made something like Code: [Select] site.com/$title_$id //<-- site.com/hello-word_1 cause it needs difference separate in order to understand the id so how to make it ? how to make it understand that the last separated is the id thanks |