Jump to content

mlukac89

Members
  • Content Count

    40
  • Joined

  • Last visited

Community Reputation

1 Neutral

About mlukac89

  • Rank
    Member
  • Birthday 09/24/1982

Profile Information

  • Gender
    Male
  • Location
    Croatia
  • Age
    34

Contact Methods

  • Skype
    mario.lukacic.or
  1. He means space between posts margin-bottom:;
  2. You can't get messages, my email is mlukac89@gmail.com
  3. Why you don't test on localhost before you put it on live page ? Probably is problem in css or in some widget. Use F12 in chrome to see where it broke, and check path to the image. Can you post your page URL ?
  4. So i need to redirect like header("Location: success.php?msg=ok"); and in success.php page <?php if (isset($_GET['msg'])) { if ($_GET['msg'] == 'ok') { header("Location: users.php"); unset($_POST); exit(); } } ?>
  5. This is a admin script, when adding a user to check if email exists, and why is bogus ? It's normal on register site too that you give a message to a user that email is in use. Where is problem ? This is in class Users public function email_exists($email) { $query = $this->db->prepare("SELECT email FROM users WHERE email = :email"); $query->bindParam(':email', $email); $query->execute(); if ($query->rowCount() > 0) { return true; } else { return false; } }
  6. Hi I have a problem as title says with form resubmission. I think all know what i mean. When i process form, i redirect to another page, and if i hit back button in browser it give me a page with "Confirm form resubmission", and if i press F5 i got pop-up window and it process form again even if i unset($_POST); data. <?php include '../config.php'; // process form if (isset($_POST['submit'])) { $username = trim($_POST['username']); $password = trim($_POST['password']); $email = trim($_POST['email']); // check if username is in use if ($users->user_exists($username) === true) { $error = '<div class="alert alert-warning alert-dismissible fade-in"> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> Username in use, please choose another one. </div>'; // check if email alrady registered } elseif ($users->email_exists($email) === true) { $error = '<div class="alert alert-warning alert-dismissible fade-in"> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> Email in use, please choose another one. </div>'; } else { $error = "success"; // unset post variables unset($_POST); header("refresh:5;url=users.php"); exit(); } } ?>
  7. @Kwright02 try this if works, http://php.net/manual/en/mysqli-result.fetch-array.php <?php $host = "localhost"; $username = "xxx"; $password = "xxx"; $dbname = "xxx"; $mysqli = new mysqli($host, $username, $password, $dbname); // check connection if ($mysqli->connect_errno) { echo "Connect failed: ", $mysqli->connect_error); exit(); } $query = "SELECT paragraphtext FROM mainpage WHERE paragraphnum='1'"; $result = $mysqli->query($query); // if query runs if ($result) { // loop through results and echo them in paragraph while ($row = $result->fetch_array(MYSQLI_ASSOC)) { echo '<p>'.$row["paragraphtext"] .'</p>'; } } else { echo 'There was a problem with query.'; } // close connection $mysqli->close(); ?>
  8. If you are using a CMS why you simple don't read a documentation first how things do ? Here you have a plain html code and you need php. http://docs.couchcms.com/tutorials.html
  9. So switching to utf8_unicode_ci is better but is slower as they said. This will have impact on many blog post for slower loading ? "The disadvantage of utf8_unicode_ci is that it is a little bit slower than utf8_general_ci."
  10. Thanks, i changed from utf8_bin to utf8_general_ci and now all works fine.
  11. Its showing this array(1) { [0]=> array(4) { ["Table"]=> string(4) "blog" [0]=> string(4) "blog" ["Create Table"]=> string(404) "CREATE TABLE `blog` ( `id` int(11) NOT NULL AUTO_INCREMENT, `heading` varchar(255) COLLATE utf8_bin NOT NULL, `text` text COLLATE utf8_bin NOT NULL, `image` varchar(255) COLLATE utf8_bin NOT NULL, `status` varchar(255) COLLATE utf8_bin NOT NULL, `created_date` varchar(255) COLLATE utf8_bin NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COLLATE=utf8_bin" [1]=> string(404) "CREATE TABLE `blog` ( `id` int(11) NOT NULL AUTO_INCREMENT, `heading` varchar(255) COLLATE utf8_bin NOT NULL, `text` text COLLATE utf8_bin NOT NULL, `image` varchar(255) COLLATE utf8_bin NOT NULL, `status` varchar(255) COLLATE utf8_bin NOT NULL, `created_date` varchar(255) COLLATE utf8_bin NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COLLATE=utf8_bin" } } btw when i press submit button without enter any search term it give me all data from blog table
  12. Hi I have a issue with function for searching a title of a blog. I have a title in table "My blog 123", and if i try to search for "my blog" i don't get any results so its case sensitive, but when try to search "My blog" or "My" i got results. Even with searching "blog" i don't get any result, like it try to search from first letter only. So how can i fix this to search if i type "blog" or "my blog" to give me results with all titles with "blog" or "Blog" in title ignoring uppercase or lowercase letters or position in sentence. if (isset($_POST['submit'])) { $term = $_POST['search']; $stmt = $dbh->prepare("SELECT * FROM blog WHERE heading LIKE :term"); $stmt->bindValue(':term', '%'.$term.'%', PDO::PARAM_STR); $stmt->execute(); $data = $stmt->fetchAll(PDO::FETCH_ASSOC); print_r($data); }
  13. Yea i know now, this code works but as Jaques1 said if its posted its better to make it secure. Btw i readed this page about security https://martinfowler.com/articles/web-security-basics.html and i know that i need to validate all inputs and outputs same as url but i make this only to that guy see how he can get, delete, edit stuff, but i won't post codes anymore because better is to leave to peoples learn to code by themself.
  14. Jacques1 i will have that in mind. I know many peoples copy/paste codes but why this approach is not good if you want to make all php logic in 1 script ? And can you explain me what need to be fixed in code ?
×
×
  • 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.