Jump to content

deleting account


jimfog
 Share

Recommended Posts

I want to delete the account of a user using ajax-after clicking the corresponding button.

The question is if it is necessary that any data must be send in the server at all.

 

I do not know if ajax requests can be made without sending anything to the server

 

I am going to delete the account based on the e-mail of the user(which is also used as the session variable).

 

The php file will have code like this:

 session_start();require_once 'admin_db_code.php'; $sessionml=$_SESSION['valid_user'];  delete_account($sessionmail);

So far I have used ajax only when submitting forms but now deleting an account with it... is an unknown "territory" for me.

How I would do it?

Thanks

Link to comment
Share on other sites

An AJAX request doesn't have to send anything. You can see some of the examples in the W3Schools tutorial that simply request data. An AJAX request will open the file as if it had been opened in the browser, there's no difference from the server side.

 

Just for security, I wouldn't make it so easy to delete the account, I would request the user for his password, at least.

Link to comment
Share on other sites

An AJAX request doesn't have to send anything. You can see some of the examples in the W3Schools tutorial that simply request data. An AJAX request will open the file as if it had been opened in the browser, there's no difference from the server side.

 

Just for security, I wouldn't make it so easy to delete the account, I would request the user for his password, at least.

Υes, you are right...I am going to request a password.

Link to comment
Share on other sites

since we are talking here about a simple request.

Is it necessary to use POST/GET methods at all?

Link to comment
Share on other sites

What other method would you use? All requests have to use some method.

 

http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Request_methods

thanks...

Link to comment
Share on other sites

ok...I have more 2 questions regarding the deletion of a user's account.

 

Is it OK to use ajax-anything wrong with that?

When an account is deleted what other actions must be done also(session, cookies etc)?

Link to comment
Share on other sites

How do you currently log them out?

I unset the session and redirect them to the frontpage-all done with server side code.

But someone when logs out is different than account deletion,,,in the first case we do not have account deletion.

 

Are you suggesting anything?

Link to comment
Share on other sites

I unset the session and redirect them to the frontpage-all done with server side code.

But someone when logs out is different than account deletion,,,in the first case we do not have account deletion.

 

Are you suggesting anything?

 

So with account deletion you delete their record from the user table and then kill their session and direct them to the front page?

Link to comment
Share on other sites

 

So with account deletion you delete their record from the user table and then kill their session and direct them to the front page?

That what is I am considering, but I am not sure if it is the proper course of action or I must add something else to.

Link to comment
Share on other sites

I would think the only other question would be related to how your database is set up. You may want to retain them in the database in some way if that is necessary to retain the state of their past participation (forum messages etc) or you may want to purge them completely if they were a malicious user.

Link to comment
Share on other sites

 

 

That what is I am considering, but I am not sure if it is the proper course of action or I must add something else to.

That's a question for you to answer, you know your application. If you want to delete the user permanently and you store references to them in multiple tables, then make sure you remove all of the information. Or maybe you want the other information to stay there and just not be linked to any user account. Or maybe you want to move them to a deleted users table so that you can restore a deleted user. It's up to you, it's your application, you know how it works.

Link to comment
Share on other sites

That's a question for you to answer, you know your application. If you want to delete the user permanently and you store references to them in multiple tables, then make sure you remove all of the information. Or maybe you want the other information to stay there and just not be linked to any user account. Or maybe you want to move them to a deleted users table so that you can restore a deleted user. It's up to you, it's your application, you know how it works.

Yes you are right but I was not referring so much in the db part but in the session and redirection part

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...