veedeoo 474 Junior Poster Featured Poster

Hi,

Shared hosting does not allow direct php.ini file editing. However, you are allowed to add entries to either .htaccess file or create a new php.ini file, depending on your server's API. There are cases where additional entries are needed to be included in .htaccess file, and others has to go on php.ini file. Even with this given option, there are some settings that you can't just change like adding extensions e.g. someextension.so.

Copy codes below, paste it your code editor, save as anyNameYouWant.php, upload this file to your server. Direct your browser to this file..

<?php

   phpinfo();


?>

Look for the value of "Server API", and post it here. I am expecting a value of either apache module, apache, CGI, or fast CGI. Based on the API loaded on your server, I can tell you where add your enties.

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

have you seen This ? Hold on, free is with limited features though....

This code should be able to do it

<script language="JavaScript" src="http://j.maxmind.com/app/geoip.js"></script>

<br/>Country Code:
<script language="JavaScript">document.write(geoip_country_code());</script>
<br/>Country Name:
<script language="JavaScript">document.write(geoip_country_name());</script>
<br/>City:
<script language="JavaScript">document.write(geoip_city());</script>
<br/>Region:
<script language="JavaScript">document.write(geoip_region());</script>
<br/>Region Name:
<script language="JavaScript">document.write(geoip_region_name());</script>
<br/>Latitude:
<script language="JavaScript">document.write(geoip_latitude());</script>
<br/>Longitude:
<script language="JavaScript">document.write(geoip_longitude());</script>
<br/>Postal Code:
<script language="JavaScript">document.write(geoip_postal_code());</script>
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

Hi,

We can use pure php, but it will not be able to response as dynamic as in the javascript response. PHP must process the form query first, before it can post a response. Unlike javascript which can post response on event change, php has to be parsed on the server side. So, there will be a considerable amount of time in seconds lag in form post response in php.

What we can do to minimize the delayed response and prevent the page from reloading is to use ajax (another javascript derivatives). With ajax implementation we can let the front end handle the form and then pass the event change through ajax, and then let the ajax post and retrieve the results from php file. The result is pretty much the same as the above demo. The only difference is making a PHP script get involved in the process. A good example of this technique is this Demo, which can be easily rewritten to do the same effect as the pure javascript implementation above. In this demo, I have one php file called processor responsible for processing the posted data by the ajax. The result is then return and delivered by the ajax on the page without page reload.

Although the php hybrid I mentioned above is pretty possible and it will work, it will also require server resources to parse the php codes. While on the javascript written script, the server don't have to parse any php …

veedeoo 474 Junior Poster Featured Poster

Yes, that would echo, but if yo want the session equal to your posted secure value, it does not..

Try this... create a new page this will be your entry page or pre-form page. Meaning everyone should pass through this page before they can even see your form.. in this page put these codes and save it as preform.php

 <?php


 session_start();
 $this_num = md5(time());
 $_SESSION['randomnum']= $this_num;

 echo "<a href ='form.php'>Go to the form</a><br/>".$this_num ;
 ?>

Create another page and save it as form.php

<?php

 session_start();
 ## if you want to predefined a session, then it should be here
 $this_session = $_SESSION['randomnum'];
 echo $this_session."<br/>";

 ## the above can be passed on to your form and then assigned as value of your variable $a..

 $a= $_SESSION['randomnum'];
 if (isset($_POST['submit'])){
 $b=$_POST['secure'];
 echo $a.'<br/>'.$b;
 if($a==$b){
 echo "<br/>this is equal";
 }
 }
else{
?>
<form method = "post" action = "">
<input type ="text" name = "secure" value ="<?=$_SESSION['randomnum']?>"/>
<input type = "submit" name = "submit" value = "submit" />
</form>      



<?php        
    }


?>

Direct your browser to the preform.php and click the link on it. That should take you the actual form. Submit the form, the secure value and the session should have been isolated in this page and have the same value..

Modify your codes base on these test pages...

veedeoo 474 Junior Poster Featured Poster

Try rearranging your codes like this

<?php
 session_start();
 ## if you want to predefined a session, then it should be here
 $_SESSION['randomnum']=md5(time());

 ## the above can be passed on to your form and then assigned as value of your variable $a..

 $a=$_SESSION['randomnum'];

 $b=$_POST['secure'];
 echo $a.'<br/>'.$b;
 if($a==$b){
 echo "this is equal";
 }

 ?>

Let me know if it work out for you, so that I can test it...

I think it will not be equal on submit and during page refresh, because the time will always be different as defined by your codes in

 $_SESSION['randomnum']=md5(time());

When the form is first submitted, the a and b are equal, but when your refresh the page, the randomnum will revalidate to the time of refresh, while the secure value in the form is not being revalidated. However, if you click on your browser's back button, both will be have the same value.. as long as you are not refreshing it is cool.

veedeoo 474 Junior Poster Featured Poster

I forgot to mention that if you need multiple url for the first selection item. The urls must be given the class name of the value of the item in the selection.. for example, the msn option above..

<!-- if we have different urls for this selection.. we need to use the value -> msn to be the class name in the second select -->
<option value="msn">MSN</option>

<!-- in the select should be something like this. Take a note of the class name msn -->

<option value="http://msn.com/" class="msn">Visit MSN</option>
<option value="url two" class="msn">MSN Url two</option>
<option value="url three" class="msn">MSN Url three</option>

<!-- you add as many as you want, as long as you are following the proper convention -->

Even with many selections, the process will be exactly the same as the two examples I have given here..

veedeoo 474 Junior Poster Featured Poster

Hi,

Yes, we can do that... I think that's pretty easy... visit this New DEMO. Just copy the source and just change the values for your requirements.

The main settings of the script is in the form .

 <!-- if you look closely I gave this form a name called dropdown. this is necessary for the javascript  -->
<form action = "" method = "post" name="dropdown">

  <!--  notice the id sitename? this is for the jquery id -->

  <select id="sitename">
    <option value="">--</option>

    <option value="msn">MSN</option>
    <option value="yahoo">Yahoo</option>
    <option value="daniweb">DaniWeb</option>

  </select>

  <!-- the jquery trigger here is the siteurl and javascript selector here is the urllist -->

 <select id="siteurl" name="urllist" >
 <option value="">--</option>

 <option value="http://msn.com/" class="msn">Visit MSN</option>
 <option value="http://Yahoo.com/" class="yahoo">Visit Yahoo</option>
 <option value="http://daniweb.com/" class="daniweb">Visit DaniWeb</option>

 </select>

 <script type="text/javascript">
 <!--
   function goUrl(){
   location = document.dropdown.urllist.options[document.dropdown.urllist.selectedIndex].value
  }
  //-->
 </script>

 <input type="button" name="test" value="Go!" onClick="goUrl()">

 <script type="text/javascript" charset="utf-8">
      $(function(){

        $("#siteurl").chained("#sitename");
      });
      </script>
  </form>

Remember the convention in chaining the event is like this.. for example, we have two selects in our form like so;

select id ="ONE "

select id = "TWO"

Then our jquery chained will be like this

$(function(){

        $("#TWO").chained("#ONE");
      });

It is Two chained to one. For three combo it should be something like this -> two chained to one -> three chained to two and one, and so forth.

veedeoo 474 Junior Poster Featured Poster

Try reading this Article entitled Minimize Bandwith in One-to-Many Joins. If it doesn't worked out for you, maybe it's time to move on and find another hosting company.

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

Hi,

This is what I am currently using, but my script records the IP of the visitors and the members as well, so that I can show who is online with their respective country flags based on the remote address.

Since I don't know your database instructures, I will use a simple script of which you can build what you are trying to make..

First, we need to detect the IP address of the browser...

$ip = $_SERVER['REMOTE_ADDR'];

Once we know about the IP address, we can pass that on to the hostip.info API to get the flag. hostip is not 100% is sluggish during redundant query.. So, I suggests for you to store the information gathered in your own database. The API returns two letter country codes.

Second, based on the ip above we can send our query to the API for the country flag to show on the page. We can use the codes below to do just that. Here is the complete script..

$ip = $_SERVER['REMOTE_ADDR'];
echo '<IMG width="20px" height="15px" SRC="http://api.hostip.info/flag.php?ip='.$ip.'" ALT="IP Address Lookup">';

Depending on the requesting traffic from the hostifp.info, your IP and flag specific to the country of your IP should be showing on this Demo. I am using the same script above with minor modification..

Of course you can expand and extend the above codes by visiting the hostip.info API usage guides. http://www.hostip.info/use.html

rayidi commented: This need registration & this won't work for Indian based IP Addresses +2
veedeoo 474 Junior Poster Featured Poster

Hi,

try reading about the php range function here. This will allow you to define the start and the limit of the array being evaluated.

veedeoo 474 Junior Poster Featured Poster

You're welcome. Just make sure to mark this as solved.... good thing it all worked out for you..

veedeoo 474 Junior Poster Featured Poster

try

<?php
    $ancpopup = "<div id=\"anctrigger\"><a href=\"#\" onclick=\"window.open('m_ancpopup.php?page=".$eid."','ancpopup','width=670px,height=470px,left=0px,top=100px,screenX=0,screenY=100')\">Accident &amp; Conviction EXIST!</a></div>";
if(mysql_num_rows($result)<>0)
{
echo $ancpopup;
}
?>

Don't forget to define your $eid, and then your mysql query.. You don't have to escape single quote if you use double quotes to define your echo. The same is true if single quote is used.. e.g. echo ""; and echo''. However, the echo " $someVariable"; the $someVariable is evaluated by the php parser, but not in sigle quote as in echo '$someVariable'; this will give you $someVariable printed out on the screen.. Alternatively, you can echo $someVariable; without the need of double quote if there is no other text string, html tags, javascript need to be printed or evaluated.

Single quote sample...

$someName = "myName";

echo 'My Name is '.$someName.'<br/>';

This above $someName will get evaluated.., but this one will not

echo 'My Name is $someName <br/>';
veedeoo 474 Junior Poster Featured Poster

Here is the Demo I made it for the other question in this forum.. Please feel free to copy the source and save all the javascript files to your server, and do not hotlink them from my site. I am just trying help out that is why I am publishing it on my site.

for the definite days of the month I think I must made one already.. I have just look where I keept those files..

cereal commented: nice! +8
veedeoo 474 Junior Poster Featured Poster

Did you try searching for it?

veedeoo 474 Junior Poster Featured Poster

Hi,

You can do this by adding another column on your members database table. For example, we have a table member witht he following columns,

id --- username --- password --- other stuffs..

We can then modify the above to something like this

id -- username -- password --- privs -- other stuffs

You must then give a unique integer values for the privs for every member group.. for example 1 for regular member, 5 for the admin. This way you can easily sort out the content you want to show for specific group.

For the guest, all you have to do is validate that this person or browser is not logged in..

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

is easyphp have a sendmail packaged with it? Browsse your local server and look for mercuryMail or something about the mail. Let me know what do you have in your local server.. You also need to tell me if your local server have a directory called sendmail, and what is your server's loaded configuration file? By giving the proper answers on these questions, I can tell you which php.ini and sendmail.ini file you need to edit to make this work on your localhost..

You need to know all these stuffs and how to set them prior to executing send mail..

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,

This should be your own domain's uploads directory or the video loaction of the items in the playlist.

clip: {baseUrl: 'YourDomainDotCom/videoDirectory/'}

And then, in your database query result while loop, your php codes should be somthing similar to my untested codes below. Echoed brackets are for the javascript.

 $query=mysql_query("SELECT * from video_list");

 ## You need to count the items in the 
 $v_count = mysql_num_rows($query);
 echo "playlist: [ ";
        echo "{";

        $x = 0;
        while($row = mysql_fetch_array($query)){
        $x++;

            echo "url: '".$row['filenameOfYourVideo'].".flv',";
            echo "title: '".$row['titleOfThisVideo']."'";

        if($x < $v_count){
         echo "},";

         }

         else{

         echo "}";
         }
         }

         echo "],";

         ?>
veedeoo 474 Junior Poster Featured Poster

They are using ajax and other libraries.. Read more about this here.

For the username availability checker,, normally this is written in jquery and php try this tutorial

For ajax sample without page reload on click... check out my demo . You can view the source of the page and copy it at your own convinience.

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

Hi,

Yes, it will work..as long as your script is using this database query.

$sql = mysql_query("select * from 12345 where name like '%$term%' or info like '%$term%'  or id like '%$term%' ");

Your query above is just looking for the match of the term, and therefore it would only return an output with containing term. So if the term is found even in the middle of the description, the script will return the entire description, but the highlight will be apply on the term and not on the entire description.

Don't worry about the number of columns. I've used the above highlighter ( I wrote it as class and not function) in my previous project and it has more than 450000 database rows and about 35 columns not including the joins that needs to be validated.. plus the actual live spider result from across the web.

I wish I can provide the link here, but the project is not appropriate for general viewers... It is an adult search spider I wrote for someone 1 1/2 years ago.

For the user feedback implementation, you may want to start a new thread, because that is another topic...

Good Luck...

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,

Just a recommendation, if you will be working on php codes with html tags in the mix, netBeans is the best IDE to use. NetBeans has a lot to offer than the eclipse. Plus, if you will be experimenting with the templating system like smarty in the future, netBeans already support smarty plugin. Variables and Function search is just amazingly accurate in netBeans IDE, and it knows your html tags opening and closing tags.

NetBeans should at least run in a system like windows 7, xp with lots of memory. Otherwise run it on any linux distros without speed bump ( I am running netBeans in my linux box). I only use windows for surfing the Internet and for some school work I have to write.

veedeoo 474 Junior Poster Featured Poster

Try this...create a test page by copying the codes below and save it as delete.php

 <script type="text/javascript">
function check(){
var r = confirm("Are you sure you want to drop this appointment?!");
if(r){

return true;

}
else{

alert("The appointment will not be cancelled");
return false;

}

}
</script>
<a href="delete.php?delete=yes" onclick="return check();" />Delete</a><br/>
<?php

if(isset($_GET['delete'])){

 ## this is where you put the deletion, but make sure to get the right info.
 echo "Appointment has been cancelled";
}

?>

Codes above should mimic the process with alert and confirmation ..Then should echo Appointment has been cancelled, if choose to drop appointment. I hope you are seeing the pattern here when javascript is used along side with php. Php will not wait for this "alert("The appointment has been canceled!");".. Unless, you make a switch or if statement to confirm that the delete value has been passed.

However, the javascript will be responsible for allowing the href to get through and therefore, setting off the isset to true. Observe closely, when the prompt is on, the url of the page is at default, but when you confirm the delete, the url goes to delete.php?delete=yes, and that is the triggering mechanism for the php script. Making this if(isset($_GET['delete'])) equal to true.

veedeoo 474 Junior Poster Featured Poster

You could try using ReflectionFunction class as shown here -> http://php.net/manual/en/class.reflectionfunction.php and just call it something similar to this. Will only work on php 5..

$findMyFunction = new ReflectionFunction('Name_Of_Function_You_Need_to_look_At');

## print will work better here than echo ..

print $findMyFunction->getFileName() . ':' . $findMyFunction->getStartLine();

Checking if the function exist before calling it will also help greatly..

 if(!function_exists('some_function'){

 ## do some_function..

 }
diafol commented: good link +0
veedeoo 474 Junior Poster Featured Poster

Hi,

I don't know about the forum's login bug, it is the admins job I think :).. I willl work on this script tomorrow..

veedeoo 474 Junior Poster Featured Poster

Here is the quickest, and yet nothing is pretty dirty.. just to get your fingers wet on blank page, and to taste the model->controller->view concepts.

Step One: The MODEL Copy codes below and save it app/Model/Test.php

<?php
##  save this in app/Model/Test.php
  class Test extends AppModel {

  }

Step Two: The CONTROLLER Copy codes below and save it app/controller/TestsController.php Please take note on the plural Tests...

 <?php
  ## save this file app/controller/TestsController.php
  ## notice the naming convention above?? Tests is plural
   class TestsController extends AppController {
        ## you define helpers here or
        ## write functions 
    public function index() {



   }

   }

Step Three: The VIEW ** open app/View/ directory, and within this directory create a new directory called ** Tests . Once again, I urge you to take a look at the Tests directory name, it is plural again.

Copy codes below and save it as app/View/Tests/index.ctp

<!-- File: /app/View/Tests/index.ctp -->

<h1>Test Page</h1>
<p>Hello! This is my first page created in CakePHP</p>

Step Four: Direct your browser to localhost/cakeDirectory/Tests/ . You should be reading the **" Hello! This is my first page created in CakePHP"
**

Summary:

Create Model file, create controller file, create directory for your scripts, create the view page inside the script directory.

Now, experiment with many libraries and functions cakePhp has to offer...

Say, you want to create another page "about Us"; all you need to do is follow the same process, except the controller part. On the TestsController.php, you just …

veedeoo 474 Junior Poster Featured Poster

here is the simple Demo of the above script . Although the string is not being pulled from the database, the term gets highlighted..

veedeoo 474 Junior Poster Featured Poster

@smallSteps,

No..don't worry about the .tpl extension.. that is a valid php extension. I just have to write the codes this way to demonstrate how to organize the codes and to make it a lot cleaner. I did not put any smarty or anything like that on the codes above. In all of my coding work, I barely throw php codes inside a barrel along with html tags... the .tpl files here still have those mashup but it is very minimal, which is pretty good without using the smarty.

The only different methods I've use is this $data[] = $row; which is still able to work in all version of php, and don't need smarty or any special parser...

Just follow through the codes, and you will a good hang to it, and you will realize that it is not using any smarty or Zend. It is just a simple php codes organized to follow the zimple logic -> view principle.. that's all :)

veedeoo 474 Junior Poster Featured Poster

Hi,

Try this. First lets make a function to do the hightlight..

function highlightTerms($text_string, $terms){

    ## We can loop through the array of terms from string 
    foreach ($terms as $term)
    {
         ## use preg_quote 

            $term = preg_quote($term);

           ## Now we can  highlight the terms 

            $text_string = preg_replace("/\b($term)\b/i", '<span class="hilitestyle">\1</span>', $text_string);
    }
          ## lastly, return text string with highlighted term in it
          return  $text_string;
    }

How to use the function above? It could be something like this.. I am only be showing your while loop, and you still have to assemble everything..

    ## this is your while loop from above.
while ($row = mysql_fetch_array($sql))
{
     ## we need to pick up the search terms or terms and put them into an array

     ## in this example, I will be using the $row['title'] as the text string

 $text_string = $row['title'];

     ## the array of terms from the search keywords as $term 

 $terms = array($term, $term);

     ## return the string with hightlighted terms

 $highlite_string = highlightTerms($text_string, $terms);

     ## echo everything here.
     ## Use $highlite_string as subtitute to your actual title.


     ## end of whille loop

 }

On your css file add style to hilitestyle using the highlight css property..

veedeoo 474 Junior Poster Featured Poster

Hi,

These are two different things that will never ever equal to each other, and will never validate to true.

if(($_POST['name']) == $_SESSION['uid'])

Because at the start of the session, you defined your session['uid'] as 'test'. Therefore, at the time that the form has been posted the condition above will validates to

if((SomeName) == (test))

and it is definitely equal to FALSE. However, this will work . Add another input to your form and then change your submit button code to this.

<input type= "hidden" name = "this_session" value = "<?php echo $_SESSION['uid'];?>"/>
<input type="submit" name = "submit" value="Submit" />

Change your if statement in validate.php to something like this.. triple validation, before anything could happen.

  if((isset($_POST['submit'])) && (($_POST['this_session'])== ($_SESSION['uid'])) && (!empty($_POST['name']))){

    ## do your redirect here..
   }

The above will validate if the submit button has been submitted, this_session is equal to the session['uid'], and the posted value of 'name' is not empty. So if the form has been properly filled, and the submission is not coming from some remote script (the session confirms that at least, but if a cookiejar is used in cURL, this form can be spoof without any problem).. the script validates to true. something like this in the parser's side

if((TRUE) && ((TRUE) == (TRUE)) && (!empty(TRUE))){

 ## validated to true and will execute everything below

}
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

try,

<div>
<span class="bold">Choose a lecturer:</span><br>
<select name="lecturer" >
<?php
// note how the keyword "distinct" in the following query prevents duplicate values from being returned
$dbQuery="select distinct lecturer from p3_modules";
$dbResult=mysql_query($dbQuery,$db);
// convert this loop to generate a drop down list (3a)
// the value of each <option> element should be the lecturer's name
// enclose the drop down list in a form with action=showModules.php
while ($dbRow=mysql_fetch_array($dbResult)) {
 echo '<option name="'.$dbRow['id'].'" >'.$dbRow['lecturer'].'</option>';

}

// add a submit button for the form
?>
</select>
<input type="submit" name="submit" value="Submit"/>
</div>
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 Kit005,

Can you show me your form codes where users input the data?

I will extend your regards to Dr. Einstien. He is my Physics professor. We call him Dr. Einstein, because his hair are just amazingly standing on end all the time, just like the guy in the old movie called Back to the Future ... lol.. It probably needs a truck loads of hair conditioners, before those hair will ever bow down lol .. oops ... I must have said too much already.. I hope no princeton kids are hangin around here they follow me where ever I go online... lol :)

veedeoo 474 Junior Poster Featured Poster

Hi,

Is there any way for your script to write the text file like this?

user1|johnson | number of parts1| 5 | number of parts2 | 10
user2 | andy | number of parts1 | 10 |number of parts2 | 10

The reason I am asking is that the script would read it line by line. If we can set it up just like above. It would be very easy for you to calculate, because php will read those items as an array. Something like this

 [user] =>array
          [0] => user1
          [1] => johnson
          [2] => number of parts1
          [3] => 5
          [4] => number of parts2
          [5] => 10
  [user] => array
          [0] => user2
          [1] => andy
          [2] => number of parts1
          [3] => 10
          [4] => number of parts2
          [5] => 10

So, with that arrangement on the flat file, we can easily explode the |, and then we can loop through the lines using for loop. That should give us a difinitive values on every items

For example if want to calculate on the total of parts1 and parts2 for the first user, it will be just as simple as $user[3] + $user[5];

Let me know if you are willing to change the formatting of your text file, so that I can help you..