Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About baser-b

  • Rank
  1. I have this function I use to simplify things. function search_string( $needle, $haystack ) { if ( preg_match_all( "/$needle/im", $haystack ) || strpos( $haystack, $needle ) ) { return TRUE; } return FALSE; } I keep getting this error in my PHP logs, and it comes in a sequence: [07-Nov-2020 05:34:14 America/Los_Angeles] PHP Warning: preg_match_all(): Unknown modifier 'G' in /home/baser-b/public_html/include/functions.php on line 791 [07-Nov-2020 05:34:14 America/Los_Angeles] PHP Warning: preg_match_all(): Unknown modifier 'g' in /home/baser-b/public_html/inclu
  2. $result = queryMysql("SELECT * FROM accounts WHERE user='$user'"); $row = $result->fetch_array(); $pass = $row['pass']; $fname = $row['fname']; $lname = $row['lname']; $email = $row['email']; $phone = $row['phone']; $title = $row['title']; $company = $row['company']; $website = $row['website']; $snailmail = $row['snailmail']; if (isset($_POST['save'])) { if (array_diff_assoc($_POST, $row)); { foreach (_$POST as $key => $value) { if ($key == $row[$key])
  3. The code is supposed to check when a form is submitted that has the fields First Name, Last Name, Email, Phone, Title, Company, Website, Address, which fields have been changed, and update the fields in the database.
  4. Okay, so this is the code I came up with mac_gyvers suggestions. It should be remembered (though how could you forget?) that I am a moron and also very new to PHP but am trying my best to learn. if (isset($_POST['save'])) { foreach ($_POST as $key => $value) { foreach ($row as $rkey => $rvalue) { if (array_search($key, $rkey)) { if($rkey == "email") { if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $error = "Invalid email format."; }
  5. So I tried to do the thing of running through the values in the $_POST and comparing them to etc etc. Anyway, this is what I came up with, which doesn't work. if (isset($_POST['save'])) { foreach ($_POST as $key => $value) { foreach ($row as $rkey => $rvalue) { if (array_search($key, $rkey)) { if($rkey == "email") { if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $error = "Invalid email format."; } } if ($rkey == "website") {
  6. Thanks for the edit, that wasn't my password though. Anyway, as an edit to my previous post: I am basically creating a part of a homepage script that will give me a vocabulary "word of the day" + definition as part of the overall setup. The point of the function I am trying to create is to serve 4 purposes: Read a random line from a text file containing a word and definition. Separate the two values. Print the two values as Word: $word and Definition: $definition. Store the values into an MySQL database that can be retrieved at another time. Delete the values from the t
  7. Well, I'm not necessarily trying to read ALL the entries from a file. My knowledge is limited. I know that file() turns a file into an array, but then I didn't know how to read a single line from the array produced, and now having thought it through, I figured that out, but it was a former experiment that had confused me when the $output[0] just returned a letter or something. But anyway this code does the same thing without getting the set of values I want from the array.... $file = "vocab.txt"; $source = file($file); $entry = explode("-", $source[0]); $word = $entry[0]; $definitio
  8. Well one about the why have a class for a single function, I am going to build upon the class that's just the one part I have a question about. A lot of the things in my code that don't make sense is because I am new at PHP and programming in general, and have not had more of an education than w3schools.com and reading other people's code and referencing it with php.net/manual/. I do have database functions defined but they are not directly relevant to the problem at hand, so I didn't include it. It is here: // Define MySQL variables define("SERVER", "localhost"); defin
  9. So I am trying to write a script that reads a text file that contains words/definitions, prints the word/definition separately, sends those values to an MySQL database, then deletes those same values from the text file without leaving an empty line. I am having some trouble with getting it ALL to go down. I can get it to read/print the info I want, send it to the database, but deleting the values from the file isn't working. It just deletes the entire contents from the file. Here's the code: class Vocabulary { public $date; public $word; public $definition;
  10. I really swear that the host I use is like screwing with me hard. Like literally will have something working one night, wake up the next day to my error log full and nothing working anymore. Or, like in this case, have the code working fine, perfectly in fact, to all of the sudden bring up all these errors and shit without changing anything I just can't figure it out. Point being, I am working on this portal, and on the account page, you can update your info. Which for one field... $result = queryMysql("SELECT * FROM accounts WHERE user='$user'"); $row = $result->fetch_assoc();
  11. Basically I want the text to be spaced like this: User: $user Project ID: 0003 [BUTTON] [BUTTON]
  12. <style> .whatever { position: relative; display: flex; float: left; background-color: #336699; color: white; padding: 10px; font-family: Candara, Sans-Serif; /* width: 400px; */ } .whateverer { position: absolute; left: 0; bottom: 0; margin: 10px; } .buttonbox { display: flex; float: right; background-color: #FFFFFF; padding: 5px; align: right; } </style> <br><br> <div class='whatever'><b>User:</b> $user :: <b>Project ID: </b>00021<div class='whateverer'><small>
  13. <html> <style> .box { color: #d0d0d0; font-weight: 300; padding: 30px 0; background: #336699; } .whatever { float: left; background-color: #336699; color: white; padding: 10px; font-family: Candara, Sans-Serif; width: 400px; } .buttonbox { float: right; background-color: #FFFFFF; padding: 4px; align: right; width: 131px; } </style> <div class='box'>Here's some shit for whatever.</div><br><br><br> <div class='whatever'><b>User:</b> $user | <b>Project ID: </b>00021<br><
  14. echo >>>HEREDOC <table name='AccountInfo'><form method='post' action='<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>' enctype='multipart/form-data'> <tr><th><span class='fieldname'>Username:</span></th><td><?php echo $user; ?></td></tr> <tr><th><span class='fieldname'>Password:</span></th><td><input type='password' size='16' name='pass' value='<?php echo $pass; ?>'></td></tr> <tr><th><span class='fieldname'>First Name:</span>
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.