
Vermillion
Members-
Posts
118 -
Joined
-
Last visited
Never
Everything posted by Vermillion
-
Lately, I have been looking for study guides about this. But I have some questions about it: What kind of questions do they ask you? Is there an age limit to take it? How much does it cost? Any other additional or random information about it may be interesting for me as well.
-
Conditional style sheets? I never heard about them... Where could I get more info directly?
-
I need to know something before I try to answer your question, as I don't quite understand what exactly you are trying to do. So you want the PHP script to automatically add the "track number # track name: [ text box ]" the necessary amount of times after the album is submitted?
-
My apologies for the random interruption, but why would you want to do that? Are you writing some sort of program that can interact with your website?
-
... My deepest apologies for the stupid question, that I should probably know. What's a framework? I see that word in my every day life, and I have googled it and Wiki'd it as well, but with the rocket explanation and useless history behind the thing, it's quite hard to understand the concept :<. Please bear with me, I learn better when people give me simple answers.
-
The only solution I can think of is to change the time of the server itself...
-
... Do they actually ask you to resolve those systems with two variables? I have been learning PHP on my own time and in school we don't know any programming languages whatsoever, so I have never taken such test. Why do you need to take a PHP test?
-
Opera is the browser that renders pages with the most updated standards. IE does not. Firefox is in the middle of IE and Opera when we talk about rendering pages, but opera is so perfect that when you try to fix an error for IE, you will mess the page in Opera. Firefox FTW. Oh, and this addon is a must: https://addons.mozilla.org/es-ES/firefox/addon/1419
-
How do you know if a programmer is a good programmer?
Vermillion replied to ok's topic in Miscellaneous
In my eyes, this is a good programmer: - Someone who tries to code with the standards all the time. - Can understand other programming languages without really knowing them. - Approaches to math and logic processes with moderation. He doesn't have to be a math freak. - Always tests his code. - Adds comments to the code with moderation. - Knows to differentiate work from fun. - Uses and understands other people's codes. - Does not use Internet Explorer. - Has imagination. -
Well, to work with permissions, you would need an "access" or "permissions" table with the following structure: user_id - ID of the user (assuming every user has a unique a ID, which you should). level - (What I do here is to set 0 for users, 1 one for moderators, and 2 for administrators). So you would need to fetch the information from the access table and the members table. Here is the code (with the escaped strings which I have no idea of how in hell I forgot about it): <?php /*Variables that are passed through the forum, assuming your forum has a password and username field.*/ $username = mysql_real_escape_string($_POST['username']); $password = md5($_POST['pass']); /*Everything related to database work.*/ mysql_connect ('localhost','username','password'); mysql_select_database ('database_name'); $query = "SELECT * FROM tablename WHERE username = '$username' AND password = '$password'"; //Assuming you have your 'tablename', and a 'username' and 'password' fields on your table. $result = mysql_query($query); //Throws the query and stores the value in the $result variable. $num = mysql_num_rows($result); //Now num has a value. If your site does NOT allow more than one unique username, the value on this variable will be either 1 or 0. /*Time to test.*/ if($num == 1){ //If there is a username with that password in the database: #Loggin successful! $user = mysql_fetch_array($result); $result1 = mysql_query("SELECT * FROM access WHERE user_id = '".$user['id']."'"); $num_permissions = mysql_num_rows($result1); if($result1 == 1){ $level = mysql_fetch_array($result1); switch($level['level']){ case 1: echo "User is a moderator"; break; case 2: echo "User is an administrator"; break; } } else { #What to do if the user has no permissions. } } else { //If there is not a username with that password: #Error loggin in! } ?> That's a quick made example. Can't guarantee it's going to work, but I really recommend you have a read on PHP Sessions and deeper MySQL guides.
-
Woah, sounds like you are pretty new to this, so first things first: <?php $connect = mysql_connect ('localhost','username','password'); //Semi colons are VERY important. $db = mysql_select_database ('database_name'); ?> Now, let's get going: <?php /*Variables that are passed through the forum, assuming your forum has a password and username field.*/ $username = $_POST['username']; $password = md5($_POST['pass']); /*Everything related to database work.*/ mysql_connect ('localhost','username','password'); mysql_select_database ('database_name'); $query = "SELECT * FROM tablename WHERE username = '$username' AND password = '$password'"; //Assuming you have your 'tablename', and a 'username' and 'password' fields on your table. $result = mysql_query($query); //Throws the query and stores the value in the $result variable. $num = mysql_num_rows($result); //Now num has a value. If your site does NOT allow more than one unique username, the value on this variable will be either 1 or 0. /*Time to test.*/ if($num == 1){ //If there is a username with that password in the database: #Loggin successful! } else { //If there is not a username with that password: #Error loggin in! } ?> Hope that helps. And apologizes if it isn't what you wanted.
-
Why Won't This Script Add The Data to MySQL? >.<
Vermillion replied to Vermillion's topic in PHP Coding Help
Fixed it by basically recreating the database and rewriting the script >>;. Thanks for the help anyways. And I would have tested if there is any errors, but my host (07x) does not support PHP error messages. Beautiful, huh? -
Hey guys, I'm having quite a weird problem with PHP not adding the information to the database upon submitting a form. This script works with two queries to add information: One to add information to the members table, and one to add the information to the user_prefs table. However for some reason, only the information to user_prefs is being added. Here is a picture of the members table. And here is the code I use to add the data to the database (I have added many #'s at the end and beginning of the part that adds the data): <?php require "../forum/config/config.php"; awings_connect(); session_start(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="description" content="The open project for everyone learning how to program, or compose music, or more!" /> <meta name="keywords" content="project, awings, forums, forum, action, replay, ds, subscription, psp, consoles, homebrew, register" /> <title>Project Awings</title> <link rel="stylesheet" href="../forum/style/css.css" /> <link rel="shortcut icon" href="../forum/graphics/favicon.ico" /> </head> <body id="noforum"> <?php include "../includes/nonforumh.php"; ?><br /> <table> <tr> <td valign="top"><?php include "../includes/mainmenu.php"; ?></td> <td width="95%" valign="top" align="center"><?php include "../forum/classes/class.registervalidator.php"; $member = new member; $register[0] = $member -> checkChars($_POST['username']); $register[1] = $member -> checkUserLength($_POST['username']); $register[2] = $member -> checkExistence($_POST['username']); $register[3] = $member -> valPassword($_POST['password'], $_POST['password1']); $register[4] = $member -> checkPassChars($_POST['password']); $register[5] = $member -> validateEmail($_POST['email']); $register[6] = $member -> checkMailExistence($_POST['email']); $register[7] = $member -> validateQuestion($_POST['sequ']); $register[8] = $member -> validateAnswer($_POST['seans']); $register[9] = $member -> validateFName($_POST['fname']); $register[10] = $member -> validateLName($_POST['lname']); $register_error_message[0] = "<li>Your username contains invalid characters. Please make sure your username only contains alphanumeric characters, underscores, and spaces.</li>"; $register_error_message[1] = "<li>Your username must contain at least 3 characters.</li>"; $register_error_message[2] = "<li>The username you chose is already in use. Please choose another one.</li>"; $register_error_message[3] = "<li>The passwords you put did not match.</li>"; $register_error_message[4] = "<li>Your password must include at least 6 characters.</li>"; $register_error_message[5] = "<li>The Email you input is invalid. Did you include an \"@\" and the respective dots?</li>"; $register_error_message[6] = "<li>The Email you input is already in use. Please use another one.</li>"; $register_error_message[7] = "<li>The secret question must have 10 or more characters.</li>"; $register_error_message[8] = "<li>Your secret answer must have 4 or more characters</li>"; $register_error_message[9] = "<li>The First Name field has invalid characters.</li>"; $register_error_message[10] = "<li>The Last Name field has invalid characters.</li>"; #print_r($register); //Confirm if the array works. Uncomment in case of debugging. $errors = array_keys($register, 1); if(count($errors) > 0){ echo "<div class=\"boxcontainer\" style=\"width:70%; padding-top:0px; margin:0px;\"><div class=\"title_boxcontainer\" align=\"center\">Errors Detected:</div>"; echo "<ul id=\"errormessages\">"; foreach($register as $key => $value){ if($value == 1){ echo $register_error_message[$key]; } } echo "</ul>"; echo "</div><br />"; include "../includes/registerform.php"; } else { ######################## ######################## ######################## $user = trim($_POST['username']); $password = md5($_POST['password']); $email = mysql_real_escape_string($_POST['email']); $question = mysql_real_escape_string($_POST['sequ']); $answer = mysql_real_escape_string($_POST['seans']); $fname = mysql_real_escape_string($_POST['fname']); $lname = mysql_real_escape_string($_POST['lname']); $bdate = $_POST['year']."-".$_POST['month']."-".$_POST['date']; $gender = $_POST['gender']; $date = date("Y-m-d"); $time = date("g:i A"); $initialip = $_SERVER['REMOTE_ADDR']; echo "<div class=\"boxcontainer\" align=\"center\" style=\"width:70%; margin-top:25%; margin-left:20%;\"><div class=\"title_boxcontainer\" align=\"center\">Registration Succesfull:</div>"; echo "You have registered succesfully, <strong>$user</strong>! <br />You may start using your account now."; echo "</div>"; $id_ = mysql_fetch_array(mysql_query("SELECT * FROM members ORDER BY id DESC LIMIT 1")); $id = $id_['id'] + 1; mysql_query("INSERT INTO members (username, password, email, question, answer, name, lname, birthday, gender, date, time, ip) VALUES ('$user', '$password', '$email', '$question', '$answer', '$fname', '$lname', '$bdate', '$gender', '$date', '$time', '$initialip')"); mysql_query("INSERT INTO user_prefs(user_id) VALUES('$id')"); } ######################## ######################## ######################## ?> </td> <td valign="top"><?php include "../includes/siteusernav.php"; ?></td> </tr> </table> </body> </html> Any help will be highly appreciated =(.
-
I don't get how to install it :
-
I tried the MFC, but it is quite complex, guess I will wait till university to learn that . In the meantime, I want to learn GTK, but I have no idea of how to install the libraries. Everytime I try, I fail at it >>;. Maybe someone can help me install the libraries to VS2008, or just recommend another good compiler which already has them installed?
-
Visual C++ Express is an awesome choice. It should work with Vista. Optionally, if you really can't get it, I recommend you to download NetBeans. It is free and you can install C++, Java, and probably other compilers to it. Personally I don't use it, but for what I have seen and been told, it seems like it is really good.
-
I am a guy . Everyone confuses me with a girl wherever I go though, I wonder why xD.
-
My name is Andrés Ibañez. I am 16 years old. I live at La Paz Bolivia, but I am not planning to go to college here or to work here. I have only had one girlfriend and I don't want another one till I turn 18. I live with my brother, mom, and 4 cats. I am a normal highschool student. I learned HTML last year, and have expanded my self learning CSS, JS, PHP, and C++. I'm good at those. My first interest was graphic design. While I am good with Photoshop, is not something I really enjoy. Random facts: - I want to become an actor AND a programmer. My favorite actress in life is Elle Fanning and she inspires me. - I have never received any classes on computer, except the very basic stuff when I was a child. When it comes to languages, I am self taugh and obviously I always ask if I have questions. - Even though I am really good with computers, I'm sure I am more of a creative person. I love art and such. That's for now .
-
Like the title says; how many of you are self taugh programmers or (web/non web developers)? Personally, I started to learn everything by myself when I wanted to make a "neohome" for a website. For that, I had to know HTML and put all my thoughts there (because I am the expressive type of people). After learning HTML, a friend of mine mentioned CSS to me, so I went ahead and learned that too. Then I wanted to do more dynamic stuff, so I moved ahead and learned some JavaScript. All of this was on late 2006 and early 2007. Then on late 2007, I had enough confidence and I started to learn PHP. It was the most confusing language for me so I purchased books for it and learned it. Although I am still learning all of those, now I learn while I create, so I am even making my own forum software . While I keep learning PHP and the other web related ones, I am currently learning C++ (one year on it) and C#. There are many other things I have to consider, but for now I will work with those. Also, about graphic design... Everyone gets a bit of experience on that, right ;P?
-
Also one little thing on your while loop: while ($row_g = mysql_fetch_array($result_g)){ //... } You should add two = signs next to $row_g, because there are checking if something is true. Using only one = is to asign variables. Sometimes that causes some small bugs in your scripts that can be a royal pain to debug, so you should try to use one = you ASSIGN variables, and two = when you COMPARE them.
-
Can someone give me a good tutorial or name a me book to learn to do so? I have Visual Studio 2008, and the integrated GUI builder looks good but I don't know how to use it. I also want to learn the MFC, but no luck finding tutorials for that either.
-
Woops haha. Well, I already changed my method though, because that one was giving me problems, so now I changed of method and I only use preg_replace when outputting the content. I just have another problem though, which I don't know how to solve, and that is, how would I indent quote tags? Or is that only done with the HTML tag? I describe more about it here; http://www.neoseeker.com/forums/45/t1060604-to-how/2.htm#22
-
Okay, so I have this BBCode script I made by myself: <?php ################################################################################ # SCRIPT: Vg Hack BBCode # # SCRIPT NAME: regex.php # # AUTHOR: Andrés Ibañez | Vermillion. # ################################################################################ /*********************************** # Functions to strip HTML, # # and to transform BBCode to # # HTML. # ************************************/ function bbcode($message){ $message = mysql_real_escape_string(nl2br($message)); $message = preg_replace("/\[b\](.*?)\[\/b\]/is", "<strong>$1</strong>", $message); $message = preg_replace("/\[i\](.*?)\[\/i\]/is", "<span style=\"font-style:italic;\">$1</span>", $message); $message = preg_replace("/\[u\](.*?)\[\/u\]/is", "<span style=\"text-decoration:underline;\">$1</span>", $message); $message = preg_replace("/\[strike\](.*?)\[\/strike\]/is", "<span style=\"text-decoration:line-through;\">$1</span>", $message); $message = preg_replace("/\[link name=(.*?)\](.*?)\[\/link\]/is", "<a href=\"$2\" target=\"_blank\">$1</a>", $message); $message = preg_replace("/\[q=(.*?)\](.*?)\[\/q\]/is", "<ul><div class=\"quote\"><span class=\"qt\">quote <strong>$1</strong></span><blockquote>$2</blockquote></div></ul>", $message); return $message; } /*Function to recover the data from the database*/ function dbRecover($message){ $message = strip_tags($message, "<strong>, <span>, <a>, <ul>, <li>, <blockquote>, <ol>"); $message = preg_replace("/<strong>(.*?)<\/strong>/is", "[b]$1[/b]", $message); $message = preg_replace("/<span style=\"font-style:italic;\">(.*?)<\/span>/is", "[i]$1[/i]", $message); $message = preg_replace("/<span style=\"text-decoration:underline;\">(.*?)<\/span>/is", "[u]$1[/u]", $message); $message = preg_replace("/<span style=\"text-decoration:line-through;\">(.*?)<\/span>/is", "[strike]$1[/strike]", $message); $message = preg_replace("/<a href=\"(.*?)\" target=\"_blank\">(.*?)<\/a>/is", "[link name=$2]$1[/link]", $message); $message = preg_replace("/<ul><div class=\"quote\"><span class=\"qt\">quote <strong>(.*?)<\/strong><\/span><blockquote>(.*?)<\/blockquote><\/div><\/ul>/is", "[q=$1]$2[/q]", $message); return $message; } ?> The line before the last one on both custom functions is not working well. The output I want (which works fine) is this: But when I try to edit it, the dbRecover() function does not transform the quote properly: And the wanted result is: [q=Moi]I think your quote is [b]messed[/b] up TBH.[/q] Also, I want the quotes to be indented, so when people quote a quote (lol at that ;P), it will be indented.
-
I think "value" is the part that makes it confusing. Would I only the username there? Because I don't understand how will that make the user be authenticated :/.