Programming Help, OS System Help, Articles, Videos, Books-Web Dot Dev
Welcome, Guest
Please Login or Register.    Lost Password?
Go to bottom Post Reply Favoured: 0
TOPIC: Re:Upgraded System
#224
matt (User)
Fresh Boarder
Posts: 12
graphgraph
User Offline Click here to see the profile of this user
Re:Upgraded System 1 Year, 10 Months ago Karma: 5  
Sorry Mike, didnt see the code.

Apologies if you've tried this already, but have you tried changing your SQL query to check the username & password against the database using:

Code:

$result = mysql_query("select username, password from users, where username='$username' and password = sha1('$password')", $handle);
Also, try this code (you may have to tweak a few settings) and see if you get any data back from the database.
Code:

<?php require_once ($_SERVER['DOCUMENT_ROOT'].'/../mysql_connect.php'); // Connect to the database //Make the query $query = "SELECT * FROM `users` WHERE `password` = sha1('T3st5r')"; $result = @mysql_query ($query); // Run the query. if ($result) { //If it ran OK, display the records. while($row = mysql_fetch_array($result, MYSQL_NUM)) { echo $row[0]." ".$row[1]." ".$row[2]." ".$row[3]." ".$row[4]." ".$row[5]." ".; } } ?>
Regards, Matt
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#230
mdub (User)
Junior Boarder
Posts: 26
graphgraph
User Offline Click here to see the profile of this user
Re:Upgraded System 1 Year, 10 Months ago Karma: 5  
I have already tried the first code you present; however, it didn't work.

For that second piece of code, I created a test.php file from it and it simply came up as a blank page.
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#231
matt (User)
Fresh Boarder
Posts: 12
graphgraph
User Offline Click here to see the profile of this user
Re:Upgraded System 1 Year, 10 Months ago Karma: 5  
Hi Mike,

OK, try the 2nd bit of code, but remove the "WHERE `password` = sha1('T3st5r'". This will prove the connection to the database is OK.

Regards,
Matt.
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#232
mdub (User)
Junior Boarder
Posts: 26
graphgraph
User Offline Click here to see the profile of this user
Re:Upgraded System 1 Year, 10 Months ago Karma: 5  
Hmmm
Still coming up with a blank page.
Now shouldn't I be getting some sort of error message?

I've got
ini_set('display_errors', 1);
error_reporting(E_ALL);

set at the top of the page.


db_connect.php
Code:

<?php // Set up error reporting display ini_set('display_errors', 1); error_reporting(E_ALL); function db_connect() { $handle = mysql_connect('localhost', 'cafs', '3mt0ps', 'cafs'); if (!$handle) { return false; } return $handle; } function get_user_record($username) { $handle = db_connect(); $query = "select * from users, where username = '$username'"; $result = mysql_query($query, $handle); return($result->mysql_fetch_assoc()); } function get_cafs_record($cafs) { $handle = db_connect(); $query = "select * from uploads where id = '$cafs'"; $result = mysql_query($query, $handle); return($result->mysql_fetch_assoc()); } function query_select($name, $query, $default='') { $handle = db_connect(); $result = mysql_query($query, $handle); if (!$result) { return(''); } $select = "<select name='$name'>"; $select .= '<option value=""'; if($default == '') $select .= ' selected '; $select .= '>-- Choose --</option>'; for ($i=0; $i < $result->mysql_num_rows; $i++) { $option = $result->mysql_fetch_array(); $select .= "<option value='{$option[0]}'"; if ($option[0] == $default) { $select .= ' selected'; } $select .= ">[{$option[0]}] {$option[1]}</option>"; } $select .= "</select>\n"; return($select); } ?>
Thanks for all the help, even if we don't get this resolved.
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#233
matt (User)
Fresh Boarder
Posts: 12
graphgraph
User Offline Click here to see the profile of this user
Re:Upgraded System 1 Year, 10 Months ago Karma: 5  
Hi Mike,

Another code to try. This takes into account, your connection and table data. If this goes blank, I go blank.

On my server, any errors in the access info, result in an error. It runs OK on my server with a table called users.

Code:

<?php // Set the database access information as constants. define ('DB_USER', 'cafs'); define ('DB_PASSWORD', '3mt0ps'); define ('DB_HOST', 'localhost'); define ('DB_NAME', 'cafs'); if ($dbc = @mysql_connect (DB_HOST, DB_USER, DB_PASSWORD)) { // Make the connection. if (!mysql_select_db (DB_NAME)) { // If it can't select the database. // Handle the error. my_error_handler (mysql_errno(), 'Could not select the database: ' . mysql_error()); // Print a message to the user, include the footer, and kill the script. echo '<p><font color="red">The site is currently experiencing technical difficulties. We apologize fo any inconvenience.</font></p>'; } // End of mysql_select_db IF. } else { // If it couldn't connect to MySQL. // Print a message to the user, include the footer, and kill the script. my_error_handler (mysql_errno(), 'Could not connect to the database: ' . mysql_error()); echo '<p><font color="red">The site is currently experiencing technical difficulties. We apologize for any inconvenience.</font></p>'; } // End of $dbc IF. //Make the query $query = "SELECT * FROM `users`"; $result = @mysql_query ($query); // Run the query. if ($result) { //If it ran OK, display the records. while($row = mysql_fetch_array($result, MYSQL_NUM)) { echo $row[0]." ".$row[1]." ".$row[2]." ".$row[3]." ".$row[4]." ".$row[5]." ".; } } ?>
Good Luck! Matt,
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#234
mdub (User)
Junior Boarder
Posts: 26
graphgraph
User Offline Click here to see the profile of this user
Re:Upgraded System 1 Year, 10 Months ago Karma: 5  
I'll give this a try tomorrow.
I HAD to give myself a break from the webdev stuff today, maybe a gain my sanity back day will help out too...

Thanks for all of the help you've been pushin' my way, even if it doesn't work tomorrow, all has been appreciated.

~Mike
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
Go to top Post Reply
Powered by FireBoardget the latest posts directly to your desktop