Jump to content

Sigmahokies

Members
  • Content count

    42
  • Joined

  • Last visited

Everything posted by Sigmahokies

  1. Hi everyone, I am still learning changing PHP by mysqli to PDO. I'm not get used with PDO because it is little complex to understand, but maybe few weeks I will understand how PDO works. Now, I am trying to make redirect with type account in website and database. I am trying to identify type of three - administrator, license, and scorer page. I set up the test to make it work, seem it went dead end, it won't go to admin or license or scorer page. What did I do wrong? maybe something is missing. here my code: <?php /** * Created by PhpStorm. * User: Gary.Taylor * Date: 7/5/2018 * Time: 10:10 PM */ session_start(); require('access.php'); if(isset($_POST['submitted'])) { $username = $_POST['username']; $password = $_POST['password']; if($username && $password) { $login = $GaryDB->prepare("select username, password, Administrator from account Where username = '.$username.' and password = '.$password.' and Administrator = X"); $login->execute(); $count = $login->fetch(); if($count == 1) { $_SESSION['username'] = $username; header('location:admin.php'); } } elseif ($username && $password) { $login = $GaryDB->prepare("select username, password, License from account Where username = '.$username.' and password = '.$password.' and License = X"); $login->execute(); $count = $login->fetch(); if($count == 1) { $_SESSION['username'] = $username; header('location:license.php'); } } elseif ($username && $password) { $login = $GaryDB->prepare("select username, password, Scorer from account Where username = '.$username.' and password = '.$password.' and Scorer = X"); $login->execute(); $count = $login->fetch(); if($count == 1) { $_SESSION['username'] = $username; header('location:scorer.php'); } } else{ header('location:denied.html'); } }
  2. Sigmahokies

    Blur on video background

    Hi everyone, I'm trying to have little blur on background which is video. I added filer:blur(5px) on this video, but it won't work. Is there any way to make it work? I searched in google to see some code in, but none of them are working. Can anyone help? Thanks, Gary Taylor
  3. Sigmahokies

    Blur on video background

    Never mind about above, I found a way to make it work Thank you, everyone.
  4. Hi everyone, I'm wondering it is possible to have few checkbox checked but count as one? For example, I put three checkbox on html, then checked two of three, but will count as one. Suppose I have group of checkbox, but considered count one from three checkbox checked. it will be very appreciate if you can help. Thanks, Gary
  5. Sigmahokies

    few checkbox checked, but count as one

    Here example look like:
  6. Sigmahokies

    few checkbox checked, but count as one

    Hey, hey! I just fixed what I want. all i have to remove "+" from =. it count as one! Thank you so much!
  7. Sigmahokies

    few checkbox checked, but count as one

    That is not what I am asking for. I am asking for to have few checkbox have been checked, but count as one. For example, If I put nine checkboxes on website, then I divide nine checkboxes into three group: Three checkboxes in one group, then three checkboxes in second group, then three checkboxes in third group, suppose someone click checkboxes two out of three checkboxes in first group, click one out of three checkboxes in second one, then click two out of three checkboxes in third one, so script would count three checked because it showed someone did it all nine checkboxes which divided into three group that will count as three checked. Get it? Please forgive me, English is not my primary language, it is my second language. My primary language is ASL. Thanks, Gary
  8. Sigmahokies

    table under table

    Hi everyone, I will like to know how to have table under master table. Is it relationship? or how you do that? Thanks, Gary
  9. Hi everyone, I know how to create new table by PHP, but I don't know how to have relationship to prime table such as account or register table once a new table is insert. Can you please show me how to do that? I know how to create new table, but my point is once table is insert in phpmyadmin, then have relationship connect to prime table. If you are not sure, I will explain more about this. Thanks, Gary
  10. Sigmahokies

    Create new table will have relationship to prime table automatically

    Actually, I am using MySQL (MariaDB), All right I will try this, I will come back to comment if I have something wrong or question. Thanks, Gary
  11. Sigmahokies

    Insert into in PHP

    Hi everyone, I am trying to get all data from input in HTML, then post in php to insert into the database (phpmyadmin), seem it doesn't work. I checked for misspelling, and checked followed very correct, but it won't work, even it did not show what is error. "require.php" file is a connect to database. Can you help? Thanks, Gary <?php require("require.php"); $first = $_POST['first']; $last = $_POST['last']; $address = $_POST['address']; $address2 = $_POST['address2']; $city = $_POST['city']; $state = $_POST['state']; $birth = $_POST['birth']; $zip = $_POST['zip']; $home = $_POST['home']; $mobile = $_POST['mobile']; $gender = $_POST['gender']; $insert = "INSERT INTO register ( ASL-PT_ID, FirstName, LastName, Address 1, Address 2, City, State, Zip, BirthDate, Home, Mobile, Gender) VALUES ('$first', '$last', '$address', '$address2', '$city', '$state', '$zip', '$birth', '$home', '$mobile', '$gender')"; if ($first && $last && $address && $address2 && $city && $state && $zip && $birth && $home && $mobile && $gender) { mysqli_query($GaryDB, $insert) or die("Could not add in the Database"); } ?>
  12. Sigmahokies

    Insert into in PHP

    You mean, hackers can use URL to make data object mess up after use php code? Are you suggesting me to have different and very oddly variable, instead similar variable like inside SQL name of column that same name as variable? like for example, in SQL statement, `address 1`, then in PHP, $address1, is that how hacker get exploit to hack in? so, should I type very oddly, like Address 1 = $wacky? I mean, create those variable is no sense to people?
  13. Sigmahokies

    Insert into in PHP

    All right, I will test this SQL injection. Please be patient with me, I am having long way to learning. Please tell me, is PDO is best security than MySQLi? If so, that mean, i have to do start over to learn PDO. I know there will always new feature, but I am usually using same concept from Java, JavaScript, ASP. My real thing is working with database with web. I just use developer tools, I tested my old website that under company that give me a free small space disk - 1 GB. It is not serious, it is my practice in PHP, so, I use my username and password to access to next file, I don't see any SQL statement in developer tools, like it is just disappear. How do you can see SQL and PHP code? I don't see anywhere in developer tools in web browser. I'm no hacker, I don't like to hack in because in case if i do this, FBI will eat me alive, even revoke my degree, so forget it. my point is I thought PHP usually invisible to anyone because PHP just do interpreter in HTML, unlike ASP because ASP is a open source in website as you can see all code in View Page Source in any web browser. How can you see the SQL statement? I just don't get it all. Hey, I am still learning, there is no stopping to learn because there are over 1,000 new features in everyday. Thanks, Gary
  14. Sigmahokies

    Insert into in PHP

    it is interest to have backticks, in other phpmyadmin in server already, it does not require to have backticks, it works. That make me puzzling.
  15. Sigmahokies

    Insert into in PHP

    I know about SQL injection, but all php code is outside, it won't show on website. all php are external file. I plan to insert the string escape mysqli, but I need to make sure it works, before I insert them. And, I don't show my code in php in website, it will work very quick, like first file, then jump second file to verify, then move to third file, there is no way to look at second file because has mysqli inject string escape which contain in php. I just create layout in html and css. I'm sure hackers cannot see my hidden file. It's like all html and css are upper from floor, but my php code is like just show up in one second to verify, then disappear from floor. This file is not on main file, it is outside, just use file to insert into database, then move to other website...it's just matter of less then second.
  16. Sigmahokies

    Validation form

    Never mind, someone helped me, just added required in html, then it will appear... Thank you for helped.
  17. Sigmahokies

    Validation form

    Hi everyone, I am trying to have validation form, seem it doesn't work. what did I do wrong? If anyone can help, Thank you so much... Gary Taylor <?php $buzz = $buzz2 = ""; if ($_SERVER['REQUEST_METHOD'] == "POST") { if (empty($_POST['select'])) { $buzz = "<h2><color ='red'> >- </color></h2>"; $buzz2 = "<h2><color ='red'> -< </color></h2>"; } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Welcome to ASL-PT Scoring</title> <link href="default.css" rel="stylesheet" type="text/css"> </head> <body> <fieldset> <h1>Welcome to ASL-PT Scoring website</h1> <table> <form action="login.php" method="post"> <select name="select"> <?php echo $buzz ?><option value="" >Please select the level</option><?php echo $buzz2 ?> <option value="Administrator">Administrator</option> <option value="License">License</option> <option value="Scorer">Scorer</option> </select> <caption>Please login to enter the site below:</caption> <tr><td>Username:</td><td class="td"><input type="text" name="user"></td></tr> <tr><td>Password:</td><td class="td"><input type="password" name="password"></td></tr> <tr><td colspan="2"><input type="submit" name="submitted" value="Login"></td></tr> </form> </table> </fieldset> </body> </html>
  18. Sigmahokies

    Flexible in array for table in the Database

    Hi everyone, I am trying to set up the flexible with array, like set up the array by count the columns in tables in the Database, so I am still figure how to create variable word through loop to allow equalized from $_post as if $_post appear in two or three or four...I figured out to set up the $_post in loop, but I haven't find a way to have create new variable to equalized with $_post in loop in same time. here my code <!doctype html> <html> <head> <title>Add name and number</title> <link href="defaultdatabase.css" rel="stylesheet" type="text/css"> </head> <h2>Add any DSDJ information to database</h2> <?php require ("require2.php"); $sql = "show tables from NewDSDJ"; $list = mysqli_query($GaryDB, $sql); while ($row = mysqli_fetch_array($list)) { $table[] = $row[0]; $option = ''; foreach ($table as $rows) { $option .= "<option value='{$rows}'>{$rows}</option>"; } } ?> <form action="addname.php" method="post"> <table> <tr><th>Select the table</td><td> <select name="subject"> <?php echo $option; ?> </select></td><td><input type="submit" name="selected" value="select"></td></tr> </table> </form> <form> <table> <?php if (isset($_POST['selected'])) { $selected = $_POST['subject']; $column = "select column_name from information_schema.columns where table_name = '" . $selected . "'"; $list5 = mysqli_query($GaryDB, $column); while ($array = mysqli_fetch_array($list5)) { $input = ''; foreach ($array as $row5) { $input = "<tr><td>{$row5}:</td><td colspan='2'><input type='text' name='label[]'></td></tr>"; } echo $input; } if (isset($_POST['insert'])) { foreach ($array as $row6) { $ins = "{$row6},"; } for ($i = 0; $i < count($array); $i++) { $label = $_POST['label']; } echo $label; $insert = "insert into " . $selected . " (" . $ins . ") values (" . $label . ")"; mysqli_query($GaryDB, $insert) or die("Could not insert"); } }echo "<tr><td><input type='submit' name='insert'></td></tr>"; mysqli_close($GaryDB); ?> </table> </form> </html> Look at above of $insert, that is one I haven't figure how to create variable word to get data from name in form in HTML. Can you help? Thanks, Gary Taylor
  19. Sigmahokies

    Flexible in array for table in the Database

    hi just someguy, please forgive me for my grammar, I'm Deaf, so ASL is my prime language, English is my second language. Anyway, I'm trying to create new variable by loop which must be follow number of array. In the many database, there are various number of columns, so I need to set up the flexible array that can insert in value in the database. For example, if one table has three columns, so have to set up with three array, if table has four columns, so have to set up four array. feel me? So, I need to create variable to get post from the name in HTML, which need to same number from array. For example, if post get four value from HTML, have to have four variable. if post get three value from HTML ,have to have three variable. I'm doing my best to improve my grammar in next time.
  20. Sigmahokies

    Images in array

    Hi everyone, I am still learning Java. I am trying to create an array with images. I have images in folder, but I can't figure how to start to have images in array. How can I do that? I checked around in google, none of them make sense, more likely off topic to image icon. I need to tell java to pull all images from folder into array, so i can process programming. can you please show how to do that? Thank you so much. Gary
  21. Sigmahokies

    do and while loop

    Hi ingolme, Don't worry about it now, I found a way to make do...while loop works! Thanks.
  22. Sigmahokies

    do and while loop

    Hi everyone, this is my second thread, I hope you can help me why do and while won't do loop as I put them in... public class GameGuess extends Thread { int a; public void Send(int a) { this.a = a; } do { int p1 = (int) ((Math.random() + 5) * 10); int p2 = (int) ((Math.random() + 5) * 10); System.out.print("Player 1: " + p1); System.out.print("Player 2: " + p2); if (p1 != a) { System.out.print("Player 1 get wrong guess."); } else if (p1 == a) { System.out.print("The Player 1 wins!"); } else if (p2 != a) { System.out.print("Player 2 get wrong guess"); } else if (p2 == a) { System.out.print("The Player 2 wins!"); } } while (p1 != a || p2 != a);
  23. Sigmahokies

    do and while loop

    Are you talking about method that above of all must inside like public void (args) {}? all code are inside args already. If you want, I can show you a full of source in Java.
  24. Sigmahokies

    do and while loop

    NetBean. It shows highlight error in do and while line. I checked the method has been correct, but it won't do loop. all method and compare are inside, I wrote code after parameter. Java source said while accept != as not equal. isn't that strange? I know what method is. I have been learning about OOP already, I am moving into intermediate level now.
×