Jump to content

How to tell if randomly selected account is in use?


matthewst

Recommended Posts

I have an application that I need users to be logged into automatically without creating an id. I have setup a database with users names as user1, user2, user3, and so on, and a field called in_use. I can make php set the in_use field in the database to yes when the page is loaded and I can get php to select the first available username. I can't however get the database to reset the in_use field by itself (if the user closes the window insted of clicking log out).

 

Any ideas?

Link to comment
Share on other sites

lollipop (laugh out loud till I fin pop)

 

yeah, yeah ;)

 

The short story:

I'm using this goofy login procedure to get around waxpotato's registration and login.

 

So far I've added a timer to php and mysql

 

php updates a field in mysql every 5 min

in mysql if the field isn't updated for 6 min it then changes the in_use field to no

even with this it still only half works half the time

 

The long story:

I work at a hospital in Missouri. I assist special needs children with homework and other activites. One of the activites is computer time (which they all love). Most of the kids like to draw pictures on the computer and I thought using shipainter to upload and share their pictures would give them something to feel good about. The problem is I can't make it work.

 

 

The problem:

The kids will choose a picture to draw on(my face, their face, whatever) this "$picture" is then passed to the below file (shipainter.php) . When I click "upload" in shipainter I get this error "protocol doesn't support output SendE". I know I get that because with this simple script I don't have a database defined, or where to put the picture in the database. In the past I've built forms that upload to the database so I know I can do that much. What I don't know is how do I transition from shipainters upload button to php. I have know idea where to start. I can't use a ready made system (waxpotato) because it requires a registration and login. Most of these kids would have a very difficult time with that, and we get such high turnover I wouldn't be able to keep up with it.

 

In a nutshell: I need the kids to be able to click an icon on the desktop (shortcut to my local web server) and be taken to the picture selection page. No login or confirmation of identity.

 

Example:

A kid chooses a background image from image_select.php and is automaticly redirected to shipainter //already built and functioning

The image is loaded into shipainter via the $picture variable //already functioning

The kid does some drawing and clicks submit

//normaly this is where I would have a form submit to a handler page ///////if ($action == "Submit"){then do some stuff}

//but shipainter doesn't work like that. This is where I need the help.

The image is uploaded to the database via a handler page //I'll give it a name based on the timestamp

Kiids are then redirected to a gallery page with all the images displayed //I can build this without a problem

 

I don't need the script written for me I just need a push in the right direction. Thank you for any help you can provide.

 

<html>
<head>
<title>Shi-Painter</title>
<script language="javascript" type="text/javascript" src="sp.js"></script>
</head>
<body>
<applet code="c.ShiPainter.class" name="paintbbs" archive="spainter_all.jar,res/normal.zip" WIDTH="100%" height="90%" MAYSCRIPT>
<param name="image_width" value="1100" />
<param name="image_height" value="800" />
<param name="image_canvas" value="picture.jpg" />

<param name="dir_resource" value="./res/" />
<param name="tt.zip" value="./res/tt.zip" />
<param name="res.zip" value="./res/res_normal.zip" />
<param name="tools" value="normal" />
<param name="layer_count" value="3" />
<param name="quality" value="1" />

<param name="undo_in_mg" value="15" />
<param name="undo" value="30" />
<param name="MAYSCRIPT" value="true" />
<param name="scriptable" value="true" />


<param name="color_text" value="0" />
<param name="color_bk" value="#FFFF0" />
<param name="color_bk2" value="#FF00FF" />
<param name="color_icon" value="#0FFFF" />
<param name="color_frame" value="0xff" />

<param name="color_iconselect" value="#112233" />
<param name="color_bar" value="0" />
<param name="color_bar_hl" value="#665544" />
<param name="color_bar_shadow" value="#778899" /> 

<param name="tool_color_bk" value="#aabbcc" />
<param name="tool_color_button" value="#ddeeff" />
<param name="tool_color_button_hl" value="#9900ff" />
<param name="tool_color_button_dk" value="#ff0099" />

<param name="tool_color_button2" value="#ffffff" />
<param name="tool_color_text" value="0" />
<param name="tool_color_bar" value="#00ff00" />
<param name="tool_color_frame" value="#ff0000" />



<param name=pro_menu_color_text value="#FFFFFF" />
<param name=pro_menu_color_off value="#222233" />
<param name=pro_menu_color_off_hl value="#333344" />
<param name=pro_menu_color_off_dk value="0" />
<param name=pro_menu_color_on value="#ff0000" />
<param name=pro_menu_color_on_hl value="#ff8888" />
<param name=pro_menu_color_on_dk value="#660000" />

<param name=bar_color_bk value="#ffffff" />
<param name=bar_color_frame value="#ffffff" />
<param name=bar_color_off value="#ffffff" />
<param name=bar_color_off_hl value="#ffffff" />
<param name=bar_color_off_dk value="#ffffff" />
<param name=bar_color_on value="#777777" />
<param name=bar_color_on_hl value="#ffffff" />
<param name=bar_color_on_dk value="#ffffff" />
<param name=bar_color_text value="0" />

<!--ƒEƒCƒ“ƒhƒEŠÖŒW‚ÌÝ’è-->
<param name="window_color_text" value="#ff0000" />
<param name="window_color_frame" value="#ffff00" />
<param name="window_color_bk" value="#000000" />
<param name="window_color_bar" value="#777777" />
<param name="window_color_bar_hl" value="#888888" />
<param name="window_color_bar_text" value="#000000" />

<!--Šm”FƒEƒCƒ“ƒhƒE‚ÌÝ’è-->
<param name="dlg_color_bk" value="#ccccff" />
<param name="dlg_color_text" value="0" />

<!--ƒAƒvƒŒƒbƒg‚Ì”wŒi‚ÌÝ’è-->
<param name=color_bk value="#ccccff" />
<param name=color_bk2 value="#f0f0f0" />

<!--ƒŒƒCƒ„[‚̃[ƒ^[ƒJƒ‰[‚ÌÝ’è-->
<param name=l_m_color value="#ffffff" />
<param name=l_m_color_text value="#0000ff" />
</applet>



</body>

<script language="javascript">
<!--
document.write('<form name="a"><input type="button" name="b" value="bn.gif" onClick="sAddImage(\'bn.gif\',2,100,10);"></form>');
//-->
</script>
</html>

 

Lets say my database is named database and the pic field is named pics.

I need this(basiclly):

 

include ('dbconn.php');

If (submit) {upload $pic to pics;

redir to gallery.php;}

 

I know uploading pictures is a little different. Here is a snippet of code I've used in the past for image uploading:

$path= "$root_folder_img/".$HTTP_POST_FILES['upload_image]['name'];

if($upload_image !=none)

{

if(copy($HTTP_POST_FILES['upload_image']['tmp_name'], $path))

{

echo "Successful<BR>";}}

 

 

How do I get ahold of "upload_image" from shipainter? Do I just change upload_image to shi-painter or something like that?

Link to comment
Share on other sites

If the server isn't allowing sending (odds are a hospital wouldn't for obvious reasons) an idea is to create a c++ program that would be a link on the desktop, you select an image and then it ftps it off to your web server.  Then on your server you have a cron job run every 10-15 minuites that checks that destination folder and takes all files in their and moves them to where they need to be.  It would be simple to do the cron end of it, but the c++ is something I have no clue how to do, but it can be done very easily if you know c++ and the ftp backend to it (which I don't) so I can't help you.  I never made it past C, because php was just so amusing.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.