veedeoo 474 Junior Poster Featured Poster

ok, after looking at your code, I decided to tweak my recommendations above.

Before anything else, we need to do some refactoring on your codes. All of the methods responsible for video data shares the same properties and variables.

for example let us take a look at the simple table below

+------------+-------+------+-------+--------+-------+-------+-------+
+ Provider   + thumb + size + embed + iframe +  url  + site  + title +
+------------+-------+------+-------+--------+-------+-------+-------+
+ youtube    + false + true + false + false  + false + false + true  +
+------------+-------+------+-------+--------+-------+-------+-------+
+ imgur      + true  + true + false + false  + false + false + true  +
+------------+-------+------+-------+--------+-------+-------+-------+
+ deviantart + true  + true + false + false  + false + false + true  +
+------------+-------+------+-------+--------+-------+-------+-------+ 
+ soundcloud + true  + true + false + true   + true  + false + true  +
+------------+------------+---------+--------+-------+-------+-------+

With simple analysis of the table above, we can easily draw a simple conclusion that the nearest values of the columns where the video providers can have very minimal differences is when we define the default values as shown on the table below..

+------------+-------+------+-------+--------+-------+-------+-------+
+ Provider   + thumb + size + embed + iframe +  url  + site  + title +
+------------+-------+------+-------+--------+-------+-------+-------+
+ default    + true  + true + false + false  + false + false + true  +
+------------+-------+------+-------+--------+-------+-------+-------+

All video providers are also utilizing either oembed_size() and oembed_title() OR og_size() and og_title methods. All video providers also uses these variables $code and $res.

Those …

veedeoo 474 Junior Poster Featured Poster

Let me work on it.. I'll post it tomorrow evening my time zone western pacific.

veedeoo 474 Junior Poster Featured Poster

I don't mean this personally, but the class above will eat the server resources like a hog.

It is a class of too many methods. One probable solution I can think of is to break this class into multiple classes. There is a design pattern called Abstract Factory/Factory Method patterns which I think can work greatly on this type of application. Most importantly, if you are aiming for cache system.

The implementation of Abstract Factory/Factory Method patterns is kinda like this. ( Mr. LDA above thought me how to this, so any corrections are greatly appreciated). It appears to me that the class above is responsible for providing video contents coming from the external sites.

We can make a video factory class like this

class VideoFactory
{
    private $ytube_content;
    private $imgur_content;
    private $dmotion_content;
    private $flickr_content;

    public function __construct(YouTube $ytube_content, Imgur $imgur_content, DailyMotion $dmotion_content, Flickr $flickr_content)
    {
        $this->ytube_content = $ytube_content;
        $this->imgur_content = $imgur_content;
        $this->dmotion_content = $dmotion_content;
        $this->flickr_content = $flickr_content;

     }

     /*
     * get the youtube data
     */

     public function get_youtube()
     {
         return clone $this->ytube_content;
      }

      /*
      * get imgur data
      */
      public function get_imgur()
      {
          return clone $this->imgur_content;

       }

       /*
       * get dailymotion data
       */
       public function get_dailymotion()
       {
           return clone $this->dmotion_content;

        }

        /*
        * get flickr data
        */
        public function get_flickr()
        {
            return clone $this->flickr_content;

        }


} 

the video classes as broken down

class YouTube
{

    public function __construct()
    {
    }

    public function set_video()
    {

        //return all youtube video data

     }

     public function make_cache()
     {
         //you can make a …
SimonIoa commented: thanks veedeoo +2
veedeoo 474 Junior Poster Featured Poster

if you run your code in the console environment like CLI in PHP, this

<!DOCTYPE html>
<?php

?>

can create problem. You just need to reconsider what you wrote on your code editor. Think about which comes first and last?

so, if submit button is set, the user gets redirected, and what should be shown to the user if it is not set? Should we wrap the html codes inside the else statement or should we not? Think about it and you will be solving this problem like pro.

veedeoo 474 Junior Poster Featured Poster

There is nothing wrong, but why?

<input type="file" name="0" id="box">

I hope you are aware that it can be viewed as an integer and maybe bolean if not careful.

$x = 5 + "0 cups of coffee";

$y = 5 + "5 cups of coffee";

will give $x = 5 cups of coffee and $y = 10 cups of coffee. What I am saying here is that both $x and $y are integer at this point. While

$x = "0"; 

is a string. If we check (isset($_POST['0'])), gues what we are going to get?

Be careful with your data types..

veedeoo 474 Junior Poster Featured Poster

as per the title of your thread where it says "XAMPP", you need to start the xampp control panel and then start the apache and mysql services.

then direct your browser to localhost/youphp_file.php

You cannot save pages with PHP codes in them as .hml document. You can however save php docs with .inc, php3, and if supported phtml or as defined in your directoryIndex directives.

veedeoo 474 Junior Poster Featured Poster

I am not sure if this is exactly what you are looking for, but in PHP it is called transaction. The mysql ENGINE directives must be set to innodb.

Normally, if you are using PHP MVC frameworks like fuel PHP, laravel, and even CI (lower level), these frameworks are pre-packaged with database library that can easily handle transactions.

The idea is pretty similar to the ADODB objects. Similar to other programming languages, PHP trasactions can be roll-back. Meaning, if later on we don't want the latest modification on our database, we can roll it back to the previous state e.g.

$this->db->trans_begin();

$this->db->query('Your_First_Query.....');
$this->db->query('Maybe_a_Second_Query..');
$this->db->query('And_yet_another_a_third_Query...');

if ($this->db->trans_status() === FALSE)
{
    $this->db->trans_rollback();
}
else
{
    $this->db->trans_commit();
}

if this

$this->db->trans_status()

evaluates to FALSE, then we can roll-back. Otherwise, we commit to finalize the transaction.

This topic is pretty huge and it requires practice and full understanding of ORM. At the moment, I really don't know what to recommend as far as tutorial is concern.

You can read more about it here and here.

veedeoo 474 Junior Poster Featured Poster

the error says it all mysql_real_escape_string() . page number is not a string, it is an integer.

So, your validation should focus on is_numeric and FILTER_SANITIZE_NUMBER_INT. Make sure to remove ., +, - before evaluating which page should be deliver to your user.

veedeoo 474 Junior Poster Featured Poster

This is a pretty simple ethical hacking for testing purposes only. This may work or may not work.. just bringing the points accross.

for example if you don't sanitize and validate this

media.php?hal=detail&id=1

and if I visited your site and I want to see all of your media. I would put this on my browser

media.php?hal=detail&id=10000000

Hoping that you did not turn off your error reporting. I would probably get an error saying

media_id is not valid or not found.

now, I know one of the column of your database. With this given info. thanks to your server, I can change the url above to

media.php?hal=detail&id=''ORmedia_id REGEXP '^[0-9]'

if we use that on our query, it will spit out all of the media with media_id matching anything from 0 to 9 ..

veedeoo 474 Junior Poster Featured Poster

Warning: Cannot modify header information - headers already sent by (output started at /home/blahblahblah.php on line 24"

try adding

exit;

after the header location..

Another alternative:

if you want to redirect after the alert, then redirect can be wrap with <script> </script> as in

echo "<script type=\"text/javascript\">alert('item succesfully added');
        window.location='your_page.php';
    </script>";

that's all I think of right now. PHP will not know if javascript already alerted the user.

To redirect using the PHP redirect function a simple javascript function is needed to call a PHP function,

veedeoo 474 Junior Poster Featured Poster

validate, sanitize, check for the referrer.

veedeoo 474 Junior Poster Featured Poster

I truly admire people who can give updates when they found the solution.

Thanks.

veedeoo 474 Junior Poster Featured Poster

This is what I meant by without iteration on conversion. I used foreach loop to prove successful conversion..

<?php 

$pass = '5f4dcc3b5aa765d61d8327deb882cf99';

print_r(str_split($pass));

$replacements = array(

  '0'=> "0000", '1' => "0001", '2' => "0010", '3' => "0011", '4' => "0100", '5' => "0101", '6'=> "0110", '7' => "0111",
  '8'=> "1000",'9' => "1001", 'a' => "1010", 'b' => "1011", 'c' => "1100", 'd' => "1101", 'e' => "1110", 'f' => "1111" );

$x = (str_replace(array_keys($replacements), $replacements, $pass));

echo '<br/> this is the converted md5 password : '. $x .'<br/>';

/*
* we can further split the converted md5 password as proof
*/
echo 'below are the split converted md5 as proof <br/>';

$x_array = (str_split($x,4));

foreach($x_array as $value){

        echo $value.'<br/>';

}

the rest is all up to you. Good luck on your Master thesis.

veedeoo 474 Junior Poster Featured Poster

IMHO, the hashed user_pass is not necessarily be the subject of un-needed iteration.

if

$md5_1=md5($_POST['user_pass']);

is equal to 'password', then the hashed password is now equal to

$md5_1 = '5f4dcc3b5aa765d61d8327deb882cf99';

and this

print_r(str_split($md5_1));

will deliver $md5_1 as an array.

Array ( [0] => 5 [1] => f [2] => 4 [3] => d [4] => c [5] => c [6] => 3 [7] => b [8] => 5 [9] => a [10] => a [11] => 7 [12] => 6 [13] => 5 [14] => d [15] => 6 [16] => 1 [17] => d [18] => 8 [19] => 3 [20] => 2 [21] => 7 [22] => d [23] => e [24] => b [25] => 8 [26] => 8 [27] => 2 [28] => c [29] => f [30] => 9 [31] => 9 ) 

just apply minor manipulation to convert those items into whatever format you want and you should be done.

Hint: Look for the array functions here. That should help you in the conversion to binary and I am sure it is a lot faster than what you have using switch statement.

veedeoo 474 Junior Poster Featured Poster

I totally agree with cereal. That should work. The script from github was written by PHil Sturgeon. The same Phil who wrote the Pyro CMS build on top of CI and CI core contributor.

veedeoo 474 Junior Poster Featured Poster

how about this? Will it help?

veedeoo 474 Junior Poster Featured Poster

Not sure, but you can experiment with this will give you the size of the window onload and on resize state.

The jquery part to send it to the controller is as simple as this.

Add a method for the controller

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

Class MyController extends CI_Controller
{

    public function __construct()
    {
        parent::__construct();

     }


     public function get_window()
     {

         if (isset($_POST)){

             ## filter and assigned to session
          }   

     }

Change this part of the script on second linked script above

this

url: 'text.php',

to this

url: 'MyController/get_window',

if you think you need to use routing, please feel free to do so.

If you want the jquery to update the session, make sure to add onchange event or something. So, that when the user manually change the window size, the script get updatated.

veedeoo 474 Junior Poster Featured Poster

how about using jquery to get the browser information and then submit the collected information via ajax to the controller method and then assign them to session.

veedeoo 474 Junior Poster Featured Poster

@UK-1991,

thanks for your message. I am confident that broj1 can deliver the solution to your problem.

veedeoo 474 Junior Poster Featured Poster

run this. Values of the array are the most commonly used in CMS application.

<?php 

 $server_min = array(
                        'max_execution_time' => 1000, 
                        'max_input_time' => 1000, 
                        'upload_max_filesize' => '200M',
                        'post_max_size' => '200M'

                        );


     function get_php_ini_settings($server_min = array())
     {

         $res = '';
foreach($server_min as $setting => $value){
                    $res .= "$setting  : ".ini_get( $setting )."  ";
                    $res .= ini_get( $setting ) < $value ? '(<font color="red">we recommend '.$value.'</font>)': '<font color="red"> OK </font>';
                    $res .= '<br/>';


            }

            $res .= '<font color="red"><b>!Important Notice!</font></b><br/>You can optionally correct the values of the items in red. To do this, you need to make the adjustments in your php.ini file located at. <font color="red"><b>'. php_ini_loaded_file().'</font></b>';
            return $res;
     }


     echo get_php_ini_settings($server_min);

anything that has red font on it, you need to change the value in php.ini. the location has already been given to you by the script.

restart your apache and you should be able to upload upon php.ini file update.

veedeoo 474 Junior Poster Featured Poster

here is another really quick and dirty MySQLI connector using foreach loop .

<?php

$con =mysqli_connect($dbhost,$dbuser,$dbpass,$dbname);

## Check connection
if (mysqli_connect_errno())
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }

    $sql='SELECT * FROM search WHERE function LIKE "%'.$search_string.'%" OR name LIKE "%'.$search_string.'%"';

    $result=mysqli_query($con,$sql);

    ## Fetch all all the result array
    $result_array = mysqli_fetch_all($result,MYSQLI_ASSOC);

    ## Free result_array set
    mysqli_free_result($result_array);

    mysqli_close($con);

    foreach($result_array as $v){

        echo $v['function'].'<br/>';
    }
veedeoo 474 Junior Poster Featured Poster

I really don't to be reiterating the common knoweledge at all times, but I think this one is one of those exemptions.

Codes below are bad

// Connection
global $tutorial_db;
$tutorial_db = new mysqli();
$tutorial_db->connect($dbhost, $dbuser, $dbpass, $dbname);
$tutorial_db->set_charset("utf8");
// Check Connection
if ($tutorial_db->connect_errno) {
printf("Connect failed: %s\n", $tutorial_db->connect_error);
exit();
}

We can instantiate the MySQLI object in one declaration like this

$tutorial_db = new mysqli($dbhost, $dbuser, $dbpass, $dbname);

we catch error if there is one

    if ($tutorial_db->connect_errno) {
        printf("Connect failed: %s\n", $tutorial_db->connect_error());
        exit();
      }

I still don't understand the unecessary while loop followed by foreach loop. However if that is what you want, change this block of codes

 // Do Search
    $result = $tutorial_db->query($query);
    while($results = $result->fetch_array()) {
    $result_array[] = $results;
    }

with this

 $result_array[] = array(); //or like this $result_array = array();
 $result = $tutorial_db->query($query);
    while($results = $result->fetch_assoc()) {
    $result_array[] = $results;
    }

Alternatively, you can eliminate the entire foreach loop and just do it like this

$result = $tutorial_db->query($query);

if($result->num_rows > 0) {
    while($result_array = $result->fetch_assoc()) {

    /*
    * add items from foreach loop here as shown on your code
    */

    echo $result_array['function']; //this is a test

    }
}

else {

echo 'Sorry your request does not exist';

}
veedeoo 474 Junior Poster Featured Poster

Hi,

try this first.. create a file index.html and save to photos/

If it does not do the trick, you can define directoryIndex directive in .htaccess file.

create .htaccess file and then paste codes below

DirectoryIndex index.html index.php index.cgi index.inc index.tpl index.htm

If you are serving your site on VPS, you can define directoryIndex directive when you create your virtualhost.

<VirtualHost *:80>
    ServerName *.yoursite.com
    DocumentRoot "putyour stuff here as directed by your host"
    DirectoryIndex index.html index.htm index.php index.tpl index.cgi
</VirtualHost>

Lastly, you can also do this in your apache httpd.conf file

<IfModule dir_module>
DirectoryIndex index.html index.shtml index.html.var index.htm index.php3 index.php index.pl index.cgi
</IfModule>

the above will need the dir_module enable

change this (httpd.conf)

#LoadModule dir_module modules/mod_dir.so

to this

LoadModule dir_module modules/mod_dir.so
veedeoo 474 Junior Poster Featured Poster

Your first attempt was fine for me.

Why is it fine for me?
The $cron_id has nothing to do and it is not part of the query. So, whatever the value of the cron_id, it will not affect nor change the delete query. It may change the frequency of executing the query, but it has no controll on what to delete.

The query that will definitely require a bind_param is something like the scenario on my example below.

For example, we have a user interface that allow user to select and delete their personal files.

Based on the requirement of the interface, there will be user input involvment here. Let say the user click on the link below

<a href="delete.php?id=102"/> delete this item </a>

the delete.php can be coded like this

<?php

    if(isset($_GET)&&(filter_var($_GET['id'],FILTER_VALIDATE_INT))){

        $file_id =  filter_var($_GET['id'],FILTER_SANITIZE_NUMBER_INT);

        ## the bind parameter
        $stmt = $mysqli->prepare("DELETE FROM user_files WHERE file_id = ?");
        $stmt->bind_param('x', $file_id);
        $stmt->execute();
        $stmt->close();

      }
veedeoo 474 Junior Poster Featured Poster

by the way, you don't really need to do this

 $query= $this->db->get('');

this should be the proper way

 $query= $this->db->get();

the reason is that the database active record class method for get is declared like this

public function get($table = '', $limit = null, $offset = null)

What does the above method tells us is that the parameter table has been predefined as '' as empty, while the $limit and the $offset parameters are predefined as null.

I know this bring up many arguments about all the parameters are equally the same. In theory, they may appear to be equal but the null will return false if evaluated if it is set, while the '' or "" will definitely return true. However, the most revealing truth that these 3 parameters are not equally the same at any point is this. If '' or "" is evaluated as is_null() it is definitely false, but all will evaluate to true if evaluated as empty(). Whereas in the comparator operators, these three will also have a hair line difference. Null is true if compared as == and ===, while '' and "" will become false in === and true in ==.

That is pretty important stuffs in dealing things in Obejcts and methods. So, we don't really do this

if($query->num_rows()== 1)

the reason is that the numerical rows carries a default value of 0 ONLy in this regards, so if we do this

if($query->num_rows()> 0)

that …

veedeoo 474 Junior Poster Featured Poster

can you change and test your model with this code?

function get_detail($Product_ID)
{
    $this->db->from('products');
    $this->db->where('Product_ID',$Product_ID);
    $query= $this->db->get('');
    if ($query->num_rows() >0 ) {

    return $query->result();

    }

     /// return false;
}

this

return $query->result();

allows you to access the $row in view as object.,

while this one will allow you to index the array e.g. $row['column_name'].

    return $query->result_array();
veedeoo 474 Junior Poster Featured Poster

ok, use your good command in html and css. Create an html document something like this

<!DOCTYPE html>
<html>
    <head>
        <title></title>
        <link rel='stylesheet' type='text/css' href='style.css'/>
    </head>

    <body>

        <div>Make this disapper on click using jquery</div> 

    </body>
</html>

create the style.css and make the <div> with blue background; widht: 400px; and height: 400px;

Write a jquery function to make the div fadeout on click. I want you to make the fadeout slow.

veedeoo 474 Junior Poster Featured Poster

can you do ?

print_r($data['row']);
veedeoo 474 Junior Poster Featured Poster

Will this be good?

How about this? It is two years old, but I think it should work with minimal upgrades.

veedeoo 474 Junior Poster Featured Poster

Really, are people unable to do even a copy and paste now? Wow.

We can pretty much see what will be the PHP developers of the future.

veedeoo 474 Junior Poster Featured Poster

from the top of my head, all you need to do is copy and paste onto the search box.. OScommerce, zencart, open cart, tomato cart, presta shop, magento community edition.

veedeoo 474 Junior Poster Featured Poster

you can add it on your plugin or theme function. I don't have any time to actually check for my answer. However, I did this long time ago and this is how much I can recall.

Warning! *Please check the wordpress codex for validity of my wordpress syntax and make sure they are not deprecated. I did this long time ago and I haven't check on their updated documentation.
*
For example, if I have a plugin called veedeoo_plug and I want to register the PHP session for this plugin in wordpress global space, then I would code it something like this.

function my_session(){

     if(!session_id()){

         session_start();
     }
}

## we need to hook the above function with the wordpress.

add_action('init','my_session');

After adding the codes above, check if there are any errors. If no errors you can assign the session as you would assign them on regular php

$_SESSION['your_session'] = 'foo_bar';

for the add_action reference, please read here.

mattster commented: nice work! +4
veedeoo 474 Junior Poster Featured Poster

Can you please tell me why you need to send two mysql queries during login credentials validation?

For security reason, what these pages tell the user, when they arrived upon redirect?

header ("Location: index.php?look=login&err=nun");
header ("Location: index.php?look=login&err=npw");

these are wrong data types. Supposedly, you want 0 and 1 as an integer or numeric data type.

if ($resulting == "0")

## and
elseif ($resulting == "1")

proofs that the above will always return false if you are referring to the mysql_num_rows response.

<?php

    $x = "0";
    $y = "1";

    var_dump(is_int($x));

    echo '<br/>';

    var_dump(is_int($y));

the above will return

bool(false)
bool(false) 

which is nowhere close to either presumed returned values of either

$resulting = mysql_num_rows(mysql_query("SELECT * FROM members WHERE loginname='$post_username' and password='$post_password'"));

or

 $user_datagain = mysql_fetch_array(mysql_query("SELECT * FROM members WHERE username='$post_username' and password='$post_password'"));

Both of the queries above will return an integer that's for sure. You can read more about data-types in mysql here.

I strongly suggest that you should reconsider re-writing your script's logic construct.

veedeoo 474 Junior Poster Featured Poster

Honestly, your query looks good to me. Unless, you made a mistake in referring to the image.

<img src="directory/<?php echo $row['image'];?>" />

should give you something like this

<img src="directory/mpb.jpg" />

remember you query looks for the minimum price for each Product_name and not the MIN of all prices. Still, this scenario will not create an image mismatched.

veedeoo 474 Junior Poster Featured Poster

Honestly, I kind of like the gimmeDotSupport. It is pretty straight forward I think.

veedeoo 474 Junior Poster Featured Poster

Most are using database, but I prefer storing it as xml file similar to how the symfony2 stores its AsseticBundle configurations as xml files.

veedeoo 474 Junior Poster Featured Poster

for the template name or style name, you can either store it in database or in xml file.

veedeoo 474 Junior Poster Featured Poster

I forgot, If you can access your httpd.conf, you can edit it like this as per apache's instructions. Make sure the dir_module is installed though.

<IfModule dir_module>

DirectoryIndex index.html index.shtml index.html.var index.htm index.php3 index.php index.pl index.cgi

</IfModule>
veedeoo 474 Junior Poster Featured Poster

you can try

DirectoryIndex index.php

try adding that to your .htaccess file either in the root or your directory in question and let us know if it work. You can read more about this topic here.

veedeoo 474 Junior Poster Featured Poster

OMG veedeoo did you bomb the bully? I guess that would have been pretty cool but one helleva scare if the guy ended up dead!

lol :). No, I did not bomb the bully. I electrocuted him, but not in my wildest imagination my gadget would even work.

My Dad did a lot of experiments on electrical autotransformers. I witnessed him converting a regular outlet voltage to thousands and thousand of volts, but these voltages carries a very minuscule amperage in them. For some reason, it gave me an idea creating something to defend myself and so I did build my portable electricution probes.

I bought the cheapest sine wave generator from radio shack and wired the input from my scooter's battery. I connected the output to the autoransformer. I placed the battery and the transformer inside my backback that entire week. I was patiently waiting for the bully to come close to me at arm lenght just like he did the last time. I was wearing my gadget jacket to hide the probes taped on my arms.

I think it was the Gods of Olympus who have hearkened to all of my prayers that week. The bully came up to embarass and harass me even more, but I was ready. When the distance was just perfect, I shoved the probes to his abdomen, and little I knew that this bully kid would fell like an statue with his face first. Sparks were everywhere and my heart was …

veedeoo 474 Junior Poster Featured Poster

Graduated High School From the world class Tech Magnet School here in California. Although we have football field, I don't know much about playground, I am sure we don't have one. All we have were computers and finest mathematics teachers. Some kids are too young to be in High School. We have more mathematics, sciences, and computer geniuses than any high schools in the US of A.

Pretty much kids graduating at the age of 18 is considered pretty old at my school. There are many fine looking geek girls and that is a plus being in tech magnet school.

Junior/Senior prom were not as colorful as any other high school in the U.S., we have less dancing but have more laptops and bow ties in the dancing hall, for us geeks this is the night we can show what we can do behind the black box. We can hack any wires that have some signs of logic in them.

Just like iamthwee, I was bullied once, but I showed the big guy what the geek can do. Good thing the poor bully kid made it to the hospital, but I was very sorry for inventing something I shouldn't.

iamthwee commented: LOL +0
veedeoo 474 Junior Poster Featured Poster

should be like this

 $dataid = mysql_fetch_array($studentidResult);
veedeoo 474 Junior Poster Featured Poster

Both will be good and this new password_hash function from PHP.

veedeoo 474 Junior Poster Featured Poster

Please ignore my reponse. For some reason, we posted our responses almost at the same time.

echo '<a href="'.$dirpath.'/'.$file.'"> Click here to download '. $file .'</a>';
veedeoo 474 Junior Poster Featured Poster

You can also try doing something like this

if(isset($_POST['submit'])){

    var_dump($_POST);

  }

the above should give you two sets of array. Assuming that all items are checked and quantities were filled, the above codes will give us something like this

array(3) {
  ["drink"]=>
  array(5) {
    [0]=>string(3) "p/c"
    [1]=>string(6) "c/half"
    [2]=>string(3) "b/k"
    [3]=>string(3) "b/c"
    [4]=>string(3) "b/w"
  }
  ["drinkno"]=>
  array(5) {
    [0]=>string(1) "1"
    [1]=>string(1) "2"
    [2]=>string(1) "3"
    [3]=>string(1) "4"
    [4]=>string(1) "5"
  }
  ["submit"]=>string(5) "Order"
}

looking at the dumped array, we can see that the drink and drinkno are paired by index that's all we need to know.

We change the code above to test if we can get pair.

if(isset($_POST['submit'])){

    echo $_POST['drink'][0] .'=>'. $_POST['drinkno][0] .'<br/>';

}

You can also sort the not empty entries

$order ='';
$order .=(!empty($_POST[drink'][0] && !empty($_POST['drinkkno'][0] ?'drink type :'. $_POST[drink'][0].' quantity : '.$_POST['drinkkno'][0] : false );
$order .= '<br/>';

## do the same for the remaining drinks
veedeoo 474 Junior Poster Featured Poster

@raminshahab, here is the array equivalent and you can try either one of the proposed solutions above. I know which one will work and which one will not. Your job now to test each.

$json_info = array('data'=> array(
            'ucsfeduworkingdepartmentname'=>array('ITS'),
            'telephonenumber'=>array('+1 415 502-7575'),
            'ucsfeduprofilenodeid' => Array ('39487740' ),
            'displayname' => Array ('Kevin Dale' ),
            'postaladdress'=>array('Box 0272 1855 Folsom Street, MCB Room 401S San Francisco, CA 94143'), 
            'uid' => Array ('88834' ) ,
            'ucsfeduprimarydepartmentnumber' => Array ('411112' ),
            'ucsfeduworkingtitle' => Array ( 'Sr Manager, Identity Mgmt' ) ,
            'mobile' => Array ( '1 415 806-8480' ), 
            'roomnumber' => Array ('401S' ) ,   
            'mail' => Array ('kevin.dale@ucsf.edu' ), 
            'box' => Array ( 'Box 0272' ), 
            'baseaddress' => Array ('1855 Folsom Street San Francisco, CA 94143' ), 
            'primary' => Array ( 'box' => 'Box 0272' ), 
            'building' => Array ( 'MCB' ), 
            'baseaddress' => Array ( '1855 Folsom Street San Francisco, CA 94143' ), 
            'postaladdress' => Array ( 'Box 0272 1855 Folsom Street, MCB Room 401S San Francisco, CA 94143' ),
            'cn' => Array ( 'Campus' ), 
            'ucsfeduaddressprimaryflag' => Array ('true' ),
            'roomnumber' => Array ( '401S' ), 
            'telephonenumber' => Array ( '+1 415 502-7575' ), 
            'ucsfedusecondarytelephonenumber' => Array ('') ,
            'ucsfedutelephonenumberreleasecode' => Array ( ''), 
            'ucsfedusecondarytelephonenumberreleasecode' => Array ( '')  ,
            'ucsfeduprimarydepartmentname' => Array ('F_IT Identity and Access Mgt' ), 
            'departmentname' => Array ('F_IT Identity and Access Mgt' )



));

good luck to you.

veedeoo 474 Junior Poster Featured Poster

you can make the password all lower case. Although I do not agree with the use of a superglobals $_GET to process user credentials, you can do it like this

Everytime the form is submitted, you can covert the password to lower case

$password = strtolower($_GET['password'];
veedeoo 474 Junior Poster Featured Poster

I am not aware of any GUI to do this kind of installation, but it is not that hard to install them using comman line.

veedeoo 474 Junior Poster Featured Poster

Sorry about this

 ($_POST['submitted'] == true)

It was my mistakes. It should be like this

 ($_POST['submitted'] == "true")

It should have double quotes, because it is a string and that's what I wanted to confirm . So the correct codes should be like this

    <?php if(isset($_POST['submit']) && ($_POST['submitted'] == "true")){ ?>

Now, that I have corrected my wrong response, I have to answer your question.

why need add ($_POST['submitted'] == true) can u explain this?

Normally, when we assign hidden attribute to a form input, it is for the purpose of second stage validation e.g. we want make make sure that it is not a robot filling and submitting our form. So, this

 <input type="hidden" name="submitted" id="submitted" value="true" />

can be confirmed by my proposed codes above. Another purpose is to prevent repeated form submission of the same user.

veedeoo 474 Junior Poster Featured Poster

try changing the form method attribute to what is expected by the form processor.

for example, if you want to process this form with get method,

<form method="post" action="index.php">

then it should be like this

<form method="get" action="index.php">