Cleansing User Passwords

<p>How should I escape or cleanse user-provided passwords before I hash them and store them in my database?</p> <p>When PHP developers consider hashing users&rsquo; passwords for security purposes, they often tend to think of those passwords like th

My PDO Statement doesn't work

<p>This is my PHP sql statement and it&rsquo;s returning false while var dumping</p> <pre><code>$password_md5 = md5($_GET[&amp;#39;password&amp;#39;]); $sql = $dbh-&amp;gt;prepare(&amp;#39;INSERT INTO users(full_name, e_mail, username, password, pas

check if row exists with mysql

<p>I need help checking if a row exists. I am getting &ldquo;email no longer exists;.</p> <p>Is there a better way to check if row exists with mysqli?</p> <pre><code>if (count($_POST)) { $email = $dbl-&amp;gt;real_

Send attachments with PHP Mail()?

<p>I need to send a pdf with mail, is it possible?</p> <pre><code>$to = &amp;#34;xxx&amp;#34;; $subject = &amp;#34;Subject&amp;#34; ; $message = &amp;#39;Example message with &amp;lt;b&amp;gt;html&amp;lt;/b&amp;gt;&amp;#39;; $headers = &amp;#39;MIM

Good PHP ORM Library?

<p>Is there a good object-relational-mapping library for PHP?</p> <p>I know of <a href="" rel="noreferrer">PDO</a> /ADO, but they seem to only provide abstraction of differences between database vendors not

Get the full URL in PHP

<p>I use this code to get the full URL:</p> <pre><code>$actual_link = &amp;#39;http://&amp;#39;.$_SERVER[&amp;#39;HTTP_HOST&amp;#39;].$_SERVER[&amp;#39;PHP_SELF&amp;#39;]; </code></pre> <p>The problem is that I use some masks in my <span class="in

PHP global in functions

<p>What is the utility of the <a href="" rel="external">global keyword</a> ?</p> <p>Are there any reasons to prefer one method to another?</p> <ul><li>Security

Parsing JSON file with PHP

<p>I tried to parse a JSON file using PHP. But I am stuck now.</p> <p>This is my JSON file</p> <pre><code>{ &amp;#34;John&amp;#34;: { &amp;#34;status&amp;#34;:&amp;#34;Wait&amp;#34; }, &amp;#34;Jennifer&amp;#34;: { &amp;

Alternative for PHP_excel

<p>Is there any alternative for PHP_excel which can &ldquo;Export to XLSX/XLS&rdquo; file in a customized format?</p> <blockquote><strong>This is a <a href="" rel="external">General Reference</a> question for t

How to prevent XSS with HTML/PHP?

<p>How do I prevent XSS (cross-site scripting) using just HTML and PHP?</p> <p>I&rsquo;ve seen numerous other posts on this topic but I have not found an article that clear and concisely states how to actually prevent XSS.</p> <p><br><br><br><h1>An

When is eval evil in php?

<p>In all the years I have been developing in php, I&rsquo;ve always heard that using <span class="inlinecode">eval()</span> is evil.</p> <p>Considering the following code, wouldn&rsquo;t it make sense to use the second (and more elegant) option? I

How to make a redirect in PHP?

<p>Is it possible to redirect a user to a different page through the use of PHP?</p> <p>Say the user goes to <span class="inlinecode"></span> and I want to redirect them to <span class="inlinecode"><

Delete an element from an array

<p>Is there an easy way to delete an element from a PHP array, such that <span class="inlinecode">foreach ($array)</span> no longer includes that element?</p> <p>I thought that setting it to null would do it, but apparently not.</p> <p><br><br><br

UTF-8 all the way through

<p>I&rsquo;m setting up a new server, and want to support UTF-8 fully in my web application. I have tried in the past on existing servers and always seem to end up having to fall back to ISO-8859-1.</p> <p>Where exactly do I need to set the encoding

When to use self over $this?

<p>In PHP 5, what is the difference between using <span class="inlinecode">self</span> and <span class="inlinecode">$this</span> ?</p> <p>When is each appropriate?</p> <p><br><br><br><h1>Answer</h1> <h1>Short Answer</h1> <blockquote>Use <span cla

php execute a background process

<p>I need to execute a directory copy upon a user action, but the directories are quite large, so I would like to be able to perform such an action without the user being aware of the time it takes for the copy to complete.</p> <p>Any suggestions wo