Jump to content

jimfog

Members
  • Posts

    1,803
  • Joined

  • Last visited

Posts posted by jimfog

  1. I don't know the context of your application, but when I'm working with user accounts I usually have the user ID in a variable. If you don't already have that, then get it from the database.
    Ok...here we are. I am at a point where I have to implement in practice what is said above.Here is the situation,1 table named credentials(sorry for repeating myself here but I do it in order to illustrate the problem as good as possible), 2 users in it, with crID of 1 and 2 respectively(both of these are end users and and a table is kept named end_users where other relevant data to them are kept) And now a business user comes to register which means 2 new records are created, one in the credentials table with crID of 3 and one new record in the business users table where the crID is the foreign key referencing the crID in the credentials table. That means the crID in the business users table must take the value of 3. How am I going to achieve that? I thought this and tell me if it sounds OK. AFTER the record is created in the credentials table, pick the crID corresponding to the e-mail provided by the specific user and put it n the business user table. What do you think?
  2. Whether or not you allow multiple accounts really depends on the requirements of your application. That's a question for you to answer based on the specific requirements of your application, it's not a generic theoretical question. Our application has an option to allow multiple users to register with the same email address for example, some of our clients wanted that and others didn't based on their own requirements. The email address isn't a unique field in the users table though. If you have a unique field then obviously you can only have 1 record with any particular value in that field. We require usernames to be unique since that is what people log in with, so it wouldn't make sense for multiple people to have the same username. The system wouldn't know which of those users is trying to log in.
    Well, you are right...it depends on the application. But since is the first big app I am writing I am not certain about the path I should take.The site will have business users which MUST give their name. As such I am asking name, last name, e-mail and password and they will be required to login with the e-mail and the password(of course).I do not want to ask for username since they will be giving these 4 above. Do you have to suggest a better alternative than the above-you have more experience than me. For the regular users I just ask username, e-mail and password
  3. input.service {//your code here}

    without ending 's'

    input[type="text"] {}

    targets all inputs of type text. or by using attribute selector try

    input[name="service"] {}

    Unless you are targetting this somewhere where the selector uses a ID reference '#myform input' for example, where it will have a higher precedence over anything without a ID reference, these should work.

    The above did not work but you where right that there was an ID reference with higher precedence-the div that surrounds the form. I used that instead- #xxxx input.service- and now is OK. I do not understand though why this happens. I do not understand how this "precedence" thing works.
  4. What you suggest is interesting. I had no idea it could be done in the way you propose.I will do it and post again if I find difficulty since this the first time I will do such thing.

  5. I really did not know in which forum to write about this topic but since it is something that has to do with PHP coding anyway I decided to do it here. Suppose an already registered user comes to the site to register for a second time(duplicate entry in the Db). Should I check the dB for that?Should I let him register for the second time? My answer is Yes to the first question and No to the second one. What is your opinion about the matter?

  6. can you show us the code you tried? what styles? what did the markup look like? you should always provide code or a link, ideally.
    I did not include code cause I though it was not needed.Anyway...no problem:
    <input class="service" size="40" placeholder="Service" type="text" name="service1">

    The above is an input field, like others found in the same form.I want to style the above separately than the othersHow am I going to do it?Using input[type=text] will target all the input elements. I tried also using .service{}(that is why I have added a class there) but it does not work. I hope now everything is OK

  7. I have a form with various input fields, all of them are set to type=text. In one of them I have also set a class=service. I want to style the one above differently than the other inputs of the form.I have tried these two below with no result: .service{} input[class=service]{} What do you suggest?

  8. Ok I will do it manually...Does that mean using a select a statement to grab the primary key from the credentials table(which is the foreign key in the second table). Is this the logic?If yes, I suppose-among others- that the foreign key in the second table should NOT be set to auto increment

  9. Sure, why not? It can be the primary keys for the other tables too, you wouldn't need multiple records per user I assume. If it's a 1-to-1 relationship then make it the primary key in every table.
    Ok I have 1 rather important question which has to do with the way foreign keys works.AS I said I have 2 tables, the one is credentials(username, password) and the other table holds info such as address, phone etc...of the userwho is stored in the credentials table. Suppose the second table is filled at a later time(this table holds the foreign key from the credentials table)----- how am I going to fill the foreign key column.AM i going to use a SELECT statement to take the primary key from the credentials table(which is the foreign key in the second table) and put it in the second table? I thought that InnoDB automatically updates foreign keys in tables where there is one.I hope you understand what I am talking about-if not I will try to clarify further.
  10. That seems backwards, it seems like the primary key in the credentials table should be a foreign key in the other 2.
    After some thought...I concluded that what you propose is the best
    The other 2 can even use the foreign key as their primary keys.
    If for example crId is the primary key in the credentials table.Are you suggesting that crID will be used as the foreign key in the other 2 tables-with the same exact name?
  11. I have 3 tables:Business_usersEnd_UserCredentials The credentials table will hold the username/password of the end users and the business users, whose other details(address, phone...etc) will be kept in the separate corresponding tables. Here is to what schema I have concluded-and tell me please what you think about it: The primary keys of business users and end users tables(businesuser_Id/enduser_id) will appear as foreign keys in the credentials table. That said, the credentials table will have 4 columns:crID(primary key)usernamepasswordbusinessuser_idenduser_id I just want to know if I am implementing correctly the foreign key logic here.

  12. how am i going to understand if I use persistent connections or not.Yes I am talking for PHP. You are saying when the script ends.The registration code "resides" in a function-I do not know if this is important, I am just mentioning it.

  13. Do you think that whenever I open a db connection I should close it also when I am done with the queries to be performed? Or it depends? Currently I am just making code where queries put user credentials in the db.I am referring in an occasion such as the above.

  14. Furthermore your explanation of sanitization/validation is messy. You are saying essentially that sanitization is the same with validation:Since-according to you-they both check for unwanted characters. Anyway...I found some resources in the web about these two and it is clear now to me. About escaping....I have understood what is all about.

  15. A hosting account is you renting both a platform and infrastructure, for example, where you develop the software. It's not really a new concept, it's just a marketing term that people who run cloud computing services and things use to describe their product.
    Probably...nowadays, PaaS and IaaS has evolved to something more advanced than just a hosting functionality...and as such has gained moreattention. See http://www.heroku.com/ for example. I am not sure...
  16. Yes...what are you saying makes sense(despite the fact in the beginning I was skeptic about it).This a lot of code for going back and forth between different files.

  17. No it does not work-I am showing the code once more(part of it)-the code you suggested and I am doing it to be sure that this is what you gave me.:

    if	    (isset($_GET['bizuser'])==true)		 {?>		   <a href="http://localhost/Appointments/Frontend/register_form.php?hairstyle">κομμωτήρια<a/><br>		   <a href="http://localhost/Appointments/Frontend/register_form.php?medical">ιατρικες υπηρεσίες</a><br>		   <a href="http://localhost/Appointments/Frontend/register_form.php?petgrooming">pet grooming</a><br>		   <a href="http://localhost/Appointments/Frontend/register_form.php?salonspa">salon spa</a>			   <?php		    if(isset($_GET['hairstyle']))			   {echo 'hi'; ?>

    Is this the code you gave me?

  18. I have a logic error in my code and I am having difficulty finding it.It has to do with two If statements, one inside another:

      if(isset($_GET['enduser'])==true)	  {?><div id="enduserform">   	 <form  action="register_form.php" method="post">		    <label class="label" for="username/e-mail">*</label><input name="username/e-mail"  placeholder="Username/e-mail" type="text" size="40" /><br>    <label class="label" for="password">*</label><input name="password"  placeholder="Κωδικός" type="text" size="40" /><br>    <label class="label" for="password2">*</label><input name="password2"  placeholder="Ξαναγράψε τον κωδικό...για την δική σου ασφάλεια" type="text" size="40" /><br>    <p class="info">Να είναι πάνω από 6 χαρακτήρες</p>    <input name="submitenduser" type="submit" />    <p class="required">Όλα τα πεδία απαιτούνται</p>    <p> το παραπάνω μήνυμα πρέπει να το φτιάξω να φαίνεται μόνο όταν ο χρήστης πατά το sumbit button, όπως	 στο facebook δηλαδή</p>   	   </form>			  </div>		 <?php  }      if(isset($_GET['enduser'])==true)      {?><div id="enduserform">         <form  action="register_form.php" method="post">             <label class="label" for="username/e-mail">*</label><input name="username/e-mail"  placeholder="Username/e-mail" type="text" size="40" /><br>    <label class="label" for="password">*</label><input name="password"  placeholder="Κωδικός" type="text" size="40" /><br>    <label class="label" for="password2">*</label><input name="password2"  placeholder="Ξαναγράψε τον κωδικό...για την δική σου ασφάλεια" type="text" size="40" /><br>    <p class="info">Να είναι πάνω από 6 χαρακτήρες</p>    <input name="submitenduser" type="submit" />    <p class="required">Όλα τα πεδία απαιτούνται</p>    <p> το παραπάνω μήνυμα πρέπει να το φτιάξω να φαίνεται μόνο όταν ο χρήστης πατά το sumbit button, όπως      στο facebook δηλαδή</p>           </form>              </div>         <?php  }      if	 (isset($_GET['bizuser'])==true)		 {?>		   <a href="http://localhost/Appointments/Frontend/register_form.php?hairstyle">hairstyle<a/><br>		      		  if(isset($_GET['hairstyle']))			   { echo 'hi';?>		   <div id="bizuserform">		    <form ...			  </form>		 </div><?php }		 }		 ?>

    The problem is that the inner IF does not work-I expect that when that user clicks the hairstyle link seen above a form will appear( <div id="bizuserform"><form ... </form>). I have not included the form code because it is big and because I do not think it is needed.besides, I tried echoing a statement above and it still not works. Of course if the inner if statement is as a standalone statement(not inner) it will work-otherwise it will not.

  19. I have a page where 2 forms can be depicted-depending on user action.(At any time only one is shown).So, in one page I have to include error checking and validation for each form.On of the forms has more than 8 fields. The result is much code in just only one page-about 280 lines. What would you do?Would you put all this code in one page or split it into other pages as well. Let us forget for a while OOP coding-since I am not good at it. I just wanted to hear views on the matter.

  20. I know what SaaS is(software as a service) but I am having difficulty understanding what exactly PaaS(platform as a service) and IaaS(infrastructure as a service) are. Can someone can give a hint here? I am developing a PHP web app this period-locally, can PaaS, IaaS play a role in it, at all?

  21. The reason for the original error is because you can only refer to columns in the table you're updating. The revised query uses a subquery, so that restriction doesn't apply inside the subquery.
    Hm...I did not know this little detail.
×
×
  • Create New...