PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 1st, 2012, 07:15 PM
lelales lelales is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Mar 2008
Posts: 601 lelales User rank is Sergeant Major (2000 - 5000 Reputation Level)lelales User rank is Sergeant Major (2000 - 5000 Reputation Level)lelales User rank is Sergeant Major (2000 - 5000 Reputation Level)lelales User rank is Sergeant Major (2000 - 5000 Reputation Level)lelales User rank is Sergeant Major (2000 - 5000 Reputation Level)lelales User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 4 Days 40 m 3 sec
Reputation Power: 37
Is this a PHP 5 issue

OK, I've been using a CMS built by a friend of mine who is an absolute genius. I've been using it for years with no problem. But now, nothing works, not even the query checks. So, I have the following code after the login status:
Code:
 $mysql = mysql_connect($host, $user, $pass);
    if(!$mysql)
    {
      echo 'Cannot connect to database. Please try again or email name@host.com';
      exit;
    }
    // select the appropriate database
    $mysql = mysql_select_db($db);
    if(!$mysql)
    {
      echo 'Cannot select database. Please try again or email sean@hostname.com';
      exit;
    }

    // query the database to see if there is a record which matches
    $query = "select * from login where
              username = '$username' and
              psswd = '$psswd'";
	

    $result = mysql_query( $query );

    if(!$result)
    {
      echo 'Cannot run query.';
      exit;
    }


When I try to login, none of the checks work . . . nothing happens at all. Is this a PHP4 vs. PHP5 issue. Can anyone give me some insight.

thanks so much!
-S

Last edited by lelales : November 2nd, 2012 at 04:18 AM. Reason: typo

Reply With Quote
  #2  
Old November 1st, 2012, 07:59 PM
requinix's Avatar
requinix requinix is offline
Still alive
Click here for more information.
 
Join Date: Mar 2007
Location: Washington, USA
Posts: 12,698 requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)  Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 5 Months 1 Week 4 Days 4 h 53 m
Reputation Power: 8969
Send a message via AIM to requinix Send a message via MSN to requinix Send a message via Yahoo to requinix Send a message via Google Talk to requinix
Be more descriptive about what "nothing works" means. What you do see? Not see? What should it do?
Has anything changed recently?

Reply With Quote
  #3  
Old November 1st, 2012, 08:07 PM
lelales lelales is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Mar 2008
Posts: 601 lelales User rank is Sergeant Major (2000 - 5000 Reputation Level)lelales User rank is Sergeant Major (2000 - 5000 Reputation Level)lelales User rank is Sergeant Major (2000 - 5000 Reputation Level)lelales User rank is Sergeant Major (2000 - 5000 Reputation Level)lelales User rank is Sergeant Major (2000 - 5000 Reputation Level)lelales User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 4 Days 40 m 3 sec
Reputation Power: 37
hey requinix

The script doesn't throw any error messages . . . nothing happens at all, except the login "username" and "passwords" go blank. I was thinking that I would get one of the error messages, but that's all that happens, which is basically nothing.

I'm out of ideas on how to trouble shoot this. If you have any ideas, please pass them along

Thanks so much!
-S

Reply With Quote
  #4  
Old November 1st, 2012, 10:07 PM
requinix's Avatar
requinix requinix is offline
Still alive
Click here for more information.
 
Join Date: Mar 2007
Location: Washington, USA
Posts: 12,698 requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)  Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 5 Months 1 Week 4 Days 4 h 53 m
Reputation Power: 8969
Send a message via AIM to requinix Send a message via MSN to requinix Send a message via Yahoo to requinix Send a message via Google Talk to requinix
Does the page refresh? You're not really describing much but that's what it sounds like it's doing.

Post more of the code. Specifically, the stuff coming after what you already posted.

Reply With Quote
  #5  
Old November 2nd, 2012, 04:08 AM
lelales lelales is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Mar 2008
Posts: 601 lelales User rank is Sergeant Major (2000 - 5000 Reputation Level)lelales User rank is Sergeant Major (2000 - 5000 Reputation Level)lelales User rank is Sergeant Major (2000 - 5000 Reputation Level)lelales User rank is Sergeant Major (2000 - 5000 Reputation Level)lelales User rank is Sergeant Major (2000 - 5000 Reputation Level)lelales User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 4 Days 40 m 3 sec
Reputation Power: 37
Hey requinix

Thanks for the help.

Here is the code that follows:
Code:
$count = mysql_fetch_row($result);
	$ticker = mysql_num_rows($result);

    if ( $count > 0)
    {
      // visitor's name and password combination are correct
	  if ($ticker>0){
		$HTTP_SESSION_VARS['valid_user'] = $username;
		$HTTP_SESSION_VARS['main_admin'] = $username;
	  } else {
		  $HTTP_SESSION_VARS['valid_user'] = $count2[1];
		  
		  $currDate = date('Y m d');
		  $currDateAdj = str_replace(' ', '-', $currDate);
		  $currTime = date('h').' '.date('i');
		  $currTimeAdj = str_replace(' ', ':', $currTime).' '.date('a');

		  
	  }
      echo '<h2>You are logged in.</h2>';
	  require ('editor_content.php');
    }
    else
    {
      // visitor's name and password combination are not correct
      echo '<h1>We cant log you in.</h1>';
      echo 'You are not authorized to use the control panels. <a href="'.$absolute.'index.php">TRY AGAIN.</a>';
    }
  }
} else {
	require ('editor_content.php');
}
?>


Any ideas?
thanks again!
-S

Reply With Quote
  #6  
Old November 2nd, 2012, 04:38 AM
lelales lelales is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Mar 2008
Posts: 601 lelales User rank is Sergeant Major (2000 - 5000 Reputation Level)lelales User rank is Sergeant Major (2000 - 5000 Reputation Level)lelales User rank is Sergeant Major (2000 - 5000 Reputation Level)lelales User rank is Sergeant Major (2000 - 5000 Reputation Level)lelales User rank is Sergeant Major (2000 - 5000 Reputation Level)lelales User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 4 Days 40 m 3 sec
Reputation Power: 37
More info

Requinix, it's basically a login form. After the username and password are entered, the viewer clicks "login" and the query is run. Unfortunately, after the viewer clicks "login" the username and password fields are cleared and nothing happens on the page . . . the user isn't logged in and no errors are thrown.

You can see the page here

thanks for the help!

Reply With Quote
  #7  
Old November 2nd, 2012, 04:39 AM
ptr2void ptr2void is offline
I haz teh codez!
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Dec 2003
Posts: 2,476 ptr2void User rank is General 18th Grade (Above 100000 Reputation Level)ptr2void User rank is General 18th Grade (Above 100000 Reputation Level)ptr2void User rank is General 18th Grade (Above 100000 Reputation Level)ptr2void User rank is General 18th Grade (Above 100000 Reputation Level)ptr2void User rank is General 18th Grade (Above 100000 Reputation Level)ptr2void User rank is General 18th Grade (Above 100000 Reputation Level)ptr2void User rank is General 18th Grade (Above 100000 Reputation Level)ptr2void User rank is General 18th Grade (Above 100000 Reputation Level)ptr2void User rank is General 18th Grade (Above 100000 Reputation Level)ptr2void User rank is General 18th Grade (Above 100000 Reputation Level)ptr2void User rank is General 18th Grade (Above 100000 Reputation Level)ptr2void User rank is General 18th Grade (Above 100000 Reputation Level)ptr2void User rank is General 18th Grade (Above 100000 Reputation Level)ptr2void User rank is General 18th Grade (Above 100000 Reputation Level)ptr2void User rank is General 18th Grade (Above 100000 Reputation Level)ptr2void User rank is General 18th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 2 Days 5 h 44 m 36 sec
Reputation Power: 2194
Dollars to donuts you're correct. Bet register_globals is being used, which should not be and is off by default in PHP 5 as it's a security hole. As is mucb of the rest of this.
__________________
I ♥ ManiacDan & requinix

This is a sig, and not necessarily a comment on the OP:
Please don't be a help vampire!

Reply With Quote
  #8  
Old November 2nd, 2012, 04:58 AM
lelales lelales is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Mar 2008
Posts: 601 lelales User rank is Sergeant Major (2000 - 5000 Reputation Level)lelales User rank is Sergeant Major (2000 - 5000 Reputation Level)lelales User rank is Sergeant Major (2000 - 5000 Reputation Level)lelales User rank is Sergeant Major (2000 - 5000 Reputation Level)lelales User rank is Sergeant Major (2000 - 5000 Reputation Level)lelales User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 4 Days 40 m 3 sec
Reputation Power: 37
thanks ptr2void

OK, I adjusted the PHP5.ini file to this:
Code:
register_globals = On
and the code still doesn't work.

This isn't a high security CMS, as it's just a password protected video. I don't think the competition is going to try and break in to see the video.

Basically I just need this to work.

Can you think of anything else I might be overlooking?

thanks!

Last edited by lelales : November 2nd, 2012 at 05:03 AM. Reason: typo

Reply With Quote
  #9  
Old November 2nd, 2012, 05:07 AM
lelales lelales is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Mar 2008
Posts: 601 lelales User rank is Sergeant Major (2000 - 5000 Reputation Level)lelales User rank is Sergeant Major (2000 - 5000 Reputation Level)lelales User rank is Sergeant Major (2000 - 5000 Reputation Level)lelales User rank is Sergeant Major (2000 - 5000 Reputation Level)lelales User rank is Sergeant Major (2000 - 5000 Reputation Level)lelales User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 4 Days 40 m 3 sec
Reputation Power: 37
php_info.php

OK, I checked "php_info.php" on my server and "register_globals" is off even though I turned it on in the PHP5.ini file.

I'll have to call the host and see if I can turn it on.

thanks
-S

Reply With Quote
  #10  
Old November 2nd, 2012, 05:08 AM
Jacques1's Avatar
Jacques1 Jacques1 is offline
pollyanna
Click here for more information.
 
Join Date: Jul 2012
Location: Germany
Posts: 1,863 Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 1 Day 19 h 44 m 40 sec
Reputation Power: 813
Hi,

Quote:
Originally Posted by lelales
This isn't a high security CMS


Famous last words ...

This register_globals "feature" allows users to inject any variable into your code, which can have severe consequences. I mean, if some script kiddie manages to steal and delete your database and capture your server, I guess this is a problem.

So stop fumbling with register_globals and actually fix the problem. $HTTP_SESSION_VARS is also obsolete (I'm not sure if it even exists in concurrent PHP versions).

By the way, I'm absolutely certain that your host will not turn on register_globals.

Last edited by Jacques1 : November 2nd, 2012 at 05:10 AM.

Reply With Quote
  #11  
Old November 2nd, 2012, 05:15 AM
lelales lelales is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Mar 2008
Posts: 601 lelales User rank is Sergeant Major (2000 - 5000 Reputation Level)lelales User rank is Sergeant Major (2000 - 5000 Reputation Level)lelales User rank is Sergeant Major (2000 - 5000 Reputation Level)lelales User rank is Sergeant Major (2000 - 5000 Reputation Level)lelales User rank is Sergeant Major (2000 - 5000 Reputation Level)lelales User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 4 Days 40 m 3 sec
Reputation Power: 37
Hey Jacques1

Thanks for the reply. Can you advise me on how to go about this without Register_globals being on?

Also, what should I use instead of $HTTP_SESSION_VARS

Is there an easy fix, or do I have to code up this page from scratch?


-S

Reply With Quote
  #12  
Old November 2nd, 2012, 05:20 AM
Jacques1's Avatar
Jacques1 Jacques1 is offline
pollyanna
Click here for more information.
 
Join Date: Jul 2012
Location: Germany
Posts: 1,863 Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 1 Day 19 h 44 m 40 sec
Reputation Power: 813
Quote:
Originally Posted by lelales
Thanks for the reply. Can you advise me on how to go about this without Register_globals being on?


You have to actually fetch the values from $_POST and $_GET respectively.

For example, if you want $username to contain the user name sent with the form, you have to write
PHP Code:
 $username $_POST['username']; 

(assuming it's sent via POST)



Quote:
Originally Posted by lelales
Also, what should I use instead of $HTTP_SESSION_VARS


$_SESSION (see the PHP manual at php.net)



Quote:
Originally Posted by lelales
Is there an easy fix, or do I have to code up this page from scratch?


You won't have to rewrite the whole code, but it could still be a lot of work to find the deprecated features and functions and replace them.

But I see that the code is missing even basic security like escaping database values. So it will be a lot of work to get this website up and running.

I fear your genius friend wasn't that genius when writing the code.

Last edited by Jacques1 : November 2nd, 2012 at 05:25 AM.

Reply With Quote
  #13  
Old November 2nd, 2012, 05:37 AM
lelales lelales is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Mar 2008
Posts: 601 lelales User rank is Sergeant Major (2000 - 5000 Reputation Level)lelales User rank is Sergeant Major (2000 - 5000 Reputation Level)lelales User rank is Sergeant Major (2000 - 5000 Reputation Level)lelales User rank is Sergeant Major (2000 - 5000 Reputation Level)lelales User rank is Sergeant Major (2000 - 5000 Reputation Level)lelales User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 4 Days 40 m 3 sec
Reputation Power: 37
thanks everyone

It is now working with register_globals turned off.

Thanks so much for the help.

I'll look into better security in the future as this project is due on Monday.

thanks again!!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > Is this a PHP 5 issue

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap