Jump to content

DarkSuperHero

Members
  • Posts

    342
  • Joined

  • Last visited

Everything posted by DarkSuperHero

  1. i think php1F7 is the temporary file name of the uploaded file.....correct me if im mistaken...
  2. so are you trying to calculate the prinable pages from an external website...eg yahoo.com or msn.com ect....
  3. sweet....yeah i agree, kenrbnsn is a "tidyer" and shorter way, although i wanted to use the code that Spike had presented....he was on the right track, but logic was a bit off...been through that so many times...more than i'd like...ahahahaha.. :-)
  4. <?php $i=0; do { if($i == 0){ echo "<tr><td valign='top' bgcolor='#FFFFFF'><center><font color='#000000'><a href='".$row['Address']."' target='_blank'>".$row['Address']."</a></font><br><br>".$row['Keywords']."</center></td>"; echo "<td valign='top' bgcolor='#FFFFFF'>".$row['Description']."</td></tr>"; $i = 1; }elseif($i == 1){ echo "<tr><td valign='top' bgcolor='#000000'><center><font color='#FFFFFF'><a href='".$row['Address']."' target='_blank'>".$row['Address']."</a></font><br><br>".$row['Keywords']."</center></td>"; echo "<td valign='top' bgcolor='#000000'>".$row['Description']."</td></tr>"; $i = 0; } }while($row = mysql_fetch_assoc($result)); try that...its untested...
  5. <?php class KeyGen { //Length of key private $keyLength; //Actual Key private $Activation_Code = ""; //Final Value key must equal private $Activation_Code_Sum = 500; //Key Elements private $AlphaNumerics = array("A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "P", "R", "S", "T", "W", "X", "Y", "Z", 1, 2, 3, 4, 5, 6, 7, 8, 9); //Corrosponding Key Element Values private $AlphaNumerics_Values = array( 22, 96, 13, 1, 3, 31, 19, 5, 2, 18, 12, 65, 26, 99, 15, 11, 4, 25, 17, 73, 5, 88, 50, 9, 8, 7, 65, 37, 22, 40); public function __construct($keyLen) {//Set Length of Key NOTE would always be 20 $this->keyLength = $keyLen; //space betweeen $this and keyLength } public function generateKey() {//Generate Key - Key value must equal $Activation_Code_Sum //current value of the key $currentValue = 0; //Generate random starting char and add to key //Get random starting character $j = rand(0, count($this->AlphaNumerics)); //Add char to code $this->Activation_Code .= $this->AlphaNumerics[$j]; //use brakets not prenthesis //Increase current value $currentValue += $this->AlphaNumerics_Values[$j]; //use brakets not prenthesis //Loop round so key has specified number of chars for ($i = 0; $i < $this->keyLength -1; $i++) { //Get random num $j = rand(0, count($this->AlphaNumerics)); //Determine next value $nextValue = $this->AlphaNumerics_Values[$j];//use brakets not prenthesis /*Check nextValue is not greater than current difference * between actual key value and final key value*/ while ($nextValue > ( $this->Activation_Code_Sum - $currentValue ) ) {//If so generate new random number and get ne value //TODO: Should make this seperate function and recurse //Get random num $j = rand(0, count($this->AlphaNumerics)); $nextValue = $this->AlphaNumerics_Values[$j];//use brakets not prenthesis } $this->Activation_Code .= $this->AlphaNumerics[$j]; //use brakets not prenthesis //Increase current value $currentValue += $this->AlphaNumerics_Values[$j]; //use brakets not prenthesis } return $this->Activation_Code;//space betweeen $this and Activation_Code } } $n = new KeyGen(20); echo $n->generateKey(); ?> i edited your code, and i was able to get it to generate a key, i place comments next to the stuff i changed....
  6. Maybe you Reflection class will help you... heres a link... http://us3.php.net/oop5.reflection :-)
  7. http://www.phpfreaks.com/forums/index.php/topic,37442.0.html <--read this... how does your css tie in with your php ? in the code provided neither ties in to each other... please be more specific on how they interact...
  8. you would probably need to have a list of approved tags, and approved attributes so there would be no javascript executing on your pages, or anything malicious....you would need to filter through what their trying to embed....just my thoughts....:-P i might be wrong hahahah
  9. I agree tizag is great, also depends on what you want to do with your code, after your think you have all the basics down....look into creating your own functions....regex....then you might want to try testing the waters with some Object oriented php...but if you think your writing too many if's you can get rid of repetitious code by making your own functions and maybe moving to Object Oriented PHP if your up for it...
  10. i agress with that last wordpress/myspace/facebook comment.... but then again its to many hands in the pot to keep it all consistant at times....
  11. interesting those are 2 slighly different ways of doing it...i had never seen it done that way before kenrbnsn....very nice... :-)
  12. try looking into cURL maybe ? I havnt done much with it, but give it a try...
  13. in your e-mailsbody you would simply have something like this... <a href="http://www.yourdomain.com/optout.php?emailid=1">CLICK HERE TO OPT-OUT</a> optout.php would have a script that would search your database for emailid when it quals 1 if your database is set up like that....not the best example but hope it helps...
  14. yes...much like one can use the same design on many pages.....but its one page...that draws information from one database to put it simple..
  15. i see you have <?php .... echo "&process=register&keyCode=".$flashKey; } elseif ($act == "userReg"){ ...... did you maybe mean something like..... echo "&process=register&keyCode=".$flashKey; } elseif ($_GET['process'] == "register"){
  16. where is $act=$_GET['userFunc']; coming from ? if its in an input field is the value correctly passed ?
  17. good deal :-) glad to be able to help....
  18. <html> <head> </head> <body bgcolor=#336699> <center><h2>Your page is being retrieved...</h2></center> <?php $title = $_POST['title']; if (!file_exists($title)) { echo 'The file you tried to edit does not exist!'; } else { $fp = fopen($title,"a+"); } if(!$fp) { echo 'Error, the file could not be opened or there was an error when creating it.'; } $content = fread($fp, filesize($title)); fclose($fp); echo "<form action='edit.php' method='post'><input type='hidden' name='title' value='".$title."'>Title (eg. index.html, index.php) <input type='text' name='title' value=''><p><textarea rows='20' cols='100' name='content'>".$content."</textarea><br><p><input type='submit' value='Save Page'></center></form>"; ?> </body> </html> try that.. :-) missing a bracket, and i dont really think you need the exit;
  19. <html> <head> </head> <body bgcolor=#336699> <center><h2>Your page is being retrieved...</h2></center> <?php $title = $_POST['title']; if (!file_exists($title)) { echo 'The file you tried to edit does not exist!'; exit; } else { $fp = fopen($title,"a+"); if(!$fp) { echo 'Error, the file could not be opened or there was an error when creating it.'; exit; } $content = fread($fp, filesize($title)); fclose($fp); echo "<form action='edit.php' method='post'><input type='hidden' name='title' value='".$title."'>Title (eg. index.html, index.php) <input type='text' name='title' value=''><p><textarea rows='20' cols='100' name='content'>".$content."</textarea><br><p><input type='submit' value='Save Page'></center></form>"; ?> </body> </html>
  20. Doing the same here....i find it dificult to not make things over complicated sometimes...i end up getting rid of something i dont need in my OO code all the time... i star out thinking i think i need it when in fact i dont/wont.. :-) cheers!
  21. <div class="actions"><input type="submit" input name="submit" value="Submit Content" class="submit"/></div> into <div class="actions"><input type="submit" name="submit" value="Submit Content" class="submit"/></div>
  22. you want that fopen ouside the loop. everytime the stuff inside the loop executes your opening the file again...so if your loop is 10,000rows...then your file is opening 10,000 times.....right ?
  23. yeah, if your checkboxes/radio boxes all have the same name, add [] to the end of the name such as <input type="radio" name="answer" value="yes"> <input type="radio" name="answer" value="no"> <input type="radio" name="answer" value="unsure"> the $_POST['answer'] or $_GET['answer'] variable would be passed to your script...and you can check to see what that value equals... edit: [mis-read...]
  24. RestlessThoughts is right... your checking to see if $_POST['add'] is set, but it is never set because there is no field with name add, its id is add, but not its name... so change your code to say $_POST['submit'] or change your form from name="submit" to name="add".... try it...let us know what happens...
×
×
  • 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.