-
Posts
138 -
Joined
-
Last visited
Profile Information
-
Gender
Male
-
Location
Richmond, VA
sigmahokies's Achievements

Regular Member (3/5)
0
Reputation
-
Hi Phill W., I know about SQL injection, it's wide open. but it's practice, I said i will set up the SQL security after I make sure Insert and update is working. Relax! Also, I know how to close SQL in PHP, I want to make sure it is working, beside, it's in xampp, so it's localhost, not open to internet. I'm not that dumb. I need to practice to make it work, so I can move on with my demonstration to interview. SQL injection is my last to install in my code in PHP. Thanks, Gary
-
I don't understand why it doesn't work to insert in Phpmyadmin (MariaDB) with my code...It saying failed to add all times. I know about security issue, I will install security later. I just want to make sure insert into MariaDB is working, then I will set up security system. Here my code: /* Register and check username and email is exist or not */ if (isset($_POST['submitted'])) { $username = $_POST['user']; $email = $_POST['email']; $first = $_POST['first']; $last = $_POST['last']; $password = $_POST['password']; $check_user = "SELECT * FROM username where Username = '".$username."'"; $check_email = "SELECT * FROM username where Email = '".$email."'"; $check_user2 = mysqli_query($GaryDB, $check_user); $check_email2 = mysqli_query($GaryDB, $check_email); if(mysqli_num_rows($check_user2) > 0) { $taken_user = "→ Sorry, Username is taken"; } elseif (mysqli_num_rows($check_email2) > 0) { $taken_email = "→ Sorry, E-mail is taken"; } else { $register = "INSERT INTO username (Username, Password, FirstName, LastName, Email) VALUES ('$username','$password','$first','$last','$email')"; $insert = mysqli_query($GaryDB, $register); } if ($insert) { $insert1 = "successfully added"; } else { $insert1 = "Failed to added"; } } Can you find what I did do wrong? Thank you in advance!
-
All right, I'm trying to tell you that I'm trying to get all array from $srs in above of script into function below of loop in array, but problem is PHP still does not recognize $srs is defined from beginning of script; Look at image screen as example that need to be done.
-
<?php $srs = array(); for ($section = 1; $section < 5; $section++) { for ($row = $section; $row < 10; $row++) { for ($seat = $row; $seat < 20; $seat++) { $srs[] = array( 'section_name' => $section, 'row_name' => $row, 'seat_name' => $seat); } } } output(convert_array($srs)); // Converts the array function convert_array($input) { return $input; } function output($obj) { echo "<pre>"; print_r($obj); echo "</pre>"; die; } ?> I'm trying to convert those array number to string, add implode() to make it happen, but seem PHP didn't recognize variable in $input. Like this implode("Section: ", $input) or (Section: ", $srs). Can you help me? Thanks, Gary
-
All right, here my original code - <!doctype html> <html> <head> <title>Stimulation Video Home Alone</title> <link href="css/grammar.css" rel="stylesheet" type="text/css"> <link rel="icon" href="images/sigma.png"> <script type="text/javascript" src="js/checkbox.js"></script> <script> function clickvideo() { let x = document.getElementById("btn"); document.getElementById("display").innerHTML = "<video width='430' controls style='border-radius: 5px;' height='240' type='mp4'>" + "<source src='UPLOADS/Breakfast/" + x + "'></video>"; } </script> </head> <form> <?php $video = opendir("UPLOADS/Breakfast/"); while(($listvideo = readdir($video)) !== FALSE) { if (preg_match("/^[^\.].*$/", $listvideo)) { echo "<input type='button' id='btn' value='".$listvideo."' onclick='clickvideo()'> "; } $videoList = $listvideo; } ?> </form> <body> <table class="table" border="1"> <tr> <td><a href="index.html"><img src="images/logo_new_final.jpeg" align="left" width="250" alt="Research"></a></td> <td rowspan="4"> <iframe height="650" width="800" src="--------------.php" frameborder="0"></iframe> </td> </tr> <tr> <td> <video width="450" controls style="border-radius: 5px;"> <source src="video/Ha_Demo.mp4"> </video> </td> </tr> <tr> <td> <div id='display'> <video width='450' controls style='border-radius: 5px;'> <source src="UPLOADS/Breakfast/<?php echo $videoList ?>"> </video> </div> </td> </tr> </table> </body> </html> That's my original script...loop in php works, it show have a name on button from files' name in folder, but I can't figure why javascript won't do onclick when I'm asking for which video i want to see, like you can push button to have other video source appear on page. I tried to use .value and .textContent to retrieve text on button to make a switch video source on current page.
-
Hi gw1500se, I'm trying to create the loop that which read directory from folder with Javascript inside echo by loop like this - $file = opendir("htdocs/site/"); while($files = readdir($file)) { echo "<button onclick='test()'>".$files."</button><br />"; } it will create few button that will have text on buttons which list in folder. Right now, I'm trying to make function in JavaScript when someone click one of several buttons, then JavaScript should response to change file or video or image. like you saw some website has several button, then you click on one of those button to see switch image on website. Of course, i will use document.getElementByTagName("button") to retrieve text, but seem it didn't get text, even, i tried to add like .value and .textContent in JavaScript...still not work. If you want, I can put my original script in next time.
-
Hi everyone, I want to know, will Javascript's onclick on button work in PHP while loop? I mean, If I out "onclick" with function inside html tag, then put html inside echo under while loop. Will JavaScript's onclick work? Like this script below: $i = 0; while( $i < 5) { echo "<button id='btn' onclick='test()'>Hello</button>"; $i++; } This loop will create 4 times loop with same echo with onclick, so will onclick call Javascript programming?
-
My apology, I mean to name title "OOP vs Procedural", instead of PDO. Sorry...
-
I want to see your opinion about OOP and Procedural. Which method has more easier to code in PHP? I'm using Procedural, but I notice PHP can read OOP as C++. Which is better for PHP? Thanks, Gary
-
Hi everyone, It's been awhile since I was here in autumn time. How are everyone here? I'm good. I want to know, which best and cheaper host to create website with PHP? include Phpmyadmin or SQLBuddy. Please let me know... Thanks, Gary
-
I put your code in above of my script, there is no error warning message on site.
-
Hi everyone Happy Holiday to everyone!!! I am trying to create the form contact in PHP. I created form contact in html, But next page - I'm not sure it is right script in PHP to send email to my gmail account. I asked the hosting company to see if their server can send email to my gmail account, they said yes, should be. So, I create script in PHP, I don't know if it is right script, i hope you will find something missing in this script. I followed exactly from website, I tested to send then I checked my gmail account, this email has not sent. Can you help? Here my script: <?phpif (isset($_POST['submitted'])) {$name = $_POST['name'];$email = $_POST['email'];$select = $_POST['select'];$text = $_POST['text'];} $to = "[email protected]";$subject = "ASL class";$message = "Message is from ".$name.".\n The type class is ".$select.".\n The message said: ".$text; mail($to,$subject,$message); echo "<p>Sent! Thank you for fill an E-mail form</p>";?> Thank you in advanced, Gary
-
Hi everyone, I want to ask for your opinion and advice. Is there possible for Deaf person getting a job as PHP web developer? I know few Deaf people who can write in PHP. I just want to see how chance for Deaf people, because discriminate against Deaf people are still exist in America even it is illegal. Please let me know, if you don't understand what I said, Please let me know, then i will be happy to repost in this thread. Thanks, Gary
-
Barand and Psycho, it is working now. Thank you, Gary
-
Hi everyone, I usually write PHP, but this time, I need a help in CSS. I am trying to create a vertical text, Not transfer rotate degree. I want to write like this: C L A S S Thanks, Gary