![]() |
| ||
| how to pass one script to another using php,mysqldatabase Hi.. I am new in php +ajax.....Now i am doing project in php+ajax+linux environment...i create a login page using php,ajax,mysql,, i have mysql tables are. register,slideshow,,,,,In register table having following field... 1.uid (autoincrement)2.first (firstname)3.last(surname)4.user(username),5.pass(password) In slide show table having following field,,, 1.uid 2.pid(presentation id,autoincrment) 3.slideno 4.description 5.location(this is what image file is store that particular location).. my login programs are.. //login.html <html>//login.php <?php The above program is successfully logged .. and i fetch uid in $insert variable...This is my quetion... uid,pid,slideno,description,location will be stored automaticallyin slideshow table..while i upload file.... my upload proram is given below... //upload.html file <html> //upload php file <?php please send me the correct coding .. Edit/Delete Message |
| ||
| Re: how to pass one script to another using php,mysqldatabase Your file upload looks ok. You just have to let your File Upload page know that the upload was successful or not. To do this, in your PHP that handles the file upload, put in a javascript function that returns the status of the upload. ] eg: <script> Notice that the function is a method of "top". This references the top window, or the window that contains the Iframe you have this code in. In your File upload page, put in a handler for the javascript function. Eg: function my_callback(status) { |
| ||
| Re: how to pass one script to another using php,mysqldatabase ya.. uploaded file is successful stored in database when i newly file upload..my problem is how to pass my uid from register table to slideshow table..using php, ajax.. please help me.. |
| ||
| Re: how to pass one script to another using php,mysqldatabase Quote:
The UID should be in the current users session. Don't pass it via AJAX. Eg: When you logged the user in, create a session for the user. You can use the built in PHP session management $_SESSION. Or you can create your own session management by entering each login into a session table in the database. When a user uploads something, check a cookie sent by the user for the session ID. You can verify this session exists by looking up your session db table, or $_SESSION variable if you use that... |
| ||
| Re: how to pass one script to another using php,mysqldatabase i dont know about session..In my login program where i insert a session....help me...and reply me madam.. |
| ||
| Re: how to pass one script to another using php,mysqldatabase Simple example of a session: When a user logs in successfully. you do: $sessid = sha1(rand(1, 1000000000).time()); // create a random id for the users session Now when you want to know if the user is logged in, just check the cookie "sess_id" and if its set, get its value an make sure it is an existing session id by checking it against $_SESSION. $sessid = $_COOKIE['sess_id']; Off Topic: In your authentication script you have: $query= "select * from register"; then you iterate through each returned db row and check user and password. This is not very efficient. Imagine if you have 100 000 users. You'd have 100 * (bytes per row) Kb sent to your PHP script from the DB each time you authenticate someone. Then PHP has to parse that SQL response into PHP objects. The "better" way of doing it is: $query= "select * from register where username = '".mysql_escape_string($username)."' AND password = '".mysql_escape_string($password)."' LIMIT 1"; This way you only get the row you want from the db. Also, you may want to save the passwords as one way encrypted hashes. PHP implements md5, sha hashes natively. You can use this to "encrypt" the passwords and increase user security. eg: $secret = '32d0we9*03ojsdfp98323;afp%^9;3f;hd'; // its good to keep a secret When you need to verify a password hash the password given by the user, and compare it with the one in the db. $user = $_GET['user']; This way even if someone managed to hack into your database, they still will have a hard time decrypting the passwords in the db. |
| ||
| Re: how to pass one script to another using php,mysqldatabase ok..let i try ..if any problem i will reply soon.. |
| All times are GMT -4. The time now is 3:01 am. |
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC