Jump to content

QuickOldCar

Staff Alumni
  • Posts

    2,972
  • Joined

  • Last visited

  • Days Won

    28

Everything posted by QuickOldCar

  1. Do you realize that you can just include the page? include() <?php $page = $_GET['page']; if(isset($_GET['page']) && $_GET['page'] != ""){ include($page); } ?> http://mysite.com/this-script-name/?page=123.html
  2. by using $_GET <?php $frame = $_GET['frame']; if(isset($_GET['frame']) && $_GET['frame'] != ""){ ?> <iframe src="./<?php echo $frame;?>" border="0" framespacing="0" marginheight="0" marginwidth="0" vspace="0" hspace="0" frameborder="0" height="100%" scrolling="yes" width="100%"></iframe> <?php } else { echo "no frame specified"; } ?> usage would be to visit in the browser this type url http://website1one.com/this-script-name/?frame=123.html
  3. see this part of code if ($searching == "yes") { echo "Results"; } in this way it would just echo the word Results I edited the code here http://www.phpfreaks.com/forums/index.php?topic=349717.msg1650539#msg1650539
  4. hopefully going by your original code and the added coding, this could get you some results <html><head><title>Cars Search Form</title> <style type="text/css"> td {font-family: tahoma, arial, verdana; font-size: 10pt } </style> </head> <body> <table width="300" cellpadding="10" cellspacing="0" border="2"> <tr align="center" valign="top"> <td align="left" colspan="1" rowspan="1" bgcolor="64b1ff"> <h3>Car Search</h3> <table width="450px"> </tr> <form name="search" method="post" action=""> Search for: <input type="text" name="find" /> in <Select NAME="field"> <Option VALUE="make">Make/model</option> <Option VALUE="colour">Colour</option> <Option VALUE="year">Year</option> <Option VALUE="fuel">Fuel type</option> <Option VALUE="transmission">Transmission</option> <Option VALUE="ctype">Car type</option> </Select> <input type="hidden" name="searching" value="yes" /> <input type="submit" name="search" value="Search" /> </form> <table width="300" cellpadding="10" cellspacing="0" border="2"> <tr align="center" valign="top"> <td align="left" colspan="1" rowspan="1" bgcolor="64b1ff"> <?php $searching = $_POST['searching']; $find = $_POST['find']; $field = $_POST['field']; //This is only displayed if they have submitted the form if ($searching == "yes") { //If they did not enter a search term we give them an error if ($find == "") { echo "You forgot to enter a search term"; DIE; } //Otherwise we connect to our Database //mysql_connect("localhost", "user", "password") or die(mysql_error()); //mysql_select_db("test_dbase") or die(mysql_error()); //We perform a bit of filtering $find = strtoupper($find); $find = strip_tags($find); $find = trim($find); $find = mysql_real_escape_string($find); $field = mysql_real_escape_string($field); //Now we search for our search term, in the field the user specified $data = mysql_query("SELECT * FROM users WHERE upper($field) LIKE '%$find%'"); //And we display the results while($result = mysql_fetch_array($data)) { echo $result['make']; echo " "; echo $result['colour']; echo ""; echo $result['year']; echo ""; echo $result['fuel']; echo ""; echo $result['transmission']; echo ""; echo $result['ctype']; echo ""; echo ""; } //This counts the number or results and if there wasn't any it gives them a little message explaining that $anymatches=mysql_num_rows($data); if ($anymatches == 0) { echo "Sorry, but we can not find an entry to match your query"; } //And we remind them what they searched for echo "Searched For: ".$find; } ?> The code should at least work now
  5. mysql_real_escape_string() can only be used after a mysql connection any $_POST['whatever'] are usually done in the beginning, but as long as you defined it before using it is fine using your hidden field in the form could make it work
  6. You could have a list or array() of your urls, and then loop all the iframe codes within a foreach(). But sadly because many websites "jump out of frame", it will then just visit the first website that redirects and not show all your iframed sites. Try my site or yahoo as one of the url's and see. http://dynaindex.com http://www.yahoo.com <?php $site_array = array("http://www.imdb.com","http://www.bing.com/","http://www.dogpile.com"); foreach($site_array as $site){ echo "<iframe name='$site' src='$site' width='100%' height='100%' frameborder='0' ></iframe><br />"; } ?>
  7. Yet another thing, You never have a value for $find on your process page coming from the form. $find = $_POST['find']; as PFMaBiSmAd just stated
  8. Correct, but you have the hidden value there and checking that. One more thing would be to escape any user input before using it. mysql_real_escape_string() $find = mysql_real_escape_string($find);
  9. Your problem is this line if ($searching =="yes") { $searching never had a value $searching = $_POST['searching']; if ($searching =="yes") { or if ($_POST['searching'] =="yes") { also look into checking the form if isset()
  10. Try this and see if it works with the proper quotes <html><head><title>Cars Search Form</title> <style type="text/css"> td {font-family: tahoma, arial, verdana; font-size: 10pt } </style> </head> <body> <table width="300" cellpadding="10" cellspacing="0" border="2"> <tr align="center" valign="top"> <td align="left" colspan="1" rowspan="1" bgcolor="64b1ff"> <h3>Car Search</h3> <table width="450px"> </tr> <form name="search" method="post" action=""> Search for: <input type="text" name="find" /> in <Select NAME="field"> <Option VALUE="make">Make/model</option> <Option VALUE="colour">Colour</option> <Option VALUE="year">Year</option> <Option VALUE="fuel">Fuel type</option> <Option VALUE="transmission">Transmission</option> <Option VALUE="ctype">Car type</option> </Select> <input type="hidden" name="searching" value="yes" /> <input type="submit" name="search" value="Search" /> </form> <table width="300" cellpadding="10" cellspacing="0" border="2"> <tr align="center" valign="top"> <td align="left" colspan="1" rowspan="1" bgcolor="64b1ff"> <?php //This is only displayed if they have submitted the form if ($searching =="yes") { echo "Results"; } //If they did not enter a search term we give them an error if ($find == "") { echo "You forgot to enter a search term"; } //Otherwise we connect to our Database mysql_connect("localhost", "user", "password") or die(mysql_error()); mysql_select_db("test_dbase") or die(mysql_error()); //We perform a bit of filtering $find = strtoupper($find); $find = strip_tags($find); $find = trim($find); //Now we search for our search term, in the field the user specified $data = mysql_query("SELECT * FROM users WHERE upper($field) LIKE '%$find%'"); //And we display the results while($result = mysql_fetch_array($data)) { echo $result['make']; echo " "; echo $result['colour']; echo ""; echo $result['year']; echo ""; echo $result['fuel']; echo ""; echo $result['transmission']; echo ""; echo $result['ctype']; echo ""; echo ""; } //This counts the number or results and if there wasn't any it gives them a little message explaining that $anymatches=mysql_num_rows($data); if ($anymatches == 0) { echo "Sorry, but we can not find an entry to match your query"; } //And we remind them what they searched for echo "Searched For: ".$find; } ?>
  11. You need to replace all “ and ” type quotes with a " also replace ’ with a ' they are different quotes and will not work.
  12. Here's a script I use to take thumbs of websites, I save them as md5, you could save them something else if wanted to I run a different script for display purposes that looks if the image exists in many multiple ways, because that's the way urls work, and then resize them with gd <div align="center"> <form action="" method="GET" align="center"> <input type="text" name="url" size="100" id="url" placeholder="Insert a Url" /> <br /> <input type="submit" value="Snap IT" /> <br /> </form> <?php if (isset($_GET['url'])){ //parse the url to host function getparsedHost($new_parse_url) { $parsedUrl = parse_url(trim($new_parse_url)); return trim($parsedUrl['host'] ? $parsedUrl['host'] : array_shift(explode('/', $parsedUrl['path'], 2))); } //get website url from browser $input_url = mysql_real_escape_string(trim($_GET['url'])); //clean the url $input_url = str_ireplace(array("http://www.","http://","feed://","ftp://","https://","https://www."), "", $input_url); $input_url = rtrim($input_url, "/"); $url = "http://$input_url"; //use parsed url versus full urls $url = "http://".getparsedHost($url); //if empty url show message if($url == "" || $url == "http://"){ echo "Insert a valid url."; die; } //make md5 hash for filename $md5_url = md5($url); //resize function function resize($img, $w, $h, $newfilename) { //Check if GD extension is loaded if (!extension_loaded('gd') && !extension_loaded('gd2')) { trigger_error("GD is not loaded", E_USER_WARNING); return false; } //Get Image size info $imgInfo = getimagesize($img); switch ($imgInfo[2]) { case 1: $im = imagecreatefromgif($img); break; case 2: $im = imagecreatefromjpeg($img); break; case 3: $im = imagecreatefrompng($img); break; default: trigger_error('Unsupported filetype!', E_USER_WARNING); break; } //If image dimension is smaller, do not resize if ($imgInfo[0] <= $w && $imgInfo[1] <= $h) { $nHeight = $imgInfo[1]; $nWidth = $imgInfo[0]; }else{ //yeah, resize it, but keep it proportional if ($w/$imgInfo[0] > $h/$imgInfo[1]) { $nWidth = $w; $nHeight = $imgInfo[1]*($w/$imgInfo[0]); }else{ $nWidth = $imgInfo[0]*($h/$imgInfo[1]); $nHeight = $h; } } $shrink = 0.40;//shrink by % $nWidth = round($nWidth); $nHeight = round($nHeight); $nWidth = $nWidth * $shrink; $nHeight = $nHeight * $shrink; $newImg = imagecreatetruecolor($nWidth, $nHeight); /* Check if this image is PNG or GIF, then set if Transparent*/ if(($imgInfo[2] == 1) OR ($imgInfo[2]==3)){ imagealphablending($newImg, false); imagesavealpha($newImg,true); $transparent = imagecolorallocatealpha($newImg, 255, 255, 255, 127); imagefilledrectangle($newImg, 0, 0, $nWidth, $nHeight, $transparent); } imagecopyresampled($newImg, $im, 0, 0, 0, 0, $nWidth, $nHeight, $imgInfo[0], $imgInfo[1]); //Generate the file, and rename it to $newfilename switch ($imgInfo[2]) { case 1: imagegif($newImg,$newfilename); break; case 2: imagejpeg($newImg,$newfilename); break; case 3: imagepng($newImg,$newfilename); break; default: trigger_error('Failed resize image!', E_USER_WARNING); break; } return $newfilename; } //load url fullscreen in IE browser $browser = new COM("InternetExplorer.Application") or die ("Could not initiate IE object."); $handle = $browser->HWND; $browser->Visible = true; $browser->FullScreen = true; $browser->Navigate($input_url); $seconds = 7; $delay_time = $seconds * 1000; if($browser->Busy) { com_message_pump($delay_time); } $im = imagegrabwindow($handle, 0); //$im = imagegrabscreen($handle, 0);//grabs entire primary window $browser->Quit(); $browser=null; unset($browser); imagepng($im, "./thumb/$md5_url.png"); //image location $image_location = "./thumb/$md5_url.png"; //browser snap size in fullscreen $w = 1024; $h = 768; //resize the image $thumbnail = resize($image_location, $w, $h, $image_location); //show the thumbnail and href links echo "<a href='$url' TARGET='_blank'><img src='$image_location' alt='$url' /><br />"; echo " <a href='$url' TARGET='_blank'>$url</a><br />"; echo "<a href='thumb/$md5_url.png'>Thumb Location</a>"; //always destroy the temp image in GD imagedestroy($im); } ?> There is also a good plugin for firefox that works Pearl Crescent Page Saver you can install the basic version, save them as %5 for md5, I set them to 40% of size which is 401 pixels I run a command like this to save as png exec("Psexec.exe -i -d ./firefox/firefox.exe -savepng $url -savedelay 3000"); You could also check out webshot it can snap all your images from a list, save as certain sizes I also wanted to add, the only way to render everything correctly on a page is to use a browser. Using firefox and adblock is nice to block the ads.
  13. upon logout Parse error: syntax error, unexpected $end in /home/asimplef/public_html/classes/Asf_Sessions.php on line 64
  14. it certainly has something to do with sessions, did you destroy the session upon logout? Before I cleared my browser it was trying to insert and was getting the error that it was a duplicate, after clearing my browser can now see the site again.
  15. Same result, A database error occured so the script was aborted restart the server?
  16. Currently getting: A database error occured so the script was aborted But even before kept getting that error I showed visiting http://www.asimpleforum.co.uk/
  17. if that's the case, why not just this if($logged_in){ if ($cookieid != database['cookie']) { session_destroy(); header( "refresh:5;url=index.php" ); echo "You have been logged out because your cookie has been compromised"; } }
  18. Got logged in, but when logging out I got this Query: INSERT INTO asf_sessions (s_sid, s_uid, s_ip, s_user_agent, s_last_action, s_referrer) VALUES (:session_id, :user_id, :ip_address, :user_agent, :last_action, :referrer) Line: 1062 Message: Duplicate entry '34836c066effc89742982fbb031a6b86' for key 1 And now when I visit the main page it keeps showing it, I'm sure I can just clear my browser...but I don't want to...lol. I'll leave you alone to keep working all this out more.
  19. Registration process works now, but is a blank email with no activation code.
  20. But instead of looking for where everyone came from all the time, it may be better to just delay the redirect, show the message and send them back to index.php <?php header( "refresh:5;url=index.php" ); echo "You'll be redirected in about 5 secs. If not, click <a href='index.php'>here</a>."; ?>
  21. From what you say, I guess you will be sending them to a page, lets say error.php that you made, that will then redirect them to your index.php page. Now on the index page you can use $_SERVER['HTTP_REFERER'] to find out where they just came from, if is from page error.php , then display a message. http://php.net/manual/en/reserved.variables.server.php
  22. Same result as last time I tried. I tried to register, but it didn't seem to do anything upon hitting the register button.
  23. I believe the only way to have your content not able to be crawled and stripped easily..would be to have your site written with AJAX. Site crawlers and scrapers are made to emulate browsers to get the information. Reading some javascript and especially ajax makes it hard to get the content. You could block ip's and ranges in .htaccess to stop them from visiting your server. But that still could not stop them at first, and they could also be running a server through a dynamic ip that will change. Using javascript for links or ajax to load content will most likely be the best way to minimize this.
×
×
  • 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.