Jump to content

ignace

Moderators
  • Posts

    6,457
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by ignace

  1. You mean if (!empty($_POST['equip'])) as if ($_POST['equip']) will throw an error like: 'equip' undefined index on line ..
  2. if($submit)?? $submit isn't even defined. Use if (!empty($_POST))
  3. Yeah we know how to pamper our guests
  4. I have posted this a while ago but found it nevertheless http://onlamp.com/pub/a/php/2002/12/05/one_time_URLs.html (original post: http://www.phpfreaks.com/forums/index.php/topic,195046.msg879256.html#msg879256)
  5. You get the host address because you are testing it locally. So therefor the ip-address = the host-address.
  6. Using arrays in string ain't a good idea altough it is possible. Try using: $query = 'SELECT * FROM rpg WHERE player = \'%s\''; $fquery = sprintf($query, $_SERVER['username']); $result = mysql_query($fquery, $db);
  7. What is the error you get? And is this the entire code?
  8. Creating a SSH connection with PHP: http://kevin.vanzonneveld.net/techblog/article/make_ssh_connections_with_php/ Creating a new FTP account in Linux: http://knowledgelayer.softlayer.com/questions/204/Creating+an+FTP+Account+within+Linux. Pass these commands to your SSH.
  9. $notesline1datenew = 'no date'; if (!is_empty_date($date)) { $notesline1datenew = date('m j Y', strtotime($notesline1date)); } function is_empty_date($date) { return preg_match('/[0]{4}-[0]{2}-[0]{2} [0]{2}:[0]{2}:[0]{2}/', $date); }
  10. $line is probably one line of the file. You can't use that here as some parts are on new lines. You can use eregi() to retrieve all the data from the file without having to use file(). $contents = file_get_contents('path/to/file'); $matches = array(); preg_match('/\d{1,2}(:|.)\d{1,2}/', $contents, $matches); print_r($matches);
  11. $query = 'SELECT * FROM nfl_feeds_history ORDER BY date_posted'; $result = mysql_query($query); if ($result && mysql_num_rows($result)) { echo '<dl>'; $currentDate = null; while ($row = mysql_fetch_assoc($result)) { if (strcmp($currentDate, $row['date_posted'])) { $currentDate = $row['date_posted']; echo '<dt>', date('F j, Y', strtotime($row['date_posted'])), '</dt>'; } echo '<dd>', $row['title'], '</dd>'; } echo '</dl>'; }
  12. $genres = array("Blues","Classic Rock","Country","Dance","Disco","Funk","Grunge", "Hip-Hop","Jazz","Metal","New Age","Oldies","Other","Pop","R&B", "Rap","Reggae","Rock","Techno","Industrial","Alternative","Ska", "Death Metal","Pranks","Soundtrack","Euro-Techno","Ambient", "Trip-Hop","Vocal","Jazz+Funk","Fusion","Trance","Classical", "Instrumental","Acid","House","Game","Sound Clip","Gospel", "Noise","AlternRock","Bass","Soul","Punk","Space","Meditative", "Instrumental Pop","Instrumental Rock","Ethnic","Gothic", "Darkwave","Techno-Industrial","Electronic","Pop-Folk", "Eurodance","Dream","Southern Rock","Comedy","Cult","Gangsta", "Top 40","Christian Rap","Pop/Funk","Jungle","Native American", "Cabaret","New Wave","Psychadelic","Rave","Showtunes","Trailer", "Lo-Fi","Tribal","Acid Punk","Acid Jazz","Polka","Retro", "Musical","Rock & Roll","Hard Rock","Folk","Folk-Rock", "National Folk","Swing","Fast Fusion","Bebob","Latin","Revival", "Celtic","Bluegrass","Avantgarde","Gothic Rock","Progressive Rock", "Psychedelic Rock","Symphonic Rock","Slow Rock","Big Band", "Chorus","Easy Listening","Acoustic","Humour","Speech","Chanson", "Opera","Chamber Music","Sonata","Symphony","Booty Bass","Primus", "Porn Groove","Satire","Slow Jam","Club","Tango","Samba", "Folklore","Ballad","Power Ballad","Rhythmic Soul","Freestyle", "Duet","Punk Rock","Drum Solo","Acapella","Euro-House","Dance Hall"); $directories = array('path/to/directory1', 'path/to/directory2', ..); foreach ($directories as $directory) { foreach (glob("$directory/*.mp3") as $file) { $fh = fopen($file, 'r'); fseek($fh, -128, SEEK_END); $tag = fread($fh, 3); $data = array(); if ('TAG' === $tag) { $data['song'] = fread($fh, 30); $data['artist'] = fread($fh, 30); $data['album'] = fread($fh, 30); $data['year'] = fread($fh, 4); $data['comment'] = fread($fh, 30); $genre = fread($fh, 1); $data['genre'] = $genres[ord($genre)]; foreach ($data as $key => $value) { //echo $key, ' = ', $value, '<br>'; } } } }
  13. $db = new MyDB(); $db->start("DBUSER","DBPASS","HOST","DB",DB_PORT(optional)); would be better if you put that into the constructor and let the constructor then proxy start(), thus: $db = new MyDB("DBUSER","DBPASS","HOST","DB",DB_PORT(optional)); public function __construct($dbuser, $dbpass, $dbhost, $dbname, $dbport) { $this->start(..); } I noticed you are writing for PHP 5 therefor you can use __destruct: public function __destruct() { $this->stop(); } if ($this->cleaned != true){ $this->cleanSQL(); } This code is used multiple times, wrap it! $result = mysql_query($this->query); should not be in the countResults() + mysql_query() has a second parameter to specify the connection you wish to use i suggest using it as you may work with multiple db's $result = mysql_query($this->query) or die("ERROR!"); or die() should not be used within a class, use exceptions instead $result = mysql_query($this->query); is used at multiple locations, you know the drill, wrap it! return mysql_error(); would be better if you used: throw new Exception(mysql_error(), mysql_errno()); if (!array($item)) should be if (!is_array($item))
  14. should be: $ip = $_server['REMOTE_ADDR']; list($first,$second,$third,$fourth) = explode('.',$ip); // $second is the second part of the IP Adress // just use the variables as needed, as in echoing them out... echo $first, $second; (you get the point)
  15. $octets = explode('.', $_SERVER['REMOTE_ADDR']); if (20 == $octets[1]) { //downtown office }
  16. If you take a close look at my post you'll notice: If you copy-paste then make sure you copy-paste well.
  17. It would help if you provided some more in-depth information about what your idea is like what are you trying to build?
  18. if (!isset($_SESSION)) session_start(); $_SESSION is always set, you can even store data in it but it just won't get saved. Use if (!session_id()) { session_start(); }
  19. Store the name of a point in your database along with it's coördinates
  20. To receive and read inbound e-mails you need PHP to be compiled as a CGI binary and not as an Apache module. You can read more about it at these two resources: http://www.phpclasses.org/blog/package/2/post/1-Process-incoming-email-messages-using-PHP.html http://www.evolt.org/article/Incoming_Mail_and_PHP/18/27914/index.html
  21. Because you did something wrong. Question solved, mark this topic solved.
  22. Please ask moderators directly. I even believe there is a forum to ask this sort of questions.
  23. Actually it would be better if you tried to correct the error yourself you will learn much more then when we just tell you what the problem is. $kills[$sumup] = $kills[$sumup] + row2['kills']; //stats need to manitain the same array until we reach our number of rows per user $deaths[$sumup] = $deaths[$sumup] + row2['deaths']; $assists[$sumup] = $assists[$sumup] + row2['assists']; $creepkills[$sumup] = $creepkills[$sumup] + row2['creepkills']; $creepdenies[$sumup] = $creepdenies[$sumup] + row2['creepdenies']; Needs to be: $kills[$sumup] = $kills[$sumup] + $row2['kills']; //stats need to manitain the same array until we reach our number of rows per user $deaths[$sumup] = $deaths[$sumup] + $row2['deaths']; $assists[$sumup] = $assists[$sumup] + $row2['assists']; $creepkills[$sumup] = $creepkills[$sumup] + $row2['creepkills']; $creepdenies[$sumup] = $creepdenies[$sumup] + $row2['creepdenies'];
  24. str_replace($k,$v,$body) . '<P />' should be: '<p>' . str_replace($k,$v,$body) . '</p>'
  25. if (is_post() && !empty($_FILES)) { $files = $_FILES['userfiles']; if (is_array($files['tmp_name'])) { $sizeof = sizeof($files['tmp_name']); for ($i = 0; $i < $sizeof; ++$i) { $tmp_name = $files['tmp_name'][$i]; $name = $files['name'][$i]; //.. } } else { $tmp_name = $files['tmp_name']; $name = $files['name']; //.. } } function is_post() { return 'POST' === $_SERVER['REQUEST_METHOD']; }
×
×
  • 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.