PHP - Question Regarding Urls And Php Code
Hi Everyone,
Before I ask my question I would like to give everyone a background on myself. I'm currently in the learning stages of PHP and MySql. (I apol. in advance for my lack of tech. terminology) I have a question regarding how to "make" or "produce" certain pages in php code. In my past I've always manually made a pages. For example, aboutus.html, information.html, cats.html etc ... I think you get the idea. Assuming code is being used. How would one go about "making" or "producing" pages that are fully functional php pages? Where people can log in, make edits, write reviews etc ... (a few examples are below) Do the owners/programmers of the below websites manually "make" or "produce" these pages? http://cars.oodle.com/used-cars/san-jose-ca-area/ http://www.yelp.com/biz/lotus-of-siam-las-vegas http://restaurants.uptake.com/california/san_jose/509917137.html http://www.yelp.com/c/san-jose/restaurants My question is, how can I "make" or "produce" these types of pages for my website? Can anyone offer my any tips/tricks on how to do so. All opinions welcome. Thanks everyone in advance for the help. Similar TutorialsI would love to google my question, but I don't know how this is called.... I want to create URLs for each user of a site with this format: www.mysite.com/user1 Facebook does this, for example. In a static page I'd do it with a folder and index file for each user, but that's not practical if you have too many users. Could you explain how this is done or at least how it is called so I can find myself something to read? Thanks!!! Hi again, okay going to be a bit difficult to explain clearly but i will try. For instance i have a script on my categories.php ready to run when called from index.php I land on this page no 1 /categories.php?name=$pagename from there the user has an option to go this page 2, /categories.php?name=$pagename&id=$myid <--- ok my question.. is it best to carry on scripting on categories.php for both pages (urls) or is it best to make another page example categories2.php for page number 2. Currently all my code is on categories.php and it is performing as desired. Still i want to know which is better and how do you guys work, if you have a similar case any suggestions and guidance would be appreciated thanks all. Hi all, I am looking a developing a script that instead of using something like mysite.com/showproduct.php?id=1 I would like it to appear as mysite.com/php-editor Is their a simple way of doing this? I would still need to pull info from a database so the page would still need to be dynamic, I just want it to appear static! I am used to using the get id function of php, what would the workaround be? would the id be hidden from the url but still usable in a query? I have had a look at the apache mod_rewrite, but quite frankly, I dont understand it! Cheers Hello, I am writing a very basic quiz program. I have three pages. The Quiz page. The Process page. And the Results Page. I have the Quiz page's form "action" to the Process page where questions are checked and a score is determined. Then I want those results displayed on the results page. So basically I want to use the quiz page, and when it is submitted it should go to the Results page while having used the Process page. Right now I have the Process page "included" on both the quiz and results page to use variables and stuff. And the form action is set to the Process page. What do I need to add to get it to do what I described above? Thanks! Hello, what this script does is it goes to a labeled directory and picks a random flv file to play, it works great with jw player on the same server. my problem is i have a "sever-A" that dont allow flv files, and a "server-B" that does. im trying to use this script to call random flv's from server-b to server-a to play them. but i get a browser error "directory not found". Is there something im missing here or its just not possible to call to another server using php? Here is a simple test page i was experimenting with below, any input on this would be greatly appreciated, thanks. <?php $imglist=''; //$img_folder is the variable that holds the path to the swf files. // see that you dont forget about the "/" at the end $img_folder = "http://www.mywebsite.com/dumppy"; mt_srand((double)microtime()*1000); //use the directory class $imgs = dir($img_folder); //read all files from the directory, ad them to a list while ($file = $imgs->read()) { if (eregi("flv", $file)) $imglist .= "$file "; } closedir($imgs->handle); //put all images into an array $imglist = explode(" ", $imglist); $no = sizeof($imglist)-2; //generate a random number between 0 and the number of images $random = mt_rand(0, $no); $image = $imglist[$random]; //display random swf ?> <HTML> <HEAD> <TITLE>Untitled</TITLE> <META NAME="GENERATOR" CONTENT="MAX's HTML Beauty++ 2004"> </HEAD> <BODY> <p><?echo $img_folder.$image?></p> </BODY> </HTML> I use this bbc code. This is bbccode_function.php: <?php function bbcode($input){ $input = strip_tags($input); $input = htmlentities($input); $search = array( '/\[b\](.*?)\[\/b\]/is', '/\[i\](.*?)\[\/i\]/is', '/\[u\](.*?)\[\/u\]/is', '/\[img\](.*?)\[\/img\]/is', '/\[url=http://(.*?)\](.*?)\[\/url\]/is', '/\[font color=(.*?) size=(.*?) face=(.*?)\](.*?)\[\/font\]/is', '/\[h1\](.*?)\[\/h1\]/is', '/\[special\](.*?)\[\/hat\]/is' ); $replace = array( '<b>$1</b>', '<i>$1</i>', '<u>$1</u>', '<img src="$1">', '<a href="$1">$2</a>', '<font style="color:$1;font-size:$2;font-face:$3">$4</font>', '<h1>$1</h1>', '<a href="http://google.com" style="font-size:32pt;text-decoration:blink;color:#FF0099">$1</a>' ); return preg_replace($search,$replace,$input); } ?> And this is test page: <?php include "bbcode_function.php"; $var = "[b]text[/b]"; echo bbcode($var); ?> But when i put <br \> code in $var, it does not goes to new row. I use this bbc code in textarea, and i need when i go in new row in textarea to use that bbc code, or somehow to make that work :S How can i do that? I'm messing around with unconventional coding practices, just to .... practice. The following code isn't being used for any amazing projects or anything, it's just me messing around with things getting practice. It's a simple code but it keeps telling me the constants are undefined. //defining the variables through an array $db['db_host'] = "localhost"; $db['db_user'] = "root"; $db['db_pass'] = ""; $db['db_name'] = "cms"; //fancy way of making them constants foreach($db as $key => $value) { define(strtoupper($key), $value); } $conn = mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME); if($conn) { echo "We are connected"; } Simple, simple, very simple but can someone tell me why it's not creating the constants? All of them in $conn are coming back as undefined. I hope no one rolls their eyes at me, lol, but I literally, just made my first PHP script, but I ran into a snag.
Okay so the code I did was
<!DOCTYPE html> <html> <body> <?php echo <h1>"my First PHP script"</h1>; ?> </body> </html> but in firefox the outcome is always "my first PHP script?> I had added the h1 tags because it wouldn't print at all before I did. I'm trying to figure out what I did wrong. Can someone please explain WHAT this code is and HOW it works? (Duh! Obviously it is manipulating XML, however I don't know what function or whatever is doing the legwork?!) Code: [Select] $xmlStr .= xmlNode("xxxTransType", "00"); $xmlStr .= xmlNode("MerchantNumber", $merchantNumber); $xmlStr .= xmlNode("Products", $Products); $xmlStr .= xmlNode("xxxName", $xxxName); $xmlStr .= xmlNode("xxxCompany", $xxxCompany); $xmlStr .= xmlNode("xxxAddress", $xxxAddress); Thanks, Debbie I am showing Youtube videos on my site and am pulling the data in from an xml file... However this is the problem I'm having... When I pull in the video the output is working correctly until you get the image file... it's HUGE... NOT what I wanted so I set about trying to figure out how to resize the image... I have tried many things but no luck. I don't have access to the google api to change the picture size sooooo... I"m trying to do so within the php I do have..here is what I have... $videos[$i]['img'] = $matches[0]; That output shows the HUGE picture.... Here is what I've tried to do ... $videos[$i]['img'] = $matches[0] "width=100px height=100px"; That is a no go... it crashes the site and I know it's a quote thing.. I do know that the first example outputs the image... or puts the img in a string to be output according to the video, I understand that. How do I resize the img to make it smaller? Here is the entire code for the parsing of the xml file.... <head> <link rel="stylesheet" href="modules/mod_jusertube/css/mediaboxAdvBlack21.css" type="text/css" media="screen" /> <script src="modules/mod_jusertube/js/mootools-more-1.3.js" type="text/javascript"></script> <script src="modules/mod_jusertube/js/mediaboxAdv-1.4.0.js" type="text/javascript"></script> <script src="modules/mod_jusertube/js/an7effects-1.5.5.js" type="text/javascript"></script> </head> <?php /** * @Copyright Copyright (C) 2010- Md. Afzal Hossain * @license GNU/GPL http://www.gnu.org/copyleft/gpl.html **/ /* This file is part of mod_lcc. mod_lcc is free softwa you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. mod_lcc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with mod_lcc. If not, see <http://www.gnu.org/licenses/>. */ // no direct access defined('_JEXEC') or die('Restricted access'); class FeedReader { var $cachetime; var $filepath; function __construct($updatefeed = 300){ $this->cachetime = $updatefeed; $this->filepath = dirname(__FILE__).DS; } function get_youtube_top($youtubeuser,$totalvid){ $filename = $this->filepath.'youtube_'.$youtubeuser.'.xml'; if(is_file($filename)){ $utime = filemtime($filename); $chtime = time() - 60*$this->cachetime; if($utime>$chtime) $updated = true; else $updated = false; } else{ $updated = false; } if(!$updated){ $link="http://gdata.youtube.com/feeds/base/users/$youtubeuser/uploads?alt=rss"; $ch = curl_init($link); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, 0); $data = curl_exec($ch); curl_close($ch); if(strlen($data)>100) file_put_contents($filename,$data); } if(is_file($filename)){ $data = file_get_contents($filename); } else{ return false; } $rss = new SimpleXMLElement($data); $i = 0; $videos = array(); foreach($rss->channel->item as $item){ //$guid_split = explode('/',$item->guid); //$videos[$i]['id'] = $guid_split[6]; $videos[$i]['title'] = (string) $item->title; $videos[$i]['link'] = (string) $item->link; //$videos[$i]['embed'] = '<object width="100" height="125"><param name="movie" value="http://www.youtube.com/watch/'.$guid_split[6].'"><param name="allowFullScreen" value="true"><param name="allowScriptAccess" value="always"><embed src="http://www.youtube.com/v/'.$guid_split[6].'" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="640" height="385"></object>'; $description = (string) $item->description; $matches = array(); preg_match("/<img[^<>]+>/",$description,$matches); $videos[$i]['img'] = $matches[0]; $i++; if($i>=$totalvid) break; } return $videos; } } Thanks guys!! Again! Hi!! the question look simple at his base because I will receive TONS of answer saying ... " hey men use javascript OR ajax " but I don't want to use these... I want to populate the second dropdown menu dynamicly with PHP code. and sql query. why?? because I have over 43000 possibility and doing a script manually is impossible. the database is changing every hour. this is the code of my working page. the form NOTE: i REMOVE ALL DB CONNECTION FOR SECURITY PURPOSE. THANKS FOR YOUR UNDERTANDING. <!doctype html public "-//w3c//dtd html 3.2//en"> <html> <head> <title>(Type a title for your page here)</title> </head> <body > <img src="http://www.scale24-25.com/images/banners/banner.jpg" alt="banner" width="997" height="213" border="0" usemap="#Map" /> <map name="Map" id="Map"> <area shape="poly" coords="0,100,85,102,92,55,108,50,326,51,323,7,3,3" href="http://www.hobby-shop.qc.ca" alt="hobby-shop" /> <area shape="poly" coords="672,57,891,53,887,4,995,4,985,108,673,102" href="http://www.hobby-shop.qc.ca" alt="hobby-shop" /> <area shape="poly" coords="326,13,330,53,98,54,90,92,670,99,668,54,889,51,886,5" href="http://www.scale-auto-style.com" alt="" /> </map> <?php if (isset($_POST['todo']) && $_POST['todo'] == "search") { $todo=$_POST['todo']; $manufacturer_reel=$_POST['manufacturer_reel']; $query="select * from kit where "; ////////// Including manufacturer_reel field search //// if(strlen($manufacturer_reel) > 0 ){ $query.= " manufacturer_reel='$manufacturer_reel' and "; } //// End of class field search /////////// $query=substr($query,0,(strLen($query)-4)); echo $query; echo "<br><br>"; $nt=mysql_query($query); echo mysql_error(); // End if form submitted }else{ echo "<form method=post action='search-keyword.php?go'><input type=hidden name=todo value=search>"; ?> <table width="960" border="0"> <tr> <td colspan="3"><p align="center"></td> </tr> <tr> <td><div align="right"></div></td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td><div align="right">Echelle du modele</div></td> <td align="center"> <?php // strat of drop down /// $q=mysql_query("SELECT DISTINCT scale FROM kit ORDER BY scale"); echo '<select name="scale"><option value="scale">Please Choose an Option</option>'; while($row = mysql_fetch_array($q)) { $thing = $row['scale']; echo '<option>'.$thing.'</option>'; } echo "</select>"; echo " <br> \n"; echo " <br> \n"; ?></td> <td><div align="left">Scale of model</div></td> </tr> <tr> <td> </td> <td> </td> <td><div align="right"></div></td> </tr> <tr> <td><div align="right">Nom du manufacturier automobile</div></td> <td align="center"><?php // strat of drop down /// $q=mysql_query("SELECT DISTINCT manufacturer_reel FROM kit ORDER BY manufacturer_reel"); echo '<select name="manufacturer_reel"><option value="reel manufacturer">Please Choose an Option</option>'; while($row = mysql_fetch_array($q)) { $thing = $row['manufacturer_reel']; echo '<option>'.$thing.'</option>'; } echo "</select>"; // end of drop down /// echo " <br> \n"; echo " <br> \n"; // end of drop down /// ?></td> <td><div align="left">Name Of vehicule manufacturer</div></td> </tr> <tr> <td> </td> <td> </td> <td><div align="right"></div></td> </tr> <tr> <td><div align="right">Nom du manufacturier de modele reduit</div></td> <td align="center"><?php // start of drop down /// $q=mysql_query("SELECT DISTINCT manufacturer_kit FROM kit ORDER BY manufacturer_kit"); echo '<select name="manufacturer_kit"><option value="kit manufacturer">Please Choose an Option</option>'; while($row = mysql_fetch_array($q)) { $thing = $row['manufacturer_kit']; echo '<option>'.$thing.'</option>'; } echo "</select>"; // end of drop down /// echo " <br> \n"; echo " <br> \n"; ?></td> <td><div align="left">Name Of kit manufacturer</div></td> </tr> <tr> <td><div align="right"></div></td> <td> </td> <td> </td> </tr> <tr> <td><div align="right">Annee de fabrication du Vehicule</div></td> <td align="center"><?php // strat of drop down /// $q=mysql_query("SELECT DISTINCT year_prod_reel FROM kit ORDER BY year_prod_reel"); echo '<select name="year_prod_reel"><option value="vehicules year manufactured">Please Choose an Option</option>'; while($row = mysql_fetch_array($q)) { $thing = $row['year_prod_reel']; echo '<option>'.$thing.'</option>'; } echo "</select>"; // end of drop down /// echo " <br> \n"; echo " <br> \n"; ?></td> <td><div align="left">Year of production of the vehicule</div></td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td align="center"> </td> <td> </td> </tr> <tr> <td><div align="right"><strong></strong></div></td> <td align="center"> <?php echo " <br><input type=submit value=Search name='name' action='search-keyword.php?go' > </form> "; } ?> <td><div align="left"><strong></strong></div></td> </body> </html> AND THE PAGE RESULT <!doctype html public "-//w3c//dtd html 3.2//en"> <html> <head> <title>(Type a title for your page here)</title> </head> <body > <p align="center"><img src="http://www.scale24-25.com/catalog/images/banners/banner.jpg" alt="banner" width="997" height="213" border="0" usemap="#Map" /> <map name="Map" id="Map"> <area shape="poly" coords="0,100,85,102,92,55,108,50,326,51,323,7,3,3" href="http://www.hobby-shop.qc.ca" alt="hobby-shop" /> <area shape="poly" coords="672,57,891,53,887,4,995,4,985,108,673,102" href="http://www.hobby-shop.qc.ca" alt="hobby-shop" /> <area shape="poly" coords="325,11,329,51,97,52,89,90,669,97,667,52,888,49,885,3" href="http://www.scale-auto-style.com" alt="" /> </map></p> <table width="920" border="0"> <tr> <td width="359"><p class="style5">You will find some TBC. TBC is for "To Be Confirmed". If somebody know the missing information ( TBC ) it will be appreciate to send it to me at this mail: <a href="mailto:info@hobby-shop.qc.ca">info@hobby-shop.qc.ca</a> <br /> <br /> thanks in advance for your help</p> </td> <td width="161"> </td> <td width="386"> <div align="right"> <p>This logo <img src= 'http://www.scale24-25.com/images/PDF_logo.gif' width='50' height='50'/> mean that you can download a PDF file. To read it you need minimum Acrobat reader and you can download it <a href="http://get.adobe.com/reader/">here</a></p> <p>Some link will return a TBC. Sorry for any inconveniant. as soon as we will receive or do the PDF it will be updated.</p> </div></td> </tr> </table> <br> <?php if (isset($_POST['todo']) && $_POST['todo'] == "search") { $todo=$_POST['todo']; $name=$_POST['manufacturer_reel']; $name1=$_POST['manufacturer_kit']; $name2=$_POST['year_prod_reel']; $name3=$_POST['scale']; //-query the database table for the post field $sql="SELECT kit_id, kit_number, kit_name, description, manufacturer_kit, manufacturer_reel, scale, engine_detail, year_prod_kit, year_prod_reel, image_id, image_id1, image_id2 FROM kit "; $sqlOperand="WHERE"; if ($name != "reel manufacturer") { $sql = $sql . $sqlOperand . " manufacturer_reel LIKE '%" . $name ."%' "; $sqlOperand = " AND "; } if ($name1 != "kit manufacturer") { $sql = $sql . $sqlOperand . " manufacturer_kit LIKE '%" . $name1 ."%' "; $sqlOperand = " AND "; } if ($name2 != "vehicules year manufactured") { $sql = $sql . $sqlOperand . " year_prod_reel LIKE '%" . $name2 ."%' "; $sqlOperand = " AND "; } if ($name3 != "scale") { $sql = $sql . $sqlOperand . " scale LIKE '%" . $name3 ."%' "; $sqlOperand = " AND "; } if ($sqlOperand == "WHERE") { echo "<p>Please enter a search query</p>"; } else { // echo '<img src="web-design/sorry.jpg" alt="sorry">'; // echo "Sorry nothing match your selection / Desolle rien ne correspond a votre selection"; // echo "run sql: <BR> $sql <BR> and display results"; } //-run the query against the mysql query function $result=mysql_query($sql); //-make the header of the table echo " <table align=center width=\"1340\" border=\"\">\n"; echo " <tr>\n"; echo" <td nowrap align=center width='95'> kit manufacturer \n"; echo" <td nowrap align=center width='55'> scale \n"; echo" <td nowrap align=center width='90'> kit number \n"; echo" <td nowrap align=center width='290'> kit name \n"; echo" <td nowrap align=center width='400'> description \n"; echo" <td nowrap align=center width='125'> vehicule year \n"; echo" <td nowrap align=center width='80'> complete engine detail\n"; echo" <td nowrap align=center width='80'> Select Picture to get bigger\n"; echo" <td nowrap align=center width='75'> instruction sheet\n"; echo" <td nowrap align=center width='75'> box contain\n"; echo " <tr>\n"; //-create while loop and loop through result set while($row=mysql_fetch_array($result)){ $description =$row['description']; $manufacturer_kit=$row['manufacturer_kit']; $scale=$row['scale']; $manufacturer_reel=$row['manufacturer_reel']; $kit_id=$row['kit_id']; $kit_number=$row['kit_number']; $kit_name=$row['kit_name']; $engine_detail=$row['engine_detail']; $year_prod_reel=$row['year_prod_reel']; $image_id=$row['image_id']; $image_id1=$row['image_id1']; $image_id2=$row['image_id2']; //-create table of item during he while loop echo " <table align=center width=\"1340\" border=\"\">\n"; echo" <td nowrap align=center width='95'> $manufacturer_kit \n"; echo" <td nowrap align=center width='55'> $scale \n"; echo" <td nowrap align=center width='90'> $kit_number \n"; echo" <td nowrap align=center width='290'> $kit_name \n"; echo" <td nowrap width='400'> $description \n"; echo" <td nowrap align=center width='125'> $year_prod_reel \n"; echo" <td nowrap align=center width='80'> $engine_detail \n"; echo" <td nowrap width='80'> <a href=".$image_id."> <img src='".$image_id."' width='75' height='50' border='0'/>"; echo" <td nowrap width='75'> <a href= ".$image_id1."> <img src= 'http://www.scale24-25.com/images/PDF_logo.gif' width='50' height='50' border='0'/>"; echo" <td nowrap width='75'> <a href=".$image_id2."> <img src='http://www.scale24-25.com/images/PDF_logo.gif' width='50' height='50' border='0'/>"; echo " </tr>\n"; echo " </table>\n"; echo " </tr>\n"; echo " </table>\n"; } } else{ echo "<p>Please enter a search query</p>"; } ?> </body> </html> YOU CAN SEE IN THE FORM i HAVE A DROP DOWN MENU CALL Name Of vehicule manufacturer .. IN VACT THIS IS THE REAL CAR MANUFACTURER EX: TOYOTA, gmc ETC.. WHEN THE USER WILL SELECT ONE OF THESE AN OTHER DROPDOWN ( NOT SHOWN ) WILL DISPLAY EVERY MODEL FOUND IN THE DATABASE IN RELATION WITH THE MANUFACTURE. IN FACT IT'S LOCATED IN THE TABLE. SO HOW I CAN GET THIS RELATION?? YOURS SEBASTIEN Hello, people!
I was watching some php tutorials in youtube and, in a video, the guy was showing how put php script inside html code. I would like to know why in the following code he didn't use only one php script?
1- Code used in the video:
<html> <body> <?php $color = $_GET['clr']; ?> <b><font color="<?php echo $color;?>">This is a test.</font></b> </body> </html>2- Modified code by me to test with one script: <html> <body> <?php $color = $_GET['clr']; echo "<b><font color=\"$color\"> This is a test. </font></b>"; ?> </body> </html>Is his code more correct(with two scripts)? Why? Hello, Ive got many URLs like these which im trying to just get the name for example "Ace Lightning" Quote http://www.wupload.com/file/1374721/Ace Lightning # GBA.rar http://www.wupload.com/file/1374722/Action Man - Robotatak # GBA.rar http://www.wupload.com/file/1374726/Activision Anthology # GBA.rar http://www.wupload.com/file/1374761/Advance Guardian Heroes # GBA.rar http://www.wupload.com/file/1374764/Agassi Tennis Generation # GBA.rar This is my code Code: [Select] <?php if($_POST['newlinks']) { $newlinks = $_POST["newlinks"]; $newlinks = preg_split("/.rar/", $newlinks); foreach ($newlinks as $newlink) { $r_name = substr("$newlink", 36, 100); echo "<strong>Game Name: $r_name</strong> <br />"; } } echo "<form method=\"POST\" action=\"index.php?page=mass-gba\">"; echo "<br /> <strong>Mass Add GBA ROMs</strong> <br />"; echo "<textarea rows=\"16\" name=\"newlinks\" cols=\"84\"></textarea>"; echo "<input type=\"submit\" value=\"Mass Add GBA Links\" name=\"B1\">"; echo "</form>"; ?> This results are like this, I cant understand why it works for the first game but not the second or any after that. Quote True Name: Ace Lightning # GBA True Name: 2/Action Man - Robotatak # GBA True Name: 6/Activision Anthology # GBA True Name: 1/Advance Guardian Heroes # GBA True Name: 4/Agassi Tennis Generation # GBA Is their something I can do in PHP (like some sort of function/config/array etc...) which would make the following process easier (examples appreciated)... I have an .htaccess file where im rewriting urls to seo friendly ones...now in the PHP script is their something I can place for urls are meant to be displayed/linked (like some sort of placeholder) which makes it easier for me to modify the urls within the PHP script, without constantly editing countless php sourcecode to just change the url? Example scenario: Say I had a php file (called submit.php): <?php echo 'Hey! Thanks for submiting the form, <a href="submit.php?form">click here</a> to go back!'; ?> and my rewrite rule for submit.php?form was: /form How would I easily change the url within submit.php without editing submit.php directly? Hello! First... I'm sorry about my english skills.. Seems that with my own language I don't get a correct or good answer So.. I have a site where visitors can put there favorite links to other sites and show them to others. My problem is multiple urls to same locations in sites-table. example: http://google.com http://google.com/ http://www.google.com http://www.google.com/ http://www.google.com/index.php (?) they all lead to same... is there any light and powerfull way to check these? I'm trying to use query with "like" but it only works if there is exactly same url. I use fopen to check that url really exicst.. table: Sites (basic information for link) -id -url -title +some meta tags if found -timestamp I'm not asking to do me this code. But if someone can tell me just what functions and others I'm looking for and what I need for this... My coal is to keep sites-table as clean as it can be. If visitor adds a url that is already in sites-table only thing that happens is updating timestamp. Thank you all for helping me! -Roosterr Can someone help me to generate SEO friendly URLs? I dont want my URLs to be presented like: www.example.com/listprod.php?categ=1&subcateg=7 I want it to dynamically do the following: www.example.com/listprod/cameras/slr Hi All, Currently, in my application, my links use index.php?id=14 (or whatever ID it is). Should I somehow encrypt those so the exact ID is not known or is this OK? Say my URL is http://www.example.com/catalog.php?category=hats&prodID=53 and I use Mod-rewrite to make it http://www.example.com/catalog/hats/53/ Can I still use $_GET['category'] to get the parameters? If so, how? Okay, i know there are lots of these questions out there and tons of ways to do this. I do have it working to replace URLs with <a href="URLs">URLs</a> but now i need some help detecting <a href=""></a> so the preg_replace will not double up the code and mess up the link. here is my code so far. Code: [Select] <?php echo 'COMMENTS<br /><br />'; while($rows = mysql_fetch_array($comres)){ list($comid, $menu_title, $post_id, $comdate, $comname, $comment) = $rows; $comment = nl2br($comment); $comment = preg_replace('/(http|https|ftp|ftps)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/', '<a href="$0" target="_new">$0</a>', $comment); $comment = str_replace("´", "'", $comment); $comdate = date("g:ia - M j, Y",strtotime("$comdate")); echo 'User: '.$comname.'<font color="#B20303"> - '.$comdate.'</font><br />'; echo ' - '.$comment.'<br /><br />'; } ?> so with this code, if someone commented a link like this http://example.com it will turn it this <a href="http://example.com" target="_new">http://example.com</a> but now if someone knew some basic HTML coding, and they used this <a href="http://example.com">Example.com</a> it will look like this... <a href=<a href="http://example.com" target="_new">http://example.com</a>>Example.com</a> Hi, What is the best way to change: www.mysite.com/product.php?id=1&sort=2&cat=z to: www.mysite.com/1/product-name-here I would need the other variables in the URL (sort & cat...) to also pass through to the new address. Is this an .htaccess change or via PHP code? Any help appreciated, thanks. |