Jump to content

Alex

Staff Alumni
  • Posts

    2,467
  • Joined

  • Last visited

Everything posted by Alex

  1. <p><img src="someimage.jpg" alt="" align="left" /> Your text here . Your text here . Your text here . Your text here . Your text here . Your text here . Your text here . Your text here . </p>
  2. There's just an extra ( like the error says: find this: '"($_POST['password']"' And edit it to: '" . md5(md5($_POST['password'])) . "' Edit: The code that you quoted isn't what MadTechie posted.. copy his original code and it'll work..
  3. You're over complicating things and making a mistake somewhere, it would be easier to do something like this: <?php $list = Array(Array('fewfm43f.com', 80), Array('google.com', 80)); foreach($list as $check) echo (@fsockopen($check[0], $check[1], $errno, $errstr, 5)) ? "{$check[0]} is Online!<br />\n" : "{$check[0]} is Offline!<br />\n" ; ?>
  4. Not being very clear.. $var = "<a href='http://phpfreaks.com'>PHP Freaks!</a>"; echo $var;
  5. try: $sql = "INSERT INTO `dbase`.`dtable` (`name`, `last`, `mi`, `add`, `add2`, `city`, `state`, `zip`, `hp`, `cp`, `work`, `email`, `make`, `model`, `color`, `plate`) VALUES ( {$_POST['name']}, {$_POST['last']}, {$_POST['mi']}, {$_POST['phone']}, {$_POST['cp']}, {$_POST['wp']}, {$_POST['add']}, {$_POST['add2']}, {$_POST['city']}, {$_POST['state']}, {$_POST['zip']}, " . md5(md5($_POST['password'])) . ", {$_POST['make']}, {$_POST['model']}, {$_POST['color']}, {$_POST['plate']})";
  6. You're missing a , on this line: " . $_POST['color'] . " Should be: " . $_POST['color'] . ",
  7. Alternatively you can name the constructor as the same name as the class. All of this is stuff that you should probably look into: http://us.php.net/zend-engine-2.php
  8. Ah, I've been out of writing PHP for a long while and am used to Actionscript classes. I just figured the syntax would be $this -> $xml, but I see how that wouldn't work. Thanks again for all the help guys. Yea, I actually don't like that AS OOP allows that. But even in AS OOP you're allowed to do: this.something; just not required to.
  9. I actually noticed and fixed that before you posted that. @OP: The main thing you'll need to know is how to use $this, $this is used inside of a class to access methods or properties within itself. So if a class has a property of $xml, to access that property from within the class you'd do $this->xml
  10. class retrieveStats { //set XML file public $xml_stats = "./visits.xml"; private $xml; //load XML file public function load_xml() { $this->xml = simplexml_load_file($this->xml_stats); } public function show_ids() { if (count($this->xml -> hit) > 0) { foreach ($this->xml -> hit as $a) { echo $a -> id; }//end foreach }//end if } //end show_ids }//end class Edit: MadTechie inb4 me. But I put loading the xml file within a load_xml method instead of the construct because in your example you tried to use a load_xml method.
  11. Well the reason for that is because strings must be surrounded by quotes, while ints don't need to be.
  12. Well, a quick google search returned this: http://www.mieliestronk.com/wordlist.html It has 58,000 words.
  13. Yea, he can just do that: echo substr($list['Article'], 0, 300); But it's usually a better idea to just let the query perform as much work as possible. And I really don't see why it isn't working.
  14. $sql = "SELECT Author, Title, LEFT(Article, 300) as Article, DATE_FORMAT(Date,'%e/%m/%y') as Date FROM news ORDER BY id DESC LIMIT $offset, $rowsperpage"; Edit: Whoops, to make it easier just use: LEFT(Article, 300) as Article. That way you don't have to edit the following code.
  15. file() does exactly this, takes the contents of a file and stores each line in an element of an array. $array = file('sometextfile.txt');
  16. You most likely messed up something on accident while trying to edit it. It would be a good idea to either post the original (unedited source) or to just try to reedit being more careful, because I doubt anyone is going to watch to search through all that code and try to find the differences.
  17. It would be better if he used: mysql_query($sql); Considering that $sql is the variable that holds the query, don't you think?
  18. Try this: <?php $arr = Array("images/smilies/rofl.gif", "don't remove", Array("images/smilies/something.gif", "don't remove", "don't remove")); function removeRec(&$arr) { foreach($arr as $key => &$part) { if(is_array($part)) removeRec($part); else if(!stristr($part, "images/smilies") === false) unset($arr[$key]); } } echo "<pre>"; print_r($arr); removeRec($arr); print_r($arr); echo "</pre>"; ?> Output: Array ( [0] => images/smilies/rofl.gif [1] => don't remove [2] => Array ( [0] => images/smilies/something.gif [1] => don't remove [2] => don't remove ) ) Array ( [1] => don't remove [2] => Array ( [1] => don't remove [2] => don't remove ) )
  19. Your query was all messed up, try this: $sql = "INSERT INTO `dbase`.`table` (`name`, `last`, `mi`, `add`, `add2`, `city`, `state`, `zip`, `hp`, `cp`, `work`, `email`, `make`, `model`, `color`, `plate`) values ( " . $_POST['name'] . ", " . $_POST['last'] . ", " . $_POST['mi'] . ", " . $_POST['phone'] . ", " . $_POST['cp'] . ", " . $_POST['wp'] . ", " . $_POST['add'] . ", " . $_POST['add2'] . ", " . $_POST['city'] . ", " . $_POST['state'] . ", " . $_POST['zip'] . ", " . md5(md5($_POST['password'])) . ", " . $_POST['make'] . ", " . $_POST['model'] . ", " . $_POST['color'] . " " . $_POST['plate'] . " )"; You should also be securing all values being used in a mysql query with mysql_real_escape_string()
×
×
  • 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.