veedeoo 474 Junior Poster Featured Poster

I am also a big fan of the separation of business logic and presentation logic. In fact, I have attempted to create a very simple template engine that can run simple html rendering from a parent text file serving as the main template file.

For the sake and for the support of the above tutorial, please allow me to contribute something I think will be helpful to others.

We can easily achieved dynamic templating without even creating a multiple template files. However, as the application gets bigger, the server resources becomes the main bread and butter of this method. So, please use this technique sparingly.

This idea came up to me when a friend from github have asked me to contribute on codeIgniter dynamic application creation project. It is something that hasn't been release to this date, but I will modify my codes to prevent any confusion and also in fairness to the person whom I have given the permission to use the snippet.

This is pretty much inspired by the smarty templating engine. The only difference is that this will not compile, but rather deliver the content directly after they are prepared.

Let Say we have an Obejct Oriented written application that will output an array. This array can be any data types. In order to implement or take advantage of the server side doing the lifting, we can change our back-end development perspective a few angles from either the left or the right of the norms. I know …

mattster commented: That's brilliant! Thanks! +4
rubberman commented: I appreciate the comment and suggestions. Thanks! +12
veedeoo 474 Junior Poster Featured Poster

besides from using the deprecated mysql_ function, your query is not properly constructed.

It should be constructed like this. Assuming that the $db is the persistent database connection. Make sure to add an error catcher. I am just giving you the most basic example.

$result = mysql_query($query,$db); 
while($row = mysql_fetch_array($result, MYSQL_ASSOC)){

     echo $row['username'] . " " . $row['userrole'];

        echo "<br>";
}

to close the connection

   mysql_close($db);

Although it is not a problem to use $try as variable, it is highly recommended not to use PHP reserved keywords at all cost.

remember $db is something like this

$db = mysql_connect($dbhost, $dbuser, $dbpass);

if you don't want it like that, this will work also, but you will have to remove all the reference to $db from my example above

mysql_connect($dbhost, $dbuser, $dbpass) or die(mysql_error());
mysql_select_db("Your_database_table") or die(mysql_error());

$query = "select * from login where username = '$username' and userpass = '$userpass'"; 

$result = mysql_query($query); 

while($row = mysql_fetch_array($result, MYSQL_ASSOC)){

     echo $row['username'] . " " . $row['userrole'];

        echo "<br>";
}

then you can close it like this

mysql_close();
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

How about Welcome and Hello.

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

@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

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

The table has nothing to do with it.

this is the one causing the error

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

you can do something like this

<?php if(isset($_POST['submit']) && ($_POST['submitted'] == true)){ ?>
veedeoo 474 Junior Poster Featured Poster

Okay, I must admit, I am not too lazy today. Here is the HMVC design diagram as it applies to Codeigniter functioning as HMVC framework. It is not like the Kohana or Fuel PHP, but the design pattern concept is there.

e872bbfa2623ccfdbec51d7e2e114e03

it should read "Application Modules are pretty much independent". Sorry about my wireless keyboard battery it think is dying. It cannot catch up on my typing speed :).

Unlike the conventional MVC pattern, the HMVC pattern in this particular framework isolates the modules, making them less interconnected. So the blog controller don't even know if there are other controllers. Because of this design patterns, we can create as many modules as our application demands expansion.

edit again..
I really need to change my batteries.. this is my third edit and it is missing a lot of letters and verbs here in there.

veedeoo 474 Junior Poster Featured Poster

Thank you very much people for the new Featured badge. Special thanks to these wonderful people in PHP forum iamthwee, Diafol,pritaeas,Cereal and many others I can't recall their handle.

Also, many, many thanks to Queen Dani, happygeek, and to the other pillars of this community. This is such a wonderful badge of honor.

Wow! I need to show this to my Mom and Dad, aa-nn-nn-ndd to my brothers to. :).

veedeoo 474 Junior Poster Featured Poster

okay, I found the link in my inbox. Here is the link for the class. The script might need some upgrades, but that should not be a problem.

veedeoo 474 Junior Poster Featured Poster

Prepared statements with parameters work like this.

Methods used : prepare() and execute()

PDO is class. An instance of this class is called an object and the functions associated with this object are called methods.

For our purpose above (shown on your codes), we need these methods called prepare and execute. Now, PDO allows us to prepare and compile our query with placeholders. Placeholders are like markers for the expected values from the users. When the execute method is called, it sends the arguments and runs the compiled statements sent earlier.

So, there are two things going on here in the background.

First, this will be send to the server and later on will be compiled

 $query_insertintotable = $con->prepare("INSERT INTO User (username,Password,First Name,Surname, Gender, DOB, Email Address)

VALUES (:userName, :password,  :firstname, :Surname, :gender, :dob, :email)");

These are placeholders for anticipated incomming values from the user

 VALUES (:userName, :password,  :firstname, :Surname, :gender, :dob, :email)");

TYPE 2 : alternatively, we can also do this

VALUES ( ? , ? ,  ? , ? , ? , ? , ? )";

Those are two options in setting-up the placeholder for binding. For now, let us stick to the first one to avoid any confusion.That is the beauty of PDO. It allows us to send query and temporarily compile with the placeholders.

The second part of the process is to send arguments by way of the method execute.

For the first example, we can do it like this

$query_insertintotable …
princetonMarv commented: nice :) +0
veedeoo 474 Junior Poster Featured Poster

I second magento. There are others OsCommerce, ZenCart, open cart, Agora cart just to name a few.

Here are some hints on the skill set requirements.
For Magento, you need to have at least basic knowledge of Zend Framework and strong OOP background.

For OsCommerce, ZenCart, Open cart, you need basic understanding of MVC design patterns and strong OOP background. All of these open source cart are pretty good and tested for years. OsCommerce have the most libraries and modules available.

For Agora, OOP background.

Another alternative is to build your own eCommerce system on top of well trusted MVC frameworks like laravel, Kohana, CodeIgniter version 2.2.0, Symfony 2, and Yii. For eCommerce application, I highly recommend Laravel, Kohana and CodeIgniter. The reason is that these frameworks already have a well established payment processing libraries. For example, CI can use omnipay.

By using MVC frameworks as the foundation of your eCommerce project, you are in control of the features you want your application to have. You can always add anything you want at any time. The only downside is that it takes a lot of work before you can see the final product. While in ready made cart, you don't have to do anything, except for features that you want to add. Besides, this can be built to be the ultimate eCommerce CMS if you want.

<M/> commented: Those are some good ones +10
veedeoo 474 Junior Poster Featured Poster

You can use JAVA. Regardless which language you use, they all do some kind of refreshing. If not, how can the application post and recieve messages?

PHP don't need to refresh the entire page for the chat. Ajax can be utilize to do the posting and receiving messages to and from the server.

So, still PHP qualifies for the instant messaging if you are looking for a browser base chat system.

For desktop type application, try JAVA and C++.

veedeoo 474 Junior Poster Featured Poster

Pretty much there is not much difference except you cannot use Scope Resolution Operator :: for non-static methods AND static method does not need an instance of the object.

This

className::function()

is use outside the class, while these

self::function()
static::function()

are use within other methods within the class. This

 $this->function();

if use in other static method will throw not in object context error.

Static method is commonly used in Singleton pattern, database connection or anything that don't need to instantiate the entire class. In short static method is independent to the class or object where it belongs.

To prove that static method is not dependent in the class of which it resides, try this..

class Test
{

    public function non_s(){
        echo 'not static method';
        self::static_m(); // this will work
        static::static_x(); //this will work

    }

    public static function static_m(){

        echo 'this is from static method static_m <br/>';
        self::non_s(); // this will throw an error
        $this->non_s(); // this will not work also

       }

     public static function static_x(){
         echo 'This from static_x();
         $this->static_m();// will throw a not in object context error. 
    }

   } 

   ## this will work
   Test::static_m();
   Test::static_x();

   ## this one will not work for the non-static
   Test::non_s(); //will not work

   ## but this will work
   $object = new Test();
   $object->non_s();
   $object::static_x();// this will work
   $object->static_x(); // this will work also

In conclusion, static method can be access regardless if there is an instance of object or not.

veedeoo 474 Junior Poster Featured Poster

as suggested, you can try using VM. There is one called Oracle VM Virtualbox Manager.

You can have many different OS installations as you want. The Iternet connection can be shared with your host computer. Please see attached screenshot

7d763fdfa856f40a2401e36d673f0236

Odesk.com on Unbuntu server skinned with kubuntu.

35fef021f038ec8ae0de9e7e3bb10431

veedeoo 474 Junior Poster Featured Poster

@Cereal

I don't understand why you get a down vote for it though. It must be a C++ pride or something. I will give you an up vote to reflect 0 vote :).

cereal commented: possible, thanks :) +13
veedeoo 474 Junior Poster Featured Poster

Just to let you know, I am planning to add a compile function to the Template class later.
Although I am trying to not go very far from PHP doing the template rendering, I want to make sure that the class will be capable of something like this.

business

$fruits = $view->data(array('apple','banana','orange','grapes','pears'));

presentation

<ul>

{foreach $fruits as $item}
    <li>{$item}</li>
{/foreach}

</ul>

Though it may appear to be like smarty, the truth is it is not. I will be using simple PHP function to compile the content of the index.tpl file.

Please stand by for that modification of the class Template.

veedeoo 474 Junior Poster Featured Poster

This tutorial is intended for people who are looking for alternative to PHP template engines like smarty, twig, dwoo, TBS, and others. Not all developers are willing to take the extra efforts needed to learn the template engine syntax. Some are just left behind thinking that PHP is a template engine itself and there is no need for another template engine.

Regardless of what you think about PHP, it has been proven that PHP can be written in procedural, OOP, CLI interface, and spaghetti style .In this particular tutorial, I will be demonstrating how to use PHP effectively as a template engine by way of business logic and presentation logic separation.

What are the requirements?
1. Basic knowledge of OOP ( we are not going to write one, but I will give you one to use. This is for one file only).
2. Xampp or equivalent
3. Basic knowledge with MySQL and PDO.

Objectives
1. The main objective of this tutorial is to minimize the presence of the application's business logic inside the presentation logic.
2. Introduction to PHP magic function called __toString().
3. Avoiding the while loop after the MySQL query, but instead passing the result as an array.
4. Simple exposure to PDO

What is business logic?
Business logic can be the function processing a resulting array from another function, mySQL queries, evaluated results from statments to trigger another function, and all other things that are working behind the background.

iamthwee commented: great +14
veedeoo 474 Junior Poster Featured Poster

if you var_dump or print_r this

$_FILES['datafile']['type']

what do you get?

Careful with the mime type as Diafol already brough up. A PHP file uploaded will give you "text/plain". By not knowing the exact extension of this file, it means a widely open back door.

ultmt.punisher commented: your suggestion helped. +1
veedeoo 474 Junior Poster Featured Poster

Rocky theme song and Thunderstruck by AC/DC should do it for him :).

<M/> commented: or we can play eye of the tiger +0
veedeoo 474 Junior Poster Featured Poster

@iamthwee,

After thinking more about this and the efforts you have already invested on your CMS, would it be possible for you to just build the blog in CI? The reason is that you are almost there. Just few more steps and you're done. You can do it Dude :).

<M/> commented: Lets play the Rocky Theme Song For Him Then +0
veedeoo 474 Junior Poster Featured Poster

Here are the books I currently have on my bookshelf.

  1. Learning Javascript Design Pattern by Addy Osmani published by O'Reilly
  2. Professional Javascript for Web Developers by Nicholas C. Zakas published by Wrox.
  3. Node.js for PHP developers by Daniel Howard published by O'Reilly
<M/> commented: Pretty cool +0
veedeoo 474 Junior Poster Featured Poster

I don't charge people for providing them with the help I could possibly provide. However, you can donate for the cause of Daniweb.

Then you can post the source code here.

veedeoo 474 Junior Poster Featured Poster

My most preferred in storing images is exactly the same as you have suggested.

Some people prefer to store images in the database. Used to be, images of high value e.g. photographers will store their porfolio in mysql after the copyright has been injected into the image, rather than just creating a layer over them and save in the directory.

Others may have a really good reason in doing so.

veedeoo 474 Junior Poster Featured Poster

it is called BLOb or binary large object. Yes, you can store images as BLOb in the database.

You just have to show us what've got so far. Writing it is pretty easy, but I need see how motivated you are in doing this.

veedeoo 474 Junior Poster Featured Poster

Personally I think Python is better then ruby because it runs on the Django framwork and it can do more.

I do respect your affinity to Python. However, why is it that you only mentioned Django framework and not a single framework for Ruby. Have you ever tried writing web applications in Ruby utilizing these frameworks?

Padrino, Ramaze, NYNY, Sinatra, Nancy, Hobbit. I could go on and on with the list. Please feel free to let me know if you need more and I'll give you 6 to 8 more

Do you know how easy it is to write an application utilizing those mini frameworks I have mentioned above vs. writing a python web application in Django framework? The argument should not always focus on which language is better. Some languages are better on specific application, while others can't just deliver the anticipated results.

Before crossing to the Ruby side of Daniweb, make sure to do some research first about this subject.

I wrote applications in Python utilizing Django, the same application I wrote in Ruby under Padrino. I wrote the very same application in PHP with three different frameworks namely Symfony2, CodeIgniter, and Fuel PHP. Still, I am not sure which one is better. The reason is that all of them did the job as I expected them to be. However, if someone will ask me, if I can write the same application I wrote in PHP in different language, then my answer would be yes, but …

veedeoo 474 Junior Poster Featured Poster

try replacing the $_SERVER['DOCUMENT_ROOT'] with the relative directory.

veedeoo 474 Junior Poster Featured Poster

okay guys, I am on break :). it is around 1:18 AM in my time zone and I am just taking the 20/20 break :). Then I will eventually hit my bunk bed..

The purpose of this post is to show my fairness to other languages of choice as mentioned by the Prateek_2. Again, my comparisons are focused on Web applications and I am not taking any desktop application into consideration. Otherwise, this will be covered on the software development forum of which I am also glad if I am given the chance to explain my take between the JAVA and C#. Obviously, I will take both.

Now i want to built some business type application like ERP

I have given him the EPESI

and i am confused which language to choose ASP.NET or java

I have given him examples of PHP based on his requirements. I hope :).

Let's take a brief look at the simple language constructs of these three languages at it applies to Web applications Enterprise or Just a plain personal page. For web applications, JEE (Enterprise edition) is highly favored instead of the regular JSE ( Standard Edition). While for the ASP.net it can be either C# or VB running on RAZOR mark-up Syntax where the full MVC design patterns can be utilized.

The Console Vs. CLI (PHP). Demonstration of a simple Hello World

JAVA

package com.test.model;

public class TestingJava {

    public static void main(String[] args){
        String sayit = ("hello wordl!"); …
veedeoo 474 Junior Poster Featured Poster

Hi,

You can try paypal API here. The implementation is fairly easy. Just make sure to sign up for your Paypal sandbox account for testing.

On the sandbox, you create the seller and buyer accounts.
Create a page with test products similar to your actual production site.
Call the api and start testing by doing transactions.
Check the sandbox if the transaction went through.

Test a few more times and look for any glitches or something that may cause a problem. You can either post your questions here on daniweb or do it on the github. If you want me directly respond to your questions, then post it here on Daniweb. You will have a better chance of getting a response from me here that anywhere else.

veedeoo 474 Junior Poster Featured Poster

There are some strenghts that are unique to codeIgniter, Zend, Laravel and many others.

Months ago, we were telling people about the diminishing codeIgniter before the eyes of its creator. However, I was really surprised with the release of the version 2.2.0. So, I guess I can recommend CI again.

For example, let say we have a medium size corporation with 5 different entities. If we want to manage these entities from ONE backend application we can utilize epesi as shown below

3ed5b1ab8a3f84634ef77d88d0f1ab1f

We can make epesi to be the corporate headquarters. We can gather reports, activity logs, trasactions, and all these good stuffs from all the 5 entities.

Now, let us go down to the entities. Let say each of them, have their own products completely different from one another. We want these entities to have their own websites. What framework should we use?

My response is codeIgniter. Why CodeIgniter? Here is why. Let say entity one sells mobile phone, entity two sells shoes, entity three sells outdoor gears, entity four sells furnitures, entity five sells used clothings. Generating a report is not a problem with Epesi, we can pretty much modify the script to accomodate any requrements.

How can achieved this in CI? Actually, this is pretty easy to achived in CI because you can create your on library specific to your needs.

Say we are to create the entity one library

<?php

    class EntityOne{

        public function __construct(){
            $CI =& get_instance();
        }

        public function …
veedeoo 474 Junior Poster Featured Poster

Is it possible to integrate SAP with php ??

There was a book entitled SAP Developer's Guide for PHP. PHP can also work with SAP HANA.

Also i want to integrate crystal reports (I heard about this from my senior) in php. Is that possible ???

Yes, all you need to do is install a JavaBridge. I already talked about JavaBridge in one of my post long time ago.

Is MySQL (which i mostly used along with php) realiable enough for business solutions, which is quite large.

For high-end business applicationm, I don't see any limitation on MySQL. However, PDO extension support multitude of databases like
Cubrid
FreeTDS / Microsoft SQL Server / Sybase
Firebird
IBM DB2
IBM Informix Dynamic Server
MySQL 3.x/4.x/5.x
Oracle Call Interface
ODBC v3 (IBM DB2, unixODBC and win32 ODBC)
PostgreSQL
SQLite 3 and SQLite 2
Microsoft SQL Server / SQL Azure
4D

In addition, there are many excellent ORM for PHP e.g. Propel, Doctrine, and another one that I can't remember its name. I know Laravel uses Eloquent, but that's not it though :).

When you were using CodeIgniter, have you tried using the codeIgniter's Active records? That's pretty simple library not even close to the latest ORM, but it can handle some pretty serious loads. How about codeIgniter's transaction table safe?

below is a screenshot of a database with a little more than 1.3 million rows. …

veedeoo 474 Junior Poster Featured Poster

Because I am way so much younger than the majority, I can't say much about my experiences in life. However, why worry about age? I thought humans are like fine wine, we get better with age :).

veedeoo 474 Junior Poster Featured Poster

It all depends on the quality of codes you can deliver. If you can write an application pretty close or at least at the same quality as the application written in Django framework, you can get paid pretty high. In my area, the minimum Object Oriented Programmer with MVC framework experience have a minimum starting salary of 65,000 dollars per year. But that's pretty low I think.

I know it is unfair, but for procedural programmers, they get paid around 10 to 20 thousand dollars less.

There is no Doubt PHP is a great language. Over the years, it has proven itself to the world that it can move forward and it can continue to evolve for the better. However, PHP is the only language where anyone can call themselves as a programmer after few hours of exposure to the language.

In my Humble opinion, there are many levels of PHP programmers and developers. I just made all these level for myself, because I went through all of these levels.

  1. The first group are the mixers ( the spaghetti coders as we call them).

  2. The hammer bearers. After learning how to write a reusable functions, they focus more in using all functions on pretty much everything.Everything to them looks like nails.

  3. The separatists. These are the more advance programmers that does not believe in the mixing of the business logic and presentation logic.

  4. The object orienters. These are the second level of advance programmers who want to take the separation …

veedeoo 474 Junior Poster Featured Poster

I believe this is not something you can achieved without the help of a Payment Gateway through API e.g. paypal, echeck.net, evp snap and many others.

In creating this type of application, the first thing that should come up for consideration is "Liability". It is always nice to have a middle gateway or company who can absorb any liabilities incurred by either party just in case..

veedeoo 474 Junior Poster Featured Poster

@hallianonline,

Cereal, have provided more than enough to solve your problem and if you need more please follow link below..

another one for you. The answer to your question is located about 3/4 down the page.

This is only an example and you may need to research the codex for other stuff related to this subject matter.

before this

while( $posts->have_posts() ) : 

you need to set your arguments to something like ..;

$your_sort_requirements = array(

                            'order' => 'ASC',
                            'orderby' => 'whatever_you_want'.
                            ## define more here as you want
                            );


## and then you create an instance of the WP_query as mentioned on the codex.

$this_is_now_your_post_query = new WP_Query(  $your_sort_requirements);

since it is now your query, we can pretty much do this

if($this_is_now_your_post_query->have_posts()){

    while( $this_is_now_your_post_query->have_posts() ) : 

    ## do as what a good wordpress developer should do here..

    }
hallianonline commented: perfect +2
veedeoo 474 Junior Poster Featured Poster

password_hash for PHP version 5.5.x can verify the password from the user's input.

for example, we have user submitted form data

$password = $_POST['password'];
$username = $_POST['username'];
## don't forget to sanitize everything.

$your_query = "select username, password from USER_TABLE WHERE username = '".$username."'";

## execute your query  here and fetch the result



## and let hashed_pass equal to the row password

$hashed_pass = $row['password'];

## verify the password

if(password_verify($password, $hashed_pass)){

    ## password is valid

    }

    else{

        ## password is not valid

        }

The most important is that the $password from the user's input is not being included in the database query. The verification is occuring in the password_hash function and not in the database query itself.

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

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

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

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

try this.

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 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

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

you need to rewrite your array to something like below to associate every fruit to each color.

<?php

    echo '<b> Fruits </b> <br/>';

             $fruits = array('lemon'=>'#FFFF00','orange'=>'#FFA500', 'apple'=>'#FF0000');

    ksort($fruits);

    foreach($fruits as $k => $v){

        echo '<p style="color:'. $v .';">'. $k .'</p>';

        }
veedeoo 474 Junior Poster Featured Poster

Hi,

you can generate coupon code by implementing str_shuffle PHP function.

example codes

function get_coupon_code($string_length = 5){

  $coupon_code =  substr(str_shuffle('ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz), 0, $string_length);

  }

  echo get_coupon_code(5);

If you want the coupon to be an image, you can use imagestring function.