What is the most useless thread on Elakiri?

shenic

Member
May 9, 2013
13,213
1,290
0
Bermuda ∆
den ajax ehema nethuwa ma ba ne ban.. den owa onemai

firebug dalada tiyenne? errors enne nedda? code eka post karapan balanna..

jquery load wenawada?

script ekata meka dala balanna..

PHP:
(function($){
  console.log('OK');
})(jQuery)

jQuery load wenawa ban :(
mama wada karanne CodeIgniter walin.

PHP:
<script type="text/javascript">	

	var base_url = "<?php echo base_url() ?>";

	$(document).ready(function (){
		add_item();
	});

	function add_item()
	{
		$('#add').click(function(){

			var country 	= $('#country').val();
			var position 	= $('#position').val();
			var from 		= $('#from').val();
			var to 			= $('#to').val();

			if (country == '', position == '', from == '', to == '')
			{
				alert('ERROR');
			}
			else
			{
				$.post(base_url + 'index.php/Ajax/function_name', 
						{	
							'country': country,
							'position': position,
							'from': from,
							'to': to
						},
							function (result)
							{								
								if (result == 'Yes')
								{
									alert("yes");
								}
								else
								{
									alert("No");
								}
							}
				);
			}
		});
	}

</script>


Console Error

1.jpg

"NO" kiyalaa nan alert wenawa!

db, table names wenas kaleth na.
controller - function codes wenas kaleth na.
model - functions codes wenas kaleth na.
eeye wada kala dan wada karanne na. :(
:( :( :( :(
 

shenic

Member
May 9, 2013
13,213
1,290
0
Bermuda ∆
Cookie clear karala balanna... PMA eka JS nathuwa wunath wada karanawa. Js support eka cookie ekaka thamai save karaganne.
Matanam ehema awulak wela na ban kawadawath.

phpmyadmin wada karanawa.. js witharai wada naththe... :(
settings wenas kaleth na.. :(

matath kawadaawath wela naha..:dull: 1st time une! :sorry:

mee ekak wath wada karanne naha... :no:

2.jpg

3.jpg

4.jpg


mama me aapahu reinstall karanna kiyala baluwe.. :(
 

Lakshan-Seram

Well-known member
  • May 31, 2011
    24,721
    12,632
    113
    127.0.0.1:8080/Kandy
    jQuery load wenawa ban :(
    mama wada karanne CodeIgniter walin.

    PHP:
    <script type="text/javascript">    
    
        var base_url = "<?php echo base_url() ?>";
    
        $(document).ready(function (){
            add_item();
        });
    
        function add_item()
        {
            $('#add').click(function(){
    
                var country     = $('#country').val();
                var position     = $('#position').val();
                var from         = $('#from').val();
                var to             = $('#to').val();
    
                if (country == '', position == '', from == '', to == '')
                {
                    alert('ERROR');
                }
                else
                {
                    $.post(base_url + 'index.php/Ajax/function_name', 
                            {    
                                'country': country,
                                'position': position,
                                'from': from,
                                'to': to
                            },
                                function (result)
                                {                                
                                    if (result == 'Yes')
                                    {
                                        alert("yes");
                                    }
                                    else
                                    {
                                        alert("No");
                                    }
                                }
                    );
                }
            });
        }
    
    </script>
    Console Error

    View attachment 59382

    "NO" kiyalaa nan alert wenawa!

    db, table names wenas kaleth na.
    controller - function codes wenas kaleth na.
    model - functions codes wenas kaleth na.
    eeye wada kala dan wada karanne na. :(
    :( :( :( :(

    php script eken ena out eka balanna..

    Capture.png
     

    shenic

    Member
    May 9, 2013
    13,213
    1,290
    0
    Bermuda ∆
    Ayeshlive & Lakshan-Seram >>>>

    ela machanla thanks.....
    aulak naha mama mokak hari kara gannam....... :)
    don't waste your valuable time for this damn shit! :)
    I could find a way... :)
     

    shenic

    Member
    May 9, 2013
    13,213
    1,290
    0
    Bermuda ∆
    php script eken ena out eka balanna..

    Capture.png

    hari yako hari! :lol: :no: :cool: :sorry: :eek: :dull: :D

    ajax.php eke bara pathala pallamaka ")" k missing! :no: :growl:

    PHP:
    $del_id = trim($this->input->post('del_id');
    :dull:

    trim() ekak ooneth na! mongal ban mata welaawakata! :sorry:
    ohee wikaaren code karanawa! :sorry:

    eeth mata error eka hoyaa ganna amaru una ban google chrome eken! :baffled:
    Firefox daala tak gaala hoyaa gaththa.... :cool:
    honda debug extension ekak hoyala balanna one Google Chrome walata :(
     

    Lakshan-Seram

    Well-known member
  • May 31, 2011
    24,721
    12,632
    113
    127.0.0.1:8080/Kandy
    hari yako hari! :lol: :no: :cool: :sorry: :eek: :dull: :D

    ajax.php eke bara pathala pallamaka ")" k missing! :no: :growl:

    PHP:
    $del_id = trim($this->input->post('del_id');
    :dull:

    trim() ekak ooneth na! mongal ban mata welaawakata! :sorry:
    ohee wikaaren code karanawa! :sorry:

    eeth mata error eka hoyaa ganna amaru una ban google chrome eken! :baffled:
    Firefox daala tak gaala hoyaa gaththa.... :cool:
    honda debug extension ekak hoyala balanna one Google Chrome walata :(


    ela ela.. denui negitte.. eye reply karanna beri una.. ninda giya :sorry:

    firebug eke tiyenawa oya scene eka...google chrome walath

    Capture.png
     

    Lakshan-Seram

    Well-known member
  • May 31, 2011
    24,721
    12,632
    113
    127.0.0.1:8080/Kandy
    hari yako hari! :lol: :no: :cool: :sorry: :eek: :dull: :D

    ajax.php eke bara pathala pallamaka ")" k missing! :no: :growl:

    PHP:
    $del_id = trim($this->input->post('del_id');
    :dull:

    trim() ekak ooneth na! mongal ban mata welaawakata! :sorry:
    ohee wikaaren code karanawa! :sorry:

    eeth mata error eka hoyaa ganna amaru una ban google chrome eken! :baffled:
    Firefox daala tak gaala hoyaa gaththa.... :cool:
    honda debug extension ekak hoyala balanna one Google Chrome walata :(

    uba code liyanne ajax.php ekemada? mama nam tikak wenas method ekak use karanne..

    ajax.php
    PHP:
    <?php
    /*
     * Application: My Reminders (NCC Level 5 June 2014).
     * Author: ******* (www.*******.com).
     * Ajax call file.
     */
    define('_VALID', true); // Hack for the security check. Make this accessible.
    require_once('includes/process.php');
    ?>
    process.php
    PHP:
    <?php
    /*
     * Author: ******* (www.*******.com).
     * Main process file used to process data sent though ajax requests.
     * Posted action is used to switch the action of processing.
     */
    defined('_VALID') or die('Restricted Access!'); // Preventing direct access of the file for security.
    require_once(dirname(__FILE__).'/config.php'); // Including the main configuration file.
    
    /*
     * Main processing script switched by the action.
     */
    if(isset($_POST['action'])){
        
        if($_POST['action']=='login'){
            
            /*
             * Processing the user login.
             */
            $username = stripslashes(strip_tags($_POST['username']));
            $password = stripslashes(strip_tags(md5($_POST['password'])));
            
            if(checkUsername($username)==false){ // Check for the already registered email addresses.
                die('Account with provided username is not available');
            }
            $role = authenticateUser($username, $password);
            if($role!=false){ // Authenticating the user.
                $userinfo = array();
                $userinfo = getUserInfoByUsername($username, $role);
                if($role=='std'){
                    $uid = $userinfo['stId'];
                }elseif($role=='stf'){
                    $uid = $userinfo['staffId'];
                }
                
                if(isset($_POST['remember'])){
                    if(!isset($_COOKIE['USR']))
                        setcookie("USR", $role.'_'.$uid, time()+172800); // Setting user remind cookie.
                }
                else{
                    if(!isset($_SESSION))
                        session_start(); // Starting the session.
                    if(!isset($_SESSION['USR']))
                        $_SESSION['USR'] = $role.'_'.$uid; // Setting the session variable.
                }
                echo 'true';
                exit;
            }else{
                die('Either username or password does not matched');
            }
            mysql_close($connect);        
        }else{
            die('Restricted Access!');
        }
    }
    else{
        die('Restricted Access!');
    }
    ?>
    meka mama me awrudakata witara kalin liwwa ekak yaluwek ge assignment ekakata.. den nam thawath tikak wenas widihata liyanne..
     

    shenic

    Member
    May 9, 2013
    13,213
    1,290
    0
    Bermuda ∆
    uba code liyanne ajax.php ekemada? mama nam tikak wenas method ekak use karanne..

    ajax.php
    PHP:
    <?php
    /*
     * Application: My Reminders (NCC Level 5 June 2014).
     * Author: ******* (www.*******.com).
     * Ajax call file.
     */
    define('_VALID', true); // Hack for the security check. Make this accessible.
    require_once('includes/process.php');
    ?>
    process.php
    PHP:
    <?php
    /*
     * Author: ******* (www.*******.com).
     * Main process file used to process data sent though ajax requests.
     * Posted action is used to switch the action of processing.
     */
    defined('_VALID') or die('Restricted Access!'); // Preventing direct access of the file for security.
    require_once(dirname(__FILE__).'/config.php'); // Including the main configuration file.
    
    /*
     * Main processing script switched by the action.
     */
    if(isset($_POST['action'])){
        
        if($_POST['action']=='login'){
            
            /*
             * Processing the user login.
             */
            $username = stripslashes(strip_tags($_POST['username']));
            $password = stripslashes(strip_tags(md5($_POST['password'])));
            
            if(checkUsername($username)==false){ // Check for the already registered email addresses.
                die('Account with provided username is not available');
            }
            $role = authenticateUser($username, $password);
            if($role!=false){ // Authenticating the user.
                $userinfo = array();
                $userinfo = getUserInfoByUsername($username, $role);
                if($role=='std'){
                    $uid = $userinfo['stId'];
                }elseif($role=='stf'){
                    $uid = $userinfo['staffId'];
                }
                
                if(isset($_POST['remember'])){
                    if(!isset($_COOKIE['USR']))
                        setcookie("USR", $role.'_'.$uid, time()+172800); // Setting user remind cookie.
                }
                else{
                    if(!isset($_SESSION))
                        session_start(); // Starting the session.
                    if(!isset($_SESSION['USR']))
                        $_SESSION['USR'] = $role.'_'.$uid; // Setting the session variable.
                }
                echo 'true';
                exit;
            }else{
                die('Either username or password does not matched');
            }
            mysql_close($connect);        
        }else{
            die('Restricted Access!');
        }
    }
    else{
        die('Restricted Access!');
    }
    ?>
    meka mama me awrudakata witara kalin liwwa ekak yaluwek ge assignment ekakata.. den nam thawath tikak wenas widihata liyanne..

    mama codeignither framework eke karanne ban.
    ajax.php eka samanya controller ekak.
    mulin eekata data gannawa.
    passe model ekata pass karanawa db ekata gahanna. :)

    ajax.php
    PHP:
    public function function_name_1()
    	{
    		$this->load->model('model_1');
    
    		if ($this->model_1->step_2(
    											trim($this->input->post('field_1')), 
    											trim($this->input->post('field_2')), 
    											trim($this->input->post('field_3')),
    											trim($this->input->post('field_4'))
    										))
    		{			
    			echo "Yes";
    		}
    		else
    		{
    			echo "No";
    		}
    	}


    model_1.php
    PHP:
    public function step_2($field_1= NULL,	$field_2 = NULL, $field_3 = NULL, $field_4  = NULL)
    	{
    		if ($this->db->query("INSERT INTO tbl_1(`id`,`field_1`,`field_2`,`field_3`,`field_4`) VALUES ('".$_COOKIE['id']."','".$field_1."','".$field_2."','".$field_3."','".$field_4."')"))
    		{
    			return TRUE;
    		}
    		else
    		{
    			return FALSE;
    		}		
    		
    	}

    db connections framework eka config karaddima set karanawa ban.. :) :)
     

    Lakshan-Seram

    Well-known member
  • May 31, 2011
    24,721
    12,632
    113
    127.0.0.1:8080/Kandy
    mama codeignither framework eke karanne ban.
    ajax.php eka samanya controller ekak.
    mulin eekata data gannawa.
    passe model ekata pass karanawa db ekata gahanna. :)

    ajax.php
    PHP:
    public function function_name_1()
        {
            $this->load->model('model_1');
    
            if ($this->model_1->step_2(
                                                trim($this->input->post('field_1')), 
                                                trim($this->input->post('field_2')), 
                                                trim($this->input->post('field_3')),
                                                trim($this->input->post('field_4'))
                                            ))
            {            
                echo "Yes";
            }
            else
            {
                echo "No";
            }
        }
    model_1.php
    PHP:
    public function step_2($field_1= NULL,    $field_2 = NULL, $field_3 = NULL, $field_4  = NULL)
        {
            if ($this->db->query("INSERT INTO tbl_1(`id`,`field_1`,`field_2`,`field_3`,`field_4`) VALUES ('".$_COOKIE['id']."','".$field_1."','".$field_2."','".$field_3."','".$field_4."')"))
            {
                return TRUE;
            }
            else
            {
                return FALSE;
            }        
            
        }
    db connections framework eka config karaddima set karanawa ban.. :) :)

    ah ela ela.. mama nam ohe php thama ;)