Jump to content

jimfog

Members
  • Posts

    1,803
  • Joined

  • Last visited

Everything posted by jimfog

  1. jimfog

    what debugger

    sorry for the so late response-do me a favor, can you give me the link of the correct php file to install.I downloaded this one php-5.4.4RC2-Win32-VC9-x86 but the error message is the same and Apace is not started. The message is this: Syntax error on line 515 of C:/Apache24/conf/httpd.conf: Cannot load C:/php/php5apache2_2.dll into server: \xc4\xe5\xed \xde\xf4\xe1\xed \xe4\xf5\xed\xe1\xf4\xfc \xed\xe1 \xe5\xed\xf4\xef\xf0\xe9\xf3\xf4\xe5\xdf \xe7 \xea\xe1\xe8\xef\xf1\xe9\xf3\xec\xdd\xed\xe7 \xe4\xe9\xe1\xe4\xe9\xea\xe1\xf3\xdf\xe1. In the php file I downloaded I did not find php5apache2_4 as I expected to.
  2. You mean I should opt for mysqli_set_charset() instead of query("SET NAMES 'utf8'");And another thing, should I use mysqli_set_charset() in every page of the application?
  3. I will put it also in another way-also. Is it necessary I use in my scripts always this code? query("SET NAMES 'utf8'");
  4. I had problem with the db character set. Everything that was sent from the form to the db in Greek was appearing a weird characters.The db collation was utf8 general and the web page where the form was "content char set utf 8". I fixed the issue by using this code: query("SET NAMES 'utf8'"); My question is the above necessary even if the db and the webpage are set to utf8? I thought that the above 2 will suffice for correct character presentation but it did not. From your experience,did you have to use the above code for correct character database presentation when it comes toa language other than English-in my case it was greek.
  5. jimfog

    sha1 usage

    The question is here, then, Is there any case/scenario where I would need to get back the password, so as to use encryption? A case in web development as we know it today. I saw the article and the author does not mention the case of salted MD5, considered by many much more secure thatplain MD5.
  6. jimfog

    sha1 usage

    So from all the hashing function out there which you would choose for storing passwords in the database? Which is the more secure?
  7. Yahoooo, it works, thanks, so much effort finally payed of. Yes you are right string concatenation sometimes is a headache
  8. I managed to output an error which I am having difficult to explain. First here is the code the "fires" the initiation of errors: $result = $conn->query("insert into users values (NULL, '".$username."', sha1('".$passwd."),'".$name."','".$phone."')") or die(mysqli_error($conn)); And here is the error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'kolovos','6973999098')' at line 2 Kolovos and the number you see next to it are the data($name,$phone) I want to insert to the table of the db-these are filled in a form first.I cannot understand what syntax error is there.
  9. Look at this code to understand the origin of conn-> query: function db_connect() { $result = new mysqli('localhost', 'root', '19471979', 'appointments'); if (!$result) { throw new Exception('Error.'); } else { return $result; }}$conn = db_connect(); $conn = db_connect() is part of another function NOT the one you see above.
  10. Yes fieldset will do the trick. Is this the way usually elements of a form are grouped?
  11. I do not use a library and it is the first time I hear the term PDO I used the code you gave me-with the die statement-in the end and the only thing I get is a blank page, not any message at all. Here is the code: $result = $conn->query("insert into users values (NULL, '".$username."', sha1('".$passwd."),'".$name."','".$phone."')") or die(mysql_error()); In the beginning I assumed that the connection was succesful and the db had been updated with the new record, but that is not the case. The db has not been updated and the strange is that I do not get any error message telling me this or that. Any ideas?
  12. You mean inside the parentheses, where the variables are listed?
  13. I have a form-here is the code: <div id="formcontainer"> <form action="register_new.php" method="post"> <label>Name:</label><span class="asterisk">*</span><input name="name" type="text" size="40" /></br> <label>Phone:</label><span class="asterisk">*</span><input name="phone" type="text" size="40" /><br> <label>Username/e-mail:</label><span class="asterisk">*</span><input name="username/e-mail" type="text" size="40" /></br> <label>Password:</label><span class="asterisk">*</span><input name="password" type="text" size="40" /></br> <input name="submit" type="submit" /></form></div> I want to adjust its line height,the problem is that by doing so,in the css rule(formcontainer) every single element is affected.What I want-for example- is to increase the space between the input name="name" and the label phone but NOT between a label and an in input element. I want the labels with their corresponding inputs packed together and at the same time the label-input pairs separated each other(increased line height). I hope I did not confused you.
  14. I cannot store a record in the database. Here is the insert statement-I want to make sure the syntax is correct. I want to focus on this first and thenlook for other pieces of code: $result = $conn->query("insert into users values (NULL, '".$username."', sha1('".$passwd."),'".$name."','".$phone."')"); if (!$result) { throw new Exception('Could not register you in database - please try again later.'); As you understand I get "Could not register you in database - please try again later". Is there any way I can get more info about the cause of the error?
  15. jimfog

    sha1 usage

    besides using sha1 when entering passwords in a database where else it might be used? Is it usual to use is also with user names-when inserting them in a database?
  16. jimfog

    type casting

    Since you mentioned the term "loosely typed", does that mean that we do NO NEEDto specify the type of cast-in PHP this being done auto into strings? At some points in the code above it is mentioned "return row". I know this is off-topic but I am asking cause it will help meunderstand the code better. With return, we exit a function early, now, in the above case does that mean that the function outputs only the $row(no more lines of code are processed)?
  17. jimfog

    type casting

    My q has to do with type casting. In what programming scenarios do we usually use it? I have not encounter so far a case where I would need to convert a variable from one data type to another.
  18. jimfog

    phone validation

    Βy passing the regular expression to the $phone, is $phone considered a string? Or $phone is considered a string anyway-regardless if there exists or not a regular expression?
  19. jimfog

    phone validation

    I want to validate the the field of a form in which the user will input his phone. So, what I must take into consideration. After some thinking, I realized that I must first be certain that the user has entered digits and not letters and second the digits must not be more or less than some number. WHat do you think? Are the above requirements sufficient or is there sth else also you want to add.
  20. jimfog

    passwords as...

    Thanks-I did it the way you proposed it..
  21. jimfog

    passwords as...

    As a sidenote, I use PHPMyAdmin to handle the database. I have set the primary key the username-sth I wish to change now. The question is does anyone know how to unset that.Or do I have to delete the username field and recreate it without setting it as primary key?
  22. jimfog

    form validation...

    Ok I got you, despite what are you saying nothing was happening...until I took a closer look and realized that there is an "issue" with the form: Instead of using <input type="button" value="Submit" /> I should have used <input name="submit" type="submit" /> The first does NOT submit the form in contrast with the second which DOES. So, the problem was that the form was not submitted at all.
  23. jimfog

    form validation...

    Ok, I understand.But in order to make things clearer, I had the impression that in order to check if the fields of a form are field, someone might as use also isset. Am I wrong?
  24. jimfog

    form validation...

    How am I going to test if the fields of the form are filled? I am confused.
  25. jimfog

    form validation...

    I cannot make a form validation code work, I cannot find where is the error-here is the code: The HTML form: <form id="form" action="register_new.php" method="post"> Name:<span class="asterisk">*</span><input name="name" type="text" size="25" /></br> Phone:<span class="asterisk">*</span><input name="phone" type="text" size="25" /><br> Username/e-mail:<span class="asterisk">*</span><input name="username/e-mail" type="text" size="25" /></br> Password:<span class="asterisk">*</span><input name="password" type="text" size="25" /></br> <input name="register date" type="hidden" /></br> <input type="button" value="Submit" /></form> The php code that resides in register_new.php: <?php require_once 'output_functions.php';require_once 'User_ath_fns.php';$username=$_POST['username/e-mail'];$name=$_POST['name'];$phone=$_POST['phone'];$password=$_POST['password'];if(!isset($username)){echo 'test';}?> I proceed to validate first that the username is filled in-I did not go to check the rest, I am just doing my tests for now. I cannot find the error above.
×
×
  • Create New...