Jump to content

EternalSorrow

Members
  • Posts

    185
  • Joined

  • Last visited

    Never

Contact Methods

  • Website URL
    http://animara.org/

Profile Information

  • Gender
    Not Telling

EternalSorrow's Achievements

Member

Member (2/5)

0

Reputation

  1. I'm sorry if I seem slow, but I have no idea what to implement what you just suggested. The Google has also failed me in this effort to decipher your code-speak.
  2. I've never actually dealt with any host which didn't use 'localhost' for the hostname. My new hosting service doesn't appear to be any different than the previous host. I also use 'localhost' for all other connections to my other databases.
  3. I found that indeed the user I was using appears to be incompatible with the database (not sure why, with all permissions), and so I changed the username to one which was accepted by the database (and tested using a simple query, just to make sure). Unfortunately, there's still a problem. Here's the new error message (which I had received using this username previously): Cannot select database: Access denied for user 'user_name'@'localhost' to database 'fanlisting' Next step, bash head on keyboard.
  4. I realize the problem is with the user trying to connect, and I've tried using various user names with all privileges granted and they all receive the same message. This, along with having the correct password as the error message says, makes me think the problem is not with the user_name but with the script.
  5. I changed hosts a few months back and was never able to get a third-party script to work properly after the move. I tried changing the script to adapt to what I thought were the problems, but this error message still pops up: Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'user_name'@'localhost' (using password: YES) in /home/cirque8/public_html/seras/fanlisting/backend/install.php on line 47 Cannot connect to the MySQL server: Access denied for user 'user_name'@'localhost' (using password: YES) I've tried changing the offending line, which starts at the $db_link: <?php /***************************************************************************** Enthusiast: Fanlisting Management System Copyright (c) by Angela Sabas http://scripts.indisguise.org ******************************************************************************/ require_once( 'header.inc.php' ); require_once( 'config.inc.php' ); ?> <p class="location">Enthusiast > Create database table</p> <?php if( isset( $_GET["done"] ) ) { $query = 'CREATE TABLE `' . $db_table . '` (' . '`email` varchar(64) NOT NULL default \'\', ' . '`name` varchar(128) NOT NULL default \'\', '; if( !isset( $disable_country ) || !$disable_country ) $query .= '`country` varchar(128) NOT NULL default \'\', '; $query .= '`url` varchar(254) default NULL, '; if( $additional_field ) { foreach( $additional_field_names as $field ) { $query .= '`' . $field . '` varchar(255) ' . 'default NULL, '; } } $query .= '`pending` tinyint(1) NOT NULL default \'0\', ' . '`password` varchar(128) NOT NULL default \'\', ' . '`showemail` tinyint(1) NOT NULL default \'1\', ' . '`showurl` tinyint(1) NOT NULL default \'1\', ' . '`added` date default NULL, ' . 'PRIMARY KEY (`email`) ' . ') TYPE=MyISAM;'; $db_link = mysql_connect( $db_server, $db_user, $db_password ) or die( 'Cannot connect to the MySQL server: ' . mysql_error() ); mysql_select_db( $db_database ) or die( 'Cannot select database: ' . mysql_error() ); $result = mysql_query( $query ) or die( 'Cannot execute query: ' . mysql_error() ); if( $result ) { echo '<p><b>Database table created successfully.</b></p>'; } else { echo '<p><b>There was an error creating the table.' . ' Please try again.</b></p>'; } // check if affiliates are enabled if( isset( $enable_affiliates ) && $enable_affiliates ) { // create affiliates table $query = 'CREATE TABLE `' . $db_table . '_affiliates` (' . '`affiliateid` int(5) NOT NULL auto_increment, ' . '`url` varchar(254) NOT NULL default \'\', ' . '`title` varchar(254) NOT NULL default \'\', ' . '`imagepath` varchar(254) default NULL, ' . '`width` int(3) default NULL, ' . '`height` int(3) default NULL, ' . 'PRIMARY KEY (`affiliateid`) ' . ') TYPE=MyISAM AUTO_INCREMENT=1 ;'; $result = mysql_query( $query ) or die( 'Cannot execute query: ' . mysql_error() ); if( $result ) { echo '<p><b>Affiliates database table created ' . 'successfully.</b></p>'; } else { echo '<p><b>There was an error creating the ' . 'affiliates table. Please try again.</b></p>'; } } echo '<p>Delete the install.php file after creating the tables ' . 'to ensure your security.</p>'; } else { ?> <p> You can automatically create your database table via this page.<br /> <b>Please make sure that you have edited your config.inc.php file before<br /> doing this. Refer to the table below.</b> </p> <p><table> <tr><td> $db_server </td><td> Usually "localhost", please refer to your host if otherwise. </td></tr> <tr><td> $db_user </td><td> Username to connect to the database </td></tr> <tr><td> $db_password </td><td> Password to connect to the database </td></tr> <tr><td> $db_database </td><td> Database name the FL table will be created in;<br /> MUST ALREADY EXIST before this script is continued<br /> (refer to your host on how to create a database) </td></tr> <tr><td> $db_table </td><td> The table name for your database;<br /> e.g., if your <?= $listing_type ?> is for computers,<br /> it would be "computers". </td></tr> <tr><td> $additional_field </td><td> If you want an extra, customized field for your FL,<br /> you should set this to "true". </td></tr> <tr><td> $additional_field_names[] </td><td> Create a new line with each additional field name (no spaces), i.e.: <br /><i>$additional_field_names[] = 'character';<br /> $additional_field_names[] = 'scene';</i> </td></tr> </table></p> <br /> <p><b>If you're done editing your config.inc.php file, click the button below.</b></p> <form action="<?= $_SERVER["PHP_SELF"] ?>" method="get"> <input type="hidden" name="done" /> <input type="submit" value="Create my FL Table" /> </form> <?php } require_once( 'footer.inc.php' ); ?> I still can't figure out exactly how it can't connect to the database even when I replace all the $db_server, $db_user, and $db_password fields to what they actually are. Anyone have any ideas what the problem could be? Thanks in advance for any assistance.
  6. @requinix By default the rows do not start out with a summary. I'm not sure what you're referring to when you say 'listed,' but the ORDER is RAND(), so with a refresh of the page a row with an empty summary may appear. @batwimp Yes, I'm familiar with joining tables, and yes, I am very much wanting to avoid creating more than one table. Unless, of course, you can convince me it will be less code/work than the current setup (I tried multiple tables in the past and found the setup infinitely more troublesome than having a single file).
  7. Since I can't seem to edit my original post to expand the 'nearly identical' rows to actually reflect how different they can be, I'll post a larger view here: 'Boring Title', 'Boring Author', 'Empty Summary', '2010', 'Group A', 'Category A', 'Rating', 'Nominated' 'Boring Title', 'Boring Author', 'Boring Summary', '2012', 'Group B', 'Category F', 'Rating', 'Not Nominated' Hopefully this will avoid further confusion, and maybe garner some assistance.
  8. I have a simple database set up for story awards given out by different groups. Here are some of the fields I'm using: Author Title Year Summary Some of the rows are nearly identical with the same Author and Title, but sometimes a different year or or others have a Summary for the story where otherwise it would be empty for a different row. The problem I'm having is I want to fetch the summary of the story from all rows where the Author and Title are identical. Currently the code is fetching a random row with the same Author and Title, but won't show the Summary if that specific row doesn't have the summary filled in (and where other rows of nearly identical information would have the summary). Here's an example of nearly identical rows: 'Boring Title', 'Boring Author', '', '2012' 'Boring Title', 'Boring Author', 'Boring Summary', '2012' How would I go about fetching all rows with the identical Author and Title and then showing the Summary even if only one of those rows has information in the Summary field? Much obliged for any help. Here's the code I'm working with: <?php mysql_connect(localhost,db_user,pw); @mysql_select_db(db_database) or die( "Unable to select database"); $quer="SELECT * FROM archives ORDER BY RAND() DESC LIMIT 1"; $re = mysql_query($quer); while ($ro = mysql_fetch_array($re)) { extract($ro); $please = ''; if (strlen($ro[summary]) == 0) { $please = "The summary is empty. Please help the Archives by <a href=\"edit.php?cmd=edit&author=$author&title=$title\">filling out the summary</a>."; } $select_author = mysql_query("SELECT DISTINCT author FROM archives WHERE `title` = '" . mysql_real_escape_string($title) . "' ") or die (mysql_error()); $aut = ""; while ($row2 = mysql_fetch_array($select_author)) { $aut .= "<a href=\"author.php?author={$row2[author]}\">$row2[author]</a> & "; } $aut = substr($aut,0,-3); echo '<div style="margin: 5px;"> '.$summary.''.$please.' <p style="float: right; width: 100%; margin-top: 10px; text-align: right;"><i> ~ <a href="info.php?author='.$author.'&title='.$title.'">'.$title.'</a> by <a href="author.php?author='.$author.'">'.$aut.'</a></i> </div>'; } ?>
  9. I changed hosts recently and a number of my third-party scripts have been broken by the database/database_user change. The one I'm having the most trouble with is the Enthusiast script (http://scripts.indisguise.org/enthusiast). Here are the example names I will use for privacy purposes: Username for cPanel: user Database user: user_dbuser I have typed in the db_user and password as instructed, but I keep receiving the same error message: Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'user'@'localhost' (using password: NO) in /home/user/public_html/seras/admin/mod_owned.php on line 1711 The referred line is this: $info['dbpassword'] ); which is finishing this action: $db_link_list = mysql_connect( $info['dbserver'], $info['dbuser'], $info['dbpassword'] ); Whenever I use a word which is not the password (such as the word 'the') the error message changes to this: Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'user_dbuser'@'localhost' (using password: YES) in /home/user/public_html/seras/config.php on line 50 Cannot connect to the database. Check your config file and try again. MySQL said: Access denied for user 'db_user'@'localhost' (using password: YES) As you can see, when I use an incorrect password, the username from the database (which is just the cPanel user plus a name chosen for the database) appears and it says I am using the password. When I put in the correct password, the user is shortened to the cPanel name. I've tried asking my host, but they state the problem is with the code and will not help. Anyone know what may be wrong, or perhaps has a working copy of the code I can look at? Much obliged for any help.
  10. Thanks to both of you for your help. I learned more about my code and I'll see if that slice worked. Again, thanks for the lesson!
  11. If I read your post correctly, the code you gave me is to replace this piece of code? if (isset($_GET['letter']) && !empty($_GET['letter']) && !is_numeric($_GET['letter'])) { $letter = substr($_GET['letter'], 0, 1); } else { $letter = ''; } And sorry for the lack of inclusion, the information is fetched in a separate code that I've presented below to avoid further confusion: <?php connect to database here if (!is_numeric($_GET["type"]) && !empty($_GET["type"]) && $_GET["type"]!="") { $type = $_GET["type"]; } $query = "SELECT * FROM design WHERE type = '$type' LIMIT 1 "; $result = mysql_query($query) or die(mysql_error()); echo '<h1>Designs: '.$type.'</h1>'; while ($row3 = mysql_fetch_array($result)) { extract($row3); if ($type == 'Divider') { echo 'Divider designs are based on css positioning and focus on a table-less layout driven by the style-sheet. All designs are tested in the newest editions of both Internet Explorer and Firefox.'; } else if ($type == 'Table') { echo 'Table designs are positioned primarily through the use of html tables. All designs are tested in the newest editions of both Internet Explorer and Firefox.'; } else if ($type == 'Iframe') { echo 'Iframe designs use the inline framing technique to absolutely position items in the design. All designs are tested in the newest editions of both Internet Explorer and Firefox.'; } } ?>
  12. For some reason I keep getting a recurring error every time someone uses a page on my site. Here is the error: [Date] PHP Warning: array_key_exists() [<a href='function.array-key-exists'>function.array-key-exists</a>]: The second argument should be either an array or an object in /home/page.php on line 52 The offending line is here: echo array_key_exists($i, $alpha) ? '<li><a href="?a=show&letter='.$i.'&type='.$type.'">'.$i.'</a></li> ' : '<li class="no_highlight">'.$i.'</li> The code works, but the error message must be showing that I am performing the echo incorrectly. Anyone have any ideas on where I could be going wrong (other than the exact line, that is )? Here's the rest of the code for full reference (the offending line is near the top). Thanks for any help! <?php $sql = "SELECT *, UPPER(SUBSTRING(series,1,1)) AS letter FROM design WHERE type = '$type' ORDER BY series"; $query = mysql_query($sql) or die(mysql_error()); // Display a range of letters. echo '<ul class="alphabet">'; while ($records = mysql_fetch_assoc($query)) { $alpha[$records['letter']] += 1; ${$records['letter']}[$records['series']] = $records['series']; } foreach(range('A','Z') AS $i) { echo array_key_exists($i, $alpha) ? '<li><a href="?a=show&letter='.$i.'&type='.$type.'">'.$i.'</a></li> ' : '<li class="no_highlight">'.$i.'</li> '; echo $i != 'Z' ? ' ':'</ul>'; } // Display records of the letter selected. if (isset($_GET['letter']) && !empty($_GET['letter']) && !is_numeric($_GET['letter'])) { $letter = substr($_GET['letter'], 0, 1); } else { $letter = ''; } $a = (isset($_GET['a'])) ? strip_tags(trim(htmlentities($_GET['a'], ENT_QUOTES))) : 'index'; switch ($a) { case 'index': $select_series = mysql_query("SELECT *, UPPER(SUBSTRING(series,1,1)) AS letter FROM design WHERE `type` = '$type' ORDER BY `id` DESC LIMIT 8") or die (mysql_error()); $i=3; echo '<h3>Newest Additions</h3>'; while($row2 = mysql_fetch_array($select_series)) { extract ($row2); $contents_here = '<div class="envelope"><a href="?a=show&letter='.$letter.'&type='.$type.'#'.$title.'"><img src="previews/'.$id.'.jpg" class="tips" title="'.$title.'|'.$series.'"><br>'.$title.'</a></div>'; if ($i==0) { echo ''.$contents_here.''; } else if ($i==3) { echo ''.$contents_here.''; } else { echo ''.$contents_here.''; } $i++; $i=$i%3; } break; case 'show': $letter2 = (isset($_GET['letter'])) ? strip_tags(trim(htmlentities($_GET['letter'], ENT_QUOTES))) : ''; $sql = "SELECT * ,UPPER(SUBSTRING(series,1,1)) AS letter, date_format(design.datetime, '%M %d, %Y') AS datetime FROM design WHERE series LIKE '$letter2%' AND type = '$type' ORDER BY series ASC, id ASC"; $query = mysql_query($sql) or die (mysql_error()); echo '<h3><a name="'.$i.'"><b>'.$letter.'</b></a></h3> <table align="center" width="100%"><tr><td>'; $series = ''; while ($row = mysql_fetch_assoc($query)) { $image = $row[image]; $datetime = $row[datetime]; $id = $row[id]; $type = $row[type]; $title = $row[title]; $count_display = $row[count_display]; if ($series != $row['series']) { //Assign category to holding var $series = $row['series']; //echo Category heading echo '<h3><a href="#" class="top"></a>'.$series.'</h3> '; } echo '<table align="center" class="format" cellpadding="0" cellspacing="0"> <tr><td> <img src="previews/'.$id.'.jpg" align="right"> <td class="design"><ul class="design_info"> <li class="special"><b>Title:</b> <a name="'.$title.'">'.$title.'</a> <ul> <li><b>Series:</b> '.$series.' <li><b>Type:</b> '.$type.' <li><b>Uploaded:</b> '.$datetime.' <li><b>Downloads:</b> '.$count_display.' </ul></ul> <ul class="design_dl"> <li class="preview"><a href="graphics/preview.php?id='.$id.'" target="_blank">preview</a> <li class="download"><a href="graphics/download.php?id='.$id.'">download</a> </ul> </td></tr> </table>'; } } echo '</table>'; ?>
  13. That worked! Here's the final code for reference, and thanks for all the help, guys! $select_author = mysql_query("SELECT DISTINCT author FROM archives WHERE `title` = '" . mysql_real_escape_string($title) . "' AND `year` = '$year' AND `category` = '$category' AND `group` = '$group' ") or die(mysql_error());
  14. Wow, lots of help , lemme sort out the questions/tips/suggestions: I definitely know the $select_author query after the extract($row) is the problem child. I am using this format because there are multiple authors for a single story, and in the database I have given them their own row to avoid using multiple tables. So it's like this: Title Author I'll Take Lemonade FirstAuthor I'll Take Lemonade SecondAuthor The $select_author grabs the two rows and places the authors as a list within the echo, so they'd come out like this: I tried using '" mysql_real_escape_string($title) . "' instead of the $title, but this error message came up: with line 267 being the line which holds the modified $select_author query, like so: $select_author = mysql_query("SELECT DISTINCT author FROM archives WHERE `title` = '" mysql_real_escape_string($title) . "' AND `year` = '$year' AND `category` = '$category' AND `group` = '$group' ") or die(mysql_error());
  15. Addslashes unfortunately does give me the same error message as before (along with making the author names disappear). I haven't received any errors regarding connecting to the database, and the rows from the db appear for a search until it comes to a title with an apostrophe in it. That's when the error message appears.
×
×
  • 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.