veedeoo 474 Junior Poster Featured Poster

Hi,

I wish I could read at least something on your linked website, then I can probably help you.

Anyways, I think curl will do it for you,.. you just have to look at the source of the form. Look for the name value of the submit button and then the form processor document.. allow your curl to follow external link wherever the form processing is located.

Here is a demo of a similar script that I wrote before. This script is running in three servers. There are two remotely located servers where the form query is submitted and script will wait for the servers response and then print those responses on the local server (third server).

So, I don't see any complexities on what you are trying to achieved..

veedeoo 474 Junior Poster Featured Poster

Hi,

I wrote something like this, but I am always hesitant to share it to general public, because there are some great security risks and vulnerabilties ,if not protected well enough against unauthorized entries.

veedeoo 474 Junior Poster Featured Poster

@the_prince_Awah,

I will see if I can do a simple str_replace function to get rid of those deviated characters... it should not be that hard.

No! I am not a genius yet.. my professor still labeled me as the mathematical wiz Kid from Fullerton.., but once I am able to solve the famous Riemann hypothesis without inflecting any damage to my brain, then I would probably consider myself as junior genius. But then again that is too much responsibilities I think.. I only dream of setting on a nice beach folding chair while holding a nice cold frappuccino in my right hand that's all :). Programming, I get bored writing them , unless it has a really good purpose out of the ordinary.

veedeoo 474 Junior Poster Featured Poster

Hi,

I think it should be md5_file($file), as shown in the function description here.

veedeoo 474 Junior Poster Featured Poster

Hi,

for your form question, you can rewrite your codes like this..

<?php
    if(isset($_POST['submit']) && (!empty($_POST['user']))){


    echo $_POST["user"];

    }
    else{
        ## we show the form below

    ?>

    <html>
    <body>
    <form action="" method="post">
    <input type="text" name="user" placeholder="enter a text" />
    <br/>
    <input type="submit" name="submit" value="submit"/>
    </form>
    </body>
    </html>

    <?php

    }

    ?>

Pretty much everything are self explanatory.. all what is the script doing is to check if the submit button has been set, and then check if the name is not empty. If these two check points are true and we echo the submitted name.Otherwise, we show the form.

for the second question, you can use the while loop function of php.. as shown here.

veedeoo 474 Junior Poster Featured Poster

Here is a sample decryted part ... just do the rest of them..

function padd_theme_prelude_begin() {
ob_start();
}
add_action('wp_head', 'padd_theme_prelude_begin');
function padd_theme_prelude_end() {
$contents = ob_get_contents();
ob_get_clean();
global $padd_guid;
if (!empty($padd_guid) && (function_exists('padd_theme_credits'))) {
if ($padd_guid === 'c55oe00i-0579-udc9-8oe7-80cfb6io8bce') {
echo $contents;
} 

else {
wp_die('Something wrong.');
}
} 

else {
wp_die('Something wrong.');
}
}
add_action('wp_footer', 'padd_theme_prelude_end');
veedeoo 474 Junior Poster Featured Poster

Hi,

Actually, this is nothing but code base 64 encoding. On your decoded codes, the author replaces the letters with their own calculated equivalent integers .

For example, the encoded messages in the codes above,. uses some form of alpha numeric deviation.. by looking at it or just by glancing at the codes, I can easily assume that the keys are the following.

f3nct42n = function
f = f
u = 3
n = n
c = c
t = t
i = 4
o = 2
n = n

gl2b1l = global

g = g
l = l
o = 2
b = b
a = 1
l = l

e = 5

p1dd_th5m5_cr5d4ts = pbdd_theme_credits

f3nct42n_5x4sts = function_exist

wp_d45('S2m5th4ng wr2ng.'); = wp_die('something wrong');

You can develop your own decrypting mechanism by reading this example here ...

That's pretty much it.... most encryptions especially in organizations they tried to invent some deviation only they know how the keys are deviated..e.g. 12=>a, 13=>b, 4=>y and so forth..

In your code above, I do believe they skept 4 to 5 characters then go backward by 3 then move on by another 4 to 5 and the process goes in cycle.

Again this is just my assumption. The reason I could see it , because I been solving many complex math problems at my school, and this one is the example of assumed assigned values.

veedeoo 474 Junior Poster Featured Poster

you mean procedural coding style? Sure why not.. that's even a lot easier, but cannot be reuse unlike the OOP style.

Here we go..

<?php
## image reducer in procedural coding style.. by veedeoo or poorboy 2012
## define your image input, output and quality.
## provide data as array('inputImage','outPutImage', quality)
## quality range are 10 to 100 ..

$imageInfo = array('images/sample.jpg','images/output.jpg', 30);

################# NO EDIT ZONE BEGINS ##############################

## get the width x, and the height y. 
list($x,$y) = getimagesize($imageInfo[0]);  

## create a blank canvas where the new resized image is going to be layered.
$canvas = imagecreatetruecolor($x, $y);

## use code below in production server.
//$canvas = @imagecreatetruecolor($x, $y);

## prepare and create the new reduce image using the source file
$preparedImage = imagecreatefromjpeg($imageInfo[0]);

## generate the new reduced image.
## actually, this process will draw the reduce image on top of the canvas
imagecopyresampled($canvas, $preparedImage, 0, 0, 0, 0, $x, $y, $x, $y);

## lastly save the new image
imagejpeg($canvas, $imageInfo[1], $imageInfo[2]);

## free up some menory
imagedestroy($canvas); 
imagedestroy($preparedImage);

################## END OF NO EDIT ZONE #############################


## print image on the screen

echo '<img src="'.$imageInfo[1].'" />';

?>

There you have it. I still preferred the one written in OOP, because it can be extended to grab image from a remote url if needed...

veedeoo 474 Junior Poster Featured Poster

here is an image manipulator class I just wrote for this question. Save as image.class.php

<?php

## this image manipulator class was written by veedeoo or poorboy 2012
## feel free to modify, extend this clas as you wish.
## does not have any warranty of any kind

class ReduceImage{
    private $imageLoc = null;
    private $outImageLoc = null;
    private $imageResizePoint = null;


    public function __construct($imageLoc,$outImageLoc,$imageQuality){
        $this->imgLoc = $imageLoc;
        $this->outLoc = $outImageLoc;
        $this->quality = $imageQuality;
    }

    protected function getImageInfo(){
     list($this->x,$this->y) = getimagesize($this->imgLoc);

     return array($this->x, $this->y);

    }
    public function createImage(){
        $this->imageX_Y = self::getImageInfo();
        $this->newImage = imagecreatetruecolor($this->imageX_Y[0],$this->imageX_Y[1]);

        ## in production server use code below
        //$this->newImage = @imagecreatetruecolor($imageX_Y[0],$imageX_Y[1])

      //$this->newX_Y = self::getImageInfo();
      $this->newfile = imagecreatefromjpeg($this->imgLoc);
      imagecopyresampled($this->newImage, $this->newfile, 0, 0, 0, 0, $this->imageX_Y[0], $this->imageX_Y[1], $this->imageX_Y[0], $this->imageX_Y[1]);


     imagejpeg($this->newImage,$this->outLoc,$this->quality);
     ## in production server use code below
     //@imagejpeg($this->newImage,$this->outLoc,$this->quality);

     return $this->outLoc;
     imagedestroy($this->newImage);
     imagedestroy($this->newfile);

    }





}

?>

Sample usage of the class above..You should not have any problem implementing this to your script above.. I don't write full codes for advance users..

<?php

include_once 'image.class.php';

## define quality..quality value range from 10 to 100 10 or worst to highest quality.

$quality = 50;
$inputImage = "someImage.jpg";
$outputImage = "output.jpg";

## instantiate the class
$reducethis = new ReduceImage($inputImage , $outputImage , $quality);

## create the new image with smaller size
$image = $reducethis->createImage();

## display reduced image
echo '<img src="'.$image.'">';


?>

That's it .... good luck.. reference? read more here.

UPDATE! class above has been updated: I removed the possible reduncy of calling another instance of createImage ().

veedeoo 474 Junior Poster Featured Poster

Hi,

Here is the demo I created. Feel free to copy the source code, but make sure to download and save this file as jquery.chained.js. DO NOT hot link the js file from my server that's all I am asking. I will always know if it is hot linked by any sites or ip.

The coding convention is kind of like this....

 <select id="selectOne">
    <option value="optionOne">Option One</option>
    <option value="optionTwo">Option TWo</option>
    <option value="optionThree">Option Three</option>
    </select>

    <!-- create the second select/option block -->
    <!-- pay attention to the class of the option block, it matches the value of the option block above -->
    <select id="chainedToSelectOne">
    <option value="chainedOptionOne" class="optionOne">Choice for Option One</option>
    <option value="chainedOptionTwo" class="optionTwo">Choice for Option Two</option>
    <option value="chainedOptionThree" class="optionThree">Choice for Option Three</option>
    </select>
    <!-- create the third select/option block related to both select/option blocks above -->

    <select id="finalSelect" name="finalChoice">
    <!-- once again, look closely on the class of the option block below. -->
    <option value="finalValueOne" class="chaindedOptionOne optionOne">Final selection for Option One</option>
    <option value="finalValueTwo" class="chainedOptionTwo optionTwo">Final selection for Option Two</option>
    <option value="finalValueThree" class="chainedOptionThree optionThree">Final selection for Option Three</option>
    </select>

    <!-- Now, we need to chained those blocks above -->
    <script type="text/javascript" charset="utf-8">
          $(function(){

            $("#chainedToSelectOne").chained("#selectOne");
            $("#finalSelect").chained("#selectOne, #chainedToSelectOne");
          });
          </script>

That's it.. that should not be too hard to follow.. otherwise, you will have to do some quick javascript language immersion.. if needed.

veedeoo 474 Junior Poster Featured Poster

HI,

When you say "mp3 file not going to database? do you mean you want to save the actual mp3 file in your database as blob?, or you just want to save the information unique to the mp3 file such as title, duration, and others? If that is what you want, check how it can be done here.

Otherwise, based on your codes above, the uploaded mp3 is being renamed and save in its final destination called music directory.

After the upload, the user is being redirect to another php file named music.php by providing the query string containing the title of the mp3 file.

I am assuming here that in music.php, there are some type codes similar to this.

## pick up the mp3 title from the query string named music

$mp3File = $_GET['music']."mp3";

## there should be some kind player codes here.

How to test my assumptions above? Do a test upload, upon its completion check if there is an mp3 file inside the music directory in your server.

Yes? double check your player codes and make sure the extension mp3 is added , or the proper file name of the mp3 itself matches with the value of music extracted from the query string.

No? Check and make sure the directory named music has the proper permssion or CHMOD. Most server needs at least 755 or 777 for the any script to write in the directory.

Check your php.ini file and make sure the upload_max_filesize …

veedeoo 474 Junior Poster Featured Poster

@rotten69,

I am using many different editors depending on what I have to work on. For instance, the above scripts I have provided in this thread was written on browser based editor, using my own php editor class in my portable xampp. I wrote this simple php editor class, so that I can write and test codes right away without the hassle of typing the url just to access the file. What is so cool about this php editor class? I can edit my php codes in browser environment.

For full php developement regardless of framework use e.g. code Igniter, cake php, and doophp , I normally use netbeans IDE php edition. I use it because of the smarty templating plugin for it. NetBeans IDE also have an auto error checking that can make the development process a lot easier. On top of this, I am using my own function and class finder just to make sure I can find the exact page where the functions or classes has been used or instantiated. The Netbean built-in search function is kind of slow, so my solution is to write my own search script that is fast enough to find functions, variables, class in all the files within specified directory.

For android related apps and simple Java, I use eclipse.

For simple and fast coding I use either notepad++ or PHP designer 2007 personal free edition. For the initial writing of the codes, I use the notepad++ first and then to debug …

veedeoo 474 Junior Poster Featured Poster

Alternatively, we can use this class to create and include cache files. Although it i s a longer version of the above, this class can be extensible and reusable as many times as you want.

save this as cache.class.php

<?php
## Written and provided to you by Veedeoo or PoorBoy 2012
## this class has no warranty of any kind.
## feel free to use this to your application as needed
## feel free to extend this class for improved and better functionalities.
## What I meant by improved and better functionalities? Function like compression of cache file e.g. gzip.


    class MakeCache{

        private $content= null;
        private $cacheDuration = null;
        private $cacheLoc = null;
        private $cacheFile = null;


        public function __construct($content,$cacheDuration,$cacheLoc,$cacheFile){
         $this->loc = $cacheLoc;
         $this->file = $cacheFile;
         $this->duration = $cacheDuration;
         //$this->comp = $cacheCompression;
         $this->content = $content;

        }

        private function checkDuration(){
            return(file_exists($this->loc."/".$this->file) && (time() - $this->duration < filemtime($this->loc."/".$this->file))? true : false); 
        }

        public function useCache(){

         if(self::checkDuration()){
             ob_start( );
        include( $this->loc."/".$this->file);
        $this->output = ob_get_clean( );

        }
            else{
                ob_start(); 
        ## include the page to be cached
        include ($this->content);

        ## prepare for writing the cache file
        $filePointer = fopen($this->loc."/".$this->file, 'w');

        ## grab the output buffer and write it in cachefile
        fwrite($filePointer, ob_get_contents());

        ## close the file
        fclose($filePointer);

        ## Send the output to the browser
         $this->output = ob_end_flush();
            }

            return $this->output;
        }

    }
    ## end of class
?>

You can call this class from any page..for example

<?php

include_once 'cache.class.php';

## instantiate the cache class

$showCache = new MakeCache("reporst.php", 10080 * 60, "cache","reports.html");

## print …
veedeoo 474 Junior Poster Featured Poster

@jemz,

html5 players does not support wmv, because it is a browser based player. So, the most commonly supported video formats or extensions are mp4/h264, ogv or ogg, webm.

If you are wondering which format is the most useful, without the burden of having too many duplicates of the same video encoded in different formats? My choice would be the mp4/h264.

Why mp4/h264 ? Because it is supported in html5 and apple gadgets.
Will all the browsers wil be able to render mp4/h264 video? the answer is yes and NO. Yes, because it supports many mobile browser. No, because firefox and apple only supports it. However, you can always write a fallback player codes, so that whenever a browser is not supporting mp4/h24 video, we can fallback to regular flash player like flowmotion or jwplayer. That should make everyone happy. The most important about using mp4/h264 encoded video is that it can be encoded in the very minimum bitrate and still the quality is far superior than any other video formats.

Downside of mp4/h264? The downside is that you cannot pseudostream this type of video, because the moov atom of this video is located at the tip of the video file. Ok..ok. yes, we can pseudo stream mp4/h264 video by using php script written by some video afficionados like myself. I will not be providing the script for it, because I am relying on it heavily to pay for my coffeee.

How do you encode mp4/h264 videos? I can …

veedeoo 474 Junior Poster Featured Poster

If mysql import fails, there is another option I called this force directory import, or copy and paste import.

In your source system, open xampp directory.
Open mysql/data directory.
Look for the database directory you want to import, copy and save this to flash drive.

On the reciever system, open the xampp/mysql/data directory.
Paste the database you want to import.

veedeoo 474 Junior Poster Featured Poster

I assume, it would be something like this?

Average wait = (time service is provided) minus (time listed on the waiting list )

veedeoo 474 Junior Poster Featured Poster

Hi,

Here is simplest way of doing this (it is too simple that my comments out numbered my actual codes :)). Of course, you must search more on how to improve this. I am in the assumption here that file you are trying to cached is in your server. If it is coming from the external server, then process is slightly different than processes my sample codes will do.

Step One: in your server, create a directory called cache, and give this directory a permission CHMOD of 777 or 755 depending on your host's recommendation.

Step Two: copy codes below and name it anyNameYouWant.php.

<?php
    $cachetime = 10080 * 60;
    ## page naming can be anything it is all up to you
    $pageName = "somepage.html"; 
    $cachefile = "cache/".$pageName;

if(file_exists($cachefile) && (time() - $cachetime < filemtime($cachefile)))  {


    ## the page has been cached from an earlier request

    ## output the contents of the cache file

    include($cachefile); 

    }
else{

    ## we need to include a fresh file or the actual file where we can generate the cache file
    ob_start(); 
    ## include the page to be cached

    include 'pageToBeCached.php';

    ## prepare for writing the cache file
    $filePointer = fopen($cachefile, 'w');
    ## grab the output buffer and write it in cachefile
    fwrite($filePointer, ob_get_contents());
    ## close the file
    fclose($filePointer);
    ## Send the output to the browser
ob_end_flush();
echo "cache file created";

}
?>

Instruction for modification.

1.$cachetime = seconds * 60 ... gives you the time expiration before a new cache file is generated …

SummerNight commented: great answer! +0
veedeoo 474 Junior Poster Featured Poster

Hi,

First, can you please let us know the format of these videos? Depending on the format, requires different player.. e.g. flash for flv and mp4/h264, divx player for divx and avi, and the list goes on...

veedeoo 474 Junior Poster Featured Poster

Hi,

Try, copy, save as anyNameYouWant.php, upload to your server, and direct your browser to this file

<?php phpinfo(); ?>

On this page, look for Server API value. Like most servers, I am hoping for your server to have a value of fast CGI or anything bearing the acronym CGI. If your server API say Apache module, you need to ask your host to put this entry on the loaded configuration file which is the php.ini file.

Option ONe: php.ini file trick EASY and RISKY
Assuming that it is indeed a fast CGI, then you we can easily add a new php.ini file in the directory needing it. For example, if your script is running in YourDomainDotCom/YourScriptDirectory, then the new php.ini file should be uploaded in the YourScriptDirectory and NOT inside the root directory. However, if the scraping script is included by other files, the php.ini file should be within the location of the file calling the scraping script.

Risks?
By setting allow_url_include = On, I want you to understand the security risks. For example, yourDomainDotCom?file=someBadDomainDotCom/someBadScript.php?exe=defaceThisSite. Although this type of vulnerability can be implemented by advance users only, and as long as you keep it in low profile your site is less likely to be a target of an attack.

Here we go. If you are sure that the server API is CGI or its derivatives, then you can copy codes below, save as php.ini file, and upload to the directory as I have already explained above.

veedeoo 474 Junior Poster Featured Poster

Hello Everyone,

Please accept my simple and humble contribution. This script will validate if the user or visitor is a suspected spammer, by utilizing the stopforumspam API.

Example implementation

## example usage. These items can be from database or from form input. The choice of implementation is all up to you.

## the sample info. is an actual spammer based on the API response from stopforumspam. Notice the username did not return to be positive, but ip and email are both positive.

$ip = '23.19.152.194';
$email = 'Kesten@gmail.com';
$userName = 'Tina Lupi';

$check = new SpamCheck($ip, $email, $userName);
$checkIp = ($check->validate_ip()? "This is spammer's IP" : "Not Spammer's IP");

## alternative validation 
// $checkIp = ($check->validate_ip($ip)? true : false);

echo $checkIp."<br/>";


$checkEmail = ($check->validate_email() ? "This is an spammer's email" : "Not Spammer's Email");

echo $checkEmail."<br/>";

$checkUserName = ($check->validate_user()? "This username appeared to be spammer's username" : "Not Spammer's username");

echo $checkUserName."<br/>";

The variables here are the ip, email, and username. Normally, spammers will use the same IP, email or username in any combinations like ip/email, email/username, ip/username.

To get the IP address of any visitor, we can use code below

 $ip = $_SERVER['REMOTE_ADDR'];
 ## alternatively, we can also use getenv
 $ip = getenv('REMOTE_ADDR');

Email and username can be from your form processor. like...

 $email = $_POST['email'];
 $username = $_POST['username'];

The alternative validation can also be set like this

   $checkIp = ($check->validate_ip($ip)? true : false);
   if($checkIp){
   ## redirect code here..

   }

NOTE! There …

veedeoo 474 Junior Poster Featured Poster

Hi,

Not exactly though, you can insert them inside your class and call them within the class. This way you will only have to call one or two methods outside your class. That's the reason why I set its visibility to private on my exmaple.

You can also retrieve the methods returned data as an array if you wish to do so.

for example,

    public function doSomething(){
    $this->error = "";
    if(SomeCondition){
    $this->error ="condition A error";

    }

    else{
    $this->error .= "condition B error";
    ## otherwise error is set to default as empty

    }
    ## say, we want to call helper methods here to validate something, then we can do so by just using the self::doSomethingElse().
    ## example..
     if(!self::verifyEmail($email)){
$this->error .= "email is not a valid email address";
}
else{
$this->email = true;
## you can either insert to database or just return the boolean true above.
$this->error .= "email has been added";
}

## return the array from this method, for other methods to utilize

return array($this->error, $this->email);

}

and then, within the method utilizing the method above can be coded like this. This will and can be use outsde this class, whenever the class is instantiated anywhere in your site.

 public function getAllValidation(){
 $this->emailHelper = self::doSomething();
 $this->otherThings = self::functionOfOtherThings();
 $this->someOtherValidations = self::functionToValidateOtherThings();
 ## extract the data returned by doSomething.
 $this->error = $this->emailHelper[0];
 $this->validation = $this->emailHelper[1];

 ## extract the rest of the helpers 

 ## do some other things here..

 ## return all validations as an array.. it can …
veedeoo 474 Junior Poster Featured Poster

Hi,

This problem can be associated with your php time out limit.. there should be no reason for duplicates unless your php timed out and lost its communication with the mysql server(shared hosting only). Otherwise, you can try LOAD DATA INFILE function as described here. This can take a text file.

Double check your php.ini file settings for max_execution_time and max_input_time values. Try increasing these values above your default settings. An ideal settings for sites that are accepting a minimum of 100MB video uploads is set to at least 1000 for both. So, in your case, this can be a reasonable settings.

Another one is a fucntion called set_time_limit(), but this one requires the safe mode to be off.

veedeoo 474 Junior Poster Featured Poster

To use it within your class, you can pretty much do it like this.

 $email=  strip_tags($_POST['email']);
 if(!self::verifyEmail($email)){
 error = "email is not a valid email address";
 }
 ## we can also clean up the message using the helper function like this

  $message =  strip_tags($_POST['message']);

  return trim(self::sanitizeString($message));

There are many more ways I could show, but my keyboard is acting up again.

veedeoo 474 Junior Poster Featured Poster

Hi,

You can also use php filter_var function. I keep on forgetting about this function. You can use this function in your helper method.

Something like this..

private function verifyEmail($email) {

 ## returns true or false
return filter_var($email, FILTER_VALIDATE_EMAIL) && preg_match('/@.+\./', $email);
}

private function sanitizeString($tstring){
 ## this method will be use by others within the class

return trim(filter_var($tstring, FILTER_SANITIZE_STRING));  

} 
private function sanitizeUrl($url){
return filter_var($this->url, FILTER_SANITIZE_URL);
}
veedeoo 474 Junior Poster Featured Poster

Hi,

The very first thing to look for is the error log if there is any. Secondly, do you mind posting an example or the actual problem itself?

veedeoo 474 Junior Poster Featured Poster

Hi,

Did you try to add a simple fall back to flash player codes? The reason is that some browser does not support other video formats in html5 player.

For example, chrome does support mp4/h264 videos, while some browsers can only support Ogg, and other support only webm.

So, my recommendation can be costly and if you are paying someone to encode your videos. here is a classic codes for html5 player supporting chrome and firefox..

 <video width="600" height="380" >
 <!-- this can be viewed in chrome -->
 <source src="movie.mp4" type="video/mp4" />
 <!-- this is for firefox ------>
 <source src="movie.ogg" type="video/ogg" />

</video> 

If you don't want spending an extra dime or nickles on ogg format, the best way is to just fallback to flash. Html5 player is still a big hype at this very moment., Internet browser developers should agreee on which is the video format they can agreed upon. Not until then, we will just have to have a complete duplicates of the same video in different format.

The fallback can be something like this..depending on your flash player..

 <video width="600" height="380" >
 <!-- this can be viewed in chrome -->
 <source src="movie.mp4" type="video/mp4" />
 <!-- this is for firefox ------>
 <source src="movie.ogg" type="video/ogg" />

<embed
  id='single2'
  name='single2'
  src='YourOWnplayer.swf'
  width='600'
  height='380'
  bgcolor='#000000'
  allowscriptaccess='always'
  allowfullscreen='true'
  flashvars='file=video.mp4'
/>
</embed>

</video>
veedeoo 474 Junior Poster Featured Poster

Hi,

What is your php/text editor? try using notepad++ or php designer 2007 personal edition. Both are free at cnet.

To fix it you really need to read line by line and try sorting it really well and add carriage return where it is needed.

veedeoo 474 Junior Poster Featured Poster

Hi,

One of many ways of doing this is to write script following the simple guidelines.

  1. First check if the user is logged in. YES? NO?. If NO?, this is not allowed..
  2. Yes?-> provide a link or form to change the password.
  3. Let the user type in the old password, and the new password. Make it twice for the new password for comparison

    ## e.g.
    <label>Type Old Password</label>
    <input type="password" name="oldpass">
    <label>Type New Password</label>
    <input type="password" name="newFirst"/>
    <label>Re-Type New Passwrod</label>
    <input type="passwrod" name="newSecond"/>

  4. Using $_POST, process the inputted password ( clean it up a little). Compare new passwords .

  5. Connect to your database, validate to make sure that the old password matches the one that is on the database table and the member changing it matches in the username column.

  6. If the validation is a success, update the password column with the new password.

  7. Redirect the user to logout.php and then give the link to login using the new password credentials.
baig772 commented: descriptive +2
veedeoo 474 Junior Poster Featured Poster

Hi,

Try searching for wordpress plugin first. You might not find the exact functionalities you are looking for, but I don't see any problem in finding a similar one. Then modify the plugin to meet your needs.

Writing your own plugin in wordpress requires some time to get yourself familiar with the wordpress coding conventions. and standards They have their own rules of the DOs and DON'Ts that must be followed religiously, otherwise any added function is not going to work as intended.

Here is the link to help you out..

veedeoo 474 Junior Poster Featured Poster

Hi,

Just bring down the comment tags. One more thing multi-line comment in php should be like this

<?php

/* beginning of long comments from the author



*close the comment tag below

*/
veedeoo 474 Junior Poster Featured Poster

Hi,

Is it possible for you to just install xampp or something similar like easyphp? By going this route, you save yourself a million times of troubles, and you can focus more on coding in php than focusing on what are the missing dll files in your operating system.

Either one of my recommendations above, will function as a server out of the box, and you can run pretty much all php scripts on these servers.

veedeoo 474 Junior Poster Featured Poster

Hi,

I thought 1 minute is equal to 60,000 milliseconds, so your equation can be something like this.

list($get_minutes, $get_seconds,$m_seconds) = explode(':', '1:27:04');
## approximate the milliseconds for some hour
$minutes = ( $get_minutes * (60* 60000));
## approximate the milliseconds for some minute
$seconds = $get_seconds * 60000;
## approximate the milliseconds for some seconds
$m_seconds = $m_seconds * 1000;
## approximate the sum of the approximated values
$set_duration = ($minutes + $seconds + $m_seconds);

## print the sum to see if is plausible.
echo $set_duration;

Based on the approximation above, there should be a total of 5,224,000 milliseconds in 1:27:04.

veedeoo 474 Junior Poster Featured Poster

you can also give this a try. Just use your command prompt type in the options, the location of the php files or project, type the output file e.g. file.exe , and you are good to go.

You can also add an icon for your converted executable php..

Downside?
The downside is that you will have to distribute some dll files needed by your application e.g. curl dll.
It does not support php 5 and above.

Security?
Watch out for the php function RecursiveIteratorIterator.. I strongly advice you to stay away from using this, unless you have a really good intention behind your application.. would not elaborate on this, but I could already see where the endusers can be exploited by this type of application..

here is a good one... just a tiny snippet of this vulnerability

  <?php
    $dir = new RecursiveIteratorIterator(
     new RecursiveDirectoryIterator('/',true)
    );

    foreach($dir as $file){
        echo $file->getPathname(),"\n";
    }
?>

You run the script above, and you will see what are the things exposed from the enduser's files. Enduser files are exposed including the sitemanager.xml file for filezilla...

Watch out for what you wish for.....

veedeoo 474 Junior Poster Featured Poster

Hi,

Ok... go to the location where you installed your xampp.. Normally this is located in c:xampp.. Open this directory and find the xampp_start . Click on the xampp_start icon. This should fire up and start the xampp.

The second alternative is to just click on the xampp icon on your desktop. This should start the xampp control panel. Open the control panel and make sure that the services are on.

Once the services are confirmed to be running, open your browser, and then type localhost.. this should take you to xampp index page.

Remember, in order for you to view the parsed output of php files on the browser, these files should be saved inside the htdocs directory.

veedeoo 474 Junior Poster Featured Poster

Make sure your server or localhost can parse php.

try this, save as anyNameYouWant.php, upload to your server or save to your localhost public directory.

 <?php

 echo "Hello World";

 ?>

Direct your browser to this file..The above should be printing "Hello World on your browser. If not, then your server does not support php.

Another thing is to check all of the files relevant to the login script and make sure they all have the extension .php or other extensions the php parser supports e.g. .inc, .tpl, and others.

veedeoo 474 Junior Poster Featured Poster

Try searching for mysql sanitation on google.. like this one here.

Protect your site from all data coming from the outside..

The rule of thumb is to sanitize it before sending it your database. ONLY advance users can do the shell exploitation. More likely, advance users are always busy with either work or schooling, so I don't see these group of people going out there to be hacking all the sites they see, unless they are insulted or challenged. The dangerous ones are the ones who are currently experimenting and trying to prove something to their friends or just for the fun of it.

Honestly, even with all the sanitation filters we have, some people can still be successful in exploiting the site using $_GET or $_REQUEST... NO! $_POST is not exempted (just different ways of doing it).

Even with all the sanitation filters applied to form input, these codes can pass through without problem

 login.php?id=1+AND+extractvalue(1,concat(0x5c,(select pass from users limit 0,1)))
 ## I have to remove the main content of the exploit to prevent people from using it.

What the exploit above will do is to echo the password from user. Why can this go trhough even with extensive santition? Take a look at the characters of the exploit, they are all valid.. it can easily give away password. This can be easily done on GET and REQUEST..

The danger can even escalate if people are careless or just too lazy to clean up their form …

veedeoo 474 Junior Poster Featured Poster

Hi,

Honestly, the best way to bring it back to its working condition is to use the back-up files instead of the updated files.

veedeoo 474 Junior Poster Featured Poster

Disclaimer! A well written form processor class can survive pretty much all of the exploits and tricks that the hackers use. NOT ALL THOUGH...

Hi,

$_REQUEST is one dangerous thing if you don't protect your script pretty well.. I mean extremely well. There have been debates and many disagreements about this. One might argue, "why did they put it there?", and "Why not just eliminate it all in all?".

The response to this is simple. Say, we have an application where security is not that much of a concern, because there is nothing there to protect like payment system or login system where cookie is not present or not being implemented. This type of applications will get the full benefits of request, because the coder don't even have to assign method on their form tags. A classic example is a simple photogallery, where clients can click on the thumbnail and take them to a larger version of the photo.. you can either use get or request on this one. Another example is a pagination script with limited database interaction...

However, using it in a system where there is a log in, a cart system that heavily relies on cookies.. Using the $_REQUEST can increase the risks for your clients.

This response is going to be lengthy, if I will try to explain it in great detail. However, here is an article about it please read it here. I agree with this person 90.00%.

Learning how to program is …

veedeoo 474 Junior Poster Featured Poster

Hi,

Try reading my recommendation here

veedeoo 474 Junior Poster Featured Poster

Hi,

You can try reading this . The author wrote a function as shown below...

   function truncate_str($str, $maxlen) {
if ( strlen($str) <= $maxlen ) return $str;

$newstr = substr($str, 0, $maxlen);
if ( substr($newstr,-1,1) != ' ' ) $newstr = substr($newstr, 0, strrpos($newstr, " "));

return $newstr;
}

and to use it on your applications, it can be as simple as this..

$summary = truncate_str($row_getPosts['entry']),600);

Just don't forget to provide a link for the full article.. for example.

  echo $summary.' <a href="article.php?post='.$row['id'].'">Read More</a>';
veedeoo 474 Junior Poster Featured Poster

Hi,

Try this... this will be your common.php and must be included in all pages needing a translation..

 <?php
session_start();
## detect browser's language
$language = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);

## set that language into session
$_SESSION['lang'] = $language;

## include translation file depending on the language in the session.
switch ($_SESSION['lang'])
{
case 'en':

include 'lang_en.php';

$user_lang = "English";

break;

case 'pt':
include 'lang_pt.php';
$language = 'Purtuguese';

break;

default:

include 'lang_pt.php';
$user_lang = 'Purtuguese';

break;

}

## below can be anywhere, but make sure session is included just like above.
echo $user_lang;

echo "<br/>Translated Strings<br/>";

echo $lang['Family Office'];
echo $lang['Family Office'];
echo $lang['Multi Family Office'];
echo $lang['Foco'];
echo $lang['Serviços'];
echo $lang['Valores'];
echo $lang['Seminários'];
echo $lang['Contactos'];
echo $lang['Português'];
echo $lang['Inglês'];


?>

If you don't want the browser's auto-detection, remove it and use $_GET instead.. don't forget to unset session as necessary..

veedeoo 474 Junior Poster Featured Poster

DISCLAIMER! This is just an opinion from a 19yo.

I don't see the necessity of using return $this->myname;.. if this is going to be use by other methods below it.Otherwise, when it is needed to be somewhere else without the hello.

Most coders use the same style, but ONLY for the purpose of method chaining. However, the approach is completely different from your codes above, because it only return->$this and not the whole thing..

Here is a sample code for method chaining.. Zend uses this a lot... I also see this a lot on my older brothers source codes, up to the extent of chaining multiple classes..

   <?php
    class Whatever{
     private $name = null;
     private $hello = null;

    public function setName($name){
     ## do something with the name
     $this->name = trim($name);
     return $this;

    }

    public function say_hello($hello){

    $this->hello = $hello;
    return $this;

    }
    public function makeSenseOutOfThis(){

        echo "This is an output of method chaining ->".$this->hello." to ".$this->name;

    }

}

$aName = new Whatever();

$aName->say_hello('hello')->setName('SomeName')->makeSenseOutOfThis();
?>

for your sample codes above, I prefer doing it this way.., because it gives you more option to extends to whatever functions, conditions in the future..

<?php
    class Whatever{
     private $name;

     public function __construct($name = null){
        $this->name = $name;
    }


    public function setName(){
     ## do something with the name
     ## this trimming can also be done within the constructor.
     $this->name = trim($this->name);
     ## I hate returning from the setter but should return from the getter

    }

    public function getName(){
     ## 
     return $this->name;

    }

    public …
veedeoo 474 Junior Poster Featured Poster

Does the smarty compile the header.html?
Anything inside the directory themes_c?
Can you turn on the debug to true?

veedeoo 474 Junior Poster Featured Poster

@lastMitch,

I did not know, that it was almost midnight when I responded on this thread. Anyways, I managed to write some simple script to make you edit php, html, css, js files right in your admin area..

I wrote a single class for this, but it needs an upgrade at the moment, so before heading out for school today, I managed to write a simple script that will do as what you need.

Please Protect this script from public access at all cost. I strongly suggest using .htaccess protection on top of the login credentials as admin. NEVER and DO NOT allow any members of your site (if any) to access this script.

I did a test run twice.. and I can confirmed that it is working on my side. The only thing that this file don't have is the fancy highlight capabilities, and systax validation.

Here we go...

sTep ONe.. save this file as stepone.php.. or any name you want will do just as fine..

<?php
####  WARNING! THIS SCRIPT MUST BE PROTECTED FROM PUBLIC ACCESS ###########
## written by veedeoo or PoorBoy 2012
## feel free to use at your application.
## filename : stepone.php


## first we define our file extension allowed. 
$ext = array('.php','.html','.js','.css','.tpl');
## we define our current working directory where the dumper should be looking for files.
$work_directory = getcwd();

## we create a file dumper function
function dump($dir,$ext) {

$d = dir($dir);
while (false!== ($file = $d->read()))
{
$extension = substr($file, strrpos($file, …
LastMitch commented: Thanks for hard work! You made my day! =) +0
veedeoo 474 Junior Poster Featured Poster

Hi,

Let me write a demo first then, I will post it here after I tested it a couple of times.. This is the same method I was using, because I was pretty lazy using the ftp. So, all my php files are generated from my website. At least, I can edit my php files without FTP applications..just Internet connection and I am good to go.

Hold on, please... thanks for the PM... :).

veedeoo 474 Junior Poster Featured Poster

ok,.. since my last reply.. I had one crash today, while responding one of the PHP question.

For people who are having the same experience as mine, please do this..

Step One: Do this after the firefox restart.. open a new tab and then type about:crashes , this should give you some links , crashed id, including the date..

Step Two: click on the link, look for the crash reason. you should be able to get like EXCEPTION_ACCESS_VIOLATION_READ

Then below the page are firefox bug related report.

Looking at these crashes.. I think it is on firefox side, and maybe a little part of the blame, can be put on the ads. Especially, if ithe ads is delivered trhough iframe.

My theory about the iframe is that I tested it locally.. embedding one of the SWF games. Most of these games are embedded within an iframe, because they want to control their refresh rate and deliver the ads on the player. The crash report I get is the same as above.

I am not really sure if that's it, but still the issue is just too isolated in one browser, so it is really hard to point our finger to daniweb having a bug in their script.

Althernative method.. This one requires a Microsoft visual C++ 2010 express.

On windows 7, click on the start paste this on the search input %APPDATA%\Mozilla\Firefox\Crash Reports\ , and then hit enter.

Click on the crash reports/ pending

right click on the most recent …

veedeoo 474 Junior Poster Featured Poster

Hi,

you can try ...

  $userAgent = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)';

  ## add these items to your curl 
  curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);
  $post_array = array(
    "Email"=>$email,
    "Passwd"=>$password
);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_array); 
veedeoo 474 Junior Poster Featured Poster

Disclaimer! I really don't know how to code in cold fusion. I was never and will probably not learn it. However, besides PHP, I know how to code in C++, C#, C, python, ruby, a little of PERL, and some robotics programming in ROM. I spent most of my time writing and experimenting with OOP PHP for calculator applications ( I have this vision that PHP can be use as Accounting program , and probably will be able to do a better job in a more complex mathematical applications. The reason I have this pretty ambitious vision is that PHP is FREE and can be extend for whatever module we want to add into it.). The language is just too easy for anyone to replicate any applications.

So pretty much, what I am going to tell you here is a one sided point of views, which is not fair for the cold fusion community. I have no intensions of pursuading anyone, NOR claiming that PHP is an ultimate holy grail in web programming.

Learn PHP, because it is the commonly use language in developement. Web developers has been pretty sucessful using php in cms, forum, shopping cart system, video sharing websites, blog e.g. wordpress. There are many stable frameworks developed for PHP e.g. cake, zend, codeIgniter, and many others. There are many extensible templating systems solely intended for the use of PHP developer.

PHP can also carry out an exec, or shell exec right from the script itself. PHP has …

veedeoo 474 Junior Poster Featured Poster

HI,

This question is pretty much about javascript. Why not just do it like this, instead of struggling on the ajax?

<?php
$sayHello = "hello";
$pop = "";
$pop .='<div style="color:red;">'.$sayHello.' Testing</div><br/><a href="http://daniweb.com">Visit Daniweb</a>';
$pop .='<p>Lorem ipsum dolor sit amet, usu facilisi adipisci mandamus an, mel eu convenire torquatos sadipscing. Has etiam tibique indoctum te. In viderer eripuit feugait nam. Ex mea probo reque pertinax, at quo noster complectitur. In purto assum ius. Quod audire reformidans cu vix, nam erat dolore ei.</p>';
?>


<script type="text/javascript">
function pop_it(){
var thispop = window.open('', '', 'width=400,height=480,resizeable,scrollbars');
thispop.document.write('<?php echo $pop;?>');
thispop.document.close(); 

}

</script>



<a href="#" onclick="pop_it()">Abracadabra </a>
veedeoo 474 Junior Poster Featured Poster

This type of topic has already been asked and answered gazilion times already. Please take a look at my sample implementation Here. Pretty much the same as what you are trying to achieve, included is a thumb generator with proportioning function in it..

Feel free to adjust the script to your needs....