cereal 1,524 Nearly a Senior Poster Featured Poster

Remove the () from the regex, seems to work for me:

<?php

function translate($content,$lang){
    $l = $lang;
    $pattern = array('en'=>'/\{\{.[^\}\}]*\|\|/','cy'=>'/\|\|.[^\{\{]*\}\}/'); # change this
    $brackets = array('en'=>'}}','cy'=>'{{');
    $content = preg_replace($pattern[$l],'',$content);
    $content = str_replace($brackets[$l],'',$content);
    return $content;
}

$content=<<<CONTENT
<p>{{Dyma destun (cy example) rand ||Here's some text en (example) rand}}</p>
CONTENT;

echo translate($content,'en');

echo "\n";

?>

or I'm missing the problem? o_o'

diafol commented: Spot on! Thanks again :) +14
cereal 1,524 Nearly a Senior Poster Featured Poster

This happens also in javascript, I found this problem while working on a cart application. Check also these: http://stackoverflow.com/questions/3726721/php-math-precision & http://stackoverflow.com/questions/1458633/elegant-workaround-for-javascript-floating-point-number-problem

broj1 commented: Good information, thnx +5
cereal 1,524 Nearly a Senior Poster Featured Poster

Perfect, just remember to use truncate outside the loop. I forgot to mention that in my example, but that was the main problem, bye!

(if we have finished mark the thread solved!)

cereal 1,524 Nearly a Senior Poster Featured Poster

Change your code from line 9 to 26 with this:

<?php

$file = file('file.txt'); # read file into array
$count = count($file);

if($count > 0) # file is not empty
{
    $milestone_query = "INSERT into milestones(ID, NAME, URL, EMAIL, LOGO, ADTEXT, CATEGORY, PUBDATE) values";
    $i = 1;
    foreach($file as $row)
    {
        $milestone = explode('|',$row);
        $milestone_query .= "('$milestone[0]',  '$milestone[1]', '$milestone[2]', '$milestone[3]', '$milestone[4]', '$milestone[5]', '$milestone[6]', '$milestone[7]')";
        $milestone_query .= $i < $count ? ',':'';
        $i++;
    }
    mysql_query($milestone_query) or die(mysql_error());
}
?>

If you echo the output of $milestone_query you will see something like this:

INSERT into milestones(ID, NAME, URL, EMAIL, LOGO, ADTEXT, CATEGORY, PUBDATE) values('ID1', 'NAME1', 'URL1', 'EMAIL1', 'LOGO1', 'ADTEXT1', 'ADTEXT1', 'CATEGORY1'),('ID2', 'NAME2', 'URL2', 'EMAIL2', 'LOGO2', 'ADTEXT2', 'ADTEXT2', 'CATEGORY2'),('ID3', 'NAME3', 'URL3', 'EMAIL3', 'LOGO3', 'ADTEXT3', 'ADTEXT3', 'CATEGORY3')

Besides, I count 9 keys in the array, not 8:

Array
(
    [0] => ID1
    [1] => NAME1
    [2] => URL1
    [3] => EMAIL1
    [4] => LOGO1
    [5] => ADTEXT1
    [6] => ADTEXT1
    [7] => CATEGORY1
    [8] => PUBDATE1

)

so pay attention to array keys 5 and 6 which in this example are the same and check if ID in your table is INT, in this case it will not accept a string like ID1, ID2 but only numbers.

cereal 1,524 Nearly a Senior Poster Featured Poster

In your code you have $q declared in line 19 and 22, the first query statement will be overwrited by the second and only this last will be performed by mysql_query.

At line 23 add or die(mysql_error()); to see if there is an error.

Also change $r.mysql_close(); with mysql_close(); or add as first argument the link identifier, not the query variable: http://php.net/manual/en/function.mysql-close.php

cereal 1,524 Nearly a Senior Poster Featured Poster

Line 69:

 $image_random_name= random_name(15).".".$extension ;

try this:

 $image_random_name = $_FILES['image']['name'][$i];

or you can use $filename which is declared in line 58 and change line 70 to:

$copy = @move_uploaded_file($_FILES['image']['tmp_name'][$i], $images_location.$filename);

Bye!

cereal 1,524 Nearly a Senior Poster Featured Poster

Check the length of the password field in the database, you wrote:

my password is = "y"
the one that i log in =d41d8cd98f00b204e9800998ecf8427e
the one in db = 415290769594460e2e48

now:

echo md5('y'); #outputs 415290769594460e2e485922904f345d

which is the same of the db version, but it seems that in your database the field is accepting only 20 chars, so change varchar(20) to varchar(32) which is the standard output for md5 function. And update the field with the new value, since the previous is truncated.

The hash that you get from the form, is generated by a boolean false:

md5(false); #outputs d41d8cd98f00b204e9800998ecf8427e

so check with a print_r($_POST); what you receive from the form. Bye!

cereal 1,524 Nearly a Senior Poster Featured Poster

Try this:

<?php

namespace Dbase;
class Dbconn
{
    public function conn()
    {
        return new \PDO("mysql:host=localhost;dbname=roundth4_rtb2", 'root', '');
    }
}
?>

then inside the class you can include the connection class:

<?php
require 'dbconn.class.php';
class headScript
{
    private $db;

    public function __construct()
    {
        $this->db = new Dbase\Dbconn();
    }

    public function headLoad()
    {
        $q = $this->db->conn()->prepare("SELECT scriptCode FROM head_scripts WHERE active != '0'");
        $q->execute();
        $q->setFetchMode(PDO::FETCH_ASSOC);
        $output = array();
        $i = 0;
        while($row = $q->fetch())
        {
            $output[$i]['scriptCode'] = "<script>\n" .$row['scriptCode']. "\n</script>";
            $i++;
        }
        return $output;
    }
}

$play = new headScript();
print_r($play->headLoad());

?>

and it should work. Bye!

cereal 1,524 Nearly a Senior Poster Featured Poster

Yes, I tried that rule before posting the suggestion and it works fine, I usually use stylish into other websites to change colors or fonts. It's handy.

cereal 1,524 Nearly a Senior Poster Featured Poster

@LastMitch
if you install an extension like stylish in your browser you can add a simple rule to hide that bar:

#toolbar { display:none; }

besides I like that bar and I use it! bye! :D

cereal 1,524 Nearly a Senior Poster Featured Poster

Change it like this:

<?php
class myClass
{
    public $myVar="this is demo";

    public function myTextdemo()
    {
        return $this->myVar; # the problem was here
    }
}

$obj = new myClass();
echo $obj->myVar; # and here you wrote $obj->$myVar with an extra $
?>

use return to output data from a function not echo and use $this inside the class functions, otherwise the declared property will not be considered and you will get an error like Undefined variable...

http://www.php.net/manual/en/language.oop5.properties.php

bye! :)

cereal 1,524 Nearly a Senior Poster Featured Poster

Change this part:

$imgdata[0] = $width;
$imgdata[1] = $height;

with this:

$width = $imgdata[0];
$height = $imgdata[1];

bye!

Khav commented: The awesome helper of all time~Khav +1
cereal 1,524 Nearly a Senior Poster Featured Poster

Change that echo with:

while($row = mysql_fetch_object($data))
{
    echo $row->Column1;
}

bye!

cereal 1,524 Nearly a Senior Poster Featured Poster

That can happen if you run a command like this one:

sudo echo "90" > /proc/sys/vm/swappiness

So, try this:

echo "90" | sudo tee /proc/sys/vm/swappiness

If you still get an error then check file permission, user and group:

ls -l /proc/sys/vm/swappiness

and post back here, maybe someone else will give you a better support. Bye!

cereal 1,524 Nearly a Senior Poster Featured Poster

Besides sysctl.conf you have to edit /proc/sys/vm/swappiness, just replace with 90. Then you can use sudo swapoff -a and sudo swapon -a to load the new value without rebooting.

cereal 1,524 Nearly a Senior Poster Featured Poster

If you check the comments at the end of the page, of the posted link, you will find some perl scripts to do such calculations ;)

cereal 1,524 Nearly a Senior Poster Featured Poster

I've already replied to this here: http://www.daniweb.com/web-development/php/threads/429083/searching-for-specific-text-on-a-page#post1837188

Please don't open more than one thread for the same question, if I cannot reply quickly someone else will do it..

cereal 1,524 Nearly a Senior Poster Featured Poster

That identifier is not present in the json file, anyway, just add a if statement inside the loop:

<pre>
<?php
$a = json_decode(file_get_contents('http://www.ace-spades.com/serverlist.json'),true);
$n = count($a);

for($i=0; $i < $n; $i++)
{
    if($a[$i]['identifier'] == 'aos://2252626508:32887')
    {
        echo 'identifier: ' . $a[$i]['identifier'] .' count: '. $a[$i]['count'] . "\n";
    }
}
?>
</pre>

if you want to check a range of identifiers then add an array and change the if statement:

$array = array(
    'aos://2252626508:32887',
    'aos://1379434439:36887',
    'aos://3819391052:32887'
);

if(in_array($a[$i]['identifier'],$array))

bye!

Djmann1013 commented: Thank you. This works! I am glad you helped me. Thanks! +1
cereal 1,524 Nearly a Senior Poster Featured Poster

Sorry, I made an example based on the json string posted above:

$linkcontents = '{"count": 5, "map": "(Server Map)", "uptime": 1436.2805321216583, "cumulative_uptime": 69137.85308456421, "name": "(server name)", "max": 12, "country": "(contry)", "identifier": "(server IP)", "game_mode": "(game mode)", "useless_ping": 99}';

sorry for that ;p I just forgot to be more specific, if you use count() you see that you get 153 arrays, you have to loop them in order to get what you want, for example:

<pre>
<?php
$a = json_decode(file_get_contents('http://www.ace-spades.com/serverlist.json'),true);
$n = count($a);

for($i=0; $i < $n; $i++)
{
    echo 'identifier: ' . $a[$i]['identifier'] .' count: '. $a[$i]['count'] . "\n";
}
?>
</pre>
cereal 1,524 Nearly a Senior Poster Featured Poster

If you use json_decode() you can treat the input as an array:

$d = json_decode($linkcontents,true);
print_r($d);

that outputs:

Array
(
    [count] => 5
    [map] => (Server Map)
    [uptime] => 1436.2805321217
    [cumulative_uptime] => 69137.853084564
    [name] => (server name)
    [max] => 12
    [country] => (contry)
    [identifier] => (server IP)
    [game_mode] => (game mode)
    [useless_ping] => 99
)

and then you can simply: echo $d['count'];

cereal 1,524 Nearly a Senior Poster Featured Poster

It depends on the storage engine, field types, encoding. Check this link: http://dev.mysql.com/doc/refman/5.0/en/storage-requirements.html

bye!

cereal 1,524 Nearly a Senior Poster Featured Poster

At line 9 I see this string:

$sql = "SELECT * FROM $dbase";

so you have a table with the same name of the database? I ask this because it seems your script expects a true condition from $result variable in the IF statement at line 13, so I suggest you to change line 11 with this:

$result = mysql_query($sql) or die(mysql_error());

and check if you get an error or false.

cereal 1,524 Nearly a Senior Poster Featured Poster

What kind of error you get?

cereal 1,524 Nearly a Senior Poster Featured Poster

If you run explain table_name in your mysql client and paste the output together with an example of data maybe we can give you a hand. And also paste the query.

cereal 1,524 Nearly a Senior Poster Featured Poster

Besides why don't you use auto_increment? With that you don't even need to use unique key:

u_id int(10) not null auto_increment primary key
cereal 1,524 Nearly a Senior Poster Featured Poster

This can happen also if you send an empty string twice. Post your code.

cereal 1,524 Nearly a Senior Poster Featured Poster

Yes, you can also enable a specific IP or a range:

sudo ufw allow from 192.168.0.1 to tcp port 443

Anyway, the link I posted above gives you all the information you need about UFW.

cereal 1,524 Nearly a Senior Poster Featured Poster

Basically run:

sudo ufw default deny
sudo ufw enable
sudo ufw allow 443/tcp
sudo ufw allow 4444/tcp

and also udp if you need to enable that too. You can list all rules by using:

sudo ufw status

You can read more by using man ufw or reading this document: https://help.ubuntu.com/community/UFW

cereal 1,524 Nearly a Senior Poster Featured Poster

Change this:

$query = mysql_query($sql);

with:

$query = mysql_query($sql) or die(mysql_error());

and check what you get. Also the session of the banned user should be destroyed.

cereal 1,524 Nearly a Senior Poster Featured Poster

Yes, here you can find more information: http://php.net/manual/en/language.types.array.php

cereal 1,524 Nearly a Senior Poster Featured Poster

I cannot help you much on this, I've seen this problem when using two different versions of PHP on the same box, but in linux is simple to solve: just change the path before using phpize... in windows, since you are placing the dll, try the other versions of php_printer.dll http://downloads.php.net/pierre/ otherwise, I think, you have to compile the dll on your own.

cereal 1,524 Nearly a Senior Poster Featured Poster

Without the semicolon otherwise you comment the line and it's not considered: extension=php_printer.dll

After you save the file reload the server and it should work.

cereal 1,524 Nearly a Senior Poster Featured Poster

You have to install it from PECL: http://www.php.net/manual/en/printer.installation.php
And it seems to be Windows only.

cereal 1,524 Nearly a Senior Poster Featured Poster

Ok, just a note, if you use file_get_contents() you don't need fopen/fwrite
This is the page form:

<html>
<head>

    <title>test</title>

</head>

<body>

    <form method="post" action="grab.php">
        <textarea name="files"></textarea><br />
        <input type="submit" name="button" value="save files" />
    </form>

</body>

</html>

And this is grab.php

<?php

if($_SERVER['REQUEST_METHOD'] == 'POST')
{

    function get_link($data)
    {
        preg_match_all('/http(s)?:\/\/(.*)/i', $data, $matches);
        $result = array();
        foreach($matches[0] as $link)
        {
            $result[] = trim(strip_tags($link));
        }
        return $result;
    }

    function head($url,$length)
    {
        $h = array();
        $mimes = array(
            'image/jpeg',
            'image/pjpeg',
            'image/png',
            'image/gif'
        );

        # reference: http://www.php.net/manual/en/function.filesize.php#92462
        $ch = curl_init($url);
        curl_setopt($ch, CURLOPT_NOBODY, true);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_HEADER, true);

        // not necessary unless the file redirects (like the PHP example we're using here)
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

        $data = curl_exec($ch);
        curl_close($ch);
        if ($data === false)
        {
            return false;
        }

        else
        {
            if (preg_match('/Content-Type: (\d+)/', $data, $matches))
            {
                $h['Content-Type'] = (int)$matches[1];
            }

            if (preg_match('/Content-Length: (\d+)/', $data, $matches))
            {
                $h['Content-Length'] = (int)$matches[1];
            }

            $result[] = !isset($h['Content-Type']) ? false : in_array($h['Content-Type'],$mimes);
            $result[] = (!isset($h['Content-Length']) || ctype_digit($h['Content-Length']) || $h['Content-Length'] < $length) ? true:false;
        }            


        return in_array(true,$result,true);
    }


    function save_files($config)
    {

        $data   = $config['files'];
        $path   = $config['path'];
        $limit  = $config['limit'];
        $length = $config['length'];

        $f = get_link($data);
        $list = array();
        $c = (count($f) < $limit) ? count($f):$limit;

        if(!is_writable($path))
        {
            die('path is not writeable');
        }



        for($i = 0; $i < $c; $i++)
        {
            $file = pathinfo(parse_url($f[$i],PHP_URL_PATH));

            if($file['basename'] == true)
            {

                # check headers
                $h = head($f[$i],$length);
                if($h == true)
                {
                    $remote_data = file_get_contents($f[$i]);

                    # check if file exists and, in case, rename it
                    if(!file_exists($path.$file['basename']))
                    {
                        $name = $file['basename']; …
cereal 1,524 Nearly a Senior Poster Featured Poster

That's a lot of work, you have to sanitize data, check if the user is sending something else apart from links or if something is appended to the links, if the link format is correct, if the limit is reached, if the headers are ok (considering that headers can be spoofed)... So here it is a scrap just to get links:

<?php

function get_link($data)
{
    preg_match_all('/http(s)?:\/\/(.*)/i', $data, $matches);
    $result = array();
    foreach($matches[0] as $link)
    {
        $result[] = $link;
    }
    return $result;
}

# here place $_POST['links'] or whatever you use in the form
$form = <<<EOF
http://website.tld/image.jpg
http://www.website.tld/image_with_w.jpg
http://www.website.tld/image.png
http://<script>alert('hello');</script>
EOF;

print_r(get_link($form));

?>

I repeat: sanitize data, make sure your script filters malicious scripts, for example here you will get a javascript executed. Try to build your script and if you have doubts or something is not working post your code. Bye!

cereal 1,524 Nearly a Senior Poster Featured Poster

Check for file_get_contents() to get the file from remote, file_put_contents() to save the file:

$file = file_get_contents($url);
file_put_contents('/path/new_name',$file);

You can check links by using parse_url() and pathinfo(), for example to get the basename from a link use:

pathinfo(parse_url($url,PHP_URL_PATH),PATHINFO_BASENAME);

so, if the url is http://www.website.tld/images/this_image.jpg you get this_image.jpg you should also check for the mime, strip comments from the images..

cereal 1,524 Nearly a Senior Poster Featured Poster

What kind? This works for me:

<?php
$xml = <<<XML
<dataroot>
              <content id= "1">
                            <quest><![CDATA[<FONT FACE="Arial">Which of the following is not the measure of a physical quantity?</FONT>]]></quest>
                            <opt1><![CDATA[<FONT FACE="Arial">kilogram</FONT>]]></opt1>
                            <opt2><![CDATA[<FONT FACE="Arial">impulse</FONT>]]></opt2>
                            <opt3><![CDATA[<FONT FACE="Arial">energy</FONT>]]></opt3>
                            <opt4><![CDATA[<FONT FACE="Arial">density</FONT>]]></opt4>
                            <ans><![CDATA[a]]></ans>
                            <ans_desc><![CDATA[<FONT FACE="Arial">kilogram is the name of the fundamental unit of mass</FONT>]]></ans_desc>
              </content>
              <content id= "2">
                            <quest><![CDATA[<FONT FACE="Arial">Which of the following sets can enter into the list of fundamental quantities 
  in any system of units?</FONT>]]></quest>
                            <opt1><![CDATA[<FONT FACE="Arial">length, mass and velocity</FONT>]]></opt1>
                            <opt2><![CDATA[<FONT FACE="Arial">length, time and velocity</FONT>]]></opt2>
                            <opt3><![CDATA[<FONT FACE="Arial">mass, time and velocity</FONT>]]></opt3>
                            <opt4><![CDATA[<FONT FACE="Arial">length, time and mass</FONT>]]></opt4>
                            <ans><![CDATA[d]]></ans>
                            <ans_desc><![CDATA[<FONT FACE="Arial">velocity cannot enter in this set because it itself involves length and time.</FONT>]]></ans_desc>
              </content>
              <content id= "3">
                            <quest><![CDATA[<FONT FACE="Arial">If the unit of force and length are doubled, the unit of energy will be</FONT>]]></quest>
                            <opt1><![CDATA[<FONT FACE="Arial">Œ times</FONT>]]></opt1>
                            <opt2><![CDATA[<FONT FACE="Arial">œ times</FONT>]]></opt2>
                            <opt3><![CDATA[<FONT FACE="Arial">2 times</FONT>]]></opt3>
                            <opt4><![CDATA[<FONT FACE="Arial">4 times</FONT>]]></opt4>
                            <ans><![CDATA[d]]></ans>
                            <ans_desc><![CDATA[<FONT FACE="Arial"><P>Energy = Force <img src="Images/Phys1/XLAD670.gif" WIDTH=12 HEIGHT=13 align="absmiddle"> 
  distance = Force <img src="Images/Phys1/XLAD670.gif" WIDTH=12 HEIGHT=13 align="absmiddle"> 
  length.</P>
<P>When force and length are doubled, the unit of energy will becomes four times 
  that of its initial value.</P>
</FONT>]]></ans_desc>
              </content>
              <content id= "4">
                            <quest><![CDATA[<FONT FACE="Arial">Given that displacement of a particle is given by <img src="Images/Phys1/XLQ680.gif" WIDTH=101 HEIGHT=21 align="absmiddle"> 
  where t denotes the time. The unit of K is</FONT>]]></quest>
                            <opt1><![CDATA[<FONT FACE="Arial">hertz</FONT>]]></opt1>
                            <opt2><![CDATA[<FONT FACE="Arial">metre</FONT>]]></opt2>
                            <opt3><![CDATA[<FONT FACE="Arial">radian</FONT>]]></opt3>
                            <opt4><![CDATA[<FONT FACE="Arial">second</FONT>]]></opt4>
                            <ans><![CDATA[a]]></ans>
                            <ans_desc><![CDATA[<FONT FACE="Arial"><P>Here K is dimensionless. Thus </P>
<P><img src="Images/Phys1/XLAD680.gif" WIDTH=198 HEIGHT=41 align="absmiddle"></P>
</FONT>]]></ans_desc>
              </content>
              <content id= "5">
                            <quest><![CDATA[<FONT FACE="Arial">Dimensions of velocity gradient are same as that of </FONT>]]></quest>
                            <opt1><![CDATA[<FONT FACE="Arial">time period</FONT>]]></opt1>
                            <opt2><![CDATA[<FONT FACE="Arial">frequency</FONT>]]></opt2>
                            <opt3><![CDATA[<FONT FACE="Arial">angular acceleration</FONT>]]></opt3> …
cereal 1,524 Nearly a Senior Poster Featured Poster

Load data into a variable, like $xml and use SimpleXML:

$data = new SimpleXMLElement($xml,LIBXML_NOCDATA);
$array = json_decode(json_encode($data),true);
print_r($array);

json_encode/decode will remove the SimpleXML obj.

cereal 1,524 Nearly a Senior Poster Featured Poster

It's seems fine to me.
In php.ini there is a directive that permits to disable GET, check for variables_order in: http://php.net/manual/en/ini.core.php if G is not present then you have to edit the configuration and reload the server. Bye.

cereal 1,524 Nearly a Senior Poster Featured Poster

If I understood the problem this should work:

RewriteRule ^(includes|and|other|directories) - [L]

place it right after RewriteEngine On the rules won't be applied in those directories. Bye! :D

diafol commented: cracking - thanks +14
cereal 1,524 Nearly a Senior Poster Featured Poster
cereal 1,524 Nearly a Senior Poster Featured Poster

no problem, that happens.. bye ;D

cereal 1,524 Nearly a Senior Poster Featured Poster

The only problem I see is at line 126 where $zon is not defined, it should be $zone. A part from that I can't see anything wrong. The $zone is always based on a form input? Maybe the script doesn't get the right value from the form..

cereal 1,524 Nearly a Senior Poster Featured Poster

Can you explain better?

The conditional statements are fine, I see just a difference in the last one where the first 3 variables are not grouped as the previous conditions, but that should not change the behaviour.

Also, I tested the conditions with:

$origin = 'NAIA 1';
$vehicle = 'Van'; # switching with 'Innova' and 'Small Car'
$zone = 'Paranaque 2';
$destination = 'BACLARAN';
$rate = 0;

and it works, the only problem I can think happens if the input is in lower case, for example if $destination is baclaran instead of BACLARAN then the conditions are not satisfied.

cereal 1,524 Nearly a Senior Poster Featured Poster

Not tested, but try:

$words = explode(',', implode('.,', $string));

this gives you an array again, if you want just a string then use just implode('.', $string).

Edit___
Or:

foreach($words as $value) { $doopnamen .= substr($value, 0, 1).'.'; }

so, if $string:

$string = 'alfa beta';

from the loop you get a.b. It was this you needed? Bye!

cereal 1,524 Nearly a Senior Poster Featured Poster

I removed the iframe and added the <div id="result"></div> since with javascript you need this and not the iframe. So try this:

<html>
<head>
    <title>search</title>
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){
           $('#forma_kerkimit').submit(function(e) {
                e.preventDefault();
                $.ajax({
                  type: "GET",
                  url: "http://localhost/phptest/search.php",
                  data: $('#forma_kerkimit').serialize(),
                  timeout: 30000,
                  cache: false,
                  error: function(){
                        $("#result").hide().html('server not responding');
                    },
                  success: function( msg ) {
                        $("#result").html(msg);
                  }
                });
            });
        });
    </script>
</head>
<body>
<!-- change this with your form -->
<form method="GET" action="http://localhost/phptest/search.php" id="forma_kerkimit">
    <table style="width:100%; /">
<tbody>
<tr>
      <td><label name= "programi_lb">Emri i programit</label></td>
      <td><label name="ckli_lb">Cikli i studimit</label></td>
      <td><label name="ial_lb">IAL</label></td>
</tr>
<tr>
     <td>
         <input style="width:100%" type="text" class="inputtext" name="programi" id="programi" tabindex="1" />
    </td>
    <td>
          <select style="width:100%" name="cikli_studimit" tabindex="2">
          <option></option>
          <option>Bachelor</option>
          <option>Diplomë 2 vjeçare</option>
          <option>Master profesional</option>
          <option>Master shkencor</option>
          <option>Doktoraturë</option>
          </select>
    </td>
      <td>
          <select name="ial" style="width:100%" tabindex="3">
          <option></option>
          <option>SHLUP "New York University - Tirana"</option>
          <option>SHLUP "Luarasi"</option>
          <option>Universiteti Katolik "Zoja e Këshillit të Mirë"</option>
          <option>Akademia e Filmit dhe Multimedias "Marubi"</option>
          <option>SHLUP "Universiteti "Marin Barleti""</option>
          <option>SHLUP "Universiteti Kristal"</option>
          <option>SHLUP "Justiniani I"</option>
          <option>SHLUP "Sevasti dhe Parashqevi Qiriazi"</option>
          <option>Universiteti Europian i Tiranës</option>
          </select>
      </td>
</tr>
<tr>
      <td><label name="lloji_programit_lb">Lloji i programit</label></td>
      <td><label name="koha_studimit_lb">Koha e studimit</label></td>
      <td><label name="gjuha_studimit_lb">Gjuha e studimit</label></td>
</tr>
<tr>
      <td>
          <select style="width:100%" name = "lloji_programit"tabindex="4">
          <option></option>
          <option>Publik</option>
          <option>Jo publik</option>
          </select>
      </td>
      <td>
          <select style="width:100%" name= "koha_studimit" tabindex="5">
          <option></option>
          <option>Full time</option>
          <option>Part time</option>
          </select>
      </td>
      <td>
          <select style="width:100%" name ="gjuha_studimit" tabindex="6">
          <option></option>
          <option>Shqip</option>
          <option>Anglisht</option>
          </select>
      </td>
</tr>
<tr>
<td><label name="akreditimi_lb">Akreditimi</label></td>
      <td><label name="vendodhja_lb">Vendodhja</label></td>
      <td><label name="fusha_studimit_lb">Fusha</label></td>
</tr>
<tr>      
      <td>
          <select name="akreditimi" size="1" style="width:100%" tabindex="7">
            <option></option>
            <option>Nuk ka hyrë në proces</option>
            <option>Në proces …
cereal 1,524 Nearly a Senior Poster Featured Poster

Are you testing this page from inside a server right? If you load the page locally (e.g. file:///index.html) it will not work.

Also, if you post the table structure and an example of the data, I can try to replicate the behave of your script. To get the table structure run the following commands in mysql client and paste results here:

show create table ial_programet;
show create table ial_institucionet;
cereal 1,524 Nearly a Senior Poster Featured Poster

Mine was an example, in your case use $_FILES['fileupload']['tmp_name']; instead:

$img = $_FILES['files']['tmp_name'];
$exif = exif_read_data($img,'IFD0');
echo $exif['Make'];

bye!

cereal 1,524 Nearly a Senior Poster Featured Poster

Please, post your updated code, it will be easier to find the problem :)

cereal 1,524 Nearly a Senior Poster Featured Poster

This works for me:

<?php
    $img = "img2.jpg";
    $exif = exif_read_data($img,'IFD0');
    echo $exif['Make'];
?>

I think you don't need to do all this:

$image = chunk_split(base64_encode(file_get_contents($_FILES['fileupload']['tmp_name'])));   //store image in $image

at least not for the exif_read_data() function, just provide the name and the correct path of the file.