
clearmind
New Members-
Posts
9 -
Joined
-
Last visited
Never
Everything posted by clearmind
-
Thanks for the quick reply Pete I think there is a kind of misunderstanding here...i'm sorry about that I'm not so sure my English help here, but clearly i want SEO friendly urls... that means i want to hide query-strings and the php file extension.. so that means to hide "http://localhost/new/html/crete-highlights?heraklion&city_guide" and instead of this i want this: "http://localhost/new/html/crete-highlights/heraklion/city_guide It's blame that the website is running locally, on my computer's web server and you can't see this in action.. I can't understand what is all about the "document root".. Is that true .htaccess file can be placed anywhere i want to?
-
Yes i want to rewrite highlights.php?heraklion&city-guide to crete-highlights/heraklion/city-guide. The .htaccess is in the folder called "html". That's the website's root folder Please keep in mind all the other rules are functioning. URL structure: http://localhost/new/html/highlights.php http://localhost/new/html/highlights/heraklion.php http://localhost/new/html/highlights/heraklion/city_guide.php This is the file structure: htdocs\new\html\highlights.php htdocs\new\html\highlights\heraklion.php htdocs\new\html\highlights\heraklion\city_guide.php also i call the files like this way: heraklion.php is included in highlights.php city_guide.php is included in heraklion.php The full URL is: http://localhost/new/html/crete-highlights?heraklion&city_guide Thanks again!
-
It doesn't work... the rules are valid apart from that one The page without mod_rewrite is actually(and it works): http://localhost/new/html/highlights.php?heraklion&city-guide The path of the city_guide.php file in the server in that way: htdocs\new\html\highlights\heraklion\city_guide.php Please notice: -"city_guide.php" is in "heraklion" directory. -"city_guide.php" is included in "heraklion.php". -"heraklion.php" is in "highlights" directory. -"heraklion.php" is included in highlights.php -"highlights.php" is in "html" directory. I'm feeling completely stuck here I would appreciate any help!
-
Hello! I'm using .htaccess for rewrite rules, everything works fine, i want to add a new rule but it seems impossible to make it work... this is the original link: highlights.php?heraklion&city_guide and this is the link after the desired rewriting rule: crete-highlights/heraklion/city-guide I think it must be something with the "&" character....but i can't figure out... I'm completelly stuck on this... Thanks for any help This is my existing .htaccess file, the one i want to add the rule: Options +FollowSymlinks RewriteEngine On #basic navigation RewriteRule ^excursions/?$ excursions.php [NC,L] RewriteRule ^crete-recommended-hotels/?$ hotels.php [NC,L] RewriteRule ^contact/?$ contact.php [NC,L] RewriteRule ^tour-reservation/?$ tour_reservation.php [NC,L] RewriteRule ^crete-highlights/?$ highlights.php [NC,L] RewriteRule ^crete-recommended-hotels/([analipsi]+)/?$ hotels.php?analipsi#hotels=$1 RewriteRule ^crete-recommended-hotels/([heraklion]+)/?$ hotels.php?heraklion=$1 RewriteRule ^crete-recommended-hotels/([stalida]+)/?$ hotels.php?stalida=$1 RewriteRule ^crete-highlights/([heraklion]+)/?$ highlights.php?heraklion=$1 RewriteRule ^crete-highlights/([chania]+)/?$ highlights.php?chania=$1 RewriteRule ^crete-highlights/([rethymnon]+)/?$ highlights.php?rethymnon=$1 RewriteRule ^crete-highlights/([lasithi]+)/?$ highlights.php?lasithi=$1
-
filesystem - get the image filename, then insert to database.
clearmind replied to clearmind's topic in PHP Coding Help
There is one more issue for me to solve... Is it possible to include image resizing functionality within? Should i use the $file_name = trim($_FILES['file']['name']);// original name of file , or the actual image file name ($imfile? I've searched through many resources including this one: http://www.phpfreaks.com/forums/index.php/topic,294431.0.html but i didn't make it through.... Also as i see in php manual would anyone suggest to use the "Imagick::resizeImage " function? (notice that my host supports ImageMagick) Any idea anyone please!? -
filesystem - get the image filename, then insert to database.
clearmind replied to clearmind's topic in PHP Coding Help
Thank you Richard!! You solution is perfect!! -
filesystem - get the image filename, then insert to database.
clearmind replied to clearmind's topic in PHP Coding Help
Thanks for you suggestion Jax2! It may be useful indeed! Also I think my current script has a lot of error reporting functionality so i can't stop thinking the way to solve this problem in my current script..... ( How can we assign the filename ( $_FILES["file"]["name"] ) into something else - suitable for inserting to database? -
Hello everybody! I'm a newbie with PHP and i'm trying to build my first application. It's a multipart data form, with image upload functionality. <form method="post" action="process.php" enctype="multipart/form-data"> <label>Bus Name: </label> <input name="busname" id="name" type="text" maxlength="100" /> <br /> <label>Bus Description: </label> <textarea name="description" id="description" cols="45" rows="5"></textarea> <br /> <label>select an image:</label> <input type="file" id="file" name="file" /> <input type="submit" id="add" value="add" /> </form> The data is submitted to "process.php" file: include 'config.php'; /* File Upload */ if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/pjpeg")) && ($_FILES["file"]["size"] < 200000)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { if (file_exists("../upload/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " - file already exists. "; echo "please go back and select another image file." ; exit; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "../upload/" . $_FILES["file"]["name"]); echo "image saved successfully</br>"; echo $_FILES["file"]["name"] . '</br>'; } } } else { echo "Invalid file. Please go back and choose a valid image file!"; exit; } /* post variables */ if(isset($_POST['add'])) { $username = $_POST['name']; $password = $_POST['description']; } /* insert name and description */ $sql="INSERT INTO bus (name, description) VALUES ('$_POST[busname]','$_POST[description]')"; if (!mysql_query($sql)) { die('Error: ' . mysql_error()); } echo "1 record added"; As you can see the values of "name" and "description", will be inserted to the database. Also i want to get the image filename of the uploaded file into database. I'm gonna use it at a later time to link the uploaded image.. I'm trying to print the "$_FILES["file"]["name"]" but i'm completely stuck.. Is there any way to do this?? Thanks in advance! DATABASE: -- Database: `busdb` -- -- -------------------------------------------------------- -- -- Table structure for table `bus` -- CREATE TABLE IF NOT EXISTS `bus` ( `busID` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(220) COLLATE utf8_unicode_ci NOT NULL, `description` varchar(220) COLLATE utf8_unicode_ci NOT NULL, `image` varchar(220) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`busID`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=29 ;