Jump to content

redarrow

Members
  • Posts

    7,306
  • Joined

  • Last visited

Everything posted by redarrow

  1. read this one? http://stackoverflow.com/questions/9358252/pdf-to-html-library-in-php
  2. i was thank you scootstah Techrits not your web site. scootstah grate programmer and you seem to no the theory so well,i would love to how to do programming so well as you, thanks for helping us all. i guess it takes practice and loads of it to be any good at php mysql sorry i am a bad speller and writer
  3. what you on about , you don't go into folders for what? you use folders yes but go into them for what. unless you want to go into a folder then use a .exe still don't make sense . what you doing there? what the project for.... if you press a button to see what in that folder then list the files what you mean. can then use code to trigger the files in that folder?
  4. KevinM1 <<< nice read on globs mate cheers. well written.
  5. or try something like this (example only.) <?php $content = file_get_contents('http://www.sparkfun.com/commerce/product_info.php?products_id=9279'); preg_match('#<tr><th>(.*)</th> <td><b>price</b></td></tr>#', $content, $match); $price = $match[1]; preg_match('#<input type="hidden" name="quantity_on_hand" value="(.*?)">#', $content, $match); $in_stock = $match[1]; echo "Price: $price - Availability: $in_stock\n"; ?>
  6. Also think about the seo of the page, it all needs to be validated. if a spider hit a incorrect formatted html xhtml page then the spider spits a error then your page is put lower in the spider it self(that the theory any way.) Just looked at your website, and the way your scrapping other spiders well slow why?
  7. slap this in the admin folder. .htaccess AuthUserFile /home/username/safe/.htpasswd AuthGroupFile /dev/null AuthName EnterPassword AuthType Basic Require valid-user
  8. True. But if you have, let's say, an "admin" folder on your site, and it isn't linked anywhere, on your site, you would think that it is safe from bots. But some blackhats, seeing "admin" in a robots.txt file, may take it as a challenge to attempt to hack your admin section, and you have told them there is a directory by that name as a starting point for their attempt. Of course, in this scenario, there is no reason to list the admin folder in the robots.txt file, since there would never be any links to it anywhere, the robots would never know to look for it. On the other hand, noobs may see the robots.txt as a security measure which it is not and naively list the admin folder. you put a index.php in the folder encase anybody looks in there, or use a mod rewrte rule.
  9. the above will work i done it like this lol well wrong. <?php $querya = "SELECT category FROM item_category"; $resulta = mysql_query($querya) or die(mysql_error()); while($Get_them=mysql_fetch_assoc($resulta){ $query = "SELECT category, COUNT($get_them['category']) FROM item_category GROUP BY category"; } $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($result)){ echo "There are ". $row['COUNT(category)'] ." ". $row['item'] ." items."; echo "<br />"; } ?>
  10. i might be a million years out but worth a try <?php $query = "SELECT category, COUNT(cat_id1,cat_id2,cat_id3,cat_id4,cat_id5) FROM item_category GROUP BY category"; $result = mysql_query($query) or die(mysql_error()); // Print out result while($row = mysql_fetch_array($result)){ echo "There are ". $row['COUNT(category)'] ." ". $row['item'] ." items."; echo "<br />"; } ?>
  11. noted the select . but just out of curiosity if this database struckture will work. i got so far. Teacher table. id: teacher_id teacher_username: teacher_surname: teacher_email: teacher_classes: teacher_class_name 1 teacher_class_name 2 teacher_class_name 3 teacher_class_name 4 teacher_class_name 5 teacher_subject_name 1 teacher_subject_name 2 teacher_subject_name 3 teacher_subject_name 4 teacher_subject_name 5 teacher_date_joined teacher_active Student Table id: student_id: student_class_name: student_name: student_surname: student_email: student_valadation_key: student_joined: student_active: home_work_table id: home_work_id: home_work_class_name: home_work_name: home_work_descrition: home_work_start_date: home_work_end_date: teachers_name: student_name:
  12. ill sort the database out like you say i need to think. subject = subject the teacher can teach. class= the class name the teacher is form tutor to. it true to say in the uk a teacher can teach many subjects at any period of the day. it also true in the uk a teacher teaches more then one class name with over 35 children in. why is the subject[] array not showing all it results. dont forget i am only testing every think. try the form please. <?php if(@$_POST['submit']){ echo " name: {$_POST['name']}"; echo "<br />"; echo " surname: {$_POST['surname']}"; echo"<br />"; echo "email address: {$_POST['email_address']}"; foreach($_POST['subject'] as $subjects){ echo"<br />"; echo "subject: $subjects"; foreach($_POST['class'] as $classs){ echo"<br />"; echo " class: $classs"; exit; } } } ?> <?php @$result1=$_POST['name']; @$result2=$_POST['surname']; @$result3=$_POST['email_address']; ?> <form method="POST" action""> Teachers Name <br /> <input type="text" name="name" value="<?php echo $result1; ?>"> <br/ >Teachers Surname<br /> <input type="text" name="surname" value="<?php echo $result2; ?>"> <br />Teachers Email Address<br /> <input type="text" name="email_address" value="<?php echo $result3; ?>"> <br />Number of student clases names, you teach <br /> <select name="num_of_classes"> <?php for($i=1; $i<6; $i++) { echo"<option value='$i'>$i</option>"; } ?> </select> <?php for($i=1; $i<@$_POST['num_of_classes']+1; $i++){ echo"<br />class $i<input type='text' name='class[]'><br />"; } ?> <br />Number of subjects you teach <br /> <select name="num_of_subjects"> <?php for($i=1; $i<6; $i++) { echo"<option value='$i'>$i</option>"; } ?> </select> <?php for($i=1; $i<@$_POST['num_of_subjects']+1; $i++){ echo"<br />Subject $i<input type='text' name='subject[]'><br />"; } ?> <br /> <input type="submit" value="Please submit your chose"> <br /><br /> <input type="submit" name="submit" value="Save Information"> </form>
  13. i made a form that the user can supply the number of classes and number of subjects the input box's show, but the user has to submit to get the result then enter info. any other ideas so no submit needed to get the input needed. <form method="POST" action""> Name <br /> <input type="text" name="name"> <br/ >Surname<br /> <input type="text" name="surname"> <br />Email Address<br /> <input type="text" name="email_address"> <br />Number of clases you teach <br /> <select name="num_of_classes"> <?php for($i=1; $i<6; $i++) { echo"<option value='$i'>$i</option>"; } ?> </select> <?php for($i=1; $i<@$_POST['num_of_classes']+1; $i++){ echo"<br />class $i<input type='text' name='class[]'><br />"; } ?> <br />Number of subjects you teach <br /> <select name="num_of_subjects"> <?php for($i=1; $i<6; $i++) { echo"<option value='$i'>$i</option>"; } ?> </select> <?php for($i=1; $i<@$_POST['num_of_subjects']+1; $i++){ echo"<br />Subject $i<input type='text' name='subject[]'><br />"; } ?> <br /><br /> <input type="submit" name="submit" value-"submit"> </form>
  14. Advance thank you. I got a new project and it worrying me. In one of the database one row got to have 5 conditions. example a user might be in charge of 5 different classes, what you recommend as the database format. example. when the user joins, do i just add 5 rows to the database, and let them add the class descriptions , do i keep the row null or a zero as default. looks like ill need it for the teacher subjects as well. id: teacher_username: teacher_surname: teacher_email: teacher_classes: teacher_class_name 1 teacher_class_name 2 teacher_class_name 3 teacher_class_name 4 teacher_class_name 5 teacher_subject_name 1 teacher_subject_name 2 teacher_subject_name 3 teacher_subject_name 4 teacher_subject_name 5 teacher_date_joined teacher_active thanks all.
  15. simple one for you then? <?php class Database{ private $host; private $user; private $pwd; private $rows; private $error; private $result; private $dbName; private $connection; private $isReady; public function __construct(){ $this->result = null; $this->isReady = false; $this->error = array(); } public function __destruct(){ @mysql_close($this->connection); } /* setters */ public function setHost($host){ $this->host = $host; } public function setUser($user){ $this->user = $user; } public function setPassword($pwd){ $this->pwd = $pwd; } public function setDbName($dbName){ $this->dbName = $dbName; } /* other interfaces */ public function init($host=null,$user=null,$pwd=null,$dbName=null){ if(!isset($host,$user,$pwd,$dbName)) die("Please provide require settings."); $this->setHost($host); $this->setUser($user); $this->setPassword($pwd); $this->setDbName($dbName); $this->isReady = true; } public function select($dbName){ $this->setDbName($dbName); mysql_select_db($this->dbName,$this->connection) or die("The said database does not exist."); } public function query($sql){ $this->result = mysql_query($sql,$this->connection) or die("Invalid query string!"); } public function connect(){ if(!$this->isReady) die("not ready to connect"); $this->connection = mysql_connect($this->host,$this->user,$this->pwd) or die("Could not connect to database. please check your credentials."); $this->select($this->dbName); $this->query("SET NAMES 'utf8'",$this->connection); //persian support } public function isConnected(){ if($this->connection) return true; return false; } public function disconnect(){ mysql_close($this->connection); $this->connection = null; } public function countRows($selectMode = true){ if($selectMode) return mysql_num_rows($this->result); return mysql_affected_rows($this->connection); } public function loadRows(){ if(!$this->result) die("Nothing found!"); $this->rows = array(); while($r = mysql_fetch_array($this->result,MYSQL_BOTH)) $this->rows[] = $r; mysql_free_result($this->result); return $this->rows; } public function siftDown($dataStack){ if(!is_array($dataStack)){ $dataStack = ereg_replace("[\'\")(;|`,<>]","",$dataStack); $dataStack = mysql_real_escape_string(trim($dataStack),$this->connection); $dataStack = stripslashes($dataStack); return $dataStack; } $safeData = array(); foreach($dataStack as $p=>$data){ $data = ereg_replace("[\'\")(;|`,<>]","",$data); $data = mysql_real_escape_string(trim($data),$this->connection); $data = stripslashes($data); $safeData[$p] = $data; } return $safeData; } public function secure($data){ return sha1(md5(sha1(md5(sha1($data))))); } }//Database class ?> <?php //usage require_once 'path/to/Database.class.php'; $db = new Database(); //Creating new object $db->init("localhost","test_root","test_pwd!","test_db"); //initializing by credentials. $db->connect(); //unicode support $test_value = $db->siftDown($test_value); //preventing harmful inputs $something_testy_else = $db->siftDown($something_testy_else); $db->query("SELECT * FROM test_table WHERE test_field = '$test_value' AND second_test_field = '$something_testy_else' LIMIT 1"); if($db->countRows()==1) $dbdata = $db->loadRows(); //returns a numeric/associative array as the result (MYSQL_BOTH) //TODO: To Process $dbdata $db->disconnect(); ?>
  16. try this as a test read this as well http://phpsense.com/2006/php-ftp-functions/ <?php $dir = 'myDir'; // create new directory with 777 permissions if it does not exist yet // owner will be the user/group the PHP script is run under if ( !file_exists($dir) ) { mkdir ($dir, 0777); } file_put_contents ($dir.'/test.txt', 'Hello File'); ?>
  17. no i no nothing only over #200.000 a year ask dan and i sit on my bum watching my money grow. i can not even spell but can swim in it lol to many programmers look at the manual never look outside there own bedroom window. even html can earn you 100 a day on my fat bum php for life my old saying lol
  18. danjapro tell us what you was trying to do with all this encrypting. I want to no in detail what it was all for, so we don't guess no more. please tell us. you might need different programming language or even a dns solution.
  19. use mod rewrite then that hide the link . easy as that. xyph trying anything is better then nothing. might not of eat the whole php manual but im allowed my written opinion staff dan administrator told me that years ago on here i remember even you asking me questions lol not saying who i am. i see a lot off mods that are mods know from when i was on here as a helper over 2 years ago roughly, but i left phpfreaks to use the knowledge that i learned and put it into programs and ideas, but now 2012 i got the car, the home and every think, i do php for good leisure , but it was down to learning php on here i got wealthy, but i notice some off you continue to live the same old lives and have nothing to show for it, some of you are really good programmers and still got no money but why?
  20. If he use a database he can win, with sha1 and md5. But knowing the encrypted results via a database relating to row name and the the link="name" but it a pain but i have done it before. but looking at the code i don't no why he not just encoding the song name only.
  21. Dont no what else to say really, except there is mycript might help. Most people encrypt the showing info that in a link like <?php $song_name=sha1(md5('song.mp3')); $url="http://sitepoint.com/images/user/media/page.php?song=$song_name"; echo "This is the url ($url) and this is the encript code $song_name"; ?> remember it one way encrypting so song.mp3 matches the result. <?php //This is un safe as you can see very easy to decode. $url="http://sitepoint.com/images/user/media/song.mp3"; $encoded=base64_encode($url); echo "<br /> <br />"; $decode=base64_decode($encoded); echo "This is encoded (($encoded)) <Br />This is decoded (($decode))"; ?> <?php //This is very safe but not decode able. one way encoding $url="http://sitepoint.com/images/user/media/song.mp3"; $encode=sha1($url); echo "<br>This is encoded but it one way not deco able (($encode))"; ?> <?php //This is safe but not as safe as sha1,one way encoding $url="http://sitepoint.com/images/user/media/song.mp3"; $encode=md5($url); echo "<br>This is encoded but it one way not deco able (($encode))"; ?> <?php //This is very safe but one way encoding sha1 and md5 are best for passwords $url="http://sitepoint.com/images/user/media/song.mp3"; $encode=sha1(md5(($url))); echo "<br>This is encoded but it one way not deco able (($encode))"; ?>
×
×
  • 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.