473,788 Members | 2,807 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problems with my login

12 New Member
Hi, i don't know if anyone can help me. I'm really a novice to be honest. I have a site I'm working on and using some code I made with the help of a friend i set up a login system. It worked on the server we were using. But when i tried to adapt it to a different server for a website I needed this functionality for it doesn't seem to work.

Somewhere in the transition something has either been lost or not added. I'm sure I've cover all the bases. I know there will be more info from me but if anyone can think of any obvious reasons that would be great I can then start to tick them off the list!

I look forward to hearing from anyone!
Nov 9 '07 #1
19 1486
Atli
5,058 Recognized Expert Expert
Hi. Welcome to TSDN!

There are so many reasons why that could be happening I barely know where to start. It would help if you could post your code here, so we could see if we spot anything specific.

The first things I'd look for is any code that relies on register_global s or something that loads resources from or links to an absolute path ("http://localhost/page.php" rather than "/page.php").

But as I say, it's impossible to say unless we can have a look at your code.
Nov 9 '07 #2
twodelay
12 New Member
Ok bit of a mess but here is the login code. its in a separate document called account.php. I have then used an include_once within the page i want it to appear. if that makes sense. anyway see below:


Expand|Select|Wrap|Line Numbers
  1. <?
  2.  
  3. if ($_SESSION["userid"]) {
  4.     ?>
  5. <link href="../../css/rollovers.css" rel="stylesheet" type="text/css" />
  6. <link href="../../css/styles.css" rel="stylesheet" type="text/css" />
  7. <link href="../../css/stylestext.css" rel="stylesheet" type="text/css" />
  8.  
  9.     <div id="signup"><div id="blogspacer"></div>
  10.         <p class="bodyboldblue">Logged in</p>
  11.         <?=$loginerror?>
  12.         <p class="loginbody">You are currently logged in as <strong>
  13.         <?=$member["member_name"]?>
  14.         </strong></p>    
  15.         <p><a class="loginbody" href='<?=$_SERVER['PHP_SELF']?>?logout=true<?=($_GET["id"]) ? "&id=".$_GET["id"] : "";?>'>Click here to log out</a></p>
  16.     </div>
  17.     <div id="blogspacer"></div>
  18.     <?
  19. }
  20. else {
  21.     ?>
  22.     <div id="signup"><div id="blogspacer"></div>
  23.     <form action='<?=$_SERVER['PHP_SELF']?><?=($_GET["id"]) ? "?id=".$_GET["id"] : "";?>' method='POST'/>
  24.     <p class="bodyboldblue">Blog Login</p>
  25.     <p class="loginbody">Username <br /><input name='un' type='text' class="loginbody" size='20'/>
  26.       </p><p class="loginbody">Password <br /><input name='pw' type='password' class="loginbody" size='20'/>
  27.       </p><p><input type='submit' class="loginbody" value='Login'/></p>
  28.     </div>
  29.     <div id="blogspacer"></div>
  30.     <?
  31. }
  32.  
  33. ?>
  34.  
Nov 9 '07 #3
Atli
5,058 Recognized Expert Expert
Ahh ok.

Before you change anything, change the short-tags into real PHP tags.
Short-tags are disabled by default in PHP and you should avoid using them at all times. They are a little shorter, but honestly, their nothing but trouble.

That is:
Expand|Select|Wrap|Line Numbers
  1. # Change these tags:
  2. <? .. ?>
  3. <?=$var?>
  4.  
  5. # Into these tags:
  6. <?php ... ?>
  7. <?php echo $var; ?>
  8.  
Nov 9 '07 #4
twodelay
12 New Member
Ahh ok.

Before you change anything, change the short-tags into real PHP tags.
Short-tags are disabled by default in PHP and you should avoid using them at all times. They are a little shorter, but honestly, their nothing but trouble.

That is:
Expand|Select|Wrap|Line Numbers
  1. # Change these tags:
  2. <? .. ?>
  3. <?=$var?>
  4.  
  5. # Into these tags:
  6. <?php ... ?>
  7. <?php echo $var; ?>
  8.  

Cool, i will sort this and let you know when its done. Thanks for your help so far.... and thanks in anticipation of your help to come!
Nov 9 '07 #5
twodelay
12 New Member
Expand|Select|Wrap|Line Numbers
  1. <?php if ($_SESSION["userid"]) {?>
  2. <link href="../../css/rollovers.css" rel="stylesheet" type="text/css" />
  3. <link href="../../css/styles.css" rel="stylesheet" type="text/css" />
  4. <link href="../../css/stylestext.css" rel="stylesheet" type="text/css" />
  5.  
  6.     <div id="signup"><div id="blogspacer"></div>
  7.         <p class="bodyboldblue">Logged in</p>
  8.         <?php echo $loginerror?>
  9.         <p class="loginbody">You are currently logged in as <strong>
  10.         <?php echo $member["member_name"]?>
  11.         </strong></p>    
  12.         <p><a class="loginbody" href='<?php echo $_SERVER['PHP_SELF']?>?logout=true<?php echo ($_GET["id"]) ? "&id=".$_GET["id"] : "";?>'>Click here to log out</a></p>
  13.     </div>
  14.     <div id="blogspacer"></div>
  15.     <?php
  16. }
  17. else {
  18.     ?>
  19.     <div id="signup"><div id="blogspacer"></div>
  20.     <form action='<?php echo $_SERVER['PHP_SELF']?><?=($_GET["id"]) ? "?id=".$_GET["id"] : "";?>' method='POST'/>
  21.     <p class="bodyboldblue">Blog Login</p>
  22.     <p class="loginbody">Username <br /><input name='un' type='text' class="loginbody" size='20'/>
  23.       </p><p class="loginbody">Password <br /><input name='pw' type='password' class="loginbody" size='20'/>
  24.       </p><p><input type='submit' class="loginbody" value='Login'/></p>
  25.     </div>
  26.     <div id="blogspacer"></div>
  27.     <?php
  28. }
  29.  
  30. ?>
  31.  
Ok so i have changed the short tags. It still does nothing when i try to log in. What do you think the next step is?
Nov 12 '07 #6
Atli
5,058 Recognized Expert Expert
I can't see anything wrong with that particular code, except that you missed one short-tag in line 20.

There doesn't seem to be any code there to process the form data that is posted if the Session variable in line 1 is false, which I would guess is the code that actually logs the user in. Could the problem be there?
Nov 12 '07 #7
twodelay
12 New Member
I can't see anything wrong with that particular code, except that you missed one short-tag in line 20.

There doesn't seem to be any code there to process the form data that is posted if the Session variable in line 1 is false, which I would guess is the code that actually logs the user in. Could the problem be there?
Well from what you said in my limited knowledge I would have thought that that might be a problem, however, it is the same code as as i used before, which worked. Grr this is complicated. The thing that bugs me is that it seems as if its not even processing anything. When you submit illegal characters or incorrect login it doesnt come up with the error message that has been set up.

I will cross reference this with my old files and see if i can see anything in the code.
Nov 12 '07 #8
twodelay
12 New Member
Ok i have racked my brains and cant see or find anything that is different to the other version i did (that worked) other than stylesheets etc.

You mentioned:

There doesn't seem to be any code there to process the form data that is posted if the Session variable in line 1 is false, which I would guess is the code that actually logs the user in. Could the problem be there?
Could you suggest what changes i could make to correct this... so sorry as you can tell I'm very, very poor at this! thanks for your help.
Nov 12 '07 #9
Atli
5,058 Recognized Expert Expert
I could probably see if there are problems with the code, if I could see it :)
Just the part where you fetch the POST values and where you log the user in.

My first guess would be it has something to do with the register_global s directive, but there is really no way to tell unless I see the code.

Just out of curiosity, which version of PHP did this code work on? And which version are you trying to use it on now?

Could you create a new .php file with the following content, run it and find the value of the 'short_open_tag ' directive and the 'register_globa ls' directive?
Expand|Select|Wrap|Line Numbers
  1. <?php echo phpinfo(); ?>
  2.  
Nov 12 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1789
by: tarAnta | last post by:
We installed ez publish 3.1 on Linux Mandrake 9.1 We used graphic setup, following all instructions. Now we login as admin in http://localhost/ezpublish/index.php/admin/login but we see many strange problems: - if we go to set up-->content and try to edit a class or press "new class" button nothing changes! - if we go to address http://localhost/ezpublish/index.php/demo/login/ under header buttons we receive this error: Module not found...
0
1899
by: Ralf Hornbeck | last post by:
Hi, I have just uploaded an older PHP project I have written by myself up to my new webserver. On this server PHP is running in version 4.3.2 and this seems to result in some trouble, since the project worked out pretty fine some weeks ago under PHP 4.2.3 (I think). My suggestion is that it has to do sth. with sessionhandling, but I am not sure. I don't think that the DB connection is responsible for the problems and I
0
3511
by: Michael Fork | last post by:
Note: I pasted the code the attachments as plain text after the message (I wasn't able to post it with an attachment...) Attached are the XSL and XML files that I am having problems with. I am trying to extract the stock information after having downloaded the HTML and converted to XML (well-formed HTML) using XSL and XPATH and am unable. I am basing what I have done so far off of...
3
2851
by: headware | last post by:
I have an issue that I've been encountering in an ASP application I'm working on. Most of the application is written in ASP, but there is one page written in ASP.NET. The ASP.NET page needs to have access to the ASP Session data to run correctly. In order to achieve this I create my own HTTP request for a certain ASP page with the name of Session variable that I want is stored in the query string of the request. The requested ASP page...
6
1249
by: Andrew | last post by:
Hell-hohoho to all... Just begun working with asp.net linking to sqlServer 2000, had some problems with the (null) user, but previous posts have got me past that by storing an identity in the web.config file. However, I want to dyamically set the login info, from a prompted box. I'm aware of the security issues here, but I'll ignore that for now. The kb article I saw set the following info in the connection string of the sql...
2
1995
by: Gary Coutts | last post by:
Hi, I am have problems redirecting from a login page. The login page is simple, with just 2 textboxes and one button. On the button click the routine below is called: I am using: Visual Studio 2003 Version 7.1.3008 Framework 1.1 Version 1.1.4322 SP1 Windows XP Pro Version 2002 SP2
0
960
by: Sonnich | last post by:
Hi all! I seem to still have problems with MySQL. I wanted to create a new instance in order to run some tests of DB sizes. I want to create a new db, user etc... using teh command line client I removed the old instance, and created a new one. Could not login as root. Simply crashes. Service cannot start. Dont know why.
0
1326
by: kang jia | last post by:
hi i have small problems occurred in my login function, which i use Django to build, in my template which is login.html, the code is like the following: <html> <head> <title>Login</title>
3
1085
by: Barely Audible | last post by:
Running 10.2. Sudden problems with my suse box - when i try to start it up it ignores the auto login and presents me with the login page. Entering the usual login on that page results in a black screen, flash of things starting and then back to the login page. The root login works okay. Any clues would be gratefully appreciated!
5
1551
by: dipperdan | last post by:
Hi, I'm trying to use sessions to create a login system to administer a website - add new info to database,etc but i'm running into some problems. The first page login.php seems to work okay, it authenticates the user then takes them to the next page update_db.php but when i get to this page, it seems all the session data is lost :icon_conf login.php <?php session_start(); // we must never forget to start the session $errorMessage =...
0
9498
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10373
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10177
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10118
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8995
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5403
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5538
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3677
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2897
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.