Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 03-08-2007, 06:46 AM   #1 (permalink)
benrussell
Recruit
 
Join Date: Mar 2007
Posts: 4
benrussell is on a distinguished road
register and login with sessions

In Php articles, under the intermediate tab, SDE created a "login with sessions" page. I used it. It seems to work.
..BUT.. I need a register page now. Is there one hidden on here somewhere that I'm just not finding? Or is anyone able to supply one that fits with SDE's "Login with Sessions".

Thank-you very much!!!
Ben Russell
benrussell is offline   Reply With Quote
Old 03-08-2007, 08:05 AM   #2 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,693
redhead is on a distinguished road
The Login against two tables discusses it partly.. But it might not be a final made solution for you, altho it does give some input to how it can be done from post 18

Another thread which would be a good read, is the md5-hash password, it discusses the use of salt and md5 to hide password infos.
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote
Old 03-08-2007, 09:25 PM   #3 (permalink)
benrussell
Recruit
 
Join Date: Mar 2007
Posts: 4
benrussell is on a distinguished road
Let's turn this around. Perhaps you can help me with the real problem, because I'm not sure that a register/login is needed.

I have a PHP upload handler that works perfectly. It currently uploads files to...
$target_file_path = "c:\Server\upload\ " . $file_name;

I would really like it to upload files to...

$target_file_path = "c:\Server\upload\username\ " . $file_name;
or even
$target_file_path = "c:\Server\upload\username\event\ " . $file_name;

Is it possible to add some kind of pre-form to direct uploads before they take place without making someone register or login?
benrussell is offline   Reply With Quote
Old 03-09-2007, 06:31 AM   #4 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,693
redhead is on a distinguished road
If you dont want the uploader to login, then you can just create a few select boxes, which consist of the available directories, say one holding:
Code:
...
<select name="user">
<option value="John">John</option>
<option value="Karen">Karen</option>
<option value="Brian">Brian</option>
</select>
...
<select name="event">
<option value="Party">Party</option>
<option value="Relaxation">Relaxation</option>
<option value="Misc">Misc</option>
...
Then in your upload script you'd make it
PHP Code:
$target_file_path "c:\\Server\\upload\\" $_POST['user'] . "\\" $_POST['event'] . "\\" $file_name
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote
Old 03-09-2007, 06:25 PM   #5 (permalink)
benrussell
Recruit
 
Join Date: Mar 2007
Posts: 4
benrussell is on a distinguished road
unfortunately its not that simple

Unfortunately, it doesnt seem to be that simple. I use a java application called Jumploader to upload the files.

Here is my index page (which gives parameters for the java applet):
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Christian County Video</title>
<meta name="generator" content="tsWebEditor (tswebeditor.net.tc - www.tswebeditor.tk)" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor=#CCCCCC background="../img/welcome.jpg">


<center>

<applet name="jumpLoaderApplet"
						code="jmaster.jumploader.app.JumpLoaderApplet.class"
						archive="jumploader_z.jar"
						width="750"
						height="350"
						mayscript>

			<param name="gc_loggingLevel" value="DEBUG"/>

			<param name="uc_uploadUrl" value="/Jumploader/uploadHandler.php"/>
			<param name="uc_uploadThreadCount" value="1"/>
			<param name="uc_maxFiles" value="-1"/>
			<param name="uc_maxFileLength" value="-1"/>
			<param name="uc_maxLength" value="-1"/>
			<param name="uc_fileNamePattern" value=""/>
			<param name="uc_directoriesEnabled" value="true"/>
			<param name="uc_duplicateFileEnabled" value="false"/>
			<param name="uc_fileParameterName" value="file"/>
			<param name="uc_fileNamePolicy" value="name"/>
			<param name="uc_logServerResponse" value="true"/>
			<param name="uc_partitionLength" value="-1"/>

			<param name="vc_lookAndFeel" value="system"/>
			<param name="vc_localFilesViewEnabled" value="true"/>
			<param name="vc_addFilesActionEnabled" value="true"/>
			<param name="vc_logoEnabled" value="true"/>
			<param name="vc_logoUrl" value="http://youserver/yourfile.png"/>
			<param name="vc_fileTreeShowFileLength" value="true"/>
			<param name="vc_fileTreeUploadSplitLocationPercent" value="40"/>


			<param name="ac_fireUploaderFileAdded" value="false"/>
			<param name="ac_fireUploaderFileRemoved" value="false"/>
			<param name="ac_fireUploaderFileStatusChanged" value="false"/>
			<param name="ac_fireUploaderFilesReset" value="false"/>
			<param name="ac_fireUploaderStatusChanged" value="false"/>
</applet>


<?php

?>
</body>
</html>
And here is my upload handler.php file:
Code:
<?php
	//----------------------------------------------
	//	upload file handler script
	//----------------------------------------------

	//
	//	specify file parameter name
	$file_param_name = 'file';

	//
	//	retrieve uploaded file name
	$file_name = $_FILES[ $file_param_name ][ 'name' ];

	//
	//	retrieve uploaded file path (temporary stored by php engine)
	$source_file_path = $_FILES[ $file_param_name ][ 'tmp_name' ];

	//
	//	construct target file path (desired location of uploaded file) -
	//	here we put to the web server document root (i.e. '/home/wwwroot')
	//	using user supplied file name
	$target_file_path = "c:\upload\ " . $file_name;

	//
	//	move uploaded file
	echo "Moving file " . $source_file_path . " > " . $target_file_path . ": ";
	if( move_uploaded_file( $source_file_path, $target_file_path ) ) {
		echo "success";
	} else{
		echo "failure";
	}

	//
	//	below is trace of variables
?>
<html>
<body>
	<h1>GET content</h1>
	<pre><?print_r( $_GET );?></pre>
	<h1>POST content</h1>
	<pre><?print_r( $_POST );?></pre>
	<h1>FILES content</h1>
	<pre><?print_r( $_FILES );?></pre>
</body>
I've researched some to find a potential formula through sessions. I can upload files to a user directory (I think) by changing the upoad path in the uploadhandler to :
Code:
$target_file_path = "c:\upload\ " . $_SESSION['usuario'] . "/" . $file_name ;
And then putting the following in the login.php page:
Code:
session_start(); 
$_SESSION['usuario'] = $loginUsername;
But hen how do I post a blank username in the login.php?
benrussell is offline   Reply With Quote
Old 03-09-2007, 06:41 PM   #6 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,693
redhead is on a distinguished road
Why use some javaapplet, when you have PHP ??
You can accomplish upload aswell through PHP, read the PHP photo gallery as a brain teaser to get an idear, at some point we might have to turn that into an article..
As a further introduction to handling images through PHP, you can read the Upload View Images thread.
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote
Old 03-09-2007, 07:25 PM   #7 (permalink)
benrussell
Recruit
 
Join Date: Mar 2007
Posts: 4
benrussell is on a distinguished road
B, b, b, Buuuuut!

But I don't know php that well, and I have this free easy to use java applet that works so well!!!!

I do have a php page that does a multiple file upload. But I'm limited to browsing for one file at a time. The java applet will upload whole folders of files at a time. During one successful test I uploaded .4 gig of information. It's been pretty cool!

Ben
Official PHP newbie/hacker/wannabe
benrussell is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 11:31 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting