QuickOldCar
Staff Alumni-
Posts
2,972 -
Joined
-
Last visited
-
Days Won
28
Everything posted by QuickOldCar
-
Explode comma delimited field for tagging system
QuickOldCar replied to Catherine85's topic in PHP Coding Help
To insert into array use implode. http://php.net/manual/en/function.implode.php To fetch can explode http://www.php.net/manual/en/function.explode.php Prob better off using a pipe though... | I would think having each category as it's own table and associate to the id be best approach. Look into wordpress database structure using terms as an example -
Image display in a div reading image filename from database
QuickOldCar replied to colap's topic in PHP Coding Help
For sexy slider it's because is now a pay for script. http://codecanyon.net/item/sexy-slider/87148 $7.00 or $35.00 for extended license -
Lets try to simplify this. css stylesheets can place items where you exactly want and the looks in named dividers. The first link uses this as an example http://phpsquad.net/style.css The second uses this http://www.enchantedhogwarts.net/css/header.css As for the links area, all you have to do is either write the code and wrap it in a divider based on the position and style determined in the stylesheet, or can even make a new .php file lets say, navigation.php and include it. http://php.net/manual/en/function.include.php for a beginners css try here http://www.w3schools.com/css/
-
Use <?php instead of shortcode <? Obviously this is not the actual code you are using if was working for a year. $words = array('unwanted words for array put here', ); But if were to do it should be formatted as this $words = array("unwanted","words","for","array","put","here"); Also as a suggestion any time bringing stuff in from arrays or text files is usually good to trim it. You may accidentally have whitespace. trim($word); Lastly, all this is just sitting there each line with no echo's or semicolons at end of lines mail("my-email@aol.com", // to "Subject Line", $body); so try mail('my-email@aol.com', 'Subject Line', $body);
-
I think looks and works just fine. I like it. Watched your entire run too. As for the white, most video hosts quickly see that the bandwidth is crucial, so less crap to load the better, examples would be wisevid and zshare, I remember wisevid was all sleek and fancy, they changed that in a hurry.
-
http://www.birdshell.net. got an extra dot there Although it works pretty slick right now, once you get many links for each category that page would become quite large. I feel maybe show latest 6 or something for each category, add a [see more results], and have it's own designated page for the categories. Possibly even pagination.
-
I made a masking safe filter, can do just words or entire posts if wanted. Can view a demo and the download is at the bottom. http://get.blogdns.com/dynaindex/Safe-Filter/
-
curl_setopt($ch, CURLOPT_USERPWD, "myusername:mypassword");
-
Yes you just label the divider and the css does the rest. you can break out of php and back in like this ?> <div id="example"> <?php or can echo it with single quotes within echo "<div id='example'>"; $somecode = "blah"; echo "</div>"; or can escape them echo "<div id=\"example\"><a href='index.php'>Home page</a></div>"; even something like this echo "<div id=\"example\">". $somecode."<a href='index.php'>Home page</a></div>";
-
instead of $sql="SELECT id, serial_no, model, calibre, manufacturer, date_manufacture, captor, date_capture, place_capture, orig_alloc_place, orig_alloc_state, current_loc_place, current_loc_state, extant, condition FROM war_trophies WHERE serial_no LIKE '%" . $name . "%' OR model LIKE '%" . $name ."%'"; try $sql="SELECT * FROM war_trophies WHERE serial_no LIKE '%"."$name"."%' OR model LIKE '%"."$name"."%'";
-
No you put html in the php code. This should be exactly what you need <? $subject="from ".$_GET['name']; $headers= "From: ".$_GET['email']."\n"; $headers.='Content-type: text/html; charset=iso-8859-1'; mail("kc@kamil-cizek.com", $subject, " <html> <head> <title>Contact letter</title> </head> <body> <br> " . "name: " .$_GET['name']. "<br>" . "email: " .$_GET['surname']. "<br>" . "fax: " .$_GET['tel']. "<br>" . "age: " .$_GET['email']. "<br>" . "gender: " .$_GET['address']. "<br>" . "name: " .$_GET['city']. "<br>" . "email: " .$_GET['postcode']. "<p>" . "fax: " .$_GET['date']. "<br>" . "age: " .$_GET['type']. "<p>" . "message: <p>" .$_GET['message']." </body> </html>" , $headers); ?> <meta http-equiv="refresh" content="5;url=http://stjohnsclaims.co.uk/test5/index.html">;
-
you can just add this to the bottom 5 is the time to delay, and of course url is the location to go <meta http-equiv="refresh" content="5;url=./index.html"> Edited the .php to .html
-
Most likely the query is failing due to quote's being wrong or not escaped LIKE '%" . $name . "%' OR model LIKE '%" . $name ."%'"
-
Change echo "<li>" . "<a href=\"search.php?id=$id\>" .$serial_no . " " . $model . "</a></li>\n"; to this echo "<li><a href='search.php?id=$id'>$serial_no $model</a></li>\n"; And should probably be using <br /> unless are converting the \n
-
for this line $query = "select * from anzac where Serial No. like \"%$trimmed%\" order by Serial No."; You can't use a . or spaces like that, and it should be the exact that is the field in your database, something like serial_no You should look in your database and see the actual field values they are that are going to search into.
-
make a blog post clickable to display on it's own page
QuickOldCar replied to webguync's topic in PHP Coding Help
Have an index or a main display page? You could just make a single.php page and include what you would like. Then just make a link to it using unique id's from the main pages. Is this some type of template system you designed on your own? -
make a blog post clickable to display on it's own page
QuickOldCar replied to webguync's topic in PHP Coding Help
Maybe this will help, I made a simple sample demo emulating a website and post links. I have no idea what the rest of your code is, but the normal is to query the database, find how many results and paginate them. From the paginated links you display a content area. Depending on the query it would display different results. As for yours it seems you made this a function and have preset rules there and a pile of joins. I guess it's possible to just include a different function with different select queries in the content area. You may view this exact code here: http://get.blogdns.com/dynaindex/post-variable.php My home link is different because I'm running this in a subdirectory. <?php //dummy post post data $post_id = range(1,20); $title = "Link to a post"; $description = "This is a demonstration of linking to a post all using the same file. Depending if you use by id or a specific value would not matter, you just have to set it to those."; $comment = "blah blah blah is my comment"; //end of dummy post data $post = mysql_real_escape_string($_GET['post']); $home_url = "http://".filter_var($_SERVER['HTTP_HOST'], FILTER_SANITIZE_STRING); $about_page = "$home_url/about/"; $url = "http://".filter_var($_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'], FILTER_SANITIZE_STRING); if (!empty($_SERVER["QUERY_STRING"])){ $url .= "?".filter_var($_SERVER['QUERY_STRING'], FILTER_SANITIZE_STRING); } if ($url == "$home_url") { $url = "$url?$post"; } echo "<a href='$home_url'>Home</a><br />"; echo "<a href='$url'>$url</a><br />"; echo "<a href='$about_page'>About</a><br />"; echo "<br />"; ?> <form name="input" action="<?php echo $url; ?>" method="get"> ID Number or Post Name:<input size="30"type="text" name="post" style="color: #FFFFFF; font-family: Verdana; font-weight: bold; font-size: 12px; background-color: #000000;" size="15" value="<?php echo $post; ?>"> <input type="submit" style="color: #FFFFFF; font-family: Verdana; font-weight: bold; font-size: 12px; background-color: #000000;" size="15" value="Go to Post" /> </form> <?php if (isset($_GET['post'])){ echo "<h2>Post Content</h2"; echo "<hr>"; $post_link = "<a href='$url$post_number'>Permalink</a><br />"; echo $post_link; echo "$post<br />"; echo "<p>".$title."<br />".$description."<br />".$comment."</p><br />"; echo "<hr>"; } elseif ($url == "$about_page"){ echo "<h2>About Page</h2"; echo "My way of displaying different content using a single php script"; } else { echo "<h2>Main Content</h2<br />"; echo "<hr>"; foreach ($post_id as $post_number) { echo $post_number; $post_link = "<a href='$url?post=$post_number'>View post</a>"; echo "<p>$post_link</p><br />"; echo "<hr>"; } } echo "<br />"; ?> <?php echo "Compliments of Quick"; ?> -
I agree with your less code for extension, I just used my array one I use for a files upload script for allowed extensions. I was thinking on making it that depending on the extension and which domain was coming from to do different things with it. Maybe a multi-downloader and checkboxes for all would like to download on the page and place them in different locations. Was just an idea, but I already have way too many ideas. Here's my simple page parser http://dynaindex.com/simple-parse Or a more advanced one I did. http://dynaindex.com/page-parser Yeah simplehtml dom pretty cool, you can grab from any tag you want, also grab titles, I don't do titles actually because I found that not every link has a title, plus many sites use self ref so as can see in that part of my code I made many corrections for making them an actual link.
-
Yeah that's the way would have to. I think would have to make specific for each site though, they all have different methods. I'd parse the url to know the site: stagevu.com using html dom parse all the href on the page: then depending on which site use w/e pattern they use like the path, like stagevu uses for stagevu the first file path is always v, but since they always have just one avi as a download easier to just search the end url's by filetype .avi http://n65.stagevu.com/v/63980ee118e01d9980d0eacacc459ad2/jomxdgbvxnip.avi then it can continue with the download script all in all I think it's easier to just get the current links from the sites, lol But here is a meatballed version that uses simplehtml dom It requires simple_html_dom.php in same directory. http://simplehtmldom.sourceforge.net/ I really didn't do checks or anything, just to see it work a few times. So using urls such as http://stagevu.com/video/srpfmbeqxlwe instead of the avi download link in the form file-download.php <?PHP set_time_limit(0); $filename = str_replace(' ','_',$_GET['filename']); $fileURL = $_GET['url']; include('simple_html_dom.php'); function getHost2($url) { $parseUrl = parse_url(trim($url)); return trim($parseUrl[host] ? $parseUrl[host] : array_shift(explode('/', $parseUrl[path], 2))); } $url = mysql_real_escape_string($_GET['url']); $getExtensions = array("avi","avi"); if (substr($url, 0, 4) != "http") { $url = "http://$url"; } $parsed_url = getHost2($url); $http_parsed_host = "http://$parsed_url/"; $html = file_get_html($url); ?> <base target="_blank"> <?php foreach($html->find('a') as $element) $title = "$element->href"; $dom = new DOMDocument(); @$dom->loadHTML($html); $xpath = new DOMXPath($dom); $hrefs = $xpath->evaluate("/html/body//a"); for ($i = 0; $i < $hrefs->length; $i++) { $href = $hrefs->item($i); $href_link = $href->getAttribute('href'); $parse_count = count("$http_parsed_host"); $substr_count = +7; if (substr($href_link, 0, $substr_count) == "mailto:") { $mail_link = $href_link; $href_link = trim($mail_link,$href_link); } if (substr($href_link, 0, 1) == "/") { $href_link = trim($href_link,"/"); } if (substr($href_link, 0, 2) == "//") { $href_link = trim($href_link,"//"); } if (substr($href_link, 0, 3) == "///") { $href_link = trim($href_link,"///"); } if ((substr($href_link, 0, == "https://") OR (substr($href_link, 0, 12) == "https://www.") OR (substr($href_link, 0, 7) == "http://") OR (substr($href_link, 0, 11) == "http://www.") OR (substr($href_link, 0, 6) == "ftp://") OR (substr($href_link, 0, 11) == "feed://www.") OR (substr($href_link, 0, 7) == "feed://")) { $final_href_link[] = $href_link; } else { if (substr($href_link, 0, 1) != "/") { $final_href_link[] = "$http_parsed_host$href_link"; } } } $links_array = array_unique($final_href_link); sort($links_array); foreach ($links_array as $links) { if (in_array(end(explode(".", strtolower($links))), $getExtensions)) { $fileURL = $links; echo "Downloading: <a href='$fileURL'>$fileURL</a><br />"; } //echo "$links<br />"; echo "<a href='$links'>$links</a><br />"; //echo "$title"; //$(‘title’).text($links); } echo "<a href='$mail_link'>$mail_link</a><br />"; $ch = curl_init($fileURL); curl_setopt($ch, CURLOPT_NOBODY, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, true); $data = curl_exec($ch); curl_close($ch); $filesize = explode('Content-Length: ',$data); $filesize = explode("\n",$filesize[1]); $filesize = $filesize[0]; //echo $filename,' - '; //echo $filesize,' - ',filesize($filename); if(!file_exists($filename)) { copy(trim($_GET['url']),$filename); } else if(file_exists($filename) && filesize($filename) == $filesize) { echo 'Downloaded'; exit; } else { echo 'Downloading "'.$_GET['filename'].'"<br>'. '<div style="padding: 5px; text-align: left;"><div style=" -moz-border-radius: 5px; margin: 3px; border: 1px solid #000; height: 15px; width: 150px;"><div style="width: '.number_format((filesize($filename)/$filesize)*100,2).'%; background: url(\'loader_background.png\') repeat-x center; height: 15px;"></div></div> ['.number_format((filesize($filename)/$filesize)*100,2).'%]</div>'; } function dlTime($timestamp) { $minutes = floor($timestamp/60); $seconds = floor($timestamp-($minutes*60)); $minEnd = $minutes == 1 ? 'min':'mins'; $secEnd = $seconds == 1 ? 'sec':'secs'; return $minutes.' '.$minEnd.' '.$seconds.' '.$secEnd; } $timePassed = (time()-filectime($filename)); $sizeDone = number_format((filesize($filename)/$filesize)*100,2); $timeLeft = ((100/$sizeDone)*$timePassed)-$timePassed; echo 'Estimated Time Left: '.dlTime($timeLeft).'<br>'; echo 'Time Passed: '.dlTime($timePassed); ?>
-
Your script works good paulryan. The url you did was also 403 - Forbidden error. They most likely deleted it or they cycle file names/encrypt so people can't abuse their bandwidth. I'm sure work fine many other sites, or would just need to get the latest url from the website, still saves from downloading and then uploading to the server.
-
Creating usernames and passwords based on filenames
QuickOldCar replied to richardmilne's topic in MySQL Help
Yeah they are old, just as an example they use these. session_is_registered() session_register() -
The best thing you can do is populate a database field full of file names and select the desired amount at random within the select statement. I tried numerous ways doing by text files, generating and merging random words, even just mixing words randomly from text files, all these solutions are memory and cpu intensive. This at the end in the mysql select is the best way order by rand() LIMIT 5
-
Show a certain quarry when page with form first loaded.
QuickOldCar replied to comparebest's topic in PHP Coding Help
Yeah is bunch of ways. See which works best for you. if (!$_GET['value']) { $value = "value"; } if (!isset($_GET['value']) or $_GET['value'] == '') { $value = "value"; } if (empty($_GET['value'])) { $value = "value"; } if (empty($_SERVER["QUERY_STRING"])){ $value = "value"; } -
This just really shows how geeky php freaks we really are, ha ha. I just did this up so can do ranges in groups with being able to set lower and maximum limits for the groups. I only played with it a little bit, so just be careful with it, ehh, maybe set an extreme maximum limit to it or something. I was doing by letter and letter position amounts but I quit on it. Something like start from rrrr to rzzz or similar. <?php $group = mysql_real_escape_string($_GET['group']); if (!isset($_GET['group']) or $_GET['group'] == '') { $group = 1; } $lower = mysql_real_escape_string($_GET['lower']); $increase = mysql_real_escape_string($_GET['increase']); $alphabet_count = 26; $maximum_range = $alphabet_count*$group; $minimum_range = $maximum_range-25; $increase = $maximum_range+$increase; ?> <form name="input" action="" method="get"> Group:<input size="30"type="text" name="group" style="color: #FFFFFF; font-family: Verdana; font-weight: bold; font-size: 12px; background-color: #000000;" size="15" value="<?php echo $group; ?>"> Lower:<input size="30"type="text" name="lower" style="color: #FFFFFF; font-family: Verdana; font-weight: bold; font-size: 12px; background-color: #000000;" size="15" value="<?php echo $lower; ?>"> Increase:<input size="30"type="text" name="increase" style="color: #FFFFFF; font-family: Verdana; font-weight: bold; font-size: 12px; background-color: #000000;" size="15" value="<?php echo $increase; ?>"> <input type="submit" style="color: #FFFFFF; font-family: Verdana; font-weight: bold; font-size: 12px; background-color: #000000;" size="15" value="Set" /> </form> <?php function seqAlphabet($numbers) { $alphabet = ''; while($numbers >= 1) { $numbers = $numbers - 1; $alphabet = chr(($numbers % 26)+97) . $alphabet; $numbers = $numbers / 26; } return $alphabet; } $string_position = range($lower,$increase); foreach ($string_position as $position) { echo seqAlphabet($position) . "<br />"; } ?>