-
Posts
3,584 -
Joined
-
Last visited
-
Days Won
3
Everything posted by JonnoTheDev
-
Not sure about the title of this post. Think its more about re-inventing a wheel. What kind of suggestions? Features, design, database structure, code structure, etc....
-
correct. you cannot have spaces in a url. The php function that I have posted will clean strings to be url friendly. i.e The Rain In Spain *?&___ And Some would become the-rain-in-spain-and-some
-
Ah shit. You cannot have spaces in a url. Replace with RewriteRule ^vehicle/([0-9]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)$ /cars.php?catid=3&subcatid=$1&prov=$2&town=$3 [L]
-
Sorry I cannot see anything wrong with this line. The regex is perfectly valid. Try adding / prior to cars.php RewriteRule ^vehicle/([0-9]+)/([A-Za-z0-9- ]+)/([A-Za-z0-9- ]+)$ /cars.php?catid=3&subcatid=$1&prov=$2&town=$3 [L] Are you sure it is in the correct place?
-
What code
-
Theres quite a lot more to it than that.
-
You should never allow any characters (.*) RewriteRule ^vehicle/([0-9]+)/([A-Za-z0-9- ]+)/([A-Za-z0-9- ]+)$ cars.php?catid=3&subcatid=$1&prov=$2&town=$3 [L] Use a function in your code to prepare any strings to be used in a url. Then you will know exactly what characters to expect in the url i.e <?php function prepareUrlText($string) { // no characters except a-z, 0-9, dash, underscore or space $blacklistChars = '#[^-a-zA-Z0-9_ ]#'; $string = preg_replace($blacklistChars, '', $string); $string = trim($string); $string = preg_replace('#[-_ ]+#', '-', $string); $string = strtolower($string); return $string; } ?>
-
To convert videos and capture a screenshot just as youtube does, you require software on your server such as FFMPEG and or Mencoder. http://ffmpeg.org/ To create an upload script is simple. There are tons on this forum that you can search for. However if you are going to be uploading very large files then I suggest an uploader such as http://uber-uploader.sourceforge.net/ There are help docs and examples.
-
Absolutely no way. The only time I see these in action are when some of our clients who are web hosting companies decide to offer web development as a service. They have limited knowledge of development so install these off-the-shelf products to construct websites. The issue comes when their clients require functionality that the CMS does not offer. Another reason not to use these is that if a security flaw is found and you have 100 clients websites working from the same system then it probably wont take long before they are all compromised. Doesn't take a genius to work out that a site has been constructed from a commercial CMS. In terms of learning I would take your time and don't rush into it. A good set of reference books is always a good start. Using Internet tutorials is fine as long as you stick to a limited number of sources. There is so much crap out there demonstarting bad habbits and so many developers have different styles of coding so it can become confusing.
-
[SOLVED] Using md5(or md4?) to create a unique hash, help please
JonnoTheDev replied to physaux's topic in PHP Coding Help
Why are you creating static pages? Is the content not stored in a database? If so you only require 1 file. A mod-rewrite, can include the page name in the url. Use the primary key as the page identifier i.e /page-title/23.html /another-page-title/24.html Both pages are index.php?id= -
Add indexes to the following fields: checked, fsize, media Make sure you are using the most efficient data types for your fields. http://www.databasejournal.com/features/mysql/article.php/1382791/Optimizing-MySQL-Queries-and-Indexes.htm
-
INDEXES Also what is contained in the following variables? $stype $fxtype $fxmedia $fsort
-
Brilliant. I think the driver must have been sampling the merchandise.
-
Exacly. When using CURL you should check for errors before trying to extract anything from the result. i.e. return an array <?php $return['file'] = curl_exec($ch); $return['status'] = curl_getinfo($ch); $return['error'] = curl_error($ch); curl_close($ch); if(!strlen($return['error'])) { // no error - continue } ?>
-
A HTTP request timeout should not kill your script. It is either the logic within your functions or your calling code that is doing this
-
Sorry, I am not completing your work for you. You should take the advice given and learn yourself. There is enough code there for you to try yourself. Learn arrays: http://uk2.php.net/manual/en/language.types.array.php Loops http://uk2.php.net/manual/en/control-structures.for.php http://uk2.php.net/manual/en/control-structures.foreach.php Mysql Joins http://dev.mysql.com/doc/refman/5.1/en/join.html
-
Join the suburbs table in the query and add to the multidimensional array. You need to learn how to structure an array so you can create a simple loop. i.e. array('uk' => array(0 => array('city' => 'Manchester', 'suburbs' => array('x', 'y')), array(1 => array('city' => 'Liverpool', 'suburbs' => array('a', 'b'))); etc
-
Just print the first 2 of the array <?php $result = mysql_query("SELECT co.country, c.city FROM countries co INNER JOIN cities c ON(c.country = co.id) ORDER BY co.country, c.city ASC"); $places = array(); while($row = mysql_fetch_assoc($result)) { $places[$row['country']][] = $row['city']; } foreach($places as $country => $cities) { print "<h2>".$country."</h2>"; print "<p>".$cities[0].", ".$cities[1]."</p>"; } ?>
-
It's entirely made in flash. Why? You will struggle getting your site indexed for any keywords on major search engines. This design could have been made with standard XHTML.
-
You should first build an array from your query then loop through it. You only require one query. <?php $result = mysql_query("SELECT co.country, c.city FROM countries co INNER JOIN cities c ON(c.country = co.id) ORDER BY co.country, c.city ASC"); $places = array(); while($row = mysql_fetch_assoc($result)) { $places[$row['country']][] = $row['city']; } foreach($places as $country => $cities) { print "<h2>".$country."</h2>"; print "<p>".implode(", ",$cities)."</p>"; } ?>
-
There was an apache module called mod_throttle but I believe it is not avaialable for apache 2. Take a look at http://www.topology.org/src/bwshare/README.html You may have to do by IP address. Another option maybe is to have 2 domains using different A record addresses (same server). Each IP is a different NIC. You could throttle the bandwidth on one of the cards.
-
[SOLVED] i'm thinkin of a number.... looping
JonnoTheDev replied to ivanmcruz32's topic in PHP Coding Help
You should certainly learn how the code works to progress. -
[SOLVED] i'm thinkin of a number.... looping
JonnoTheDev replied to ivanmcruz32's topic in PHP Coding Help
The code is terrible. Global variables are bad. Your HTML markup is invalid. You dont have a form. You do not even need a loop for this task nor do you require functions. Here is you script simplified: <html> <head> <title>Number Guessing v1.1.1.90</title> <style type = "text/css"> body { background: green; color: white; } </style> </head> <body> <h1>Number Guessing</h1><br><br> <h2>Please guess a number between 1 and 10</h2><br><br> <?php if($_POST['submit'] == 'Enter') { $_POST['attempts']++; if(is_numeric($_POST['guess'])) { if($_POST['guess'] == $_POST['hiddenGuess']) { print "<p>You guessed correctly</p>"; } if($_POST['guess'] > $_POST['hiddenGuess']) { print "<p>You guessed too high</p>"; } if($_POST['guess'] < $_POST['hiddenGuess']) { print "<p>You guessed too low</p>"; } } else { print "<p>Please enter a number</p>"; } } ?> <p>Attempts: <?php print isset($_POST['attempts']) ? $_POST['attempts'] : 0; ?></p> <form method="post" action=""> <input type="text" name="guess" /> <input type="hidden" name="attempts" value="<?php print $_POST['attempts']; ?>" /> <input type="hidden" name="hiddenGuess" value="<?php print is_numeric($_POST['hiddenGuess']) ? $_POST['hiddenGuess'] : rand(1,10); ?>" /> <input type="submit" name="submit" value="Enter" /> </form> </body> </html> -
Flash players are available for free all over the web. Do some Googling. Flash is not the technology that is used for uploading files to a webserver however an application may have a flash front end, however it will be tied into a server side script (PHP or PERL). Once the file is uploaded the server side script should be written so it will add the appropriate records to your database. A script to obtain the music files is required that will query the database and display the appropriate records. When a user clicks a link the selected track is played in your flash player. I suggest you learn PHP, mysql and focus on database queries. Uploading files. $_GET & $_POST arrays.
-
How do I change the time of phpmyadmin in my database tables
JonnoTheDev replied to Irresistable's topic in PHP Coding Help
Where are you displaying the time? You are not making yourself very clear.