Hi,
I'm a newbie in php/mysql programming,rea lly am.
I'm working on a web-site that allows registration and posterior
logging in. Already registered user logs in with valid username and
password. Username and password are validated against a MySQL database
of personal data that contains these fields among others.
This is done by means of a PHP script that redirects to a "page2.html "
(if user and password non-existent) OR it redirects to a
"page3.html ",if username and password exist and match in the database.
Following is part of the code:
<?php
function RedirectURL($ur l)
{ // This calls javascript
$redir = "<script language=\"java script\">locati on.href=\"$url\ "</script>\n";
return $redir;
}
?> // got this function from the groups. thanks.
<?php
..
..
..
$query = "SELECT password FROM all_pers_data WHERE username =
'$loginID' ";
$result = mysql_query($qu ery) or die
(RedirectURL('h ttp://xxx.xxx.xxx.xxx :XXXX/ / /page2.html'));
$numentries = mysql_numrows($ result); //Numero de filas
returned. mysql_close($li nk);
$correct_userna me = $loginID;
$correct_passwo rd = mysql_result($r esult,0,"passwo rd"); //assumming
there is only one match...
if (strcasecmp($co rrect_username, $loginID) ||
strcasecmp($cor rect_password,$ loginPW) ) {
die(RedirectURL ('http://xxx.xxx.xxx.xxx :XXXX/ / /page2.html'));
//loginID or password that do not match
}
else {
die(RedirectURL ('http://xxx.xxx.xxx.xxx :XXXX/ /
/page3.html'));//ASSERT, print out info in .html page.
}
..
..
..
?>
My question is: how can I transfer the variable "$result" from my PHP
to the .html pages, so that I'm able to print out the info for the
existent user through page3.html. In other words, i would like to
re-use "$result" from the php/mysql query; this, in order to display
information about the successfully logged in user.
Any help or suggestions i will appreciate a lot. Thanks.
Ivan 4 6123 da******@hotmai l.com wrote: My question is: how can I transfer the variable "$result" from my PHP to the .html pages, so that I'm able to print out the info for the existent user through page3.html. In other words, i would like to re-use "$result" from the php/mysql query; this, in order to display information about the successfully logged in user.
Any help or suggestions i will appreciate a lot. Thanks.
<url: http://jibbering.com/faq/#FAQ4_18 />
--
Grant Wagner <gw*****@agrico reunited.com>
comp.lang.javas cript FAQ - http://jibbering.com/faq
["Followup-To:" header set to comp.lang.php.] da******@hotmai l.com wrote:
[snip] My question is: how can I transfer the variable "$result" from my PHP to the .html pages, so that I'm able to print out the info for the existent user through page3.html. In other words, i would like to re-use "$result" from the php/mysql query; this, in order to display information about the successfully logged in user.
Any help or suggestions i will appreciate a lot. Thanks.
Use session variables: http://www.php.net/session
When you know the $result save it in a session variable
$_SESSION['SQLResult'] = $result;
and, afterwards, when you need the same result use the value saved in
the session variable
echo 'Saved result is: ', $_SESSION['SQLResult'];
Don't forget to start the session support in *every* page that uses the
$_SESSION array
--
USENET would be a better place if everybody read: | to mail me: simply | http://www.catb.org/~esr/faqs/smart-questions.html | "reply" to this post, | http://www.netmeister.org/news/learn2quote2.html | *NO* MIME, plain text | http://www.expita.com/nomime.html | and *NO* attachments. |
.oO(da******@ho tmail.com) function RedirectURL($ur l) { // This calls javascript $redir = "<script language=\"java script\">locati on.href=\"$url\ "</script>\n"; return $redir; }
header("Locatio n: $url"); http://www.php.net/header
Micha
I noticed that Message-ID:
<sl************ *******@ID-203069.user.uni-berlin.de> from Pedro Graca
contained the following: My question is: how can I transfer the variable "$result" from my PHP to the .html pages, so that I'm able to print out the info for the existent user through page3.html. In other words, i would like to re-use "$result" from the php/mysql query; this, in order to display information about the successfully logged in user.
Any help or suggestions i will appreciate a lot. Thanks.
Use session variables: http://www.php.net/session
But if the pages need to have a .php extension.
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: dawnunder |
last post by:
eg.
Someone fills out 3 fields. (There will be more but this is just to
give you an idea)
1. Country?
2. State?
3. City
I want this script to generate a web page and list the people by
|
by: Joe |
last post by:
I am trying to write a Perlscript to be used with some HTML pages. Here is
how it works:
1.. The first HTML page has a form which requests for user input. Then it
passes the QUERY_STRING to a Perl script.
2.. The Perl script will then validate the data. If input validation
fails, it returns to the previous screen and asks the user to retry. If the
validation passes, it display the user input and asks for confirmation.
|
by: JA |
last post by:
I have this little tell-a-friend script that will send out a link back to
the site. I want to put a link on my product pages that will go to the
script, and have the script display the product name, and have the product
name in the email that goes out, along with a link back to the product page,
instead of just to the general site, and then have the Thank You page
include a link back to the product.
I put it up as a project on a...
|
by: StephenMcC |
last post by:
Hi All,
Got a quick query in relation to the Server.Transfer method available in IIS
5+/ASP. I've got an issue where I want to take a portion of an online app and
extract this out into a web site on its own, so I will end up having two web
sites. This planned to aid problems we've been having with performance, as if
the portion (which is an app in its own right) has problems we then have to
restart the whole site and so bring everything...
|
by: lawrence |
last post by:
I'm learning Javascript. I downloaded a script for study. Please tell
me how the variable "loop" can have scope in the first function when
it is altered in the second function? It is not defined in global
space, therefore it is not a global variable, yes? Even if it was
global, how would it get from one function to another? In PHP
variables are copied by value. Are they copied by reference in
Javascript?
<SCRIPT LANGUAGE="JavaScript">
| |
by: danubian |
last post by:
Hi,
I'm a newbie in php/mysql programming,really am.
I'm working on a web-site that allows registration and posterior
logging in. Already registered user logs in with valid username and
password. Username and password are validated against a MySQL database
of personal data that contains these fields among others.
This is done by means of a PHP script that redirects to a "page2.html"
(if user and password non-existent) OR it redirects to...
|
by: Nedu N |
last post by:
Hi All,
I am facing a typical problem in my .NET application with the pop-up script
messages. The thing is that its working fine when i run on my development
machine but not running in expected manner when i move it to Prod
environment. Please have a look at the following code snippet...
//Page name - Add.aspx
private void Page_Load(object sender, System.EventArgs e)
|
by: p3t3r |
last post by:
I am using .NET2 and have a number of aspx pages. On each page is a
LinkButton that performs a server.transfer() to another page.
If we use page names A,B,C,D,E as an example. I start on page A and do a
server.transfer to page B. The address bar still shows page A (which is what
I want). Page B then does a server.transfer to page C. Now the address bar
shows the URL for page B (not C and not A which is what I want). Every new...
|
by: quirk |
last post by:
I am trying to write a script where a page is populated with some maths questions, user answers them (it's timed but I've left this bit out), gets results on same page and ajax takes their score, sends it to php script which updates sql. Make sense so far?!!
The problem I have is getting their score out of javascript and into ajax and therefore into the sql record table. I have no problem sending php variables to ajax, just the javascript...
|
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: 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: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
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...
| |