veedeoo 474 Junior Poster Featured Poster

cscgal should be able to direct you to the right direction about donating to daniweb. Good luck on your school project.

veedeoo 474 Junior Poster Featured Poster

ok, here are the full codes, I hope this will help you. Please do not hesitate to ask more questions. I should be able post response tomorrow. My wireless keyboard is running out of battery. So, I really need to post my answer as quickly as possible.

Here we go, first updated files

save this as book.php

<!-- filename book.php ..this is updated version. -->
<form method = "post" action = "processBookType.php">
<label>Please type book title</label>
<input type = "text" name = "title"/>
<br/>

<input type = "submit" name = "submit" value = "submit" />
</form>

save this as processBookType.php this file meets the following requirements.. include -> book class.

  <?php
 include 'book.class.php';
 if((isset($_POST['submit'])) && (!empty($_POST['title']))) {
 $status = true;
 $title = $_POST['title']; 

 }
 else{

 $status = false;
 ## you can  uncomment the code below if you want to use the variable equal to null
 //$title = NULL;
 ## this justify our empty argument , but I prefered the NULL above.
  $title = "";
 }

 $publisher = new Book ($status, $title);
 echo $publisher->getdisplayTitle();

 ?>

Brief info. about the processBookType.php above.. I gave two options for the title when it is submitted empty. One is $title = NULL; and equal to "".. both will do fine. However, it a much bigger application and if it going to be on a production server it should be set to NULL.

Now, the book.class.php.. As you notice in the include function, I have it as book.class.php.

save this file as book.class.php

veedeoo 474 Junior Poster Featured Poster

Hi,

First, don't get the class occupy your head too much. you can add them later. The most important steps in writing program is to established the barebone of your project (logic wise). Without laying out the proper logical flows of your project, it will confused you even more..

Relax, and think about your homework without panicking. Your instructor instructed you to do the following..

  1. Create a "Book" class
  2. Name the file “book.php”.
  3. Add a public method “displayBookTitle()”.
  4. Accept $_POST array as single argument.
  5. Make use of an “if / else” statement along with isset() and empty() to check if the book title is available.
  6. Echo an appropriate error message when desired condition is not met.
  7. Concatenate the book title retrieved from the $_POST array to this string: “The following book was submitted: “
  8. Echo the concatenated string.

Looking at the items above, we can easily use the process of eliminating the less important for us to build the barebone of our program.. Creating the book class is not the top notch priority in writing the barebone script. The public method is part of the class. The most important item of all the items above is the keyword POST. Whenever these terms "POST, GET, REQUEST" comes up, it is 99.9999% sure that a form is involved..

Now lets write this form.. we can call this book.php

 <!-- filename book.php ..yet but later on. -->
<form method = "post" action = "processBookType.php">
<input type = "text" name = "title"/> …
veedeoo 474 Junior Poster Featured Poster

Hi,

Remove extra curly bracket on line 111 just below echo $page_content.

veedeoo 474 Junior Poster Featured Poster

Can you run the phpinfo() one more time?

What is the value of the "Loaded Configuration File"... I am expecting a value of etc/php.ini .

Copy this script and upload to your server, name it anyNameYouWant.php direct your browser to this file.

<?
 if(!function_exists('zend_optimizer_version')) echo "Zend Optimizer is not installed";
 else echo "Zend Optimizer info.: ".zend_optimizer_version();

 echo "<h2> Checking Zend Engine Version</h2>";
 echo "Zend engine version: " . zend_version();
?>

If the installation was successful, I am expecting the script above to give us something like "Zend Optimizer : ZendOptimizer-3.3.9" on the first line and on the second line should be " Checking Zend Engine Version Zend Engine version : 2.3.0 ". The 2.3.0 version might be different on your server.

NOrmally, phpinfo(), will print out a page.. the very first table shows your php version, the second table is your system summary, and then there will be Zend information table with Zend logo on it.. and an announcement like "This program makes use of the Zend Scripting Language Engine: Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies"

If you don't have those, then your VPS don't have the Zend Engine on it that's for sure.. You can try asking the GoDaddy support department if they can add this on your package. I must refrain from giving any comments about godaddy hosting department. I love their domain registration, but I cannot comment on the hosting side.

veedeoo 474 Junior Poster Featured Poster

I guess your server don't have nano... lets try vi..

On your terminal again type.

cp /etc/php.ini /etc/php.ini_Default

The above command is for making a back up copy of your default php.ini file. Now, let's try if we can edit it with vi. Type this command

vi /etc/php.ini

There should be an editor like enterface on your black box (putty).. to insert, you must press "insert" on your keyboard and make sure you are seeing INSERT on your terminal. Start adding the zend option to this as instructed in the tutorial.

To save your changes press ESC on your keyboard..that should save your php.ini settings.. To make the changes takes effect on your server type

/etc/init.d/httpd restart

If everything goes well the zend optiomizer is now enabled. To confirm that the zend is enabled.. Copy, save, and upload through ftp to the root directory of your site..save this file as any name you want.

<?php

phpinfo();

?>

Direct your browser to this file... scroll down the page and look for the zend optimizer entries. If you prefer to confirm this through your putty command line, type

-v 

Hit enter... you teminal should show something about zend.. try the phpinfo() first... because you will be using it later for the gd library installation confirmation.

While you are running the phpinfo(), please confirm that your server's loaded configuration file is /etc/php.ini, if it is different than this, then you will have to do the above editing changing …

veedeoo 474 Junior Poster Featured Poster

try this..

log on to your remote site using putty.

  1. On the command box type

    wget http://downloads.zend.com/optimizer/3.3.9/ZendOptimizer-3.3.9-linux-glibc23-i386.tar.gz

Hit enter... you should be able to see donwload in progress including files being transferred from Zend for linux donwload.

Once the download is finished..decompress the tar, by typing the command below

tar zxf ZendOptimizer-3.3.9-linux-glibc23-i386.tar.gz

Hit enter again.... this should decompress your tar file. Look for confirmation like Done or any indication that it is done..

Once the decompression is finished, type the command below to moved the decompressed file to /usr/lib/php/modules/. Type command below..

cp ZendOptimizer-3.3.9-linux-glibc23-i386/data/5_1_x_comp/ZendOptimizer.so /usr/lib/php/modules/

Now we need to update our php.ini file for the zend optimizer's extension .so.. To do this we need the linux text editor (nano). Type the follwing comman on your terminal.

nano /etc/php.ini

Hit enter... the rest just follow if from the tutorial links I have provided above.. it should now work for you.. Once you are done witht he zend optimizer, do the gd

For the GD library.. first you need to check if there is an easy way to do this inside your plesk parallel.. Loof for a link like options in server management, and look for something that is related to apache update .. It's been a long time since the last time I am playing around with plesk, so my memory is pretty blury about the location of the option menu on plesk.

veedeoo 474 Junior Poster Featured Poster

Hi,

Try, changing either $result to something else e.g. $result2 .. I think your scripts is just experiencing a minor naming collisions when integrated each other. Is this script will be running on production server? If yes, can you at least hash those CC numbers even at the minimum.. I don't know, but it is just so tempting for someone to make your script throw up all those numbers. Before considering any hashing and securing credit numbers for database storing, please read this white paper about it.

I am sorry for being such an A__ , I can't help it, whenever someone is posting script that has a lot of personal info. in it.. I just can't stop from crinching..

veedeoo 474 Junior Poster Featured Poster

Let's do this few steps at a time...

How to change file permission using FTP-> Filezilla

These can be done right on your desktop in the filezilla console.
1. Connect to your server using filezilla
2. Locate the folder or directory you want to change the permission.
3. Right click on the directory, and then select or click on the "File Permissions.."
4. On "Change file attributes" window prompt, change the "numeric value" to your software recommended permission.

Warning, some server API like CGI and FAST CGI recommends 755 which have the same equivalent as 777 if apache module is used as server API. If your software recommends 777 CHMOD, try the 755 first, and then if it does not work, go for the 777 CHMOD.

You can use the fileZilla to move your zip file from your desktop to your site. The reason I am recommending the use of putty is for the php.ini file update, zend optimizer installation, and the gd libary. These items cannot be done without terminal access or other people calls it SSH.

To unzip the zip files already in your server, you need to log on to your plesk panel and then extract the file. If you still not able to do it this way. Extract the files on your desktop, and then use fileZilla to upload all of the extracted files to your server..

veedeoo 474 Junior Poster Featured Poster

first you need to ask godaddy hosting technical support if you have a root access credential on your vps server. These information should be on your account confirmation email. They normally require an additional identification like driver license. I am not sure if they still have the same policy when working on one of their client some two years ago. Did you have any other choice than plesk parallel (Never mind .. i just realized that your script is a business software, so plesk is the best choice)? Did you order the cpanel option with your vps account or does it already have a plesk panel included in the account?

The phpMyAdmin in plesk is different.. read more about it here

for your zend that is under the centos 5 .. You can install that using a terminal like putty found Here

Here is a good tutorial click here on how to install zend on centos.. just make sure you got the right flavor version .

veedeoo 474 Junior Poster Featured Poster

Hi,

these should be more than enough for your purpose. eBooks at the least don't do more than 600M. Just make sure when the script is moved to production server, tell the hosting company to adjust your server configuration based on what we already covered here.

Normally, scripts that support uploads have a minimum requirements as shown below..

max_execution_time = 1000
max_input_time = 1000
open_basedir = (no value)

; these are close to maximum
upload_max_filesize = 600M
post_max_size = 600M

Others may require safe_mode = off and register_argc_argv = On. However, due to the nature of your script, I don't recommend it, unless it is recommended by the script and mod authors. The first setting (safe_mode = off) prone to security hole and the second (register_argc_argv = On) is like giving a consent on your script to become a server resources hog. I am not really familiar with probid. So, I can't say much about it, but I can only discuss more about the server configuration settings and safety.

veedeoo 474 Junior Poster Featured Poster

LIMITED SPACE, because I don't do cut and paste most of the time, and I type everything on this little textarea. Please take a look at your response textarea console.

veedeoo 474 Junior Poster Featured Poster

Hi,

I can't write a mysql tutorial here due to the limited space, and besides Internet has already got bunches of them that it is almost redundant to post it here. Please follow this tutorial Here , and then come back to this thread if you bump into troubles. When you do come back, make sure to include your codes.

veedeoo 474 Junior Poster Featured Poster

Veedeoo, Are you the mathematics wiz kid from Princeton University? He also goes by handle of Poorboy and Morpheus Linux.

I hope you are not Dr. Einstien ????? Well, I am attending PU and I am also the PoorBoy and the Morpheus, but I don't know about being a Math wiz kid. That's rather a label they put upon my head. PU?? Not for long though, because I will be moving to CALTECH this June. PU says I must report to CALTECH immediately. So, I am preparing and looking forward going back to California. My only worries is that, my prospective classmates in CALTECH are pretty old some of them are even almost turning back into a clay, they can be my grandfathers or even great great and great grandfathers (I think??), and they don't have anyone like my age. It's ok, I will just hang-out in the library writing programs and visit DaniWeb, my forums, and my blog during my freetime.

veedeoo 474 Junior Poster Featured Poster

Since you are still running your script on localhost, your limit is all based on how much drive space you have on your desktop. VPS hosting like the ones offered by certified or offered by HostV comes in with a default settings of 300M to 600M.. So, if you will be developing and targetting this environment the php.ini file settings for upload limit will be

post_max_size = 600M
upload_max_filesize = 600M

Remember, regardless of the consequences, these two values must be equal at all times. As you increase the size of your post_max_size and upload_max_filesize, the max_execution_time and max_input_time must also increase proportional to the upload speed of the user's internet connection. An estimated of about 150kb/s is pretty much the average across the globe. Keep in mind that people who are connecting and uploading to your site on a very slow connection will not be able to finished their upload beyond 50MB.. the server will just close its door, because of the max_execution time has been reached or it has ran-out. Be mindful that anything beyond the 75MB threshold everything seems to take forever. If the script timed out, while the upload is in progress, everything will be in the TMP directory unprocessed, requiring you do another upload. The is the reason why youtube limit the upload file size, inspite of all the benefits of running their site on super servers.

If you will be expecting an upload size of more than 200MB per session, then I don't …

veedeoo 474 Junior Poster Featured Poster

Your script wants you have ioncube or Zend(engine and optimizer).. I am not quite sure what did they mean by ioncube.. I am in the assumption here that they want you to have an ioncube loader for the script to run. If that is what they want, you can download the zip file that is MATCHING your operating system and the PHP version currently installed on your xampp. http://www.ioncube.com/loaders.php.

Before attempting to download the zip file above, just make sure everything are working on your site. If one of your pages says "ioncube loader is missing", then that is the only time you install the loader. I will show you how to get into the ioncube loader extension installation later if it is needed. Otherwise, we will just have wait for the ioncube loader errors to appear.

As far as the GD requirements, the latest xampp already met the version requirements.

phpprobid is pretty much secretive on other server requirements they have, because they are targetting people to sign-up for their hosting package currently being offered by them. I am pretty sure about the php.ini file for the uploads, but some requirements needs some entries on the apache/conf/ directory which I don't really know because the site don't even mention any other requirements. Lets keep our finger crossed and hope that is all to it.

Just to be safe and to prevent your server from terminating the upload script, set the following like this

max_execution_time = 1000

veedeoo 474 Junior Poster Featured Poster

open xampp/php/php.ini with your notepad. Before doing anything on this file, make sure to make a back up copy of this file by saving it as php.iniDeFault.

Change post_max_size and upload_max_filesize values to 300M, make sure the

Read more about your scripts requirements. Normally they want you to have higher values on
max_execution_time .. the default settings provided by xampp and any other php distros are set to about 30 or 60. This value will not suffice waiting for your upload to finished.

Change max_execution_time = 30 to your script's requirements
Change max_input_time = 60 to your script's requirements.

If you have a really good memory installed on your desktop, add more memory for your xampp's consumption, by changing this value

memory_limit = 128M Normally 300M will suffice.

Check the recommended settings of your software for register globals. If it is requiring ON setting other than OFF which is a default setting, change the value from off to on. WARNING! CHANGE THIS ONLY PER YOUR SCRIPT REQUIREMENTS. If they don't want you to turn this on, DO NOT TURN IT ON.

register_globals = Off

Make sure this value is set to ON.
file_uploads = On

Once again check for your software's recommendation about the allow_url_include, by default this is set to OFF due some big security issues. If they script requires you to turn this ON, that is the only time this has to be ON.

Does your script requires eAccelerator or Zend plugin?,.. Yes? Change this

;zend_extension

veedeoo 474 Junior Poster Featured Poster

I don't think there is one book that will cover them all, but this is how I did it on top of the countless nights reading every possible ebook and phpDev articles I could find. Of course, not to forget the w3schools and php.net credits. In fact, I have colletions of about 38 academic books of various programming languages. Some of them were given to me by my older brothers who are software Engineers. At a very young age, I learned from them, watching how they do things.

First to second Week of reading: Read Beginning PHP 5.3 by By Matt Doyle.

Third to Fourth Week of reading: Learning PHP, MySQL, and JavaScript
A Step-by-Step Guide to Creating Dynamic Websites By Robin Nixon

and then try-> PHP Objects, Patterns and Practice (Expert's Voice in Open Source), this book will not get you bored ever I think. Prepare to get your hair really greasy for weeks, learn how to drink lots of coffee, walk in the park or ride the bike until everything sinks in.

When finished with the php objects above, apply your gained knowledge by reading this book PHP 5 CMS Framework Development Second Edition by Martin Brampton. Try to expirement with the codeIgniter framework, cakephp, and of course the ### rated Zend Framework.

If all is well for you after the CMS and framework Development, aim for the Zend Framework Certification or write you own application based on either of this frameworks (codeigniter, phpckae, symfony.. with either …

veedeoo 474 Junior Poster Featured Poster

Hi,

Turn on your xampp server and then click -> http://localhost
On your left panel, click on the phpinfo().

I need the following values
1. Loaded configuration file.
2. post_max_size
3 upload_max_filesize

veedeoo 474 Junior Poster Featured Poster

Hi,

Try this.. open your notepad or any suitable php code editor. Paste codes below

ErrorDocument 404 /404.html 

Save the above as .htaccess , and then upload to your server.

Second step..
On your notepad again or html editor, create a new page similar to the google 404 page and name it 404.html

upload the 404.html to your server.

That's about it...

veedeoo 474 Junior Poster Featured Poster

Hi,

Double check that your app/Config/database.php is properly filled up with your database credentials. You need to fill up two of them like so..

class DATABASE_CONFIG {

    public $default = array(
       'datasource' => 'Database/Mysql',
       'persistent' => false,
       'host' => 'localhost',
       'login' => 'root',
       'password' => '',
       'database' => 'cake',
       'prefix' => '',
       //'encoding' => 'utf8',
     );

    public $test = array(
       'datasource' => 'Database/Mysql',
       'persistent' => false,
       'host' => 'localhost',
       'login' => 'root',
       'password' => '',
       'database' => 'cake',
       'prefix' => '',
      //'encoding' => 'utf8',
   );

If that does not do the trick, try writing a simple database connection script and use the same credentials as you have for your cake php. Something like this

<?php
 $db_host = "localhost";
 $db_user = "root";
 $db_password = "";
 $db_database ="cake";

 $conn = mysql_connect($db_host,$db_user,$db_password) or die(mysql_error());
 echo "connected to your mysql<br/>";
 $db = mysql_select_db($db_database,$conn)  or die(mysql_error()); 
 echo "connected to ".$db_database;

If the two options above do not make the cut.. Dump the WAMP, and try XAMPP.. Running this XAMPP on any thumbdrive. I have Zend, Igniter, and CAKE. I am running them on the same thumbdrive powered by xampp.

For my linux box, I am also running xampp with Zend, Igniter, Cake, and ffmpeg php with all the trimmings and dlls...More likely it is the WAMP that is faulty..

veedeoo 474 Junior Poster Featured Poster

Dude,

I am so happy for you.. It is always a good habit to back up database. For people who are just lazy doing it on phpmyadmin panel. You can also do this behind the putty terminal. Assuming that your hosting account has a root access with it or the account is allowed to access through SSH terminal like putty.

Run putty.exe for windows and accessories->terminal on linux. On the terminal prompt type

mysqldump --opt -u DatabaseUsername -p DatabaseName > dataBaseName_dump.dump

Give your server an ample time to execute the command, and then open your FTP program like the filezilla. Connect to your site and look for the dataBaseName_dump.dump, download this dump file to your desktop. For linux distros like ubuntu or Zorin Os, this can be done by just opening the terminal and then run the following command

sudo -s 

System will ask for your password, type password and then type

cd/Desktop

Then to download the file from your site type

wget http://YourDomainDotCom/dataDaseName_dump.dump

That's pretty much it.. good luck on making back up and linuxing .. :)

veedeoo 474 Junior Poster Featured Poster

Server problems, it will be in the hands of your hosting company. Let's just hope they are doing a daily back-up. Otherwise, let's just cross our fingers, and hope that all the data are still there upon recovery. If you are running your own server, the data is located in mysql/data directory. I am not sure how it would look like in linux... let me run my linux box and see..

veedeoo 474 Junior Poster Featured Poster

The best way is to log-in to your cpanel and then go to phpMyAdmin, on the top menu click "export", on the export method option, select sql click go, at the prompt confirm the download. Save your sql backup file on your desktop.

Prgrammatically, don't even bother it is just too slow. I don't know, maybe someone have a faster way of creating back up by way of php that is fast enough for me to get excited.

veedeoo 474 Junior Poster Featured Poster

Yes, tomato is a fruit. Included in dicotyledon fruit group along with apples, plums, pears, oranges and few others.

veedeoo 474 Junior Poster Featured Poster

Hi,

You can also look at the form validation class in system/libraries/. Class definitions and functions are explained Here. Either extend the class as shown in this example, or set new rules

$this->form_validation->set_rules();.

I remember bumping into this problem two years back, but I can't even remember how and which files we have to tweaked. I will ask my brother Michael though to see if he ever remembers.

veedeoo 474 Junior Poster Featured Poster

@faisals701,

Here is a classic example of $_REQUEST vulnerability, if NOT properly PROTECTED.. Copy codes below and upload to your localhost. You can name it anyNameYouWant.php. Regardless of the form method use as long as it not protected, it will have the same vulnerability as to no method at all by way of REQUEST processing.

<?php
$method_one = '<form method ="POST" action ="">';
$method_two = '<form method ="" action ="">';
$method_three = '<form method ="GET" action ="">';

if (isset($_REQUEST['submit'])){
	$name = $_REQUEST['name'];
	$nickName = $_REQUEST['nickname'];
	
	echo $name."<br/>";
	echo $nickName."<br/>";
}
else{
 ## uncomment ONE method at a time here
 
 ## uncomment method one to test POST
 //echo $method_one;
 
 ## uncomment method two to test either method
 echo $method_two;
 
 ## uncomment method three to test GET method
 //echo $method_three;	
?>

<label>Name</label>
<input type = "text" name = "name" value ="" />
<br/>
<label>Nickname</label>
<input type = "text" name = "nickname" value = "" />
<br/>
<input type = "submit" name="submit" value ="submit"/>
</form>
<?php
}
?>

To test uncomment the $method_WhateverNUmberHere, comment out the one that you don't need to test.

Run the script on your browser, and try to test all the options -> $method and closely observe how the script will handle each $option. To make it a lot easier for everyone, if the method $_REQUEST isn't defined will default to $_GET effect. Meaning, if method is assigned like this method = "" (blank) it would have the same effect as method = "get".

For example, …

veedeoo 474 Junior Poster Featured Poster

@faisals701,

You need to change $_REQUEST to $_POST.. Anyone can send a remote upload on your form if that's how you are going to process it.

For added security, a unique ID should be auto generated by your script and plugged it in in your session..

Example of a unique id generator

$uID = md5(uniqid (rand(), true));

Re-validate $uID, before finalizing your upload ( this is when you actually rename, move the file, save data into your database.

veedeoo 474 Junior Poster Featured Poster

Hi,

Look for line 72 grade.php

$$key = $value;

it should be

$key = $value;

Try using some PHP IDE like netbeans or eclipse... others settled in for advance php editor like personal php designer 2007. The good thing about them, they are all for FREE.. Load your entire script as new project to either netbeans or eclipse.. IDEs will at least look for errors and warnings found on the script. This can truly help in minimizing errors while writing codes.

veedeoo 474 Junior Poster Featured Poster

Hi,

Something is wrong with these echoes..

echo '<tr><td class="rows">'; echo $origin_description; '</td></tr>';
echo '<td class="rows">'; echo $destination_description; '</td>';
echo '<td class="rows">'; echo $date = $res; '</td>';
echo '<td class="rows">'; echo $time = $res; '</td>';
echo '<td class="rows">'; echo $fare= $res; '</td>';
 
echo '</tr>';

it should be something like

echo '<tr><td class="rows">'.$origin_description.'</td></tr>';
echo '<td class="rows">'.$destination_description.'</td>';
echo '<td class="rows">'.$date = $res.'</td>';
echo '<td class="rows">'.$time = $res.'</td>';
echo '<td class="rows">'.$fare= $res.'</td>';
 
echo '</tr>';

And these

echo '<td class="rows">'.$date = $res.'</td>';
echo '<td class="rows">'.$time = $res.'</td>';
echo '<td class="rows">'.$fare= $res.'</td>';

Although it will get outputted , it is not standard. It should be define before echoing them. Your codes will look nice and well organized.

ADDED LATER on EDIT

The above should be changed to these, because the values has already been assigned from the query results.

echo '<td class="rows">'.$date.'</td>';
echo '<td class="rows">'.$time.'</td>';
echo '<td class="rows">'.$fare.'</td>';

OR to these

echo '<td class="rows">'.$res['date'].'</td>';
echo '<td class="rows">'.$res['time'].'</td>';
echo '<td class="rows">'.$res['fare'].'</td>';
veedeoo 474 Junior Poster Featured Poster

don't forget to trim the new_data..

$birdName = trim($new_data[0]);
$birdId = trim($new_data[1]);
veedeoo 474 Junior Poster Featured Poster

Hi,

For this

<select name="birdname"><option value="<?php echo $row['bird_id'] , $row['name']?>">

I would $_POST it first to get the value from the <option>, and then explode it by " ' "

Something like this.. codes below are example and should be modified, before implementing to production server..

$bird_name_id = $_POST['birdname'];
## when posted the value of $bird_name_id is something like this name , id 
## this is where we need to use the explode function or any handy php function available.. your choice.
$new_data = explode(",", $bird_name_id);
$birdName = $new_data[0];
$birdId = $new_data[1];
veedeoo 474 Junior Poster Featured Poster

Hi,
Just a humble question from me :)...I thought when using the RecursiveIteratorIterator class goes by this pattern

$the_iterator = new RecursiveIteratorIterator(new RecursiveArrayIterator($some_arr));

So, by looking at your codes, I assumed that your are trying to filter the $the_iterator by RegexIterator which is obviously are images.

on your codes, the array is this one

('../Home'

Is it just a place holder?, or this is what you are trying to run with the script?


JUst asking, maybe I can learn something new from this thread :)

veedeoo 474 Junior Poster Featured Poster

@subrata_ushasi,

jUst my humble opinion, I think it will be a lot easier to run it on xampp.

1. Download xampp from apache and friends . Select the zip file
2. Unzipped file and then move the xampp directory to your thumb drive. Unless you will be running an ffmpeg, mencoder, flvtool2, mp4box, php applications, then xampp must be installed in the c drive just like any other program. For all ecommerce and blog applications, these can run on the thumb drive. Which I think is pretty handy.

3. Explore thumb drive, and look for xampp directory.
4. Click on the xampp start.. do not close the command prompt window, while the xampp server is running.
5. Direct your browser to localhost
6. On the left column of the page click phpmyadmin.

7. On the phpmyadmin page move your cursor to the right column and look for the "database" tab, click on the "database" tab. Create a database for your magento installation.

8. After creating the database, click on the "privilege" to add new user if there is no predefined user "root" in there. Normally it has a root with ALL privileges on it already assigned. Otherwise, a new user must be created..

9. Use the database credentials to setup magento.

veedeoo 474 Junior Poster Featured Poster

Wow, can you please give us more explanation on what you are trying to achieved here.

I thought when you do this;

INSERT INTO `YourTable`(`col-1`, `col-2`, `col-3`) VALUES ("",[value-2],[value-3])

That should give you an empty value for the col-1.. or you can set the table null -> Yes and then default -> NULL .

veedeoo 474 Junior Poster Featured Poster

You need to install EITHER one ->> Xampp, LAMP, or EasyPHP on your windowsXP environment.

veedeoo 474 Junior Poster Featured Poster

Yes, it will be in the dropdown.

veedeoo 474 Junior Poster Featured Poster

Hi,

Try adding a new column and name it role.. and then it is all up to you how are you going to assign values to sort between teacher and student.

For example, if we are to give an integer 7 for the role of teacher and a value of 1 for student, then we can easily sort their privileges and page access..

Sample query..

$query = "SELECT * FROM TableName WHERE title='".$title."' ";
## pull out the result as $row


## then check for the role

if($row['role']== 7){
## label this member as teacher. You can store this in session
$isTeacher = true;


## this user must be a teacher
## redirect this member to the teachers only page
}
else{
$isStudent = true;

## this member must student
## redirect this member to students only page

}

You can also expand the members privs, by adding more role valu e.g. 8, 9, or better yet make a triple digits like 100 for students, 700 for teachers, 900 for supervisors, and others.

Notice I define $isTeacher = true;?, you can put this in session, so that it is a lot easier for them to browse across the site without having to re-validate their role..

Example

if($isTeacher){
## if true then this member will only see menu or pages applicable to teachers only

}
veedeoo 474 Junior Poster Featured Poster

Hi,

These codes

$sql="SELECT * FROM $tbl_name WHERE invoice_no = '$invoiceno'";
$result=mysql_query($sql,$dbh1);
$row=mysql_fetch_array($result) or die(mysql_error());
echo "$row";

Shouldn't be a lot easier to find if rows is greater than zero?

Something like this

$sql="SELECT * FROM $tbl_name WHERE invoice_no = '$invoiceno'";
$result=mysql_query($sql,$dbh1);
$row= mysql_num_rows($result) or die(mysql_error());
echo "$row"; 

## check on the result
if($row>0){

## do your thing here

}

Do the same on the second database..

veedeoo 474 Junior Poster Featured Poster

If I can help you, can I at least get a free Bus pass? Where is this place though? :). If it is too far from Princeton, New Jersey, it's ok :).

Stop punishing your fingers by typing these

<select name='dep_day'>
<option>Day</option>
<option value='1'>1</option>
<option value='2'>2</option>
<option value='3'>3</option>
<option value='4'>4</option>
<option value='5'>5</option>
<option value='6'>6</option>
<option value='7'>7</option>
<option value='8'>8</option>
<option value='9'>9</option>
<option value='10'>10</option>
<option value='11'>11</option>
<option value='12'>12</option>
<option value='13'>13</option>
<option value='14'>14</option>
<option value='15'>15</option>
<option value='16'>16</option>
<option value='17'>17</option>
<option value='18'>18</option>
<option value='19'>19</option>
<option value='20'>20</option>
<option value='21'>21</option>
<option value='22'>22</option>
<option value='23'>23</option>
<option value='24'>24</option>
<option value='25'>25</option>
<option value='26'>26</option>
<option value='27'>27</option>
<option value='28'>28</option>
<option value='29'>29</option>
<option value='30'>30</option>
<option value='31'>31</option>
</select>

All dates, months, and years should be written in php like this

<?php
## you may want to write simple php function to get the number of days for the month
$days_ofMonth = 31;
echo '<select name="dep_day"/>';
for($dep_day = 1; $dep_day <= $days_ofMonth; $dep_day++){
?>
<option value="<?php echo $dep_day;?>"><?php echo $dep_day;?></option>
<?php
}
echo '</select>';
?>

You can focus more on your programming than typing identical numbers. Let the php work for you.

Biiim commented: helpful +4
veedeoo 474 Junior Poster Featured Poster

This is our point of interest

<select name="select" id="select">

Process the form by either GET or POST

## grab the selected aution id
$a_id = $_POST['select'];

$query1 = "SELECT * FROM auctions WHERE auction_id = '".$a_id."'";
$result1 =mysql_query($query1,);
while ($row=mysql_fetch_array($result1)) {

## echo item title description, and all other stuffs
echo $row['title'];
}

That's all..

veedeoo 474 Junior Poster Featured Poster

Just a minor correction with the codes..

find line 14

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

change to

if ((isset($_POST['submit'])) && ( (isset($_POST['pica10'])) || (isset($_POST['pica14'])) ||(isset($_POST['pica18']))))

That should take care of the form being submitted without a tick. Now, we have added another php operator used in the script. && (AND) and the || (double pipe or OR)

veedeoo 474 Junior Poster Featured Poster

please do not hesitate to change this and the rest of your pizza sizes..

if(!empty($_POST['pica14']))

to

if(isset($_POST['pica14']))

or

if($_POST['pica14'])

it won't matter, because everything are wrapped in the if isset clause.

veedeoo 474 Junior Poster Featured Poster

Hi,

I don't have the chance to test my codes below, because I am also busy at school.. NOOO it is not about programming. It should give you what you are trying to make.

PHP functions use in this script.. just in case your professor ask you.. empty(), $_POST, for loop, if/else, and mathematical operators addition, multiplication and !not.

<?php
## A simple pizza delivery system Written 

## layout our pizza options
 # define your maximum quantity inside the select option
 $max_q = 10;
 # define your pizza prices 
 $small = 300;
 $medium = 450;
 $large  = 650;
 
## first we detect if the submit button has been submitted, if not we show our client the form

if (isset($_POST['submit'])){
## the following prevent undefined error beyond the php 5.2.X versions.
$s_quant = "";$m_quant = "";$l_quant = "";$s_cost = "";$m_cost = "";$l_cost = "";
 ## process the form. What matters here the most is to know if the checkbox is ticked
 ## process small pizza if it is tick.
 if(!empty($_POST['pica10'])){
 $s_quant = $_POST['sq'];
 echo "<b>Small pizza</b><br/>Quantity: ".$s_quant."<br/>";
 ## always wrap var for mathematical calculation with parenthesis
 $s_cost = ($small) * ( $s_quant);
 echo "Price: ".$s_cost."<br/>";
 }
 if(!empty($_POST['pica14'])){
 $m_quant = $_POST['mq'];
 echo "<b>Medium pizza</b><br/>Quantity: ".$m_quant."<br/>";
 ## always wrap var for mathematical calculation with parenthesis
 $m_cost = ($medium) * ( $m_quant);
 echo "Price: ".$m_cost."<br/>";
 }
 if(!empty($_POST['pica18'])){
 $l_quant = $_POST['lq'];
 echo "<b>Large pizza</b><br/>Quantity: ".$l_quant."<br/>";
 ## always wrap var for mathematical calculation with parenthesis
 $l_cost = ($large) * ( $l_quant);
 echo "Price: ".$l_cost."<br/>"; …
veedeoo 474 Junior Poster Featured Poster

Hi,

The sample script I have provided you is just a sample on how to do things roughly. However, you need to write a simple programming flowchart of how the pizza orgering process may take place, and then based on this flowchart, you can create the php codes. We cannot make the flowchart to bend around the php codes. It has to be the other way around.

Here is a simple flowchart for the pizza ordering system.
1. Client is presented with the form
2. Client select items and quantities on the form selection
3. Client submit the form

The processing php file for the above, could be something like this
1. Check if the form is submitted and not empty
is form enpty? ->make the client know
is form not empty? -> process the client's input by way of either get or post
2. Filter the processed data from the client's input
condition One: Which pizza size is selected?
Condition two: how many pizza of this size has been selected?

3. Create a switch where we can monitor the clients selections.. Meaning if the client wants 3 small, 2 large, and 7 medium pizza, we are able to process the form.

4. Present the client with the summary of the order.


So, what I want to see in your codes is something like this

if(Small pizza quantity > 0){

## do your …
veedeoo 474 Junior Poster Featured Poster

Hi,

The sample script I have provided you is just a sample on how to do things roughly. However, you need to write a simple programming flowchart of how the pizza orgering process may take place, and then based on this flowchart, you create the php codes. It is not the other way, making the flowchart bending around the php codes. It has to be the other way around.

Here is a simple flowchart for the pizza ordering system.
1. Client is presented with the form
2. Client select items and quantities on the form selection
3. Client submit the form

The processing php file for the above, could be something like this
1. Check if the form is submitted and not empty
is form enpty? ->make the client know
is form not empty? -> process the client's input by way of either get or post
2. Filter the processed data from the client's input
condition One: Which pizza size is selected?
Condition two: how many pizza of this size has been selected?

3. Create a switch where we can monitor the clients selections.. Meaning if the client wants 3 small, 2 large, and 7 medium pizza, we are able to process the form.

4. Present the client with the summary of the order.


So, what I want to see in your codes is something like this

if(Small pizza quantity > 0){

## …
veedeoo 474 Junior Poster Featured Poster

Hi,

Where is your updateinfo.php?

veedeoo 474 Junior Poster Featured Poster

Hi,

You can add two columns in your customer's table. One is for temp_password, and second is for the temp_passAge. We can then use time as comparator for the time elapsed since the temp password was created.

Example:

## assign server time to ctime
$ctime = time();
## you may want to add your query here like
$username = $_POST['username'];
$temp_password = $_POST['temp_pass'];

## then the actual query
$query = "SELECT * FROM 'customer' WHERE 'temp_password' = '".$temp_password."' ";

## grab the result here in loop

while( $row = whatever here ){
## take the values

$password_age = $row['temp_passAge'];

## subtract current time from the password age 
$time_e = $ctime - $password_age;

## set your expiration in seconds
$pass_expire = 2400; ## this is in seconds

## set your conditions for whatever
if($time_e >= $pass_expire){

## the password expired

echo "Your Password Expired";

## provide link to whatever page needs to handle this event.
}

else{

echo "Your Password is good";

## show form to update password

## do database update on the user's password

}
}

I prefer doing this on this part of the code

else{
 
echo "Your Password is good";
 
## show form to update password
 
## do database update on the user's password
$password_ok = true;
}

Then just build your response and processes based on the true or false. So, that you don't have to put too many stuffs inside the while loop..

veedeoo 474 Junior Poster Featured Poster

cool, just in case sales tax needs to be included. I overlooked the calculation for the total amount due it should read

echo "Must Pay ".( $total_AmountDue + $gross_AmountDue)." Immediately, or else I will eat these Pizza";
veedeoo 474 Junior Poster Featured Poster

Hi,

If the id is coming from auto increment, then it would be difficult to guess which is which. I know it is easy if you are looking at it, but programatically it will be difficult for the script. I mean you can do >22, but that is not the proper way.

You will have to add another column on your table to serve as switch. For example, we can add a column named "status" and this column can have a value of either true or false. This way you can set it to false whenever it is needed using the "task" as parameter. We can filter your data like SELECT * FROM 'table' WHERE status = 'true'. Not only that, we can also set the status to true and false whenever it is needed.