veedeoo 474 Junior Poster Featured Poster

My first <HTML></HTML> page was created when I was 9.

veedeoo 474 Junior Poster Featured Poster

Wow, that's pretty big investment right there. The last time I heard it was up for $185,000 per TLD..

Good luck to you.

veedeoo 474 Junior Poster Featured Poster

how about
rating and comment system.
member playlist or view list ( member can save photos in their playlist).
flagging function where users can flag photos for immediate admin reviews
recommendation function: members can recommend they like
most viewed photos
most recommended photos
top rated photos.
most commented photos

veedeoo 474 Junior Poster Featured Poster

PyCharm looks promising, but the features I like to have are all in the paid version only. Community version should help beginners and intermediate programmers/developers.

veedeoo 474 Junior Poster Featured Poster

In addition, you can also consider Django python web framework. There is one example here and more here.

veedeoo 474 Junior Poster Featured Poster

for this

mdEnc.update(source.getBytes(), 0, source.length());

not sure if you can get away with it using the PHP function called ord .

Again, I am pretty much speculating here trying to mimic that iteration effects against the length of the input string.

In PHP the lenght of the string can be determine by strlen function. Now, there is a problem with the strlen function in PHP, because all spaces are considered or treated like strings. Therefore " hello + 4 spaces ", will have a strlen value of 10 ( one space before the h and 4 spaces after the o). To alleviate this trouble, PHP offers a solution called trim.

So, now everything are in place. You just need to realize the output of the getBytes() in Java ( I know what it is, I just want you to be resourceful in finding much information about the problem on hand). If the getBytes() returns an ASCII code then, ord is the perfect replacement of it in PHP.

To be able to produce the same results in PHP, you will have to iterate through the input string and process each character with ord.

for example, if we have a "hello_world" string input the ORD output will be somthing like this ( all in ASCII)

Array ( [0] => 104 [1] => 101 [2] => 108 [3] => 108 [4] => 111 [5] => 95 [6] => 119 [7] => 111 [8] => 114 …
veedeoo 474 Junior Poster Featured Poster

The first thing I always learn and get myself familiarize with is the language construct. Regardless of what programming language it is, their language construct is the most important.

veedeoo 474 Junior Poster Featured Poster

Let me give you the hints first...

line 29, 35, and 38 are not valid statements.

Line 36, you've used COMMIT which is the last query segment in trasactional. The BEGIN query should be intiated first and then your update query followed by the COMMIT to finalized the transaction.

IMPORTANT! Transaction only work with the table engine set or equal to innoDB. It will not work on MyISAM.

example of transaction

$this_begin = "BEGIN";
mysql_query($this_begin) or die (mysql_error());

followed by the update query immediately

$this_update = "UPDATE ....";
mysql_query($this_update) or die (mysql_error());

lastly, the commit query

$this_commit = "COMMIT";
mysql_query($this_commit) or die (mysql_error());

there are many ways in setting up statements for this..

if(mysql_query($this_begin)){
    // this is true if the begin query was successfule
    }
    else{
        //die or define something as false
        }

If you are lazy like me, this will work also , but THERE IS A BIG BUT.. you need to learn how to do it in the old fashion way first, then you go crazy on the shorthand.

$flag = (mysql_query($this_updatee) ? 'success' : 'error');
veedeoo 474 Junior Poster Featured Poster

I am having coffee, pause(sour gummy bear), coffeee, pause(gummy bear), coffeeee and more coffeeeee. :)

veedeoo 474 Junior Poster Featured Poster

you cannot exit when you are already outside the block.

veedeoo 474 Junior Poster Featured Poster

@Simonloa,

I highly recommend doing this. If you want to use the rest of your codes.

 if(isset($_SESSION['uid'])  && (!empty($_SESSION['uid'])){

     $uid=$session_uid;
        $login='1';
}

else{

       $url=$base_url.'login.php';
            header("location:$url");
}  

and for the ob_start("ob_gzhandler")

you can read all about it here...

veedeoo 474 Junior Poster Featured Poster

On a side note why the hell does the vanilla install of codeigniter force you to set an encryption key but doesn't force you to set cookie_encrypt to be TRUE.

Isn't that just plain stupid? Or am I again missing something.

I think it was An overlooked negligence in plain sight.

No, you don't have to do any of my protocol examples those are semi paranoid. Just use a pretty good encryption and you should be good to go.

iamthwee commented: thanks +14
veedeoo 474 Junior Poster Featured Poster
  1. I was about 9 basic programming. CGI with Perl at 10 and then, I almost took over the world when I was 10 ( Just Kidding :), but it was true though). I was banned for 3 years to use any kind of computer or anything that may appear or have resemblance to a computer. I wrote my codes on my journal everyday. When 3 years was up, that's the time they told me they think I was good :).

  2. PHP and Python . I love PHP because I can pretty much make anything from it. When I am lazy, I would always fell in love with Python all over again, because I don't have to type them time consuming curly brackets like in PHP :).

  3. No, I did not find it hard to get started. I have 3 older brothers who were and still are in the Silicon Valley when the technology boom started. I thought learning how to code was a prerequisite to be able to join the grown ups club.

veedeoo 474 Junior Poster Featured Poster

I am not sure, if this is want you want

session_start();

if(!isset($_SESSION['uid'] || $_SESSION['uid'] == ''){

    ## session don't exist or not set
    ## do what you need to do.
}

or alternatively we can do the positive

session_start();

if(isset($_SESSION['uid']){

    ## redirect to the page for logged in users

    }

    else{

        ## show them the page for non-logged in users

        }

please limit your usage of !empty or empty on session. Only in this occassion it is not 100% appropriate.

veedeoo 474 Junior Poster Featured Poster

You could try something like this.. something pretty easy without function and no object..

$option_block = ''; //this actually prevent the error just in case it is zero results.

$query=mysqli_query($rcon,"SELECT userid FROM registration");
    while ($row=mysqli_fetch_array($query)){

    $option_block .= '<option name="to">'.$row['userid'].'</option>';
}

then on your page witht he form, you can do like this.. I am guessing on the file structure here, because I don't where the actual query result is coming from.

require_once('connect/registerdb.php');
require_once('messages/list.php');

To:<select name="respondto">
        <?php echo $option_block;?>
</select>

that's pretty much it...good luck to you.

veedeoo 474 Junior Poster Featured Poster

I think you can do it with rollup.. There is one example there that pretty much identical to yours.

veedeoo 474 Junior Poster Featured Poster

Did you try running this

<?php

phpinfo();

?>

scroll down the page and look for the mysqli table similar to the screenshot provided below.

72ddcc2c5e1350a528eb59b81f3d8ce2

veedeoo 474 Junior Poster Featured Poster

Still confused about that one. Seriously, there should be a massive disclaimer about using CI sessions! It's ridiculous.

I do understand your frustration.

For once more, please allow me to dissect what is really going on inside the CI session class. I also do understand the assumptions and analysis of the programmer assigned to write this class.

First and foremost, how did this important piece of information made it to the user's cookie bin?

The answer is simple. Because of the method called _set_cookie and this is how it was done

setcookie(
        $this->sess_cookie_name,
        $cookie_data,
        $expire,
        $this->cookie_path,
        $this->cookie_domain,
        $this->cookie_secure
    );

We can encrypt all we want in every possible means, the tiempo of the tango will never change. Why? Because, we are only encrypting the name of the session and the cookie name. Encrypting my name, while exposing the most critical information in the open does not and will not equate to security as they call it.

The screenshot below is the product of the method above

43498189d8755b601254f8cb578a486c

and this is the edited version of what the cookie says. I removed 90% of it, because it is getting pretty detail and I don't intend to be teaching or enticing people on cracking on these things that are supposedly "secret".

cd0200f3a6c62cf916c926b7b827d0fa

I purposely did the screenshot, because I don't want people copy and pasting this stuff running around the web to decode it. The point I am trying to make here …

veedeoo 474 Junior Poster Featured Poster

try this.

veedeoo 474 Junior Poster Featured Poster

Welcome and Hello! I really don't know what to say about your career, and I honestly believe that I am in no position in giving such kind of advice. Besides, I am a lot younger than you. However, I was always told to explore many things that I may have interests. So that if one thing doesn't work out well for me, I have other things I can explore. Of course, McDonald is always be one of them ( I am just joking :)).

I graduated college at a very young age, and looking back at my very short years in undergraduate and graduate studies, I wish I could have stayed there for a couple more years. I didn't even remember going out of town during my spring break, summer break,and the breaks other students wrote on their calendars. I was always worried about he cost of my education my parents have pay. I could have pretended of having a severe tooth ache for the entire semester :).

Gee, now I am watching all these people on the news they are having a great time. I often asked myself, why I didn't go there..

My only advice to you is enjoy every bit of your school days. You worry about the job after your graduation.

veedeoo 474 Junior Poster Featured Poster

Also, if you run this

<?php 

phpinfo(); 

?>

you will be able to check for whatever php extension you have installed on your server.

If you go down about 3/4 of the page, you will see the session directives. The latest Registered serializer handlers is php php_binary wddx.

Most PHP configuration will always have files as the default value for the session.save_handler directive. So, if you set the CI to save it to the database, then this directive will be overriden.

The session.save path is always defaulted to tmp directory. However, if you want to change this to some encrypted name, you are always welcome to do so, as long as you change the value on your php.ini file.

If you are using xampp or equivalent, you can literally view the sessions generated by PHP

For example, Symfony2 will generate a session text file inside the tmp directory similar to this.

logged|
    b:0;id_user|
    i:0;username|
    s:0:"";privs|
    i:0;email|
    s:0:"";_symfony2|
    a:3:{
    s:10:"attributes";a:0:{}s:7:
    "flashes";a:0:{}s:6:"locale";s:2:"en";}

does it look familiar? those are the same as the example above, but I would never post anything on how CI handles its session transactions.

Looking at the code above, it appears that this session belongs to the site admin of a Symfony2 website. The privs for the admin is 7, the user id of the admin is 6.

Can we fixiate this session ? Sure, middle school kids can probably figure this out in no time.

veedeoo 474 Junior Poster Featured Poster

I forgot, when you distribute your application, make sure that your installation database table for members must have a predefined auto-increment value to prevent clever users from guessing the member's user id.

So for example, we packaged our application for distribution of a beta release.

Normally, installer will have to parse the table from the default sql file. Below is a make up users table..

CREATE TABLE IF NOT EXISTS `users` (
  `id_user` int(11) NOT NULL AUTO_INCREMENT,

  PRIMARY KEY (`id_user`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 ;

to prevent incrementing from 1 of which in most cases are assigned to the admin, we can change the distribution sql to something like this for all tables with auto increment

CREATE TABLE IF NOT EXISTS `users` (
  `id_user` int(11) NOT NULL AUTO_INCREMENT,

  PRIMARY KEY (`id_user`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1549;

the first registered user will be given the next incremented value from 1549 and not 1 which is almost a give away to anyone who knows how to spoof sessions.

veedeoo 474 Junior Poster Featured Poster

Yes, you are correct a clever user can edit their session. Just be very careful and always make sure to manually itimized the session you ONLY! need for the user to move around the site.

I don't use this method as strongly suggested by many blog tutorials

$this->session->set_userdata();

What I normally do to my application is to manually assign things that I need so that I can use it to query any additional data about the user. For example, if user A is logged_in and he has been granted the Privilege of 300 which is equivalent to regular memeber in the hierarchy of users.

my session assignment would be pretty conservative. I would only assigned three to four things in there at the most.

$sess_data = array(
               'username'  => 'user_name',
               'user_id' => 'user_id',
               'time_logged_in' => time(), //always affix and suffix something and make sure to add delimiters anywhere for you to explode.
               'logged_in' => TRUE
           );

$this->session->set_userdata($sess_data);

we can set the number of minutes in the script to re-verify the user or else logged him out.

$session_expiry = 3600;

if(time() - $this->session->userdata('time_logged_in') >= $session_expiry){

    ## time to terminate the session for this user
    $this->session->sess_destroy();
    redirect('mainpage', 'refresh');

}

Controlling page access based on privilege rule. There are some sites where the contents shown based on the user privilege. For example, all members with priv 300 can only view banana pictures, priv 400 are allowed to view pears and apples, and priv 500 can view all the fruits available …

veedeoo 474 Junior Poster Featured Poster

that's pretty cool approach iamthwee :). Your ultimate CMS is looking great indeed.

veedeoo 474 Junior Poster Featured Poster

Additional information.

Since distributions of application, requires version maintenance and upgrades. The installer should be able to check the version being installed agains the latest version available. This can be done by adding an xml parser on your installer to check what version is currently available and then compare the version being installed.

If the version being installed is less than the current version, you execute your download function and deflate the download file replacing everything in the application directory, except the installation directory. This is the reason install script must have its own directory and must not reside in the application directory.

a simple release_info.xml file

<?xml version="1.0" encoding="UTF-8"?>
<release>
<version>2.0</version>
<release_date>June 22, 2014 </release_date>
<release_note>This is version 2.0</release_note>

<release_changes> List of changes
<change> upgraded index.php</change>
<change> Added more security</change>
</release_changes>

<update_info>
<database>columns
<col>new_column</col>
<col>new_column2</col>
</database>
<files>files
<file>application/controllers/new.php</file>
</files>
</update_info>


</release>
veedeoo 474 Junior Poster Featured Poster

here is an old screenshot I found..

b037009383ff432ed784d0f7607815e5

veedeoo 474 Junior Poster Featured Poster

There are many styles and ways of writing an installer and I would normally write my installer in procedural. The reason is that, at the end of the installation process, the user will be instructed to delete or rename the install directory.

Here are steps I must undertake for pretty much all the installer I wrote.

  1. The very first thing is to check if the php.ini directives required by your application has been met. For example, in the installer I wrote for Youtube clone CMS type of application, the application will need to meet the following requirements:

    max_execution_time: 3000
    max_input_time: 600
    upload_max_filesize: 200M
    post_max_size: 200M
    register_argc_argv:
    open_basedir: no value
    safe_mode: off

The above php.ini file directive screening process must be in the index.php of the install directory

application
system
install * same level as the application directory in CI

Now, the index.php in the install directory are devided in many functions that will handle all the steps of the installation along the way.

step one: php.ini directives check point, file permission check. We capture the steps through a form submission.

    if(!isset($_POST['step']){
        $step = 1; // this makes the user be defaulted at step one and force the script to check the php.ini directives and file permission requirements.

         switch ($step){
           ## we initialize at server_failed as false
           $server_failure = FALSE;
         ## check if the server's php.ini directive meets our requirements.
             case 1: //we are on initialization of the installer
          ## now, check …
veedeoo 474 Junior Poster Featured Poster

Not so relevant but worth mentioning ( i think :)).

on my first .htaccess directives above, the one with a PT or passthrough. The reason I am using this type of directives is purely motivated by laziness (wow an excellent pasitive and negative contrast).

I am so darn lazy to keep on defining my routes on application/config/routes.php. A good friend of mine ( a coffee drinking buddy) had asked me to write a search controller and search model utilizing the codeigniter's active records. So, as lazy as I can be. I want the search query in shorthand uri form. Something like .. friendDomainDotCom/search/query/page_number. Most importantly he does not want the index.php? to be part of the url.

So, with the .htaccess directives above (PT), I can have an alias. and my route configuration will be one only using the generalized :any

$route['search/:any'] = 'search';

The above routing will cover all uri segments related to the search controller

domainDotCom/search/happy/3

which assigned the search controller to segment 0, the query is in segment 1, and the current page (3) being in the segment 2.

this

RewriteRule .* index.php/$0 [PT,L]

had helped me to be more lazy :).

people may asked, what will happen to the form processor on submit during search? Don't worry, I took care of it as a session variable, including the search result count (this can cause a double query). Those things should not be carried over when users requests for the next page.

By the …

veedeoo 474 Junior Poster Featured Poster

you can cheat the viewers by making them to think that they are on your root directory eventhough they are like two direcotries down by elevating the working directory of the bootstrap.

something like this

//index file from /simplemvc/ directory conducting the controllers calls as if it is located in the in the root.

chdir(dirname(__DIR__));

include_once('/application/controllers/test.php/');

So, eventhough this file is located inside the /simplemvc/ directory is is being viewed by PHP as if it is in the root. Not to mention that the access through this page is being redirected by .htaccess.

veedeoo 474 Junior Poster Featured Poster

rewritebase is defining the base directory or "Sets the base URL for per-directory rewrites".

For example if I want to rewrite and redirect all request on my mydomain.com to /simplemvc/ directory, for the purpose of routing request and others, my .htaccess will be something like this

RewriteEngine On
    Options -Indexes

    RewriteBase /simplemvc/
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-l

    RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]

the above will apply the rule in simplemvc directory. This one however has to be located inside the /simplemvc/ directory.

Another scenario is if the user wants ONLY ONe specific directory accessible to the public. Then all request for any files located in the /simplemvc/ directory and all the files that don't exists in the root can be routed like this from the root directory

RewriteEngine on
RewriteRule    ^$    simplemvc/   [L]
RewriteRule    (.*) simplemvc/$1    [L]

By implementing the above rewrite rule on the root directory, public access are always routed to /simplemvc/ directory for whatever controller/method requests.

By the ways if someone is reading this, they maybe wondering whatever happens to the

<IfModule mod_rewrite.c>

</IfModule>

its there, but I am just lazy typing them on this post.

veedeoo 474 Junior Poster Featured Poster

most webhost recommends 755 for the directories and all files are defaulted at 655, except for files where writing is needed.

on servers that are still running on apache module as server API, they normally have 777 to be able write and this is also true as default on all directories. For the latest servers with fast CGI as server API, they did lower down the writtable to 755 and 655 for the files.

For some scripts and files like video encoders and static ffmpeg for linux, these files are dangerously CHMODed at 777, because of the exec requirements during the video encoding process, but then these files are protected by .htaccess file.

something like this, very simple protection for the encoder.module

<Files *.module>
deny from all
</Files>
iamthwee commented: thanks +14
veedeoo 474 Junior Poster Featured Poster

I am using this for both production and development. The only difference with yours is the PassThrough

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L] 

$0 or $1, don't really matter :).

veedeoo 474 Junior Poster Featured Poster

@NuGG,

I have three different distros running on my virtual box. Centos, Ubuntu 64, and Red Hat. I never allowed my webhost to pre-load my server, because I want to prep my server for the application I am trying to test. I also have both the apache and Nginx.

veedeoo 474 Junior Poster Featured Poster

@davy_yg,

University of Arizona created an application called Guide on the side. If you are interested, you can download it here, or here.

This application is cake PHP dependent. Let me know about what you think about it. I wrote the installer override for this application. Just in case you get stuck during the installation, I am here to help.

veedeoo 474 Junior Poster Featured Poster

I second the quantum computing.

veedeoo 474 Junior Poster Featured Poster

Migration is an excellent tool in version upgrades of your distributable application.

For example, you distribute an application called iamthwee's fine CMS. Few months after your beta release, you've just relized that a beta version 2 needs to be released as an ultimate upgrade, and in this particular release you need to upgrade the database by adding new table to add your new ultimate features on the older version.

With migration, your user doesn't need to stay up all night to do upgrades. It will be just like how wordpress updates itself from time to time.

Let say on your old version, you have the following tables

users
media
messages
comments
article
favorites

Your latest version requires the following new tables
bookmarks
friends
websites

So instead of telling your application users to logon to phpMyAdmin to create those tables, you can just distribute an upgrade package with new configuration file and then the update controllers and new additional files.

Assuming that the upgrade package already includes new configuration file setting the config migration to true. Your update contoller can be very similar to this.

 class Migration_bookmark_vtwo extends CI_Migration{

    private $bookmarks = 'bookmarks';
    public function up(){

    $this_new_bookmark = array(
                                 b_id => array( 
                                           'type' => 'INT',
                                           'constraint' => 10
                                           'null' => FALSE,
                                           'auto_increment' => TRUE
                                           ),
                               url => array(
                                           /itimized rules here
                                           )
                                           );
       $this->dbforge->create_table($this->bookmarks, TRUE);
       $this->dbforge->add_field($this_new_bookmark);



       }

       public function down(){
       ## then the roll back method
       $this->dbforge->drop_table($this->bookmarks);
       }

       } //endof class
veedeoo 474 Junior Poster Featured Poster

okay, let me try one more time, but I strongly suggests to try out Cereal's approach first.

I'm kind of lazy today so I will be using my referenced link above. That would be the first one.

I will be modifying this script.

I will chop it and add some ingredients to it as needed..

<?php

    ## we want those arrays defined first
    $current_width = array();
    $current_height = array();

    $imgdir = 'images/test_image/'; //Pick your folder

    $allowed_types = array('png','jpg','jpeg','gif'); //Allowed extensions

    $dimg = opendir($imgdir);//Open directory
    while($imgfile = readdir($dimg))
    {
      if( in_array(strtolower(substr($imgfile,-3)),$allowed_types) OR
          in_array(strtolower(substr($imgfile,-4)),$allowed_types) )
    /*If the file is an image add it to the array*/
      {

      $a_img[] = $imgfile;
      list($width, $height) = getimagesize($imgdir.$imgfile);

          ## we assign the current width and height in the loop into the content_width/height arrays.

            $current_width[] = $width; 
            $current_height[] = $height;

      }

    }

        echo 'max value width x :'. (max($current_width));
        echo '<br/>';
        echo 'max value y :'. (max($current_height));

That's pretty much we need. If we do this outside the while loop

var_dump($current_height);

it should give us an array of heights of the images from the directory. The output should be something like this. This is just my imaginary dimensions.

array(8) { [0]=> int(400) [1]=> int(900) [2]=> int(332) [3]=> int(593) [4]=> int(450) [5]=> int(261) [6]=> int(600) [7]=> int(450) } 

if we do the same for the widths,

var_dump($current_width);

again, it will give us something similar to this

array(8) { [0]=> int(500) [1]=> int(1200) [2]=> int(500) [3]=> int(768) [4]=> int(600) [5]=> int(193) [6]=> int(600) …
veedeoo 474 Junior Poster Featured Poster

sure why not, but before doing that, we need to find out if you have the ffmpegPHP installed on your server.

There are other ways of testing the ffmpegPHP installation and one of them is like this.

<?php


    $video_file = 'uploads/yourvideo.extension';

    ## we create an instance of the ffmpeg movie object

    $veedeoo = new ffmpeg_movie($video_file);


    ## get the duration of the video. This is very important when creting thumbnails.

    echo 'Video Duration : '. $veedeoo->getDuration() .'<br/>';

    ## get the framerate which is the frame per seconds. There is no use of re-encoding a video at a higher fps than the actual fps of the source.
    echo 'Video FrameRate : '. $veedeoo->getFrameRate();

Define the video_file and direct your browser to this file. You should be viewing duration and framerate values.

Let me know...

veedeoo 474 Junior Poster Featured Poster

I am currently developing one. So far, it is about 60 percent finished. A friend of mine who is Computer Science Professor have been asking me for almost 2 years now to build a lecture, quiz, test and grading application using the codeIgniter/Smarty/bootstrap. The quiz and the exams classes are pretty cool (I think). It is so cool that even when students hug each other while taking the test, their asnwers will never be the same. The probability of the same student getting the same set of questions is almost none.

I made the grading sytem to be very strict and yet helpful to the students. I made it to sort all missed questions and matched them to the textbook being use by the class and print out list of topics to read.

When I started this project, I wrote the framework from the ground up. I presented this application to the school, but after 30 minutes, I was the only one talking in the room, and the rest of the people appeared to be confused and most of them thought I was an alien of some kind :). So, I have decided to move the application to CodeIgniter framework and hopefully it will be a lot easier for them to digest and at the best in the, I am hoping they will percieve me as human again.

here are the screenshots

the main page

4c1a12afea7d81ed5c98b909e09d332d

The exam page demo

172e8d0d2a8d4d7b84f1827515d4cbb5

The …

veedeoo 474 Junior Poster Featured Poster

I think it is the best option to encode them to either .h264/MP4 or flv files. If you have an ffmpegPHP, mencoder, flvtool2, mp4box installed on your server you are good to go.

veedeoo 474 Junior Poster Featured Poster

I just need 3 rows..

for example, the most common CSV file format are similar to this.

First row as column names with delimiter |

username | email_address | phone_no | status | hobbies |

after the first row, it will be followed by the entries with | delimiter. Hobbies with delimiter ,.

veedeoo | veedeoo@any_do_com | 000-000-0000 | active | scuba diving, skateboarding, rock concerts, playing ukelel, playing Les Paul electric guitar, pink floy riffs

Line 0 or first row are commonly written like that. The CSV file dumper can parse that and make them the column names.

veedeoo 474 Junior Poster Featured Poster

can you post your codes from model?

veedeoo 474 Junior Poster Featured Poster

it says, video file is corrupt.

For now, stay away from those html5 player and use jwplayer or flow player. These are the standard player of the web. Both players are capable of flash fallback.

To be able to convert video files to ogg, webm, flash, h264, and others, you will need to have ffmpegPHP installed on your server. Tell your host you need ffmpegPHP, mencoder, flvtool2, mp4box installed on your server.

veedeoo 474 Junior Poster Featured Poster

Hi,

Can you at least give us few lines of the CSV file. It is okay to change the data to something else as long as the structure is the same as the original.

I can't promise you with anything, but I need to see at least few entries on the CSV then I let you know if I can do anything about it. Else, I cannot draw any analysis about the hammer's effeciency without looking at the nail first.

veedeoo 474 Junior Poster Featured Poster

That would be on the file called ratings.php,

on the top of the page, it says

define('SVRATING', 'txt');        // change 'txt' with 'mysql' if you want to save rating data in MySQL

// HERE define data for connecting to MySQL database (MySQL server, user, password, database name)
define('DBHOST', 'localhost');
define('DBUSER', 'root');
define('DBPASS', 'passdb');
define('DBNAME', 'dbname');

put your database credentials and save your changes and change 'txt' with 'mysql'.

One final step is to direct your browser to the file named create_tables.php. On success, the script should create two database table to store ratings and day the items are rated.

It is my assumption that the script should work from this point and on.

veedeoo 474 Junior Poster Featured Poster

Cool :). Wow! this thread was posted 6 years ago. This is way older than lastMitch could dig. You are the Man..

veedeoo 474 Junior Poster Featured Poster

cool :), welcome.

veedeoo 474 Junior Poster Featured Poster

I just wanted to add that in production server, we need to serialize the response from the controller's process_ajax() method. You can use this tutorial as a guideline.

veedeoo 474 Junior Poster Featured Poster

Please allow me to give a simple example.

First, we will use this script right here. We will make some minor modifications so that it can work inside CI. Download and unzipped the zip file.

We will create our simple ajaxupload controller. This is going to be very basic. In fact, I am taking the liberty of not creating a model. However, you are always welcome to create a model file later on.

Step One:
In your codeigniter directory, create files/users/uploads directories if they don't exist. Our uploaded images will be saved in the uploads directory.

Step Two:
Let us create the most basic controller file named ajaxupload.php, and here are the codes. I am in the assumption here that you already autoload the basic libraries and helpers e.g. url helper.

filename: application/controllers/ajaxupload.php

<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

    class Ajaxupload extends CI_Controller {


        public function __construct(){

            parent::__construct();

        }

        public function index(){

            $this->load->view('upload_view.php');


    }

        public function process_ajax(){

            if(is_array($_FILES)) {
                if(is_uploaded_file($_FILES['userImage']['tmp_name'])) {
                    $sourcePath = $_FILES['userImage']['tmp_name'];
                    $targetPath = "files/users/uploads/".$_FILES['userImage']['name'];

                if(move_uploaded_file($sourcePath,$targetPath)) {

    echo '<img src="'.base_url().$targetPath .'" width="100px" height="100px" alt="'.$_POST['image_title'].'"/>';

            }
        }
    }



    }
 }  

Don't worry about sanitization of the inputs for now. You can do them later after you are certain that uploaded files made it to the uploads directory.

Step three:
Create a view file application/views/upload_view.php

<html>
<head>
<title>PHP AJAX Image Upload</title>
<link href="<?php echo base_url(); ?>assets/css/styles.css" rel="stylesheet" type="text/css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script type="text/javascript">
$(document).ready(function (e) {
    $("#uploadForm").on('submit',(function(e) {
        e.preventDefault();
        $.ajax({ …
veedeoo 474 Junior Poster Featured Poster

Correction, this

$x = $area = $latest_area;

should read

$x =  $latest_area;

sorry about that.. :)