QuickOldCar
Staff Alumni-
Posts
2,972 -
Joined
-
Last visited
-
Days Won
28
Everything posted by QuickOldCar
-
I made some pagination that are welcome to use or just get idea's from. Code for them is at the links. http://get.blogdns.com/paginate http://get.blogdns.com/dynaindex/paginate.php
-
Pretty cool iframe cropper script! My first (real) script.
QuickOldCar replied to jdock1's topic in Beta Test Your Stuff!
Not Found, Error 404 -
For me in ie the latest news is inside the images display area and not at the lower right as in firefox. Could it be a missing </div> ?
-
Good idea for a site Paul. I guess you can get recognized for anything you wanted to include. Can do music, instruments, singing, dancing, modeling, acting, artist and so on. What I'm saying is if it were me I wouldn't limit it to one thing.
-
You can try deleting that theme folder and use the default , then try a different theme.
-
Php news script - question probably concerning mysql
QuickOldCar replied to nick.a's topic in MySQL Help
I tried to break this down in another way and also try to explain it. //this gets the current url $url = filter_var("http://".$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'], FILTER_SANITIZE_STRING); if (!empty($_SERVER["QUERY_STRING"])){ $query_string = filter_var($_SERVER['QUERY_STRING'], FILTER_SANITIZE_STRING); $url .= "?".$query_string; } //startrow would be used for any pagination you have to tell mysql where to start from $startrow = 0; //this sets the amount depending on what the url is if ($url == "http://mysite.com/") { //can also add index.php or w/e you need with OR $post_amount = 3; } else { $post_amount = 10; } //the partial mysql query $result = mysql_query("SELECT * FROM table ORDER BY ID DESC LIMIT $startrow,$post_amount"); -
Php news script - question probably concerning mysql
QuickOldCar replied to nick.a's topic in MySQL Help
It's gonna be hard for anyone to give code when they don't know what you have. Here's a method I use on my site for the main page. I use a multiple mysql query and search/navigation using pagination. I don't know how you do your site at all. $url = filter_var("http://".$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'], FILTER_SANITIZE_STRING); if (!empty($_SERVER["QUERY_STRING"])){ $query_string = filter_var($_SERVER['QUERY_STRING'], FILTER_SANITIZE_STRING); $url .= "?".$query_string; } if ($url == "http://mysite.com/") { //can also add index.php or w/e you need with OR $result = mysql_query("SELECT * FROM table ORDER BY ID DESC LIMIT 0,3"); } else { $result = mysql_query("SELECT * FROM table ORDER BY ID DESC LIMIT 0,10"); } If this doesn't help you and nobody else chimes in and walks you through I can help in a few days. I'll be too busy next few days. -
It's simple and right to the point. Seems easy to read. Since you only have 4 sections maybe you can make them smaller for the pictures to get them all on the page with no need to scroll on the main page. First impression I got was it was one of those "related searches" sites, due to the simple categories layout.
-
I would appreciate opinions on my new theology & technology blog
QuickOldCar replied to thurfjell's topic in Website Critique
Let me ask what you feel of the site. It's most likely the same as everyone else feels, it's very plain, unorganized, no features, drab colors, and then even gonna add uneventful. Trying to give an honest opinion here, do everything different. -
Need a link to your website.
-
How can I set php dates 10 years into the future?
QuickOldCar replied to liquid2g's topic in PHP Coding Help
Wouldn't the easiest way be to hop in a DeLorean 10 years to the future, do all the dates as normal and just time warp back to this date? I just couldn't resist, being that you are doing a science fiction blog and all. -
PHP-based indexing and search implementation
QuickOldCar replied to kristo5747's topic in PHP Coding Help
I second using a database. Then trying one of the following methods http://sphinxsearch.com/ http://lucene.apache.org/ http://www.zackgrossbart.com/hackito/search-engine-python/ Or even use mysql full text indexing http://dev.mysql.com/doc/refman/5.5/en/fulltext-search.html -
Can't connect to the site.
-
It seems ok. It would probably be nicer if had borders/backgrounds and some more styling to distinguish areas. And not just floating areas amongst the black.
-
I like a lot about the site. The search is fantastic, the preview and then into the advanced search is very good. Although maybe you should look into making a separate section for past posts, and also paginate them as well. You already have posts cycling in the top one by one, then a footer, everything after that I don't feel is needed on the main page.
-
I think it's lots better. The header image could probably be smaller, that's just preference I suppose. Still looks clean, easy to read and works well.
-
I'm not sure why you have a forward slash here <p></php echo $foo; ?></p> should be <p><?php echo $foo; ?></p>
-
Not that it's not impossible to give you an example code, but it is difficult to do a mock-up database and image upload/display for you. I been slowly working on a multi-files upload script that I'll show you the working example and also give you it in a download. It's not 100% completed, but it does work, I had more work to do on the category selects and navigation. http://get.blogdns.com/file/ And here it is packaged up including a database sql file http://get.blogdns.com/download/file.zip
-
All the images can go into a central folder, save all the information in the database into fields also saving the image location/name in a field. You may want to add a timestamp to their images so is no duplicates uploaded. Each new car post would have it's own id if use auto-increment, so all the content would be associated to the id.
-
Is this the complete code? I don't see anywhere that you connected to the database. http://www.w3schools.com/php/php_mysql_connect.asp
-
Passing a category into a url/pagination problem
QuickOldCar replied to convy's topic in PHP Coding Help
If wanted a different pagination I wrote 2 different ones up that control the mysql startrow and limit, the simpler one can do any amount per page while the more deluxe one I have set to 10 posts per page. Can see them both working and the codes embed below them. http://get.blogdns.com/paginate and this is more deluxe http://get.blogdns.com/dynaindex/paginate.php -
How to Get just referrer url and not all the variables?
QuickOldCar replied to dombrorj's topic in PHP Coding Help
Whatever works is fine, as long as it gets the job done the way you want it to. I just hack the end off , you show from the beginning. If start having port numbers, user names and passwords or anything other in the url would see the difference. I do it my way to have more control over it and also to be a function. this should be filtered $url = filter_var($_SERVER['HTTP_REFERER'], FILTER_SANITIZE_STRING); -
Passing a category into a url/pagination problem
QuickOldCar replied to convy's topic in PHP Coding Help
I made a few changes, try it and see if you can work with this. <?php include('admin/conf.php'); include('admin/functions.php'); $select_category = mysql_real_escape_string($_GET['category']); if (!isset($_GET['category'])) { $select_category = "All"; } if (!isset($_GET['startrow']) or !is_numeric($_GET['startrow'])) { $startrow = 0; } else { $startrow = (int)$_GET['startrow']; } $connection = mysql_connect($host, $user, $pass) or die ('Unable to connect!'); mysql_select_db($db) or die ('Unable to select database!'); if ($select_category == "All") { $sql = "SELECT id, title, content, photo, timestamp FROM approved ORDER BY timestamp DESC LIMIT $startrow,2"; } else { $sql = "SELECT id, title, content, photo, timestamp FROM approved WHERE category='$select_category' ORDER BY timestamp DESC LIMIT $startrow,2"; } $result = mysql_query($sql) or die ("Error in query: $query. " . mysql_error()); if (mysql_num_rows($result) > 0) { while($row = mysql_fetch_object($result)) { ?> <img src="http://trunham.info/pictures/ <?php echo $row->photo;?>" width="100" height="100" border="1" align="left" /> <font size="+2" class="style1"><a style="text-decoration:none" class="articletext" href="article.php?id= <?php echo $row->id; ?>" ><?php echo $row->title; ?></a></font><br><br> <font class="articletext2"><?php echo substr($row->content,0,100) ;?>...</font> <?PHP } } echo '<a href="'.$_SERVER['PHP_SELF'].'?startrow='.($startrow+2).'category='.($select_category).'">Next</a>'; $prev = $startrow - 2; if ($prev >= 0) echo '<a href="'.$_SERVER['PHP_SELF'].'?startrow='.$prev.'">Previous</a>'; ?> <form name="input" action="" method="get"> <select name="category"> <option value="<?php echo $select_category; ?>"><?php echo $select_category; ?></option> <option value="All">All</option> <option value="General">General</option> <option value="Music">Music</option> <option value="Funny">Funny</option> </select> <input type="submit" value="Set" />/> </form> -
Try this, I added a timestamp function and placed it in your code. <?php function addTimestamp($filename) { $character = "/"; $target_check = strrchr($filename,$character); if ($target_check[$character]) { $temp_filename1 = end(explode($target_check[$character],$filename)); $target = true; } else { $temp_filename1 = $filename; } $temp_filename = strtolower(trim($temp_filename1)); $timestamp = date('Y-m-d-H-i-s'); if ($target) { $new_filename = str_replace($temp_filename1, "$timestamp-$temp_filename", $filename); } else { $new_filename = "$timestamp-$temp_filename"; } return $new_filename; } $locatie="upload/"; $toegestaan = "doc"; $max_size = 1000000; set_time_limit(0); if(isset($_POST['upload'])) { if(is_uploaded_file($_FILES['bestand']['tmp_name'])) { $extensie_bestand = pathinfo($_FILES['bestand']['name']); $extensie_bestand = $extensie_bestand[extension]; $extensies_toegestaan = explode(", ", $toegestaan); for($i = 0; $i < count($extensies_toegestaan); $i++) { if($extensies_toegestaan[$i] == "$extensie_bestand") { $ok = 1; } } if($ok == 1) { if($_FILES['bestand']['size']>$max_size) { echo "Het bestand is te groot, de maximale grootte is: <b>$max_size</b>"; exit; } if(!move_uploaded_file($_FILES['bestand']['tmp_name'], $locatie.$_FILES['bestand']['name'])) { echo "het bestand kan niet worden verplaatst"; exit; } $filename = addTimestamp($locatie.$_FILES['bestand']['name']); echo "Het bestand ".$_FILES['bestand']['name']." is geupload<br> <a href='$filename'>$filename</a>"; } else { echo "Verkeerde extentie, de toegestane extensies zijn: <b>$toegestaan</b>"; } } else { echo "Het uploaden is mislukt, probeer het opnieuw"; } } ?> <title>test tittle</title> <style type="text/css"> <!-- body { margin-top: 0px; } --> </style></head> <body> <table width="1216" height="1191" border="0" cellpadding="0" cellspacing="0" background="back"> <tr> <td height="317" colspan="2"> </td> </tr> <tr> <td height="381"> </td> <td><p> </p> <form method="post" action="<?=$_SERVER['PHP_SELF']?>" enctype="multipart/form-data"> <table width="398" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="180"> </td> <td width="218"><input type="file" name="bestand" /> <input type="submit" name="upload" value="uploaden" /></td> </tr> <tr> <td> </td> <td> </td> </tr> </table> </form></td> </tr> <tr> <td width="420"> </td> <td width="796"> </td> </tr> </table> But litebearer's code is much better for the upload
-
How to Get just referrer url and not all the variables?
QuickOldCar replied to dombrorj's topic in PHP Coding Help
sorry for late reply, been busy here's a function to eliminate the query and any fragments off url's <?php function removeQuery($new_url) { if ($new_url != '') { $query_parse_url = parse_url(trim($new_url), PHP_URL_QUERY); $fragment_parse_url = parse_url($new_url, PHP_URL_FRAGMENT); $remove_query_and_fragment = str_replace(array("$query_parse_url","$fragment_parse_url"), '', $new_url); $trimmed_host_and_paths = rtrim($remove_query_and_fragment, '?,#,/'); return $trimmed_host_and_paths; } else { return "no url inserted"; } } ?> <?php //usage $url1 = "http://www.phpfreaks.com/forums/php-coding-help/?action=post"; $url2 = "www.phpfreaks.com/forums/php-coding-help/?action=post"; $url3 = "somesite.com/forum/location/#"; $url4 = "HTTP://WWW.PHPFREAKS.COM/forums/php-coding-help/?action=post&var=var/"; $example_1 = removeQuery($url1); $example_2 = removeQuery($url2); $example_3 = removeQuery($url3); $example_4 = removeQuery($url4); echo "$example_1<br />$example_2<br />$example_3<br />$example_4<br />"; ?>