示例#1
0
                        if (isset($_POST['artistId'])) {
                            $artistId = intval($_POST['artistId']);
                        }
                        $has_error = false;
                        if (empty($name)) {
                            $name_error = "Artist name cannot be empty";
                            $has_error = true;
                        }
                        if ($formationZipCode <= 9999) {
                            $formationZipCode_error = "Formation zipcode must be 5 digits";
                            $has_error = true;
                        }
                        if (!$has_error) {
                            // Successful
                            if ($artistId == -1) {
                                $ret = add_artist($name, $formDate, $breakupDate, $formationZipCode);
                            } else {
                                $ret = update_artist($artistId, $name, $formDate, $breakupDate, $formationZipCode);
                            }
                            if (!$has_error) {
                                header('Location: artists.php?action=list', true);
                                die;
                            }
                        }
                    }
                    // Display add artist page
                    ?>
	<form action="" method="post" style="display: block;">
		<div class="form-group">
			<input type="text" name="name" id="name" tabindex="1" class="form-control" placeholder="Name" value="<?php 
                    echo $name;
示例#2
0
    if (!check_perms('site_collages_delete')) {
        if ($MaxGroups > 0 && $NumTorrents + count($URLs) > $MaxGroups) {
            $Err = "This collage can only hold {$MaxGroups} artists.";
        }
        if ($MaxGroupsPerUser > 0 && $GroupsForUser + count($URLs) > $MaxGroupsPerUser) {
            $Err = "You may only have {$MaxGroupsPerUser} artists in this collage.";
        }
    }
    foreach ($URLs as $URL) {
        $Matches = array();
        if (preg_match('/^' . ARTIST_REGEX . '/i', $URL, $Matches)) {
            $ArtistIDs[] = $Matches[4];
            $ArtistID = $Matches[4];
        } else {
            $Err = "One of the entered URLs ({$URL}) does not correspond to an artist on the site.";
            break;
        }
        $DB->query("\n\t\t\tSELECT ArtistID\n\t\t\tFROM artists_group\n\t\t\tWHERE ArtistID = '{$ArtistID}'");
        if (!$DB->has_results()) {
            $Err = "One of the entered URLs ({$URL}) does not correspond to an artist on the site.";
            break;
        }
    }
    if ($Err) {
        error($Err);
    }
    foreach ($ArtistIDs as $ArtistID) {
        add_artist($CollageID, $ArtistID);
    }
}
header("Location: collages.php?id={$CollageID}");