PHP - Link Follow In Mixxed Html Php Line
How can I get robots to follow this mixxed line?:
<td align="left"><?php echo $fieldsFormatted['field_website']; ?></td> This line outputs the text "Website" with the link to a url depending on row id, but is not followed or index by spiders or crawlers. Any help is appreciated! Similar TutorialsHi. I want a simple textbox, that when submited, will replace very every new line, with the <br> tag. What will happen, when it submits, it will take the contents of a textbox, add the <br> tag where a new line is suposed to be, and save the string to a MySQL Database. I think this is the easiest way of allowing a user to edit what appears on a website when logged in, but if there is a easier way, then please tell me. What I am trying to do, is a login page, and once logged in, you enter new text into the textbox, click submit, and on the website homepage, the main text will change to what was submitted. But if there is a new line, I think the only way in HTML to make one is to put a <br> tag, so I want the PHP to but that tag wherever there is a new line. Sorry if I am confusing, I am not that advanced at PHP, but I would be very happy if you could supply me with the correct code. Time is running out... If you do not understand me, please tell me -- PHPLeader (not) I'm using a templated PHP script and have successfully added a link (to an image) This piece of code works perfect if the user has a $id listed in DB and is returned from the SQL Query that collects the need values, which first follws this piece of code. However, if the user does not have a $id in that table, it should do the else if, but it goes straight to the last else. What should the else if($id == ' ') or else if(empty($id == ' '))?? PLEASE HELP.. Code: Code: [Select] if ($id) { if ($user->get('id') == 0 || $userid == 0 || $userid <> $user->get('id')){ //$url = JURI::root() . 'index.php?' . $component . '&id=' . $id . '&tmpl=component&print=1'; $url=JURI::root().'index.php?'.$component.'&id='.$id.'&tmpl=component&print=1'; for($i=1;$i<count($type);$i++){ $url.='&'.$type[$i].'='.$layout[$i]; } } } else if($id == ' ') { $url=JURI::root().'index.php?option=com_muscol&view=album&id=27&tmpl=component&print=1'; for($i=1;$i<count($type);$i++){ $url.='&'.$type[$i].'='.$layout[$i]; } } else { echo 'User Album Loading...'; } } I am trying to use curl to login to a website and get the login cookie. After I try to post, however, I get a 302. Does anyone know how to log into a page like this? Maybe there's a tutorial or something. This what firefox sends: http://oron.com/ POST / HTTP/1.1 Host: oron.com User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.15) Gecko/20110303 Ubuntu/10.04 (lucid) Firefox/3.6.15 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 115 Connection: keep-alive Referer: http://oron.com/login.html Cookie: login=username; xfss=; per_page_files=50 Content-Type: application/x-www-form-urlencoded Content-Length: 56 login=username&password=password&op=login&redirect=&rand= HTTP/1.1 302 Moved Server: nginx/0.8.50 Date: Tue, 22 Mar 2011 00:56:34 GMT Content-Type: text/plain; charset=UTF-8 Connection: keep-alive Set-Cookie: login=username; domain=.oron.com; path=/; expires=Mon, 20-Jun-2011 00:56:34 GMT Set-Cookie: xfss=sijw0iyu3evs3f13; domain=.oron.com; path=/; expires=Mon, 20-Jun-2011 00:56:34 GMT Location: http://oron.com/?op=my_account Content-Length: 0 ---------------------------------------------------------- http://oron.com/?op=my_account GET /?op=my_account HTTP/1.1 Host: oron.com User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.15) Gecko/20110303 Ubuntu/10.04 (lucid) Firefox/3.6.15 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 115 Connection: keep-alive Referer: http://oron.com/login.html Cookie: login=username; xfss=sijw0iyu3evs3f13; per_page_files=50 HTTP/1.1 200 OK Server: nginx/0.8.50 Date: Tue, 22 Mar 2011 00:56:35 GMT Content-Type: text/html; charset=UTF-8 Transfer-Encoding: chunked Connection: keep-alive Expires: Mon, 21 Mar 2011 00:56:35 GMT Content-Encoding: gzip I am new to PHP and trying to debug some old code. How am I to read the following: $properties = $GLOBALS['Props']; I am guesisin that it is saying: Create a string variable named $porperties and set it equal to the Global variable of 'Props'. But I assume my interpretation is wrong since I get some weird results. This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=313079.0 Hey folks, looking for a twitter follow/unfollow php script that WORKS. any hints/links? thanks I have a class ServerBridge which is used to proxy browser ajax requests received by a web server to another API server. To update a record (or create a record is similar): Browser client makes PUT request to web server. Web server modifies the uri path and passes the body plus headers connection, accept, accept-encoding, accept-language, content-type, content-length only to the API server. The API server does work and returns the location of the resource on itself to the web server. The web server modifies the location header to point to the resource location on itself, and returns all received headers except Date, Server, X-Powered-By, Access-Control-Allow-Origin, Access-Control-Allow-Methods, Access-Control-Allow-Headers to the browser client. Browser client makes another undesired PUT request to web server.Why is step 5 occurring and how do I prevent it? I don't really mind the browser client making another request to the resource, but it would need to be GET and not PUT. Also, is my white-list headers to forward to api server and black-list headers to return to browser client appropriate? I haven't posted the ServerBridge script (but can if needed), but did include the requests and headers related to the browser client, web server, and api server below. Browser client JavaScript $('.edit-record').simpleEdit('/api/accounts'); jQuery.fn.extend({ simpleEdit: function(url, options) { var dOptions={type: 'text', ajaxOptions: {type: "PUT"}, placement: 'right', send: 'always' }; options=options?options:{}; return this.each(function() { var $t=$(this); var o=Object.assign({ url: url+'/'+$t.closest('tr').data('id'), title: 'Enter '+$t.data('name') }, dOptions, options); $t.editable(o); }); } }); Web-server index.php $c['serverBridge'] = function ($c) { return new \Greenbean\ServerBridge\ServerBridge( new \GuzzleHttp\Client([ 'base_uri' => $c['settings']['server']['scheme'].'://'.$c['settings']['server']['host'], 'headers' => ['X-Secret-Key' => $c['settings']['server']['key']], 'timeout' => 30, 'allow_redirects' => false, ]), new \Greenbean\ServerBridge\SlimHttpClientHandler() ); }; $app->put('/api/accounts/{id:[0-9]+}', function (Request $request, Response $response) { return $this->serverBridge->proxy($request, $response, function(string $path):string{ return substr($path, 4); //Remove "/api" from uri }, function(array $headers):array{ if(!empty($headers['Location'])) { $headers['Location'] = ['/api'.$headers['Location'][0]]; //Add "/api" to redirect header if it exists } return $headers; } ); }); $app->POST('/api/accounts/{id:[0-9]+}', function (Request $request, Response $response) {/*Similar to PUT*/});
<?php class ServerBridge { public function __construct(\GuzzleHttp\Client $httpClient, ?HttpClientHandlerInterface $httpClientHandler=null){ $this->httpClient=$httpClient; $this->httpClientHandler=$httpClientHandler; //Whether to use Slim or Sympony HTTP requests and responses } public function proxy($clientRequest, $clientResponse=null, \Closure $modifyPath=null, \Closure $modifyHeaders=null) { //Accept a Slim or Sympony HTTP request, forward it to API server via cURL, and return the cURL response //$modifyPath will modify REQUEST_URI before sending to API server //$modifyHeaders will modify response headers before sending to calling client return $response; } } API Server index.php $app->put('/accounts/{id:[0-9]+}', function (Request $request, Response $response, $args) { $this->accounts->update($args['id'], $request->getParsedBody()); return $response->withRedirect('/accounts/'.$args['id'], 302); }); $app->post('/accounts', function (Request $request, Response $response) { $account = $this->accounts->create($request->getParsedBody()); return $response->withRedirect('/accounts/'.$account['id'], 302); });
Web Server
I have a simple contact form with a textarea field, where the visitor can type a message in. However, if the user enters paragraphs or any type of line breaks, then the email that is sent shows the "\r\n" characters. I've tried using the nl2br function to no avail. Here's a sample code snippet: Code: [Select] $message = $_POST["message"]; // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // Additional headers $headers .= 'From: '. $_POST["email"]; mail($to, $subject, $message, $headers); Am I missing something? Besides the "\r\n" characters showing, everything else works fine. Hi there,
I am trying to wrap some content in a div, but when I render it, it is outputting the actual HTML. This is the line I have: add_filter( 'woocommerce_product_description_heading', 'rename_product_description_heading', 10, 1 ); function rename_product_description_heading( $heading ) { return __( '<div class="myclass">Additional Information</div>', 'woocommerce' ); }
which is outputting: <div class="myclass">Additional Information</div> rather than wrapping it in the div.
Can anyone help me with wrapping the "Additional Information" text in a div? Thank you :) Hi Guys, I have a textarea on a html page with XXX amount of lines. How can I in php insert a separate mysqlrow for EACH line on the html textarea? Thanks G I have a feeling someone is going to say AJAX but here goes, Currently I have a basic php / html page the goes something like this: Code: [Select] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>BASIC HTML PAGE</title> </head> <body> <?php include 'home.inc.php'; ?> </body> </html> Now I've added some links: Code: [Select] <li><a href="#">Add</a></li> What I'm after is when someone click on that link is it changes the <?php include 'home.inc.php'; ?> From the base file to <?php include 'add.inc.php'; ?> Help much appreciated! I have a page which reads content from a database and display its result.
<?php include ("databaseconnections/conx_stampsforsale.php"); $sql = mysql_query("SELECT country, description, price FROM stampsforsale"); if (!$sql) die ("Error Displaying Data. " . mysql_error()); else { echo ("<table><tr>"); $count = 0; while ($row = mysql_fetch_array($sql)) { $target_path = "stampsforsale/" . basename($row['country'] . ".jpg"); echo ("<td><a href='" . $target_path . "' target='_blank'><img src='" . $target_path . "'width=150 height=100></a><br />" . $row['country'] . "<br />" . $row['description'] . "</br>" . $row['price'] . "<br /><br /></td>"); $count++; if ($count % 3 == 0) { echo ("<tr>"); } } echo ("</tr></table>"); } // end of displaying data ?>The above code works fine and it loads inside a the main section on my web page as follows: index.php?mC=stampsforexchange.php. In order not to get a huge number of results I am planning to put the above code inside a function and then set the stampforexchange.php page with flags for each country so that when a particular country is clicked only stamps from that country are shown. The following is the above code revised into a function. <?php include ("databaseconnections/conx_stampsforsale.php"); function getCountryStamps($country) { $sql = mysql_query("SELECT country, description, price FROM stampsforsale WHERE country = $country"); if (!$sql) die ("Error Displaying Data. " . mysql_error()); else { echo ("<table><tr>"); $count = 0; while ($row = mysql_fetch_array($sql)) { $target_path = "stampsforsale/" . basename($row['country'] . ".jpg"); echo ("<td><a href='" . $target_path . "' target='_blank'><img src='" . $target_path . "'width=150 height=100></a><br />" . $row['country'] . "<br />" . $row['description'] . "</br>" . $row['price'] . "<br /><br /></td>"); $count++; if ($count % 3 == 0) { echo ("<tr>"); } } echo ("</tr></table>"); } // end of displaying data } ?>And this is the html part where I am trying to call the function: <td><a href="index.php?mC=getCountryStamps(Malta)"><img src="flags/malta.gif" width=100px height="67px" /><br />Malta</td></a> However I am getting the following warning message: Warning: include(getCountryStamps(Malta)): failed to open stream: No such file or directory in C:\xampp\htdocs\stamps\index.php on line 21 Warning: include(): Failed opening 'getCountryStamps(Malta)' for inclusion (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\stamps\index.php on line 21 Can someone please point in the right direction as I am stuck with this one? Thank you in advance. what im trying to do is take a youtube embed code find the URL code for that video and remove all other parts of the code keeping only the URL of the video after i get the URL by it self then replace the http://www.youtube.com/ part of the URL with http://i2.ytimg.com/vi/ to do this i know that i need something like this to get the URL of the video http://www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+) but how to only return just the URL is something idk how to do then use str_replace http://www.youtube.com/(?:v|cp)/" with http://i2.ytimg.com/vi/ so in the end im asking if anyone know how to remove all other codes i dont want and only keep the URL this may have to be done using "regex" im not sure as i dont know to much about regex and what it can do but does sound like it would help lol Hi there, I've been tasked with the job of re-doing the company website from scratch and I'm having a bit of trouble with some of the logic involved as I'm not a web designer by trade. Or by any reasonable stretch of the imagination. Anywhoot, what I'm struggling with is this: I have laid out the website so for each of the core business units there is one php page, call it 'page x'. On page x there are two sections; a sidebar and a content section. At the top of page x there is a menu bar with a links to a different category (eg. services, products, about, contacts, etc). What I have at the moment for page x is an INCLUDE statement in each of the subsection which pulls through a html page and plops it down in the right place. What I am struggling with is how to use the links at the top of the page to pull through a different html page depending on what link I click. I was thinking that I could use something a couple of variables, $sidebar and $content, and then some kind of on-click function to pass a string to each of the variables and then use the INCLUDE statement to call the correct pages. What I have tentatively come up with is this : Code: [Select] <a href=#><img src="/MS_Images/service_hlight.jpg" width="100" height="42" onclick=$sidebar = "OutsourceIT_Website/Managed Services/services_side.html" /></a> and then: Code: [Select] <?php include $sidebar; ?> Would this work in principle? How do I go about making sure that the variable in the link is declared properly? Is there a better way to go about doing this that I am missing due to my ignorance? Hope someone can help because Uncle Google is getting fed up with my vague search terms. Hello everybody. Have a good day. I'm Lam, I have problem hope you help me. 1. This is content html Quote <img src="http://example.com/logo.png" /> anti http://google.com<br /> and http://bing.com I want convert to Code: [Select] <img src="http://example.com/logo.png" /> anti <a href="http://google.com">http://google.com</a><br /> and <a href="http://bing.com">http://bing.com</a> and this code php Code: [Select] preg_replace("/(http:\/\/[a-zA-Z-0-9._?\/\s]+)/", "<a href=\"$1\">$1</a>", $content); but result Code: [Select] <img src="[color=red]<a href="http://example.com/logo.png">http://example.com/logo.png</a>[/color]" /> anti <a href="http://google.com">http://google.com</a><br /> and <a href="http://bing.com">http://bing.com</a> I can help me I speak English not well hope u ignoring thanks. Hello and looking for some help please.. I have already read this : http://www.phpfreaks.com/forums/index.php?topic=120619.0 What I am after to do, is to after a successful Paypal payment from paypal, generate a link in a wordpress site (or external even) that will expire after 3 days to a video. I hope that makes sense please? Thanks in advance, Jim Dear All Good Day, i am new to PHP (a beautiful server side scripting language). i want to send a mail with line by line message i tried with different types like by placing the things in table and using <br /> but the thing is the tags are also visible in the message of the mail. Here is my code: $message1 = "Name :". $_REQUEST['name']."<br />"; $message1 .= "Surname :". $_REQUEST['surname']."<br />"; $message1 .= "Cellphone :". $_REQUEST['mobileno']."<br />"; $message1 .= "Telephone :". $_REQUEST['landno']."<br />"; $message1 .= "Fax :". $_REQUEST['fax']."<br />"; $message1 .= "Company :". $_REQUEST['company']."<br />"; $message1 .= "Email :". $_REQUEST['email']."<br />"; $message1 .= "Country :". $_REQUEST['country']."<br />"; $message1 .= "Enquity :". $_REQUEST['enquiry']."<br />"; $message1 .= "Date&Time :". $date."<br />"; For this code if try to print/echo it it is working fine it is displaying line by line, but using this variable ($message1) in the mail these <br /> are also visible. Can any one guide me to resolve(to remove these tags from the message part) this issue. Thanks in Advance. :confused: i have to read a single line from a csv, its a really big file and i only need one column.
i need the response to be a string ,i made a search and found the following code but i dont have any idea how to get a single line from a single string per run .
<?php $row = 1; //open the file if (($handle = fopen("file.csv", "r")) !== FALSE) { while (($data = fgetcsv($handle, 0, ",")) !== FALSE) { $num = count($data); echo "<p> $num fields in line $row: <br /></p>\n"; $row++; for ($c=0; $c < $num; $c++) { echo $data[$c] . "<br />\n"; } } fclose($handle); } ?> Edited by bores_escalovsk, 16 May 2014 - 06:38 PM. |