Need help with Javascript
Moderator: General Moderators
Need help with Javascript
Ok, the, I believe that the PHP portion of the code is done.
But there are some things that I believe cannot be done by PHP, some 'realtime' things.
For instance, on my site, a current password is required before any changes can be made, including pictures, music, so on....
So, by the time the user has uploaded an entire song, they find out they didn't type their password.
So, this would have to be coded in javascript... right?
But there are some things that I believe cannot be done by PHP, some 'realtime' things.
For instance, on my site, a current password is required before any changes can be made, including pictures, music, so on....
So, by the time the user has uploaded an entire song, they find out they didn't type their password.
So, this would have to be coded in javascript... right?
- CoderGoblin
- DevNet Resident
- Posts: 1425
- Joined: Tue Mar 16, 2004 10:03 am
- Location: Aachen, Germany
Only PHP...
At it's simplest 3 scripts, Login.php,Index_list.php,Download.php
Login.php - Login form, when sucessful set userid (whatever) in a session. If no previous information is stored go to Index_list.php otherwise use the stored information to go back to where you came from.
download.php - Checks if userid is set, if not store information (again session) and go to Login.php
This means PHP is used at all times. Using javascript to log in could be a security issue has the javascript would be examined.
At it's simplest 3 scripts, Login.php,Index_list.php,Download.php
Login.php - Login form, when sucessful set userid (whatever) in a session. If no previous information is stored go to Index_list.php otherwise use the stored information to go back to where you came from.
download.php - Checks if userid is set, if not store information (again session) and go to Login.php
This means PHP is used at all times. Using javascript to log in could be a security issue has the javascript would be examined.
I'll reword it...
You have an account...
You have a form that you post an MP3's path....
You have an upload speed of 10Kbps....
It takes 10 minutes to upload the MP3...
Aww damn... didn't type the password, have to do it all over again...
Anyway I can check for a password before the form is processed?
You have an account...
You have a form that you post an MP3's path....
You have an upload speed of 10Kbps....
It takes 10 minutes to upload the MP3...
Aww damn... didn't type the password, have to do it all over again...
Anyway I can check for a password before the form is processed?
-
malcolmboston
- DevNet Resident
- Posts: 1826
- Joined: Tue Nov 18, 2003 1:09 pm
- Location: Middlesbrough, UK
personally i would do
Code: Select all
if (isset(($_SESSION['username'])) {
// set at login time
// show form
} else {
// the user has not logged in
// auto-redirect
header ("Location: login.php);
}Again.... the user *has* to be logged in to even see this pagemalcolmboston wrote:personally i would do
Code: Select all
if (!isset(($_SESSION['username'])) { // set at login time // show form } else { // the user has not logged in // auto-redirect // header ("Location: login.php); }