How strong do salts need to be?
At the moment I use this function to generate a "unique" salt upon user registration:
$salt = substr(str_shuffle('0123456789abcdefghijklmnopqrstuvwxyz'), 0, 12);
I then hash it with sha1 along with the password.
What do you think?
PS. I'm not planning on getting MySpace big.
...
how can i send and recieve files live like in yahoo chat..i.e if i send the file than the user on the other end will only get that file if he click on the accept button and if he click deny than the file should not upload and should be deleted from the server...i want to that via php jquery $.ajax()
...
I just moved a develoment site onto a test production server and I'm testing some things out.
When you go to the root URL (ie rooturl.com), the browser is correctly rendering rooturl.com/index.php without showing the index.php in the address bar.
However, I also have a directory at rooturl.com/admin that also has an index file of index...
In my framework, I have a method that returns an array with objects.
It looks pretty much like this:
/**
* @return array Array with Action objects
*/
public function getActions() {
return $this->actions;
}
The user of this Class will get an doc-popup when calling this method, which only says that this met...
Hi,
I don't understand why this piece of code miserably fails.
The first pass of the for() loop works fine but in the second pass mssql_query() fails, no errors are reported and the program just die.
for($i=0; $i <2; $i++){
$query = "SELECT * FROM Viaggio ";
$result = mssql_query($query, $link) or die("query fallita:".msql...
i want to make my site available in several languages, but im not going to use user registration so how can i make a language system?
searched for a cookie language system tutorial but didnt found anything
if you have any other suggestion please share, and i cant use modrewrite
...
At first I was going to use doctrine ORM as the main one but it was an overkill, unneeded features and probably excessive calls. One of the main reasons was the "helper" that handled traverse trees (the hierarchy tree) easily but I'm starting to prefer building my own class.
This is what I'm looking for:
1) Can manage multiple databa...
I am retrieving another page using cURL, and unless I have a certain cookie I cannot see the page content. The cookie name is seepage and its value must be set to 1 for me to see the page content.
I would like to load this page using cURL, and this is the script I have at the moment:
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_...
I need to display some random data (1 row) from MySQL table and performance is very important for me. It doesn't necessarily has to be absolutely unique and super random data, so I have two options:
1) Query the database (my table has > 500 000 rows);
2) Automatically once a week create a flat text file (or php file with an array) from...
I have a script which allows the user to create a simple poll, each poll's ID is stored in a text file seperated by a comma: like so:
001,003,005,
I then use a foreach loop to get these poll ID's from the text file.
All relativly simple, however the way in which I create the row of text in the file always add's a comma (,) at the e...
When including a file in another, I want to end the parsing after a certain if statement.
Is it ill advised to use this method for terminating a parsing of a script, and does exit; terminate parsing at all, or just the rest of the current php file?
...
I am trying to create events on Facebook using Facebook connect. So far, the
$appapikey = 'my key here';
$facebook = new Facebook($appapikey, 'my secret here');
$user = $facebook->require_login();
$fapi = $facebook->api_client;
if(!$facebook->api_client->users_hasAppPermission('create_event')){
echo'<script type="text/javascript"...
How do I prevent XSS (cross-site scripting) using just HTML and PHP?
I'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.
...
I have a php page where users may enter data into fields inside a form.
The form also has a picture upload utility.
This page is refreshed every time a new picture is uploaded, so to 'remember' the values the user ALREADY has filled in, I have this code:
<input type="text" value="<?php echo @$_POST['name'];?>">
This DOESN'T work for d...
For some reason, my form breaks when I try to make a file upload required. Here is the code for it:
$form_id = "upload_form";
$form[$form_id] = array (
'#type' => 'fieldset',
'#description' => t('This is a utility to import nodes from a Comma Separated Value file. To begin, pick a node type, and upload a CSV.'),
);
$form[$form...
Is there way to return a two dimensional array from a SQL query? Like..
"SELECT id, x, y, z FROM test"
..and have it return as id => x, y, z? I could do a loop and create a second array but I imagine that's extra work that I might not have to do. Just not familiar with SQL right now.
...
Our development server has suffered some configuration mismatch on recent update to PHP 5.3, and now I can't see any errors any time I hit a fatal/parse error, I just see a blank page.
Now, I know how to enable error reporting in normal cases, but I don't have access to php.ini and ini_set('display_errors', 1) obviously doesn't cut it ...
So ....
There are obviously many questions that all have been asked about Singletons, Global State Variables, and all that great stuff. My question is,
If Singletons and Globals are So Bad, Why are they used so often?
The following examples are simply ones off the top of my head that I believe are used by a good chunk of people.
I g...
Question: Is preventing XSS (cross-site scripting) as simple using strip_tags on any saved input fields and running htmlspecialchars on any displayed output ... and preventing SQL Injection by using PHP PDO prepared statements?
Here's an example:
// INPUT: Input a persons favorite color and save to database
// this should prevent SQL i...
Hello everyone,
Okay, so I have been using a PDO wrapper for a project I'm working on, and I'm trying to find out whether a DELETE query was successful or not. Here is the code I am using:
/**
* A pretty straight-forward query to delete a row from the verification
* table where user_id is $user_id and code is $code
*/
$result = $this->...