TVProjects top



TVProjects bottom
You are not registered.
Registration allows you to subscribe to projects, open projects, and more. Click here to register.

Website Source Code
<< Back

create.php

<?php
    
function get_create()
    {
        global 
$categories$logged_user$url;
        
        if (
$logged_user != -1)
        {        
            
$selected 0;
            
$vars['ERRORS'] = '';
            
$vars['TITLE'] = '';
            
$vars['DESC'] = '';
            
            if (isset(
$_POST['sent']))
            {
                
$title $_POST['title'];
                
$cat intval($_POST['category']);
                
$desc $_POST['desc'];
                
                if (
strlen($title) == 0)
                    
$vars['ERRORS'] .= 'Please enter the project title.<br />';
                    
                
//if (strlen($desc) == 0)
                //    $vars['ERRORS'] .= 'Please enter a description.<br />';
                    
                
if (($cat 0) or ($cat 13))
                    
$vars['ERRORS'] .= 'Invalid category.<br />';
                    
                if (
$vars['ERRORS'] == '')
                {
                    
mysql_query('INSERT INTO `projects` (`name`, `category`, `description`, `options`, `positions`, `staff`, `started`, `hiring`, `last`) VALUES
                                                        (\'' 
db_escape($title) . '\', ' $cat ', \'' db_escape($desc) . '\', 15, \'Project Leader\', \'' $logged_user '-0\', ' time() . ', \'\', ' time() . ');');
                    
$id mysql_insert_id();
                    
mkdir('projects_media/' $id '/');
                    
copy('images/default_icon.png''projects_images/' $id '.png');
                    
copy('images/no_logo.png''projects_logos/' $id '.png');
                    
                    
update_member_of($logged_user);
                    
                    
$link create_link($cat$id$title);
                    
$ret '<div style="font-weight: bold; font-size: 20px; color: green">The project has been successfuly created!</div><br />';
                    
$ret .= 'Click <a href="' $link '">here</a> to enter your project page. Your project link is:';
                    
$ret .= '<div style="font-size: 13px; color: #6185b0">' $url $link '</div>';
                    
                    
tell_users(1, -1'A new project has created on TVProjects: ' $title'A project called ' $title " has created on TVProjects:\n$url$link");
                    
                    return 
$ret;
                }
                else
                {
                    
$vars['TITLE'] = escape_html($title);
                    
$vars['DESC'] = escape_html($desc);
                    
$selected $cat;
                }
            }
            
            
$nbsps '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
            
$vars['CATEGORIES'] = '<option disabled="disabled">Applications</option>';
            for(
$i 0$i 5$i++)
            {
                if (
$i == $selected)
                {
                    
$vars['CATEGORIES'] .= '<option value="' $i '" selected="selected">' $nbsps $categories[$i] . '</option>';
                }
                else
                {
                    
$vars['CATEGORIES'] .= '<option value="' $i '">' $nbsps $categories[$i] . '</option>';
                }
            }
            
$vars['CATEGORIES'] .= '<option disabled="disabled">Games</option>';
            for(
$i 5$i 14$i++)
            {
                if (
$i == $selected)
                {
                    
$vars['CATEGORIES'] .= '<option value="' $i '" selected="selected">' $nbsps $categories[$i] . '</option>';
                }
                else
                {
                    
$vars['CATEGORIES'] .= '<option value="' $i '">' $nbsps $categories[$i] . '</option>';
                }
            }
            
            return 
get_template('create'$vars);
        }
        else
        {
            return 
'<div style="font-style: italic">You have to log in in order to open a project.</div>';
        }
    }
?>