Jump to content

QuickOldCar

Staff Alumni
  • Posts

    2,972
  • Joined

  • Last visited

  • Days Won

    28

Everything posted by QuickOldCar

  1. Here's another ajax dropdown example. http://www.onlinehowto.net/Tutorials/AJAX/AJAX-Drop-Down-Select/1338 Or you can read all about ajax. Is tutorials there as well. https://developer.mozilla.org/en/AJAX
  2. Yet is very possible, you just add another field into the same submit form. But unless use ajax for the form, the results are gonna be what the user selects, like as an example they could select ford as make and model as civic, and would get no results naturally. <?php $make = mysql_real_escape_string($_POST['make']); $model = mysql_real_escape_string($_POST['model']); ?> <form name="input" action="" method="post"> Car Make: <Select name="make"> <option "Input" value="<?php echo $make; ?>"><?php echo $make; ?></option> <option value="ford">ford</option> <option value="chevrolet">chevrolet</option> <option value="honda">honda</option> <option value="lexus">lexus</option> </select> Car Model: <Select name="model"> <option "Input" value="<?php echo $model; ?>"><?php echo $model; ?></option> <option value="civic">civic</option> <option value="corsica">corsica</option> <option value="lumina">lumina</option> <option value="delsol">delsol</option> </select> <input type="submit" value="Get The Results" /> </form> <?php if(!isset($_POST['submit']) || $_POST['make'] == "" || $_POST['model'] == "") { echo "<h2>Please check both values.</h2>"; } else { $con = mysql_connect("server","database","password"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("a5525005_cars", $con); $result = mysql_query("SELECT * FROM `cars` WHERE Makel='$make' AND Model='$model'");// added the variables in the query echo "<table class='ex1' border='0' width='113%' style=text-align:center; cellpadding='6' cellspacing='0'> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr style=font-family:verdana;font-size:80%;>"; echo "<td width=13%>" . $row[""] . "<img src=\"" . $row["Photo"] . "\"></a>"; echo '<td width="14%"><a class="mylink" href="' . $row['URL'] . '">' . $row['Model'] . '</a></td>'; echo '<td width="5%"><a class="mylink" href="' . $row['URL'] . '">' . $row['Year'] . '</a></td>'; echo '<td width="4%"><a class="mylink" href="' . $row['URL'] . '">' . $row['Fuel'] . '</a></td>'; echo "</tr>"; } echo "</table>"; mysql_close($con); } ?> Like I said, unless do a more complex ajax queries to get dynamic values upon selections, this is a crude way. Here is an example of the ajax way http://php-ajax-code.blogspot.com/2007/07/ajax-triple-dropdown-with-states-cities.html (yeah it's a bit more complex) I could see you doing multiple forms though, when make is selected, query the model results, then let them select the model....then onto the final results. You can direct them to each form using form names in the action <form name="input" action="model.php" method="post">
  3. Since you asked combo box, I'll show that and also use POST Just add more value options <?php $make = mysql_real_escape_string($_POST['make']); ?> <form name="input" action="" method="post"> Car Make: <Select name="make"> <option "Input" value="<?php echo $make; ?>"><?php echo $make; ?></option> <option value="ford">ford</option> <option value="chevrolet">chevrolet</option> <option value="honda">honda</option> <option value="lexus">lexus</option> </select> <input type="submit" value="Get Car Make" /> </form> <?php if(!isset($_POST['make']) || $_POST['make'] == "") { echo "Insert the Car Make."; } else { $con = mysql_connect("server","database","password"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("a5525005_cars", $con); $result = mysql_query("SELECT * FROM `cars` WHERE Makel='$make'");// added the variable in the query echo "<table class='ex1' border='0' width='113%' style=text-align:center; cellpadding='6' cellspacing='0'> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr style=font-family:verdana;font-size:80%;>"; echo "<td width=13%>" . $row[""] . "<img src=\"" . $row["Photo"] . "\"></a>"; echo '<td width="14%"><a class="mylink" href="' . $row['URL'] . '">' . $row['Model'] . '</a></td>'; echo '<td width="5%"><a class="mylink" href="' . $row['URL'] . '">' . $row['Year'] . '</a></td>'; echo '<td width="4%"><a class="mylink" href="' . $row['URL'] . '">' . $row['Fuel'] . '</a></td>'; echo "</tr>"; } echo "</table>"; mysql_close($con); } ?>
  4. You can get as creative as you want with this. You may use various types of forms to get the users input, a text box, dropdown select, checkbox or w/e. Look here for more explanation and tutorials. http://www.tizag.com/phpT/postget.php http://www.tutorialspoint.com/php/php_get_post.htm http://www.w3schools.com/html/html_forms.asp For your example lets call our value make and use a simple form to see different results. <?php $make = mysql_real_escape_string($_GET['make']); ?> <form action="" method="get"> Car Make: <input type="text" name="make" value="<php echo $make; ?>"/><br /> <input type="submit" value="Get Make of Car" /> </form> <?php if(!isset($_GET['make']) || $_GET['make'] == "") { echo "Insert the Car Make."; } else { $con = mysql_connect("server","database","password"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("a5525005_cars", $con); $result = mysql_query("SELECT * FROM `cars` WHERE Makel='$make'");// added the variable in the query echo "<table class='ex1' border='0' width='113%' style=text-align:center; cellpadding='6' cellspacing='0'> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr style=font-family:verdana;font-size:80%;>"; echo "<td width=13%>" . $row[""] . "<img src=\"" . $row["Photo"] . "\"></a>"; echo '<td width="14%"><a class="mylink" href="' . $row['URL'] . '">' . $row['Model'] . '</a></td>'; echo '<td width="5%"><a class="mylink" href="' . $row['URL'] . '">' . $row['Year'] . '</a></td>'; echo '<td width="4%"><a class="mylink" href="' . $row['URL'] . '">' . $row['Fuel'] . '</a></td>'; echo "</tr>"; } echo "</table>"; mysql_close($con); } ?>
  5. I believe you are missing a quote change this $query = "INSERT INTO tracks (trackName, userID, tag, price, file, fileName, fileSize, fileType) VALUES ('$tname','$userid','$tag','$price','$content','$fileName','$fileSize' , '$fileType)"; to this $query = "INSERT INTO tracks (trackName, userID, tag, price, file, fileName, fileSize, fileType) VALUES ('$tname','$userid','$tag','$price','$content','$fileName','$fileSize','$fileType')"; Pikachu2000 is too fast
  6. For holding temporary information, reading lists, or any data that you don't need to search through, flat files are fine to use. It takes less time to develop something to work with. If you are concerned with not losing data, being searchable, multiple or complex queries, the database is the better way to go. You have a lot more control over it as well. sqlite is a mix of the 2, it keeps everything in files but also acts like a database. http://www.sqlite.org/
  7. and then can add the S so can have the way asked for correct
  8. This script can do it. http://www.dagondesign.com/articles/automatic-mysql-backup-script/
  9. You can play with the timeout, if no timeout value is set it'll wait forever until it connects. It's best to set the timeout You have a balance between being able to connect fast or not connecting because the site took too long to respond also. curl_setopt($ch, CURLOPT_TIMEOUT, 3);
  10. Well the standard way would be to have them as variables //variable values coming from somewhere $language = "pl"; $month = date('M'); $day = date('D'); $year = date('Y'); $hour = date('h'); $minute = date('i'); $second = date('s'); greet($language,$month,$day,$year,$hour,$minute,$second); in function follows same order And in function you wouldn't need to change the value because it comes from before it function greet($language,$date1) { //$date1 = date('D'); //not needed $date1 value already there (unless you want to change the value) You can also do arrays or a string and can explode them separated by any delimiter that makes sense to you. Checking if value exists or is not empty as well. I don't have time to explain fully, I need to go to work. Hopefully I explained well enough or others can explain and give more examples of arrays and even exploding arrays from strings of text using delimiters
  11. I changed it a bit. <?php function greet($language) { $date=date("H"); if($language == "uk") { if ($date >= '00' && $date < '12'){ return "Good Morning"; }elseif ($date >= '12' && $date < '18') { return "Good Afternoon"; }elseif ($date >= '18' && $date < '24') { return "Good Evening"; }else{ return "All Messed Up"; } } elseif ($language == "pl") { if ($date >= '00' && $date < '12'){ return "Dzien dobry"; }elseif ($date >= '12' && $date < '18') { return "Dzien dobry" ; }elseif ($date >= '18' && $date < '24') { return "Dobry wieczor" ; }else{ return "Zjebales" ; } } else { return "No Language Selected"; } } echo greet(pl); echo "<br />"; echo greet(uk); ?>
  12. Something like this as an example: if(empty($_POST['year']) || empty($_POST['month']) || empty($_POST['day'])) { // one or all is empty do something here like redirect back so user can insert values $date_ok = false; } else { // all have values continue with code $date_ok = true; } or can even do more checks on it and the other way, must be set and not empty for each if(isset($_POST['year']) && !empty($_POST['year']) && isset($_POST['month']) && !empty($_POST['month']) && isset($_POST['day']) && !empty($_POST['day'])) { //continue with code only if all above conditions are met } whichever way you do it you must check all 3 values separate, not as one empty plus other code just used for displaying purposes. Or in this case you manually assembling your date.
  13. Try not using short tags of <? versus <?php Echo the results, otherwise they will not display. <track> <path><?php echo $result['link'];?></path> <title><?php echo $result['title'];?></title> </track>
  14. I don't usually comment on people's efforts to help and try and educate others, but are you sure you should be writing tutorials for others? http://www.coolcodeforum.com/forum/viewtopic.php?f=22&t=6&sid=ba4bccb66c39b6f7a8fb353817793fed Pretty much 99.9% of php coders can see all the mistakes on that page. Maybe you should make it a habit to run the code you write at least. Spell checking and read it back to yourself. If describing a code make it related to the code. I could list here the 5 mistakes I quickly saw there, but what fun would that be? As for the looks and stuff, some people prefer plain, some fancy. People will always have opinions if there are choices. Sometimes simplicity is better as for functionality, or can get all fancy with slower loading pages, possibly design errors. But I will have to say sometimes the simplest borders can go a long way if not to at least divide the content into sections and maintaining margins while creating content containers. Since you are using phppp forum as your main site, why not try to match your main page with the forum design. (Or a different theme choice and match that)
  15. Basically how adam said. The crawling and your links can be gotten in a few ways. A crawler can rip every link from your pages, (besides ajax), then follow every of those links to any depth it wants. Generating random words and or pages in urls can be used in crawlers to try to get results from a website, could even be in a search form. Can also get information from a sitemap if you have one. They even acquire links from your site other sites they crawled that had a link of yours. There's also feed crawlers grabbing latest posts.
  16. Here's a get last path from url function I made. function getLastPath($url) { $trim_path = trim($url, '/'); $parts = explode('/', $trim_path); $last = end($parts); return $last; } or you can just integrate something like this <?php if($_POST['newlinks']) { $newlinks = $_POST["newlinks"]; $newlinks = preg_split("/.rar/", $newlinks); foreach ($newlinks as $newlink) { $trim_path = trim($newlink, '/'); $parts = explode('/', $trim_path); $r_name = end($parts); 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>"; ?>
  17. http://www.phpclasses.org/package/4091-PHP-Retrieve-multiple-pages-simultaneously.html
  18. Then another suggestion would be to make a script that cycles each of your customers in loops, and do a select to mysql or even sqlite going by date, basically a "last time date checked". If last date checked less than 12 hours, run another script to do any actions. At the same time update the last date checked to the current time. sleep() is not good to do unless for a very small amount and only when absolutely necessary.
  19. This is just one way. $url= "http://www.gamersfirst.com/warrock/?q=Player&nickname=$nickname"; Just wrap in double quotes, and if do any quotes within the doubles would need to be single quotes.
  20. http://php.net/manual/en/function.urlencode.php
  21. If you need lists of domains to crawl let me know, I have 100 million+++. I systematically crawl the lists with curl for the DynaIndex. But I also have a link ripper crawler too. http://get.blogdns.com/dynaindex/ripper/ It sorts any link it finds and saves it to it's main domains folder. Something like this: http://get.blogdns.com/dynaindex/ripper/?domain=about.com It's a text file based system I came up with. I don't save titles for urls because all the sites rename them to whatever they want. I have other ways to show the original and exact title for the url. I just didn't finish everything I wanted to do with it yet. Here's a very nice open source search crawler I used a few years ago. http://www.sphider.eu/ Just add any domains want to crawl, set the link depth level and let it go. I may just incorporate this into my links ripper one day. If you want to search lists from alexa,dmoz,whois by a word or words in the domain name, and also being able to exclude words, you can use my crude domains search I made. http://get.blogdns.com/dynaindex/urls/ I really think switching to cassandra as the database is the way to properly do all this, and using python for for the search. There is an insane amount of links on the net. A few little niche sites may be better.
  22. Or alternately can use http://us.php.net/rawurldecode and http://php.net/manual/en/function.rawurlencode.php example: <?php $url = "http://somesite.com/My File/script.php?value=1+2+3+4"; $decode = rawurldecode($url); $encode = rawurlencode($decode); echo $url."<br />"; echo $decode."<br />"; echo $encode."<br />"; ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.