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!
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.
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: -
<?
-
-
if ($_SESSION["userid"]) {
-
?>
-
<link href="../../css/rollovers.css" rel="stylesheet" type="text/css" />
-
<link href="../../css/styles.css" rel="stylesheet" type="text/css" />
-
<link href="../../css/stylestext.css" rel="stylesheet" type="text/css" />
-
-
<div id="signup"><div id="blogspacer"></div>
-
<p class="bodyboldblue">Logged in</p>
-
<?=$loginerror?>
-
<p class="loginbody">You are currently logged in as <strong>
-
<?=$member["member_name"]?>
-
</strong></p>
-
<p><a class="loginbody" href='<?=$_SERVER['PHP_SELF']?>?logout=true<?=($_GET["id"]) ? "&id=".$_GET["id"] : "";?>'>Click here to log out</a></p>
-
</div>
-
<div id="blogspacer"></div>
-
<?
-
}
-
else {
-
?>
-
<div id="signup"><div id="blogspacer"></div>
-
<form action='<?=$_SERVER['PHP_SELF']?><?=($_GET["id"]) ? "?id=".$_GET["id"] : "";?>' method='POST'/>
-
<p class="bodyboldblue">Blog Login</p>
-
<p class="loginbody">Username <br /><input name='un' type='text' class="loginbody" size='20'/>
-
</p><p class="loginbody">Password <br /><input name='pw' type='password' class="loginbody" size='20'/>
-
</p><p><input type='submit' class="loginbody" value='Login'/></p>
-
</div>
-
<div id="blogspacer"></div>
-
<?
-
}
-
-
?>
-
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: -
# Change these tags:
-
<? .. ?>
-
<?=$var?>
-
-
# Into these tags:
-
<?php ... ?>
-
<?php echo $var; ?>
-
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: -
# Change these tags:
-
<? .. ?>
-
<?=$var?>
-
-
# Into these tags:
-
<?php ... ?>
-
<?php echo $var; ?>
-
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!
-
<?php if ($_SESSION["userid"]) {?>
-
<link href="../../css/rollovers.css" rel="stylesheet" type="text/css" />
-
<link href="../../css/styles.css" rel="stylesheet" type="text/css" />
-
<link href="../../css/stylestext.css" rel="stylesheet" type="text/css" />
-
-
<div id="signup"><div id="blogspacer"></div>
-
<p class="bodyboldblue">Logged in</p>
-
<?php echo $loginerror?>
-
<p class="loginbody">You are currently logged in as <strong>
-
<?php echo $member["member_name"]?>
-
</strong></p>
-
<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>
-
</div>
-
<div id="blogspacer"></div>
-
<?php
-
}
-
else {
-
?>
-
<div id="signup"><div id="blogspacer"></div>
-
<form action='<?php echo $_SERVER['PHP_SELF']?><?=($_GET["id"]) ? "?id=".$_GET["id"] : "";?>' method='POST'/>
-
<p class="bodyboldblue">Blog Login</p>
-
<p class="loginbody">Username <br /><input name='un' type='text' class="loginbody" size='20'/>
-
</p><p class="loginbody">Password <br /><input name='pw' type='password' class="loginbody" size='20'/>
-
</p><p><input type='submit' class="loginbody" value='Login'/></p>
-
</div>
-
<div id="blogspacer"></div>
-
<?php
-
}
-
-
?>
-
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?
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?
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.
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.
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? Sign in to post your reply or Sign up for a free account.
Similar topics |
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...
|
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
|
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...
|
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...
|
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...
| |
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
|
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.
|
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>
|
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!
|
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 =...
|
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,...
| |
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...
|
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...
|
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,...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |