Jump to content

rhock_95

Members
  • Posts

    120
  • Joined

  • Last visited

    Never

Everything posted by rhock_95

  1. I would like to oblige but the script is so loaded with my own personal comments it would take me half an hour just to strip all the comments... is there a particula part of the script that would help specifically? the script queries a database for a single column but has pagination results...
  2. This Almost works... what it does is print the "No results found matching your query" above each record...but it is still printing all the records
  3. Thanks for the reply... with that I get nothing but line errors (like a missing curly bracket) but I can't seem to resolve the errors exactly how would I incorporate this into my script?
  4. Thanks again for the efforts... but the script still retrieves all the records...it also prints out ALL the messages... any ideas?
  5. Thanks for the reply... Ho do I do this? this is actually the crux of what I am seeking
  6. Is there a simple way to prevent an html form from being submitted (without javascript) if no text is entered? <form action="peop_search.php" method="post"> <input type="text" name="query" /> <input type="submit"> </form> If an invalid query is entered it prints the message below but if nothing is enterd it prints all the records if ($numrows == 0){ echo("No results found matching your query - $query"); Is there any way to amend this to echo the above if nothing is entered?
  7. use the administration menu to create a forum
  8. thanks for the reply... still getting the same error Parse error: parse error, expecting `','' or `';'' on the same line from <phpinfo.php>
  9. well on my first attempt to use the code I got the error on this line: if (extension_loaded("gd")) { howevr not being a php coder I will won't know what to expect with the rest of the code either thanks
  10. I have a site running phphnuke 6.9...it is running on a hosted server with PHP Version 4.3.4 because of the older version of PHP I am unable to get a captcha script to run correctly...what I would like to do is implement the existing (php nuke) security code app into a database query form.... Below is the code from the nuke (admin) login form...is it possible to plug this code into my existing (php)scripts that query a database? if (extension_loaded("gd")) { echo "<tr><td colspan='2'>"._SECURITYCODE.": <img src='admin.php?op=gfx&random_num=$random_num' border='1' alt='"._SECURITYCODE."' title='"._SECURITYCODE."'></td></tr>" ."<tr><td colspan='2'>"._TYPESECCODE.": <input type=\"text\" NAME=\"gfx_check\" SIZE=\"7\" MAXLENGTH=\"6\"></td></tr>"; } echo "<tr><td>" ."<input type=\"hidden\" NAME=\"random_num\" value=\"$random_num\">" with the way the code is (like above) I am getting the following error: Parse error: parse error, expecting `','' or `';'' on the first line of the code above.. can someone take a look and offer advice on whether I will be able to do this? thanks
  11. I have several existing scripts that query different database tables I have a cpatcha script that I would like to use on a new version of one of my existing scripts but I need some help with the forms...I can't seem to be able to get the query script to execute and still require the securiyt code... The captcha script has it's own "verify" (submit) button and my query script has its own "search" (submit) button...can someone please explain how to get the query script to run but require the security code to be entered? TIA
  12. I think the previously mentioned problem is du to an older version of PHP... I installed the script on a newer server (PHP 5.04) and the test page seems to work however I need some advice on how to implement the security function on an existing form here is the test page: <?php //error_reporting(E_ALL); session_start(); if (isset($_POST['submit'])) { // clean and check form inputs including the secure image code $name = trim(strip_tags($_POST['name'])); $email = trim(strip_tags($_POST['email'])); $comments = trim(strip_tags($_POST['comments'])); $secure = strtoupper(trim(strip_tags($_POST['secure']))); $match = $_SESSION['captcha']; // the code on the image // input error checking if ($name=="") { $err.= "Please provide your name<br/>"; } if (!$email) { $err.= "Please provide your email address<br>"; } if ($email) { if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) { $err.= $email. " is not a valid email address.<br/>"; } } if ($comments=="") { $err.= "Please provide comments<br/>"; } if (!$secure) { $err.= "No security code entered<br/>"; } if (($secure!=$match) && ($secure!="")) { $err.= "Security code mismatch<br/>"; } if ($err=="") { // success - input passed all tests echo "What you do with success is up to you."; exit(); } } ?> <head> <title>Trolls go away</title> <style type="text/css"> body,td { font-family:arial, helvetica, sans-serif; background:#fff; color:#000; font-size:12px; } input, textarea { background:#eee; color:#000; font-size:12px; border:1px solid #000; } </style> </head> <body> <?php if ($err!="") { echo "<strong>Form Error(s)</strong><br/>"; echo "<font color='#cc3300'>". nl2br($err). "</font><br/>"; } ?> <form name="captcha" method="post" action="<?php echo $_SERVER['SCRIPT_NAME'];?>"> <table cellpadding="3" cellspacing="2" style="border:1px dotted #666;"> <tr> <td>Name:</td><td><input type="text" name="name" value="<?php echo $_POST['name'];?>"/></td> </tr> <tr> <td>Email:</td><td><input type="text" name="email" value="<?php echo $_POST['email'];?>"/></td> </tr> <tr> <td valign="top">Comments:</td><td><textarea rows="5" columns="30" name="comments"><?php echo $_POST['comments'];?></textarea></td> </tr> <tr> <td>Security Code</td><td><input type="text" name="secure"/></td> </tr> <tr> <td><img src="captcha_image.php" alt="security image" border="0"/></td><td><input type="submit" name="submit" value="Send"/></td> </tr> </table> </form> </body> </html> I need to use the security function on an existing form that calls a different php script (that searches a database)
  13. what is it that you are suggesting may be "misconfigured? I don't have any problems with many other php scripts that access many different databases etc with out any errors or problems I installed the scrip as directed by your document
  14. no text appears over the background image ???
  15. I hope someone can help me.., I am looking for a complete captcha script that actually works...I have tried just about every one I can by searching and none of them work out of the box... I either get "header already sent..."errors OR the ones that "seem" to work DO NOT display the text (font) over top of the background image... GD Support enabled GD Version bundled (2.0.15 compatible) FreeType Support enabled FreeType Linkage with TTF library GIF Read Support enabled JPG Support enabled PNG Support enabled WBMP Support enabled XBM Support enabled can anyond suggest a foolproof script?
  16. can anyone offer some insights on how to use this class?
  17. I already have cURL installed All I asked at this time was "does this file get edited" ? or "do I need to write a seperate script that calls this class (without any editing)?
  18. Can someone explain how to use this class...it is a scraping tool that uses curl and although I am familiar with basic php I don't have a clue how to use this class...cURL is entirely new to me... does this file get edited or do I need separate script that calls this class the way it is? any help or insights is appreciated <?php /******************************************************************************* * grabber.php * by voyager, 2003 * * A class which is usefull for grabbing any information of any site over the net. * It can retusrn a single value (text) or an array (texts) with given 'markup' * strings. The class uses PHP CURL functions so you need CULR installed on your * server ********************************************************************************/ class Grabber { var $content; var $content_array; var $noURL; //this is the boolean which will mark if to open the URL or not var $text; //the text without starting and ending unneeded parts var $searchar; // the searched array var $searchtxt; //the searched text // The constructor opens an URL and writes it in give file and dir // if 4th argument is given it check if this file exists already // when is the last modification and if it is older, opens the URL, // else opens the file. If $ifmod=0 it always opens the URL //it defaults to 24 hours function Grabber($url,$tmpdir='tmp/',$tmpfile='tmp.txt',$ifmod=86400) { $this->content=""; $ch = curl_init (); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_TIMEOUT, 60); $useragent = "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6) Gecko/20040206 Firefox/0.8"; curl_setopt($ch,CURLOPT_USERAGENT,$useragent); $this->content = curl_exec ($ch); curl_close ($ch); } //this grabs only a piece of text function grab_unit($start,$end) { //cut from start to end $this->text=substr($this->content,strpos($this->content,$start)+strlen($start)+1); $this->text=substr($this->text,0,strpos($this->text,$end)); $this->searchtxt=$this->text; } //it gets start delimeter, end delimeter and an array of pieces to //put out. Returns the array of needed infomation //delimstart and delimend are arround the pieces of searched data function grab_array($start,$delimstart,$delimend,$end) { //cut from start to end $this->text=substr($this->content,strpos($this->content,$start)+strlen($start)+1); $this->text=substr($this->text,0,strpos($this->text,$end)); //getting out the unndeeded and pushing into the array $this->searchar=preg_split("@$delimstart|$delimend@",$this->text); } //the elemnts of the array arent still what we need? function refine_array($start,$end,$clear_html=0) { for($i=0;$i<sizeof($this->searchar);$i++) { $this->searchar[$i]=substr($this->searchar[$i], strpos($this->searchar[$i],$start)+strlen($start)); if(!empty($end)) { $this->searchar[$i]=substr($this->searchar[$i], 0,strpos($this->searchar[$i],$end)); } if($clear_html) { $this->searchar[$i]=strip_tags($this->searchar[$i]); } } } //You still have some unregular data which makes everything bad? // REmove the trash, giving an array of it function remove_trash($trash) { for($i=0;$i<sizeof($trash);$i++) { for($j=0;$j<sizeof($this->searchar);$j++) { $this->searchar[$j]=str_replace($trash[$i],"",$this->searchar[$j]); } $this->searchtxt=str_replace($trash[$i],"",$this->searchtxt); } } //this function does not work with the members of the grabber. //it just takes start and end limits and the content - $word // to return whats inside. You can easy debug it with giving 1 to testvar function cut($start,$end,$word,$testvar=0) { $word=substr($word,strpos($word,$start)+strlen($start)); if($testvar) die($word); $word=substr($word,0,strpos($word,$end)); return $word; } function send_post($vars, $url) { $strRequestBody = ""; while (list($key, $val) = each($ascVarStream)) { if($strRequestBody != "") $strRequestBody.= "&"; $strRequestBody.= $key."=".$val; } $ch = curl_init(); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_URL, $strURL); curl_setopt ($ch, CURLOPT_POST, $strRequestBody); curl_setopt ($ch, CURLOPT_POSTFIELDS, $strRequestBody); $return_string = curl_exec ($ch); curl_close ($ch); if ($return_string=="") { $message="Error: Could not post to remote system."; return $message; } return $return_string; } // End function } ?>
  19. by \"A\" I meant several categories that begin with the letter \"A\"... the problem is... I have a script that has two drop down menus that are populated by the database... on is \"Citiy\" and the other is \"category\" I really need the category menu to be in exact alphabetical order...? any ideas? //get data for city and category $sql = \'SELECT DISTINCT city FROM bus_list\'; $r = mysql_query($sql) or die(mysql_error()); while($row = mysql_fetch_object($r)) { $city[] = $row->city; } $sql = \'SELECT DISTINCT category FROM bus_list\'; $r = mysql_query($sql) or die(mysql_error()); while($row = mysql_fetch_object($r)) { $category[] = $row->category; }
  20. hope someone can help me... I have a table (see below) that ai am adding data to OUT side of chronological order...(i.e., categorically by alphabetical order...).... this puts the \"ID\" (auto increment) out of sync alphabetically... My problem when I go back and reset the table order by \"category\"... it is not correct... there will be blocks of \"A\'s\" , \"B\'s\" , \"c\'s\", then more :A\'s\" etc... etc.. can anyone help me? CREATE TABLE `bus_list` ( `name` varchar(255) NOT NULL default \'\', `address` varchar(255) NOT NULL default \'\', `city` varchar(255) NOT NULL default \'\', `zip` varchar(15) default NULL, `phone` varchar(40) default NULL, `www` varchar(255) default NULL, `notes` text, `cat` varchar(255) default NULL, `id` int(11) unsigned NOT NULL auto_increment, `subcatid` varchar(11) default NULL, PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=1 ;
×
×
  • 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.