Find Jobs
Hire Freelancers

A event software

$10-30 USD

Closed
Posted almost 8 years ago

$10-30 USD

Paid on delivery
So I'm from faroeisland a small country and i've made a software for Dota 2, Counter strike and League of legends where people are able to sit down in a lobby on my webpage(wordpress). But I need some improvements in my code and some additional features. I'm not sure what the budget is needed but If you know your PhP and mysql it's an easy task. This is my code so far :) PHP [login to view URL] <?php /*Plugin Name: Lobby manager Description: Show a lobby section Version: 0.1 Author: Jóannes á Fløtti Author URI: [login to view URL] License: GPLv2 */ /* Lobby lists /* ------------------------------------ */ function generate_lobby_list($game) { global $wpdb; $list = []; $query = $wpdb->get_results( "SELECT ID, time FROM esport_event where game = '".$game."' order by time"); foreach($query as $row) { $list[$row->ID] = ['time' => $row->time]; } //$query = $wpdb->get_results( "SELECT user_id, event_id FROM esport_user_event where date = '" . date('Y-m-d') ."'" ); return $list; } function my_assets() { wp_enqueue_style('lobby-manager', plugins_url( '/css/[login to view URL]', __FILE__ )); wp_enqueue_script( 'lobby-manager', plugins_url( '/js/[login to view URL]', __FILE__ ), array( 'jquery' ) ); wp_localize_script( 'lobby-manager', 'sitdown', array( 'ajax_url' => admin_url( '[login to view URL]' ) )); } add_action( 'wp_enqueue_scripts', 'my_assets' ); class ESport_Lobby_Manager_Widget extends WP_Widget { function __construct() { parent::__construct( // base ID of the widget 'esport_lobby_mananger_widget', // name of the widget __('Lobby manager', 'esport' ), // widget options array ( 'description' => __( 'Creates a lobby section', 'esport' ) ) ); } function form( $instance ) { // markup for form $time = $instance[ 'lobbytime' ]; $game = $instance[ 'lobbygame' ]; ?> <p> <label for="<?php echo $this->get_field_id( 'lobbygame' ); ?>">Spæl:</label> <select class="widefat" name="<?php echo $this->get_field_name( 'lobbygame' ); ?>" id="<?php echo $this->get_field_id( 'lobbygame' ); ?>"> <option value="dota2">Dota 2</option> <option value="cs">Counter Strike: Global Offensive</option> <option value="lol">League of legends</option> <option value="rocketleague">Rocket League</option> </select> </p> <?php } function update( $new_instance, $old_instance ) { $instance = $old_instance; $instance[ 'lobbygame' ] = strip_tags( $new_instance[ 'lobbygame' ] ); return $instance; } function widget( $args, $instance ) { extract( $args ); $date = new DateTime(); $list = generate_lobby_list($instance['lobbygame']); echo '<div class="row" style="z-index:10">'; foreach($list as $key => $lobby) { $timeArr = explode(':',$lobby['time']); $date->setTime($timeArr[0],$timeArr[1]); ?> <div class="col-lg-4 col-md-4 col-sm-12 col-xs-12 lobby-<?php echo $key; ?>"> <h2 class="lead"> Klokkan <?php echo substr($lobby['time'],0,-3); ?> FO t&iacute;&eth; <img src="<?php echo plugins_url( '/img/[login to view URL]', __FILE__); ?>" class="loading pull-right"> </h2> <form class="form-inline lobby-container"> <?php if ( is_user_logged_in()) { if($date->getTimestamp() > time()) { $user = wp_get_current_user(); ?> <div class="regForm hide"> <div class="form-group"> <label class="sr-only" for="playerProfileName">Eyðkennis navn</label> <input type="text" class="form-control" name="playerProfileName" value="<?php echo esc_attr( get_the_author_meta( 'dotaprofile', $user->ID ) ); ?>" placeholder="Eyknevni"> <input type="hidden" name="playerProfileID" value="<?php echo $user->ID; ?>" placeholder="Eyðkennis navn"> </div> <button type="button" class="btn btn-success sitdown">Set teg</button> </div> <button type="button" value="<?php echo $user->ID; ?>" class="btn btn-warning leave hide">Reis teg</button> <?php } else { ?> <p> <strong> Ikki møguligt at seta seg! </strong> </p> <?php } } else { ?> <p> <strong> Logga á fyri at seta teg! </strong> </p> <?php } ?> <ul class="lobby-list fade-in" id="playersInLobby-<?php echo $key; ?>"></ul> <!-- <button type="button" class="btn btn-default update hide">Dagfør</button>--> </form> <script> jQuery(function(){ jQuery('lobby-<?php echo $key; ?>').lobbyManager({ lobby: 'div.lobby-<?php echo $key; ?>', lobbyID: <?php echo $key; ?>, container: 'form.lobby-container', list: '#playersInLobby-<?php echo $key; ?>' }); }); </script> </div> <?php } echo '</div>'; } } function esport_register_lobby_manager_widget() { register_widget( 'ESport_Lobby_Manager_Widget' ); } add_action( 'widgets_init', 'esport_register_lobby_manager_widget' ); function esport_lobby_widgets_init() { register_sidebar( array( 'name' => 'Dota lobby', 'id' => 'dota_lobby_section', 'before_widget' => '<div id="esport-dota-lobby-manager">', 'after_widget' => '</div>', 'before_title' => '<h2 class="rounded">', 'after_title' => '</h2>', ) ); } add_action( 'widgets_init', 'esport_lobby_widgets_init' ); add_action( 'wp_ajax_take_a_seat', 'prefix_ajax_take_a_seat' ); //add_action( 'wp_ajax_nopriv_take_a_seat', 'prefix_ajax_take_a_seat' ); function prefix_ajax_take_a_seat() { global $wpdb; if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { try { $wpdb->insert( 'esport_user_event', array( 'user_id' => filter_input(INPUT_POST, 'id'), 'event_id' => filter_input(INPUT_POST, 'event'), 'name' => filter_input(INPUT_POST, 'name'), 'date' => date('Y-m-d') ), array( '%d', '%d', '%s', '%s', ) ); echo json_encode(['status' => $wpdb->insert_id, 'message' => ($wpdb->insert_id > 0) ? 'Welcome to lobby' : 'No mana left!']); } catch (Exception $e) { echo $e->getMessage(); } die(); } else { echo json_encode(['status' => 0, 'message' => 'No funky business here!']); die(); } } add_action( 'wp_ajax_leave_a_seat', 'prefix_ajax_leave_a_seat' ); //add_action( 'wp_ajax_nopriv_take_a_seat', 'prefix_ajax_take_a_seat' ); function prefix_ajax_leave_a_seat() { global $wpdb; if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { try { $wpdb->query( $wpdb->prepare( " DELETE FROM esport_user_event WHERE user_id = %d AND event_id = %d AND date = %s ", filter_input(INPUT_POST, 'id'), filter_input(INPUT_POST, 'event'), date('Y-m-d') ) ); echo json_encode(['status' => 1, 'message' => 'Regeneration!']); } catch (Exception $e) { echo $e->getMessage(); } die(); } else { echo json_encode(['status' => 0, 'message' => 'No funky business here!']); die(); } } add_action( 'wp_ajax_update_a_lobby', 'prefix_ajax_update_a_lobby' ); add_action( 'wp_ajax_nopriv_update_a_lobby', 'prefix_ajax_update_a_lobby' ); function prefix_ajax_update_a_lobby() { global $wpdb, $current_user; if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { $user = wp_get_current_user(); $query = $wpdb->get_results( $wpdb->prepare( "SELECT user_id, name FROM esport_user_event WHERE event_id = %d AND date = %s ORDER BY id asc ", filter_input(INPUT_POST, 'event'), date('Y-m-d') )); $list = ""; if($wpdb->num_rows) { $i = 1; $seated = false; foreach($query as $row) { if($i <= 10) { $list .= '<li class="player-'.$row->user_id.'">' . $row->name . '</li>'; } if($row->user_id == $current_user->ID) { $seated = $i; } $i++; } } else { $list .= '<li><strong>Eingin í lobby</strong></li>'; } echo json_encode(['status' => 1, 'count' => $wpdb->num_rows, 'list' => $list, 'seated' => $seated]); die(); } else { echo json_encode(['status' => 0, 'message' => 'No funky business here!']); die(); } }
Project ID: 10110959

About the project

5 proposals
Remote project
Active 8 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
5 freelancers are bidding on average $88 USD for this job
User Avatar
Hi there - My name is Jhalak. I’ve read your brief and can see that you’d like to build an Website. My team has 4 years experience designing and developing mobile apps and Websites. I would approach your project by starting with wireframes and getting the site completed, before starting the actual development phase. I am highly qualified for this project and would love to speak with you further about taking this project on. If you'd like to view my previous work, take a look at my Freelancer Portfolio. Regards, Jhalak Thanks, Diamond looking forward for your reply.
$25 USD in 1 day
4.8 (42 reviews)
4.8
4.8
User Avatar
Relevant Experience and Qualifications: Hello Dear I am Sanjay Rajput… Your job attracted my attention because it is compatible with my freelancing interests and experience… For your fee, you will receive my undivided attention to this project. It will be completed to your specifications and delivered when you need it. For clarification, may I ask, ‘Does your audience respond better to a general or more technical approach?' I hope to hear from you soon so we can start working on this as soon as possible. ---------------------------------------------------------------------------------------------------- Approach to the Job: About Me I have 4+ year of experience in the Web Development in PHP, My SQL, and the CMS like Wordpress, Magento. And I have Worked on Many Domains like Custom CMS, Hospital, Medicine, Organization, Video Library and Many Portals Built with PHP and My SQL. So I have Strong Knowledge of PHP and My SQL, And My Goal is Satisfaction of Client. Thanks & Regards, Sanjaysinh Rajput
$66 USD in 1 day
0.0 (0 reviews)
0.0
0.0

About the client

Flag of DENMARK
Denmark
0.0
0
Member since Apr 2, 2016

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.