Phpcs cherrypick #10

wants to merge 2 commits into from

8 participants


Successor of the phpcs PR. But not with all the changes of the PSR-0 Test suite.
Feedback welcome.


PHP FIG member

@gsherwood are you able to comment on the quality of this PR since you're the one who was leading the PHPCS stuff.


It seems like PHPCS standards belong in the PHPCS repo (where the PSR-1 and PSR-2 standards currently are). Or, if we want to host canonical standards, they should probably go in a separate repo.


Justin - where are these standards? I thought was the official location.


@AmyStephen the PSR standards are there. The PHPCS standards are here.



Thank you. There are far too many acronyms for this old brain to keep with. :-P

I agree with your comment to keep these resources in one place. Also, it might be helpful to add a link to those definitions from here -- maybe even as a footnote right inside of the published standard in this repo.


I'd be happy to look at this sniff and write some unit tests for it if you want to contribute it to PHP_CodeSniffer. Given PSR-1 includes PSR-0 and PSR-2 includes PSR-1, it would mean that developers who are using PHPCS to check their code against PSR-1 or PSR-2 would automatically get this check as well, instead of them having to write a custom standard to include it.

Submit a PR in if you that is something you'd like to do, or just let me know and I'll port the code over to a new PSR0 directory under CodeSniffer/Standards


Hello there;
I have created a profile page and it all works except that instead of posting each person's individual weight, it only grabs the first person's from the database and posts that for everyone. Here is the code... I cannot figure out what I am forgetting... I know it is probably something really simple too... I hope that someone can help me soon please...

Thank you so much!

The code is:

$usernames = array("user1", "user2", "user3", "admin", "new user");
$passwords = array("password1", "password2", "password3", "admin", "new password");
$page = "protected_page.php";
$page_title = 'login';
$page_title = 'login-home';
$page_title = 'logout';
for($i=0;$i {

// Connect to the database
$dbc = mysql_connect('', 'jaeger', 'Activate1!', 'jaeger');

//database connect info here

//check for file upload
if(isset($_FILES['csv_file']) && is_uploaded_file($_FILES['csv_file']['tmp_name'])){

//upload directory
$upload_dir = "uploads/";

//create file name
$file_path = $upload_dir . $_FILES['csv_file']['name'];

//move uploaded file to upload dir
if (!move_uploaded_file($_FILES['csv_file']['tmp_name'], $file_path)) {

    //error moving upload file
    echo "Error moving file upload";


//open the csv file for reading
$handle = fopen($file_path, 'r');

//turn off autocommit and delete the product table
mysql_query("SET AUTOCOMMIT=0");

while (($data = fgetcsv($handle, 1000, ',')) !== FALSE) {


    //Access field data in $data array ex.
    $firstname = addslashes($data[2]);
    $lastname = addslashes($data[3]);
    $email = addslashes($data[4]);
    $teams = addslashes($data[5]);
    $address = addslashes($data[6]);
    $city = addslashes($data[7]);
    $state = addslashes($data[8]);
    $zipcode = addslashes($data[9]);
    $phonenumber = addslashes($data[10]);
    $username = addslashes($data[11]);
    $password = addslashes($data[12]);

    $sql = "INSERT into groups(first_name,last_name,email,radio_name, address, city, state, zipcode, phonenumber, username, password, confirmcode) VALUES('$firstname','$lastname','$email','$teams','$address','$city','$state','$zipcode','$phonenumber','$username','$password','y')";
    mysql_query($sql) or (mysql_query("ROLLBACK") and die(mysql_error() . " - $sql"));


//commit the data to the database
mysql_query("SET AUTOCOMMIT=1");

//delete csv file


$pagenum = $_GET["pagenum"];
if (!(isset($pagenum)))


$pagenum = 1;


$query = "SELECT,first_name,last_name,username,p.weight1,p.weight2,p.weight3,p.weight4,p.weight5,p.weight6,p.weight7,p.weight8 FROM groups g left join profile p on order by first_name asc";
$data = mysql_query($query,$dbc) or die(mysql_error());
$rows = mysql_num_rows($data);
$page_rows = 1;
$last = ceil($rows/$page_rows);
if ($pagenum < 1)
$pagenum = 1;

elseif ($pagenum > $last)
$pagenum = $last;
$max = ' limit ' .($pagenum - 1) * $page_rows .',' .$page_rows;
$query=$query. $max;
$data_p = $data = mysql_query($query,$dbc) or die(mysql_error());

Activate Simi Valley - Home

group class group walks swimming vegetables

<!-- end .sidebar1 -->

Activate Simi Valley

Activate Simi Valley

Our Mission: To support healthy living in Simi Valley

Welcome <?php echo $_SESSION['name_of_user']; ?> to your personal profile

This is where you can periodically check on your progress.

Healthy Living Guide

Weigh-In Log

"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } ?>
Weight1 Weight2 Weight3 Weight4 Weight5 Weight6 Weight7 Weight8
". $row["weight1"] ."  ". $row["weight2"] ."  ". $row["weight3"] ."  ". $row["weight4"] ."  ". $row["weight5"] ."  ". $row["weight6"] ."  ". $row["weight7"] ."  ". $row["weight8"] ." 

Logout|  Profile | Users | Add User | Upload Users | User Weight Profiles 



Facebook Twitter

Email: YMCA Sponsored by the: Simi Valley YMCA Simi Valley YMCA

Frequently Asked Questions (FAQ)
Web Designer: Linda Designs

Back to the top
<!-- end .content --></div>

<!-- end .container -->



Hi @LindaMann

This is still not an appropriate venue for your questions. Also, you posted your database credentials again. You probably don't want to do that.


Hello again, @LindaMann -

Agree with @BobtheCow .

My suggestion earlier was to use Google to search for a support forum that offers the services you are after. I went ahead and found three forums where volunteers provide free support for PHP questions. Please try one of these:


It looks like @gsherwood is waiting on a PR to their repo, so this can go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment