Jump to content

manny

Members
  • Posts

    52
  • Joined

  • Last visited

    Never

Everything posted by manny

  1. cool, then use dirname twice. like this. $dir = dirname(dirname(__FILE__)) .'/test/';
  2. true true, i agree. i would recommend doing both :-) fixing a simple code, will help the person see the differences.
  3. do not use file_exists(), if $A will == '' and the directory exist, it will return true. instead use is_file(); example <?php // if you need to go back one folder use dirname(dirname(__FILE__)) // same like ../ $dir = dirname(__FILE__).'/test/'; // dirname(__FILE__) returns the absolute path for the file this is written in $a = 'BOB'; $b = $dir.$a; if(is_file($b)) { // do something... } else { // do nothing... } ?> is_file() will also make sure it is a file, and not a symbolic link or a folder, but an actual file
  4. i would reccomend utilizing the absolute paths, so that it works for almost any server config... Works like a charm for me. <?php $fh = fopen(dirname(dirname(__FILE__))."/inc/config.php", "a") or die("\r\nCan't open file."); $write = "\$config['database_host'] = {$mysqlh}; \$config['database_user'] = {$mysqlu}; \$config['datbase_pass'] = {$mysqlp}; \$config['datbase_name'] = {$dbn}; \$config['table_prefix'] = {$tp};"; fwrite($fh, $write); fclose($fh); ?>
  5. My pleasure. Feel free to contact me if you need any other help.
  6. manny

    spacess

    How many results does the mysql_fetch_array() returns?
  7. This should fix your parse error. <html> <body> <?php $hours="akj"; $hours_array = str_split($hours); foreach($hours_array as $value) { ?> <form> <input name="lname" type="text" value="<?php echo htmlspecialchars( $value); ?>" /> </form> <?php } ?> </body> </html>
  8. Here is an example how you can do that.. <input type="checkbox" name="checkbox[iD]" value="ID" /> <input type="checkbox" name="checkbox[135]" value="135" /> <?php $checkboxes = !empty($_POST['checkbox'])? $_POST['checkbox'] : array(); foreach ($checkboxes as $id => $value) { // code goes here... } ?> Let me know if this helps.
  9. this is how it can be done. <?php $stars = range(1,70); foreach ($stars as $star) { if($ibforums->member['star'] == $star) { $checked = ' checked'; } else { $checked = ''; } ?> <input type=radio id="s<?=$star?>" value="<?=$star?>" onclick="showPreview(<?=$star?>);" name="star"<?=$checked?> /> <label for="s<?=$star?>"> <img src="style_images/1/icons/<?=$star?>.png"> </label> <?php } ?> Hope this helps
  10. Try this code... <?php include ('includes/db.php'); if(isset($_POST['submit'])){ $sitename = $_POST['sitename']; $url = $_POST['url']; $theme = $_POST['theme']; mysql_query("CREATE TABLE IF NOT EXISTS `comments` ( `com_id` int(11) NOT NULL auto_increment, `page_id` int(11) NOT NULL default '0', `com_name` varchar(50) NOT NULL default '', `com_comment` text NOT NULL, `com_cat` varchar(10) NOT NULL default '', `com_date` int(11) NOT NULL default '0', `ip` varchar(255) NOT NULL, PRIMARY KEY (`com_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=3302 ;"); mysql_query("CREATE TABLE IF NOT EXISTS `favorites` ( `id` int(11) NOT NULL auto_increment, `username` varchar(255) NOT NULL, `pageid` bigint(11) NOT NULL, `pagecat` varchar(255) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=31 ;"); mysql_query("CREATE TABLE IF NOT EXISTS `feedback` ( `fb_id` int(11) NOT NULL auto_increment, `fb_email` varchar(50) NOT NULL default '', `fb_message` text NOT NULL, `fb_date` int(11) NOT NULL default '0', PRIMARY KEY (`fb_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=10 ;"); mysql_query("CREATE TABLE IF NOT EXISTS `game` ( `game_id` int(11) NOT NULL auto_increment, `game_name` varchar(150) NOT NULL default '', `game_link` varchar(888) NOT NULL, `game_thumb` varchar(255) NOT NULL, `game_des` text NOT NULL, `game_cat` varchar(100) NOT NULL default '', `game_type` varchar(255) NOT NULL, `game_views` int(11) NOT NULL default '0', PRIMARY KEY (`game_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=583 ;"); //Game query missing ); at end of query mysql_query("INSERT INTO `game` (`game_id`, `game_name`, `game_link`, `game_thumb`, `game_des`, `game_cat`, `game_type`, `game_views`) VALUES (1, 'Drag Racer V3', 'http://toxicflash.com/swf/f-619.swf', 'http://arcadecredits.com/thumbs/1.gif', '', 'racing', 'e', 27), (2, 'Stunt Pilot', 'stuntpilot.swf', 'stuntpilotmedicon.jpg', 'Be the best Stunt Pilot and complete all the courses without crashing!', 'action', 'h', 10), (3, 'Doomland 2154', 'doomland_con.swf', 'Doomland 2154.jpg', 'Shoot em up time crisis style in this amazing 3d shooter, Doomland 2154.', 'shooter', 'h', 3), (4, 'Big Truck Adventures 2', 'bigtruckadventures2-swf.swf', 'Big Truck Adventures 2.jpg', '', 'racing', 'h', 48), (5, 'Happy Tree Friends: Flippy Attack', 'Flippy Attack.swf', 'Flippy Attack.png', 'The objective of this game is simple. Stay alive as long as possible. Using characters from Happy Tree Friends.', 'Action', 'h', 14), (6, 'Hamster Ball', 'hamsterball.swf', 'Hamster Ball.jpg', 'The objective of the game is to move the hamsterball to the orange flag and stop there as quickly as possible. Make sure you avoid the spikes and pitfalls so the poor hamster dosent die. Make sure you collect the stars on the way! Enjoy!', 'Adventure', 'h', '2');"); mysql_query("CREATE TABLE IF NOT EXISTS `game_cat` ( `cat_id` int(11) NOT NULL auto_increment, `cat_name` varchar(100) NOT NULL default '', PRIMARY KEY (`cat_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=10 ;"); //Game_cat query missing ); at end of query mysql_query("INSERT INTO `game_cat` (`cat_id`, `cat_name`) VALUES (1, 'Action'), (2, 'Adventure'), (3, 'Racing'), (4, 'Shooter');"); mysql_query("CREATE TABLE IF NOT EXISTS `joke` ( `joke_id` int(11) NOT NULL auto_increment, `joke_name` varchar(150) NOT NULL default '', `joke_joke` text NOT NULL, `joke_cat` varchar(50) NOT NULL default '', `joke_by` varchar(255) NOT NULL, `joke_view` int(11) NOT NULL default '0', `joke_date` int(11) NOT NULL default '0', PRIMARY KEY (`joke_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=176 ;"); mysql_query("CREATE TABLE IF NOT EXISTS `joke_cat` ( `jokecat_id` int(11) NOT NULL auto_increment, `jokecat_cat` varchar(150) NOT NULL default '', PRIMARY KEY (`jokecat_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=19 ;"); //joke_cat query missing ); at end of query mysql_query("INSERT INTO `joke_cat` (`jokecat_id`, `jokecat_cat`) VALUES (1, 'Adult Jokes'), (2, 'Animal Jokes'), (3, 'Bar Jokes'), (4, 'Blonde Jokes'), (5, 'Computer Jokes'), (6, 'Dirty Jokes'), (8, 'Funny Quotes'), (9, 'Knock Knock Jokes'), (10, 'Lawyer Jokes'), (11, 'Medical Jokes'), (12, 'Misc Jokes'), (13, 'Redneck Jokes'), (14, 'Relationship Jokes'), (15, 'Religious Jokes'), (16, 'Yo Mama Jokes');"); mysql_query("CREATE TABLE IF NOT EXISTS `pm` ( `id` bigint(20) NOT NULL auto_increment, `from` varchar(255) NOT NULL, `to` varchar(255) NOT NULL, `subject` varchar(255) NOT NULL, `message` text NOT NULL, `parentid` bigint(20) NOT NULL default '0', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ;"); mysql_query("CREATE TABLE IF NOT EXISTS `settings` ( `id` varchar(2) NOT NULL, `sitename` varchar(255) NOT NULL, `url` varchar(255) NOT NULL, `status` varchar(255) NOT NULL, `topads` text NOT NULL, `bottomads` text NOT NULL, `theme` varchar(255) NOT NULL, `rpp` varchar(100) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1;"); //settings query missing ); at end of query mysql_query("INSERT INTO settings SET `url`='".$url."', `id`='1', `status`='online', `theme`='$theme', `sitename`='".$sitename."');") or die(mysql_error()); mysql_query("CREATE TABLE IF NOT EXISTS `users` ( `id` int(10) unsigned NOT NULL auto_increment, `type` varchar(10) NOT NULL default '2', `status` varchar(255) NOT NULL, `gameplays` int(11) NOT NULL default '0', `first` varchar(32) NOT NULL, `last` varchar(32) NOT NULL, `username` varchar(32) NOT NULL, `password` varchar(255) NOT NULL, `email` varchar(255) NOT NULL, `avatar` varchar(255) NOT NULL default 'default.gif', `location` varchar(255) NOT NULL, `myspace` varchar(255) NOT NULL, `aim` varchar(255) NOT NULL, `yim` varchar(255) NOT NULL, `about` text NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;"); //users query missing ); at end of query mysql_query("INSERT INTO `users` (`id`, `type`, `status`, `gameplays`, `first`, `last`, `username`, `password`, `avatar`, `about`) VALUES (1, '1', 'offline', 0, 'billy', 'bob', 'admin', '21232f297a57a5a743894a0e4a801fc3', 'default.gif', 'I am the admin!....');") or die(mysql_error()); mysql_query("CREATE TABLE IF NOT EXISTS `video_cat` ( `vid_id` int(11) NOT NULL auto_increment, `vid_cat` varchar(250) NOT NULL default '', `vid_count` int(11) NOT NULL default '0', PRIMARY KEY (`vid_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ;"); //video_cat query missing ); at end of query mysql_query("INSERT INTO `video_cat` (`vid_id`, `vid_cat`) VALUES (1, 'autos'), (2, 'comedy'), (3, 'sports'), (4, 'music'), (5, 'education'), (6, 'news');"); mysql_query("CREATE TABLE IF NOT EXISTS `video` ( `video_id` int(11) NOT NULL auto_increment, `video_name` varchar(250) NOT NULL default '', `video_link` varchar(250) NOT NULL default '', `video_des` text NOT NULL, `video_cat` varchar(50) NOT NULL default '', `video_views` int(11) NOT NULL default '0', `video_by` varchar(255) NOT NULL, PRIMARY KEY (`video_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=56 ;"); //video query missing ); at end of query mysql_query("INSERT INTO `video` (`video_id`, `video_name`, `video_link`, `video_des`, `video_cat`, `video_views`, `video_by`) VALUES (1, 'Numa Numa', '60og9gwKh1o', '', 'Comedy', 248, ''), (2, 'Shrek Karaoke', 'gknjvqdB_1M', '', 'Music', 82, ''), (3, 'Eminem - Beautiful', 'pCzRei9-42s', '', 'music', 26, 'admin'), (4, 'Call of Duty: Modern Warfare 2 Trailer', 'P7vyLDEwF5I', '', 'news', 15, 'admin'), (5, 'Michael Jackson - Billie Jean', 'CaAD7EizAfw', '', 'music', 16, 'admin'), (6, 'Michael Jackson - Beat It', 'jyCiNAgfcUs', '', 'music', 11, 'admin'), (7, 'sponge bob - pump it', 'fYIeLApUUlI', 'music video for sponge bob pump it by black eyed peas', 'music', 2, 'Admin'), (8, 'Spongebob We Will Rock You', 'OkrMnu9k4-A', 'Spongebob and his friends singin We Will Rock You, from Queen', 'music', 8, 'Admin'), (9, 'Michael Jackson - They Dont Really Care About Us', 'ZPFFDSChedY', 'The last song he preformed before his death.', '', 30, 'Admin');"); mysql_query("CREATE TABLE IF NOT EXISTS `vote` ( `id` int(4) NOT NULL auto_increment, `username` varchar(255) NOT NULL, `pageid` int(11) default NULL, `pagecat` varchar(255) NOT NULL, `rating` int(11) default NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=16 ;"); echo '<div class="done">Updated.</div><br /> Please delete the install.php file. <br /><br />Username: __ Password: __<br /> These are to login to the admin panel (default admin account). CHANGE THEM ASAP!!! '; exit; } echo "<form action='install.php' method='POST'> <div class='header'>Settings</div> Site Name:<br /> <input type='text' name='sitename' size='40'><br /> Domain: <input type='text' name='url' size='40' value='http://'><br /> Theme: <input type='text' name='theme' size='40' value='default' readonly><br /> <input type='submit' name='submit' value='Install Media Script!'> </form>"; ?> If this didn't help, do me a favor and give me the url for the pahe you are trying to install Let me know if you made it
  11. Try to go something like this <?php $con = mysql_connect("localhost", "Username", "Password") or die('Could not connect: ' . mysql_error()); mysql_select_db("DB_Name", $con); $id = !empty($_GET['id'])?(int)$_GET['id']:0; if(!empty($_GET['id']) && $_GET['id'] != 0) { // Check. //echo "Invalid!";die(); $sql = 'SELECT * FROM `news` WHERE id="'.$id.'" ORDER BY `date`'; $post_num = 'single'; } else { $sql = 'SELECT * FROM `news` ORDER BY `date`'; $post_num = 'multi'; } $result = mysql_query($sql); if ($post_num == 'multi') { $x = 0; while ($row = mysql_fetch_assoc($result)) { $listings[$x]['text'] = htmlspecialchars_decode($row['text']); $listings[$x]['title'] = htmlspecialchars_decode($row['title']); $listings[$x]['date'] = $row['date']; /// Keep adding lines for every field you want to include /// Keep adding lines for every field you want to include /// Keep adding lines for every field you want to include $x++; } } elseif ($post_num = 'single') { $row = mysql_fetch_assoc($result); $listings['text'] = htmlspecialchars_decode($row['text']); $listings['title'] = htmlspecialchars_decode($row['title']); $listings['date'] = $row['date']; /// Keep adding lines for every field you want to include /// Keep adding lines for every field you want to include /// Keep adding lines for every field you want to include } switch ($post_num) { case 'single': ?> <h2> <?php echo '<a href=?id='.$id.'">"'. $title; ?></a> </h2> Posted by <?php echo $row['poster']; ?> on <?php echo $row['date'] . ' at ' . $row['time']; ?> <p><?php echo $text;?></p> <? break; case 'multi': foreach ($listings as $listing) { echo '<a href=?id='.$id.'">"'. $title.'</a></h2>'; } break; default: //if none exist you have an error in your code break; } Let me know how it goes
  12. hold on Help is on the way give me like 5 minutes
  13. Let's try this $i = 0; foreach ($quotes as $quote) { $performancedata_results[$i] = $quote[3]; $performancedata_results[$i] = ($quote[3]*$performancedata[$i][1]) + $performancedata[$i][4]; $performancedata_results[$i] = $performancedata[$i][6] - $performancedata[$i][5]; /// you must increase the value of $i... or the foreach loop will keep overwriting the previous values because $i remains with the value 0 $i++; } Then i want you to var_dump $performancedata_results; also PM me with IM so i can get better understanding faster
  14. First lets try this and see what happens Replace $i = 0; foreach ($quotes as $quote) { $performancedata[$i][3] = $quote[3]; $performancedata[$i][6] = ($quote[3]*$performancedata[$i][1]) + $performancedata[$i][4]; $performancedata[$i][7] = $performancedata[$i][6] - $performancedata[$i][5]; } with foreach ($quotes as $quote) { $performancedata[$i][3] = $quote[3]; $performancedata[$i][6] = ($quote[3]*$performancedata[$i][1]) + $performancedata[$i][4]; $performancedata[$i][7] = $performancedata[$i][6] - $performancedata[$i][5]; /// you must increase the value of $i... or the foreach loop will keep overwriting the previous values because $i remains with the value 0 $i++; } after that i would like to see the var_dump();
  15. You might want to check your character encoding in your RSS / Page, they should be compatible
  16. try changing foreach ($performancedata as $singleline) { $output .= '<tr>'; $output .= '<th scope="row">'.$singleline[9].'</th>'; $output .= '<td>'.$singleline[0].'</td>'; $output .= '<td>'.$singleline[2].'</td>'; $output .= '<td>'.$singleline[3].'</td>'; $output .= '<td>'.$singleline[1].'</td>'; $output .= '<td>'.$singleline[4].'</td>'; $output .= '<td>'.$singleline[10].'</td>'; $output .= '<td>'.$singleline[8].'</td>'; $output .= '</tr>'; } to foreach ($performancedata as $id1=>$singleline){ $output .= '<tr>'; $output .= '<th scope="row">'.$singleline[9].'</th>'; $output .= '<td>'.$singleline[0].'</td>'; $output .= '<td>'.$singleline[2].'</td>'; $output .= '<td>'.$singleline[3].'</td>'; $output .= '<td>'.$singleline[1].'</td>'; $output .= '<td>'.$singleline[4].'</td>'; $output .= '<td>'.$singleline[10].'</td>'; $output .= '<td>'.$singleline[8].'</td>'; $output .= '</tr>'; } i would also take a look at the code where you build the array... it is wrong structure why do you have 10 arrays with single element its a waste. but i guess you have your reasons. let me know your progress
  17. you set two functions 1: mget(); 2: insert(); when are you calling them? also you set ob_start("ob_gzhandler"); are you calling ob_end_flush(); somewhere else?
  18. True but the other way will let you run more complex formulas better to get use to a better way Finally SOLVED
  19. Hello. I am not using that generic name as variable, I just replaced site name with $site for this sample. I probably managed to fix the issue after all, because I dont remember it anymore, oops well then you will have to remove it example $db = @ mysql_connect("$dbpath","$dbuser","$dbpass"); @ mysql_select_db("$dbname",$db); $db being the connection not the site name
  20. wow i totally forgot change $sql = ("UPDATE users SET `gold` = `gold`-100, `potions` = `potions`+ 1 WHERE `username` = '$username'") or die(mysql_error()); to change $sql = ("UPDATE users SET `gold` = (`gold`-100), `potions` = (`potions`+ 1) WHERE `username` = '$username'") or die(mysql_error());
  21. correction on echo "<center>You don't have enough gold, you currently have ". $row['gold'].". Come back when you get more.</center>"; goahead and see if it shows or what it shows
×
×
  • 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.