veedeoo 474 Junior Poster Featured Poster

just add something like this

move_uploaded_file($tmp_name, '/upload/images/photos/' . $name);
echo  '<img src="uploads/'.$name.'"/>';

on the file_exists declaration, just update the location..

The script above shows the image uploaded... you can change it to your #2 request.

I will look into this again tomorrow, maybe we can improve your script a little...

veedeoo 474 Junior Poster Featured Poster

try changing this part .. sorry about that...my head just got lost its PHP focus..

 if (file_exists('photos/' .$name)) {
   echo 'The file already exist';
  }
veedeoo 474 Junior Poster Featured Poster

Hi,

Can you try this ?

 for($x = 0; $x < count($files['name']); $x++){
    $name = $files['name'][$x];
    if (file_exists($name)) {
    echo 'File already exist';
    }
    else{
    $tmp_name = $files['tmp_name'][$x];
    move_uploaded_file($tmp_name, 'uploads/' . $name);
    }
    }

try it out first, I will help you out with the echo part of your question later.. My LAMPP is tied up with the JAVA testing..

veedeoo 474 Junior Poster Featured Poster

hi,

Did you manually created the servlet, I mean manually created the directories in the catalina/webapps directory?

If yes, is your web.xml properly setup?

One more thing, you don't have to put the .java extension on your form action, the router will take care of it. This is where the PHP framework got the idea. So, the form can and it is ok to just like this..

<form action ="checkMate"  method ="get">

or

<form action ="checkmate"  method ="get">

and the url of the servlet is accessible in your browser in this convention

http://localhost:8080/TheNameOfYourServlet/NameOfTheClass

So, youre servlet should be accesible in this url

http://localhost:8080/TheNameOfYourServlet/checkMate

For the servlet, if you are running it in tomcat and viewing it on your browser, you need to create your html file inside the servlet directory.. Or if you've created a Web pages directory, this is a great place to save the html files also.

Lastly, is the web.xml. Make sure that all of your web files or pages are included here.. here is an example of a web.xml for servlet...

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
    <servlet>
        <servlet-name>checkMate</servlet-name>
        <servlet-class>checkMate</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>checkMate</servlet-name>
        <url-pattern>/checkMate</url-pattern>
    </servlet-mapping>
    <welcome-file-list>
        <welcome-file>YourFormPage.html</welcome-file>
    </welcome-file-list>
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
</web-app>

Notice how the xml file was constructed, entries are pretty self explanatory. The same concepts we can find in Zend and magento.. the Name of the application class takes the sevlet name

veedeoo 474 Junior Poster Featured Poster

more tips for CHMOD and other things.. Try searching on the the mode option, and change FTP_ASCII to FTP_BINARY..

You can also experiment with FTP_AUTO .. I am not sure, but there should be some function to set it to auto mode.

veedeoo 474 Junior Poster Featured Poster

Hi,

Check if your remote server target directory is writable. On your PHP.ini file, make sure these values are increase to some acceptable values that will allow the script to finish its job.

Run a php info script and look for these values both of your servers

max_execution_time
post_max_size
max_input_time
upload_max_filesize

You check those values and let us know.

Can't you find a better script besides what you have posted above? why not just use a PHP ftp as simple as this ... Warning! NOT TESTED... check my reference here

function connect_ftp($remoteServerHost, $username, $password, $filesToBeUploaded, $directory_and_file_name_InRemoteServer){

$init_connect = ftp_connect($server);
$validate_login = ftp_login($init_connect, $username, $password);

if($init_connect && $validate_login){
    $init_upload = ftp_put($init_connect,$directoryInRemoteServer,$filesToBeUploaded,FTP_ASCII);
}
else{
    die('Unable to initialize connection to remoter server');
}

if(!$init_upload){
    echo 'Upload Attempt was a complete failure, check your directory permission. Check if the file size is not extremely large';
}

ftp_close($init_connect);
}

Example of implementation..

connect_ftp('ftp.remoteServer.com', 'username', 'password', 'backupTar.tar', 'backup/backupTar.tar');
veedeoo 474 Junior Poster Featured Poster

Hi,

Where do you run your servlets? I am running it on apache tomcat, I write my application in eclipse. May I see your codes?

If you guys are using tomcat, there is an example pre-package with tomcat and it is called RequestParamExample.java.

You can use this and run it on your tomcat.. the form is being processed by this part of the codes..

String firstName = request.getParameter("firstname");
    String lastName = request.getParameter("lastname");
    String 
    out.println(RB.getString("requestparams.params-in-req") + "<br>");
    if (firstName != null || lastName != null) {
        out.println(RB.getString("requestparams.firstname"));
        out.println(" = " + HTMLFilter.filter(firstName) + "<br>");
        out.println(RB.getString("requestparams.lastname"));
        out.println(" = " + HTMLFilter.filter(lastName));
    } else {
        out.println(RB.getString("requestparams.no-params"));
    }

The above codes will print the submitted form as filled by the frontend user..below is a servlet classic form example.. modify it to make it look like the PHP form..

    out.println("<P>");
    out.print("<form action=\"");
    out.print("RequestParamExample\" ");
    out.println("method=POST>");
    out.println(RB.getString("requestparams.firstname"));
    out.println("<input type=text size=20 name=firstname>");
    out.println("<br>");
    out.println(RB.getString("requestparams.lastname"));
    out.println("<input type=text size=20 name=lastname>");
    out.println("<br>");
    out.println("<input type=submit>");
    out.println("</form>");

Notice, there isn't much difference between the PHP and JAVA, except

    (RB.getString("requestparams.InputAttribute"));

You need to add your checkboxes, using the format above, and then on the processing part..

     if (firstName != null || lastName != null)

You must add all items you don't want to be null, for example,

     if (firstName != null || lastName != null || checkbox1 != null) 

I ONLY USE this as an eXample

     || checkbox1 != null

But for your servlet it has to check on name, and then …

veedeoo 474 Junior Poster Featured Poster

Hi,

Here is a simple form validation I modified way back in 2007. Although i completely outgrown this script and I have written many fancy validation scripts ever since, I still honestly believe this can serve a really good sample script for you. I did a minor upgrade tonight so that it can function in PHP version 5.4 and above environment.

I adopted the implementation of filter_input_array php function, I found from unknown author. It was long time ago, I don't even remember the name of the blog. Actually, this my very first form validation written in procedural..

Please take notes how I avoided embedding my entire validation script within html tags. Although there are PHP embedded in the html form tags, those are the output from the function.

You can add more filters and other things as you desire. My aplology this function was written by a kid in 2007, but it worked flawlessly..

filename: checkForm.php

<?php
 ## original script credits unknown author
 ## updated by veedeoo 7/28/2013
 ## redefined filter functions
 ## upgraded the script to PHP 5.4 and > compliant

// things I modified in 2007
## created check_form function



function check_form(){

## we only want to process if request method is POST and ONLY if the submit button has been clicked or submitted!!!!
if (($_SERVER["REQUEST_METHOD"] == "POST") && (isset($_POST['submit']))){

## define filters: upgraded 7/28/2013
$php_filters = array(
    'fname' =>  FILTER_SANITIZE_STRING,
    'mname' =>  FILTER_SANITIZE_STRING,
    'lname' =>  FILTER_SANITIZE_STRING,
    'email' =>  FILTER_VALIDATE_EMAIL,
    'zip_code' =>  FILTER_SANITIZE_NUMBER_INT,
    'street' =>  FILTER_SANITIZE_STRING,
    'tel_no' …
veedeoo 474 Junior Poster Featured Poster

you need to know the fiverr form processor location to be able to do this outside the API protocol. Look for something like this on their website

<form method="post" action="thisLocation/file.php">

You will also need to know the exact form attibutes e.g.

<input type="text" name="thisAttr" />
<input type="password" name="thisOneAlso"/>

Look for any hidden input as in

<input type="hidden" name="thisOne" value="youNeedThisAlso"/>
<input type="hidden" name="loginTransaction" value="youNeedThis"/>

Look for transaction ID and session key most of the time it is delivered by javascript OR in hidden form input.

Without those info. we cannot use cURL. cURL function as if you are physically logging in, and it does the job for you by providing the input necessary for the form to be processed.

veedeoo 474 Junior Poster Featured Poster

I am not going to be harsh on you, but have you ever reconsider how strenuous it is to becoming a developer, programmer, or a coder? What you are asking is not even extra hard if you at least try.

It is just asking yourself, what would Juan do if he wants to follow Maria? You write this on the paper and start brain-storming the processes Juan must take to be able to follow Maria. Now, you highlight the process or processes if we are to programme the action of Juan and the probable response of Maria.

Will Maria accept?
Does Maria wants to be notified, if someone desires to follow her?
Will Maria allows her follower to see all of her activities? or can she pick which one among her followers can have the special persmission to do so.?
Can Maria send and receive messages from her followers and vice-versa?

Does Juan wants a confirmation on his request to follow Maria?
Will Juan automatically allow Maria to follow him?

How about if one Don't or lost his or her desire to follow or to be followed?
Does your application include removing followers, and un-follow functions?

Will the application will have an option to restore the following rights of previous followers?
Will the application will just allow everyone following each other without pre-authorization?

You can then break-down the most feasible process, and then again highlight the most important information that can be preserve, change, …

veedeoo 474 Junior Poster Featured Poster

Since, there is no built-in decrypter on gmail except, their own localized encryptor (python), you will have to download the message and run it on your own localhost with PHP server?

There are many portable apache-mysql-php servers you can download today. Not to mention xampp and many others google search results can provide. You just have to search which one supports POP3.. I am pretty sure most of the compiled WAMPs and LAMPs are capable of working with POP3.Xampp comes with mercury mail which is a POP3 capable, your reciever just have to enable it in the control panel..

You provide him the script to retrieve the message from gmail using PHP, and the just parse the message locally and then eventually decrypting it,.

Search google on how to retrieve POP3 email from gmail using PHP.

HINT for your search : 1. MIME parser class 2. POP3 email client class php

You must pre-packaged the mime parser and the pop3 client, and the script instantiating the class using the receiver's username and password as parameters. The parsed data will then have to be process by your decrypter function using the key.

IMPORTANT! The first time your receiver run your application, he has to login to his gmail account and confirm the remote accesss authorization for his IP address, otherwise your application will be blocked from accessing gmail pop3 for ever and ever, or until someone notices your countless email requests for account reset.

veedeoo 474 Junior Poster Featured Poster

try this ..give the key to your reciever and provide him with the function to decrypt..

veedeoo 474 Junior Poster Featured Poster

Hi,

I don't know if my suggestion will even make sense logic wise, but I think it is more clever if you hold on to the MAC and wait for the PDO::lastInsertId(). Once you get that lastInsertId(), you can set this as a boolean response, and then confirm to insert the MAC as an update.

I am assuming here, that you are currently using PDO, else , use mysql_insert_id() .

veedeoo 474 Junior Poster Featured Poster

Hi,

For my own personal experimentation potential, what is the purpose or benefit of having the data inserted to db as json encoded Vs. the Conventionals?

veedeoo 474 Junior Poster Featured Poster

Please update the class with visibilities as public, just add public in the front.. like this.

public function __construct
public function findMyfunction
veedeoo 474 Junior Poster Featured Poster

Hi,

I wrote a simple class in doing this job. The only limitations is that you will have to put all of your function files in certain directory.

I wrote this more than some 3 years ago, but I never have the chance to updgrade it. This class was inspired by unknown author that I came across long time ago. The original function was not capable of finding the exact file name of which the function is defined (it has to be included), I added a recursion in it. Today, I just notice that it was not a best choice for me to do a recusrsion.

Here is the class, use it if you think it will be of any help, ELSE; just ignore it.. WARNING! Not the best class I wrote.. I was only 16 when I originally thought about this, but I was not able to make it work until 2 years ago. I did not change anything on it ever since. This class was also published here in Daniweb at one time..

the dreaded class :), here we go .. you are welcome to modify the class, and if you do please shar it..

<?php

## no revision since 2009, except for commenting the echo in the method in 2013.

#### You can save this class somewhere else and just include it to your script..

class Find_function {

private $_somedirectory;
private $_somefunction;

function __construct($inDirectory,$myFunction){

$this->_somedirectory = $inDirectory;
$this->_somefunction =  $myFunction;
}
function findMyfunction(){

$theSearchRes = '';
ob_start(); …
veedeoo 474 Junior Poster Featured Poster

Hi,

try ....>>

Open your php.ini file and tell us what are the value assigned to mail directives

[mail function]

we need to see the entire block..
go to code.google.com and search for phpmailer

Back to your server locate which mailer is installed e.g. mercury, etc

In the same level as your php directory find sendmail directory.. in linux this is normally located in the etc directory, but different php application preferences can change the exact location sometimes it is inside the bin directory. YOu just need to know the locations of things in your own server.

in send mail directory find sendmail.ini
load sendmail.ini to gedit or notepad++ find [sendmail] directives

Within the [sendmail] block define

smtp_server=localhost
smtp_port=25
;auth_username=
;auth_password=

change it to something like this..example below uses the smtp.gmail..you can user yahoo, or msn.. the choice is yours..

smtp_server=smtp.gmail.com
smtp_port=587
auth_username= YourAccountUserName@gmail.com
auth_password= YourGmailAccountPassword

Go back to your PHP.ini file and set the mail function directives to this.. it should be the as what we have on the sendmail block.

SMTP = smtp.gmail.com
smtp_port = 587
sendmail_from = YourAccountUserName@gmail.com   

Restart your server..

Run your php mailer script..

If you will using the gmail smtp port, make sure you logon to your google email account and click on the red bar confirmation on top of the page, and authorize your server IP to use the smtp OTHERWISE! …

veedeoo 474 Junior Poster Featured Poster

ok, now I know what you are talking about..

open xampp/php/php.ini file
look for

[browscap]
 ; http://php.net/browscap
 ;browscap = ""

change it to

[browscap]
; http://php.net/browscap
browscap = "C:\xampp\php\extras\browscap.ini"

The above is an assumed location of your xampp.
Place the browscap.ini inside the xampp/php/extras/ directory

Restart you xampp
clear you browsers history
run your php script to test browscap

veedeoo 474 Junior Poster Featured Poster

Dude,

I thought browserscap is just for IIS? I am not sure, but can you double check and make sure you've got the right version for your server..

veedeoo 474 Junior Poster Featured Poster

it looks like you are a victim of your own server's counter measure called cpHulk brute force lock-out . If you can't access your server with your browser, ftp client, or any other means coming from your IP address, you must contact your host to make an exemption for your IP. Sometimes, execessive FTP failed connection attempt using php or ftp client can lock you out of your own account.

Number one cause of this is too many authentication failures..

I don't remember how to do this anymore, but you need to use other IP and access your server as root.

You will have to search or just contact your hosting provider.. I am not sure about the codes below, but you can try using different IP maybe your neighbor's.. connect using the PUTTY login as root.

Command below applies ONLY to people with shell access.. If you don't have it, let your host do the clearing for you.

type

mysql cphulkd

I am not sure with the following command try all of them

delete from bruteforce;

or

delete from brute;

or

delete from brutes;

one of those command should work, and followed by this command

delete from login;

or

delete from logins;

hit enter...

Go back to the computer where you locked-out and try connecting again.

Logon to your cpanel and look for the server logs.. locate all of your failed authentication attempts..

veedeoo 474 Junior Poster Featured Poster

Please allow me to add my opinion about developing an extensible codes in OOP. It is always nice to start on the right track than going back for some bits and pieces that were left behind.

There are 10 design patterns in PHP. I was 13 when I first hit my keyboard to type <?php ?>, and as far as I can remember there were only 3 to 5 design patterns commonly used in PHP. Today, PHP has become a powerful Object oriented programming language and the design patterns acceptable to PHP development are now 10. It might be more, but I will only give the 10 to help you out which one will be your gig.

Just be very careful though, because design pattern does not apply to all situations. Important quote I picked up along the way "When you are holding a hammer, everything looks like a nail."

The reason I brough up this subject is to help people know that for every application there is a proper tools or coding techniques that should be implemented. I know very well that typing echo "this" returns the string "this", but that is only a speck of dust hovering by the PHP's front door. The core of PHP is evolving at an extremely high speed. If you ever tried writing codes in python or ruby there isn't a lot of upgrade activity there, while in PHP the update is happening every day if not hours.

After learning the construct, one …

Szabi Zsoldos commented: excellent info! +4
veedeoo 474 Junior Poster Featured Poster

Hi,

You need to ask company x what are the form attributes that are needing response. Plus, I honestly believe thay you should iterate through the xml file items and then apply base64_encode on them..

I am really surprised by no support from company X, it is their API and not yours.. Giving you the C# codes does not equate to implementation in PHP. Not all PHP programmers codes in C#..

In C#, this code right here is un-instantiated array

byte[];

then they iterated the items in xml file, cast items to string, convert them to utf8, and lastly encode to base64.

How are we going to implement the same logic in PHP programming? The answer is pretty simple. Take my sample codes below for example. I don't like the pre-mature foreach loop within the function. However, that leaves me choice. We cannot apply casting, encryption, to any existing array, without serializing them. I am not to implement serialization in my example, because Company X never told you that.

So, here we go. Suppose, we have an xml file... NOTE: I will be using xml_load string here instead of xml load file to make the example a lot clearer..In this example, only the values are encoded..

XML is just an example, use your own, fruits is a lot easier to digest than using a different example..

 <?php

    $xml = '<?xml version="1.0" encoding="UTF-8"?>

    <fruits>
    <item>
    <title>Orange</title>
    <color>it is orange</color>
    <taste>Sweet, sour, and tangy</taste>
    <price>1.00</price>
    </item>
    <item>
    <title>Pear</title>
    <color>Yellow Green</color> …
veedeoo 474 Junior Poster Featured Poster

hi,

for testing purposes only, can you modify this code,

     $result=mysql_query("UPDATE tblretailer SET ret_name='".$ret_name."', ret_street='".$ret_street."', ret_city='".$ret_city."', ret_phone='".$ert_phone."', ret_fax='".$ret_fax."', ret_user_fname='".$ret_user_fname."', ret_user_lname='".$ret_user_lname."', ret_email='".$ret_email."' WHERE ret_id='".$ret_id."';");
//redirectig to the display page. In our case, it is index.php
header("Location: del_updret.php");

to

 $this_query = "UPDATE tblretailer SET ret_name='".$ret_name."', ret_street='".$ret_street."', ret_city='".$ret_city."', ret_phone='".$ert_phone."', ret_fax='".$ret_fax."', ret_user_fname='".$ret_user_fname."', ret_user_lname='".$ret_user_lname."', ret_email='".$ret_email."' WHERE ret_id='".$ret_id."'";

 $result=mysql_query($this_query);
//redirectig to the display page. In our case, it is index.php
//header("Location: del_updret.php");

if (!$result) {

  $err  = 'OOPS ONe:' . mysql_error() . '<br/>';
  $err .= 'OOPS Two! This query cannot be inserted: <br/>' . $this_query . '<br/>';
  echo '<br/><br/>';
  die($err);
}

if the modified version works, the error is in your query.. this part of your code

WHERE ret_id='".$ret_id."';");

It is desirable to get the query confirmation first, before redirection.. so your codes should have either this

if (!$result) {

  $err  = 'OOPS ONe:' . mysql_error() . '<br/>';
  $err .= 'OOPS Two! This query cannot be inserted: <br/>' . $this_query . '<br/>';
  echo '<br/><br/>';
  die($err);
}

else{
     header("Location: del_updret.php");
}

or positive with postiive confirmation

if($result){

        header("Location: del_updret.php");

        }

        else{
        die('Something Went Wrong');

        }

It is alll up to you there are tens of ways of doing this..

veedeoo 474 Junior Poster Featured Poster

sorry, I have to remove my answer.. someone already posted a response on the duplicate version of this question..

veedeoo 474 Junior Poster Featured Poster

Yes, it can. I wish I was able to looked into the windows apps, but I never did until now..

for exmaple,

echo '<!DOCTYPE HTML>
      <html>
      <head>
      <title>
      </title>
      <body>
      </body>
      </html>';

Once you figure out how to get the azure web server to work with PHP, your php file for the apps can be something like this..BUT it should access the SQL database by way of PDO wrapper..

By the way, if you provide the azure.js a jquery file, codes below might work.. except, for the database.. jquery is enough to simulate the response onclick for the new apps..

<?php

    $page_data = array(

                 'title'=>'Windows Azure',
                 'description'=> 'Mobile Services',
                 'footer' => 'yoursiteDotCom 2013'
                 );

   $menu_data = array(
                'home' => 'Home',
                'about' => 'About',
                'contact' =>'someone@someDomainDotCom'
                );              

                 ?>
<!DOCTYPE html>
<html>
    <head>
        <title>Sample: get started with data</title>

    <!--[if lt IE 9]><script src="http://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.6.1/html5shiv.js"></script><![endif]-->
   <style rel="stylesheet" type="text/css">
           /* Reset and define common styles */
        * { box-sizing: border-box; -moz-box-sizing: border-box; margin: 0; padding: 0; }
        body { font-family: Arial, Helvetica; background-color: #e0e0e0; }
        button { border: 1px solid #999; color: #555; background-color: #F4F4FA; padding: 0 10px; }
        button:hover { background-color: white; }
        input[type=text], input:not([type]) { padding: 0 10px; text-overflow: ellipsis; }

    /* Main page structure and masthead style */
    #wrapper { max-width: 800px; margin: auto; padding: 20px; }
    article { background-color: white; box-shadow: 0 0 12px rgba(0, 0, 0, 0.75); border-radius: 10px; }
    header { background-color: #71BCFA; padding: 20px; border-top-left-radius: 10px; border-top-right-radius: 10px; }
    header h1 { text-transform: uppercase; font-weight: …
veedeoo 474 Junior Poster Featured Poster

I just noticed the input values on your form are incorrect.. you need to change the values to quantity of the lightbulbs.

for example

 <td> Four 25-Watt Light Bulbs</td>
    <td> $2.39 </td>
    <td><label>
    <div align="center">
    <input type="checkbox" name="checkbox1" value="2.39"/> <br />
    </div>
    </label></td>

SHOULD be changed to

    <td> Four 25-Watt Light Bulbs</td>
    <td> $2.39 </td>
    <td><label>
    <div align="center">
    <input type="checkbox" name="checkbox1" value="4"/> <br />
    </div>
    </label></td>

Do the remainder on your html page. Do not change the pHP side.

Your script should output something like this, if all boxes are checked.

You ordered 24 light bulbs items
Your total bill with the 6.2% sales tax is:$ Amount here
Your chosen method of payment: card here 

Double check all of your Output a formatted string (printf)... I suspect the calculation could give wrong amount..

veedeoo 474 Junior Poster Featured Poster

Hi,

It is my lazy night, tonight so I am not going to explain my answer any further than what the corrected codes can do. By the way, You will need to reasearch PHP reference.. I wrote a function in the form processor that uses the reference function.

In your form, you need to put name for the submit, and you don't need to add $ sign on the price, otherwise it will be parse as variable.

Another thing, is your usage of printf, you cannot printf <br>, It has to be an isolated event, because it is a function looking for arguments...like..

 print "this string"; printf(arg1,arg2);print"<br/>';

Here is your html file...

        <!DOCTYPE html>
<!-- testproblem.html
-->
<html lang = "en">
<head>
<title> Light Bulb Exercise </title>
<style type = "text/css">
td, th, table {border: thin solid black;}
</style>
</head>
<body>
<form action = "testproblem.php" method = "post">
<h2> Light Bulb Convenient Store </h2>
<table>
<!-- Text widgets for the customer name and address -->
<tr>
<td> Name: </td>
<td> <input type = "text" name = "name"
size = "30" />
</td>
</tr>
</table>
<p />
<table>
<!-- First, the column headings -->
<tr>
<th> Product </th>
<th> Price </th>
<th> Select One </th>
</tr>
<!-- Now, the table data entries -->
<tr>
<td> Four 25-Watt Light Bulbs</td>
<td> $2.39 </td>
<td><label>
<div align="center">
<input type="checkbox" name="checkbox1" value="2.39"/> <br />
</div>
</label></td>
</tr>
<tr>
<td>Eight 25-Watt Light Bulbs</td>
<td> $4,29 </td>
<td><label>
<div align="center">
<input type="checkbox" name="checkbox2" …
veedeoo 474 Junior Poster Featured Poster

What is the script that does instant payment notification? It should return pretty much all the information from paypal. You can then use those info. for your database e.g. payment recieved, customer's name, and email address.

You just have to deduct the confirmed payments off the outstanding balance, and then set the elapse time from the date of payment...e.g. 30 days from today, then the paypal IPN script will once again request for the payment authorization for the remaining amount in full or partial..

Just to give you the idea, here is a classic reponses from paypal on confirmed payment. Please look at the Example Report in the bottom part of the page..

veedeoo 474 Junior Poster Featured Poster

Hi,

The mysqli instance is this

$con = mysqli_connect('localhost','root','password','table');

Then your mysql_real_escape_string should also be a mysqli method like so;

$sql="SELECT * FROM contacts WHERE id = '" . mysqli_real_escape_string($q) ."'";

ADDED LATER:

I just noticed on your index.php you are using the regular mysql connector, try using mysqli on it also. These must be change to mysqli construct..

    $con = mysql_connect("localhost", "root", "password") or die(mysql_error());
    mysql_select_db("table");
    $sql = "SELECT * FROM contacts";
    $data = mysql_query($sql,$con);
    while($category = mysql_fetch_array($data)){
    $catname = $category['firstname'];
    $valueid = $category['id'];
    echo '<option value="'.$valueid.'">'.$catname.'</option>';

If you need quick start guides in implementing mysqli, please read here ...

That should be the case in the w3scool's tutorial.

veedeoo 474 Junior Poster Featured Poster

Hi,

Sorry, I thought it would be something to be considered. I can honestly say that I never coded an application targeting the windows mobile users.. I did a few for android and apple, but have never considered writing for the windows powered mobile.

After looking at the source codes from the tutorial, it is clear that azure can run on linux, apple, and IIS servers. However, for the linux it has to have a python installed in it, as shown by the bash codes below

#!/bin/bash

# Check that Python is available
command -v python >/dev/null 2>&1 || {
    echo >&2 "Cannot find python. Either:
      - Install python
      - Or, serve the quickstart files from an alternative web server such as Apache."
    exit 1
}

# Go to the directory containing the www files (one level above where this script is)
# and then start the simple web server
pushd `dirname $0` > /dev/null
cd ..
python -m SimpleHTTPServer 8000

# Finally, return to the original directory
popd > /dev/null

I am not going to create a tutorial on python, but I just want to point out a promising argument from the bash above..

see this?

 Or, serve the quickstart files from an alternative web server such as Apache."

Analogy wise, that is pretty promising.. meaning that if you upload your apps to any linux server and if does not have any python in it, then it can utilize an alternative web server and in this …

veedeoo 474 Junior Poster Featured Poster

Hi,

check this out..

veedeoo 474 Junior Poster Featured Poster

sorry, I forgot to comment on your original question..

change this on line 62

<script>alert('Access Denied!');</script><?
goToURL("index.php");

to this

<script>alert('Access Denied!');</script>

<?php
goToURL("index.php");

Make sure to make corrections on all occurences of <?. For now, stay away from using the short tags. You can use later on..

veedeoo 474 Junior Poster Featured Poster

@1a2p3a4c5h6e,

!Warning! Codes are not tested... but should work with pretty minor tweaks, just fix my excess parenthesis or missing quotes...

Just another humble thoughts of refactoring your codes is to use a framework style routing. To be able to do this, you will have to ** rename your php pages after the action** (the same as the action name, literally).

Can pretty much eliminate the elseif --if not all, as shown by simple routing function below.. You can also use FILE to make it like a wordpress style.. the choice is yours.. You are always welcome to add switch within the function to accomodate other file names as needed..

function get_Action($action,$directory){

$include_this_file = basename($_SERVER['SCRIPT_NAME'], '.php');

if(($include_this_file !=="") || (file_exists($directory .'/'. $include_this_file))){

    return $directory.'/'.$include_this_file;
}       
else{
     return $directory.'/show_laporanbelajar_guru.php';
     }
}

We can easily use it like this

include_once(get_Action(getParam('act'),'viewer'));

We can further refactor the above function by using a single line return.. similar to the common practices in Ruby or Python..thus, eliminating the else completely..

return((($include_this_file !=="") || (file_exists($directory .'/'. $include_this_file)))? $directory.'/'.$include_this_file : $directory.'/show_laporanbelajar_guru.php');
veedeoo 474 Junior Poster Featured Poster

You can also try this.. Please let me know if there is an error.. I barely updated the script from 2 years ago..The original author never released an update ever since.

Here is an example on how to use it..(lifted from the original author's distros)

$xls = new Excel('Report');
foreach ($rows as $num => $row) {
  $xls->home();
  $xls->label($row['id']);
  $xls->right();
  $xls->label($row['title']);
  $xls->down();
}
ob_start();
$data = ob_get_clean();
file_put_contents(__DIR__ .'/report.xls', $data);

The $rows is the array, it could be from database or just plain text..

veedeoo 474 Junior Poster Featured Poster

Hi,

try running this script

<?php

echo (function_exists('mail')?'You have mail function enabled in this server': 'No it is not enabled, please contact your hosting provider ASAP');

or

<?php

  phpinfo();

If using the second option above, look for the send_mail directives...e.g. sendmail_from, sendmail_path. If it is not listed on the directives, then you will have to contact your host to find out how to enable it. NOrmally, this is enabled by default.

veedeoo 474 Junior Poster Featured Poster

Hi Atli,

I could honestly guess the responsible for comparison is the function slow_equals.

We can test its derivative hash function by doing a simple loop..

 for($x = 0; $x <= 20; $x++){

    echo $x.'. '.create_hash('password').'<br/>';

  }

the above codes provided hashes as shown below.. ( these are the possible derivatives for the the term 'passwords', when x is less than or equal to 20).

0. sha256:1000:egGeuoIEBpbH6tDFhnkFYx2smgOFYkxU:RxaIy45ly9fybHO2X6TbXGDzQQctNE/I
1. sha256:1000:MlqY39AXlcFPwhQQDOKv3dzyvsOskYuw:58KlEHhK/UEJiexe0/P/IZ92TenCG3d3
2. sha256:1000:qw7Kv3q+72sPKEl2usiMq3tLTXNH2XKx:5Xpw7xGaFVmZtCfpEFSgU6ZptTKJMQGa
3. sha256:1000:UgwkgqLkV+InVwP32XkMuhvHPlKlEcoC:VztVwrs5cJUUtEu9UcSTOW8bqjbxlazH
4. sha256:1000:noLwBZj+thmsgEWoCv1pP+DEVq3TOmyO:05qToWmwNrvdVMnD7v7CpuOznabkHBB0
5. sha256:1000:k+XKOwKwP95OCY9k9oFn6R4WIjAvS7Gg:AhAQdodA/d7CLQut1MNanMPhv9roKziX
6. sha256:1000:iKFYD2GuZavyXtPj1/Ke/fseDVD0UA4z:P9E8R7BgW8viot1WlobpdJ+UQ5Ejv7Ew
7. sha256:1000:WeuHltpve02t5bg1hNwxkiLJV7nWNGSK:/edJ0FrcbtjumDpi+4LrA3jbWX5fi9En
8. sha256:1000:rO/68tjYKN6culo7ZEnBkU/aItjIiRQ/:pRkiLv/iEVIARww5veu1JReHMxv+JGea
9. sha256:1000:I3GFNanvi5I6v4niYz3wTwvfAXcyXMfW:ZABb/t3DtrbNDNrbntXFJMfJWXLNuTmr
10. sha256:1000:w6Sgz/I5x3KDsaoB4VJpiu0UjL8M4JO/:UQ/tJMS8M6iwLzt1TkMy8xu5G/QTgZGV
11. sha256:1000:DbVrSMEfxTGUBSr88YA2fWK88YzQK3G9:ofadE4SD8XJ5T6h2Q0Y9TGBfhfgFKUDx
12. sha256:1000:4uWplmwCS877XN/GlxyX/6XPgkv34aXX:MBVAMXwM3ZMDcyufKKf2bx+IXh7J/hH0
13. sha256:1000:BO5JiAjHDpOyV1+tMUPn5RpUp+kcjQeP:WXmIglL8BqQU+OSe7kYw9UymFGiT9nGm
14. sha256:1000:R9NZYlhH1wEN8W/jINnPGt/x1dGJxb1a:/SHvWfRxKZnTxS17INkllew5/7OGKsXH
15. sha256:1000:p0BlIKU/T+gI5zf7olE14+a76ZfD9bV+:RA7nAzFcrIRexd2AB137LblJXTIzFsve
16. sha256:1000:lp/vQhgmAQSiUs52363uJPGpSkq19c+/:1Ao5ZeXKb0cMdpgE7iwV37RuppcWxJAG
17. sha256:1000:+rLC0YTXcB/UZ6kKmObvHcpOLMMXD+MO:HzpYb1pcnmDWdkruRazSIi9E5UCjyzOf
18. sha256:1000:LyXIOL3aqbuSqAbx59AD7jjjmuqJLyYT:yrTQ7Y85OD4O9Mkq4p1kr/K5fIn4zu/i
19. sha256:1000:71R3rhRhr/QIrATOS8M8nkGffkqbByaL:F0F3YxLlfkGCf7FuTw7uli/mvQnY/XJe
20. sha256:1000:Y98l+4uToOp6hwdMAWCWEHpcvHAAc9U2:v/80HmIIC6WRGm7OOxR+WL/HEOgEE2TP

Let say one and only one from the 'password' hashed derivatives above was stored in the database, and lets also assume that the user type the 'password' correctly..

We can check the match by writing a simple interface class., but should be more elaborate with strict form input validation as much as possible.

We create our simple interface class using line 17 derivative above as our stored hash..

<?php

## Warning! script below is for demonstration purposes ONLY, and should not be use to validate the actual password
## input from the user. All form inputs MUST undergo strict validation and sanitization.

## password_hash.php is the file downloaded from  https://defuse.ca/php-pbkdf2.htm
include_once('password_hash.php');


class validate_pass{

public function __construct(){}

## set public for testing
public function check_pass($db_pass,$hashed_pass){
 ## utilize the hasher function
    if(validate_password($db_pass,$hashed_pass))
            return true;
}
## can use this to …
veedeoo 474 Junior Poster Featured Poster

you can also try implementing this. I have this script on my bench tester and I have been trying to hack into it for 3 weeks now, but without success. I think I made an overstatement here. It can be hack, there is no iron clad script.. eveyrthing can be hacked, but the hacker will need a super dooper fast computer to deliver the library within a fraction of a second.

The script will generate a derivative hash of a password only the script can validate if it is matched or not. Every time a password needs to be validated, the script generates a different derivative hash of the password, so for example "xaksdlljfll4seiolldld" is the stored hash for "password".. when the user type the password in the password form input, the script will hash it differently and not exactly the same as the stored password in the database.. the comparator can be something different like "awollisjd3cloepppwfeqwep". This approach provide a secure account information for the members, because even the site owner and database administrator will not be able to decypher it. This reminds me of a well known corporation who are willing to give me a two years of unlimited starbucks coffee supplies just to give them the unhashed password of their employees, but I would never never do that, even for 10 million dollars...moral values should kept us well grounded (for me ), regardless of how truly good we think we are.

veedeoo 474 Junior Poster Featured Poster

WHM == Web Host Manager. Depending on your server configuration, WHM can be access through your browser by typing https://xx.x.xxx.xxx:2087 xx.x.xxx.xxx is your main IP address.

I am not sure if your WHM location follows the same address. Make sure to confirm this address with your hosting provider.

veedeoo 474 Junior Poster Featured Poster

Hi,

First and foremost, everything that I will write below this paragraph, are not a reflection of any assumption that you don't know anything. I must say this first, because there are members here who would interpret my response as such.

I am sure you did this already: Register your DNS to your domain registrar... for example if you have ns1.yourDomainDotCom and ns2.YourDomainDotCom, you will need to log on to your domain registrar's account e.g. godaddy.com and add those two as your domain host name. Make sure each are pointing to your IP.. If you only have one IP then both must be pointed to this IP>

Instruct your users or members to change the nameservers of their domain name. They don't need your IP address just need the ns1.yourDomainDotCom and ns2.YourDomainDotCom. Tell them to logon to their own domain registrar and update the nameservers of their domain.

Let them wait 2 to 72 hours to completely propagate..

Some VPS hosting company will provide many IP addresses for one account. If this is your case, create at least 3 sets or depending on how many IP addresses do you have. Always reserve one IP for your main site and the rest can be use as DNS.. You must do this in WHM panel of your VPS main account.

After setting up the DNS for your clients you will need to create a package account in your WHM panel. Depending on how much space you are going to give your users.. …

veedeoo 474 Junior Poster Featured Poster

Hi,

Are you asking about CNET as in cnet.com? If yes, you will need to read their developers API documentation.

API is the only way you can provide an acurate search results..

Here is a good example on sending an item request

http://developer.api.cnet.com/rest/v1.0/techProduct?productId=31518214&iod=none&viewType=json&partTag=[yourDeveloperKey] 
veedeoo 474 Junior Poster Featured Poster

Hi,

May I know what is your operating system derivatives? Is it windows 8? If possible run it as administrator.

Run the WAMP, never mind if it does not start. press alt+ctrl+del ==>click on the task manager.. look for the Apache, mysql, phpMyAdmin ( there should be some application running similar to this).. If you don't see it.. close the task manager.

On your desktop, right click on the wamp shortcut icon, select properties=>click on compatibility tab=>scroll down and then tick => run as administrator.

If you are running windows 8 , flick on the right hand side corner of the screen, touch search icon, type wamp. On the search result shown on the left, single tap wamp, in the bottom of the screen double tap on the "run as administrator".. Your case might be different if you don't have a touch screen. Replace the flicking and tapping with clickings instead.

veedeoo 474 Junior Poster Featured Poster

Aside from the extension entry, this is how the mysqli section on php.ini file should look or similar to this. Again this is all dependent to what..value of your Server API ? Apache module or fast CGI? should be shown on your phpinfo();

[MySQLi]

; Maximum number of persistent links.  -1 means no limit.
; http://php.net/mysqli.max-persistent
mysqli.max_persistent = -1

; Allow accessing, from PHP's perspective, local files with LOAD DATA statements
; http://php.net/mysqli.allow_local_infile
mysqli.allow_local_infile = On

; Allow or prevent persistent links.
; http://php.net/mysqli.allow-persistent
mysqli.allow_persistent = On

; Maximum number of links.  -1 means no limit.
; http://php.net/mysqli.max-links
mysqli.max_links = -1

; If mysqlnd is used: Number of cache slots for the internal result set cache
; http://php.net/mysqli.cache_size
mysqli.cache_size = 2000

; Default port number for mysqli_connect().  If unset, mysqli_connect() will use
; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the
; compile-time value defined MYSQL_PORT (in that order).  Win32 will only look
; at MYSQL_PORT.
; http://php.net/mysqli.default-port
mysqli.default_port = 3306

; Default socket name for local MySQL connects.  If empty, uses the built-in
; MySQL defaults.
; http://php.net/mysqli.default-socket
mysqli.default_socket = "MySQL"

; Default host for mysql_connect() (doesn't apply in safe mode).
; http://php.net/mysqli.default-host
mysqli.default_host =

; Default user for mysql_connect() (doesn't apply in safe mode).
; http://php.net/mysqli.default-user
mysqli.default_user =

; Default password for mysqli_connect() (doesn't apply in safe mode).
; Note that this is generally a *bad* idea to …
veedeoo 474 Junior Poster Featured Poster

Dude,

You are welcome...:)

I am not assuming that you don't know. I know that you already knew, but how are you going to confirm which loaded configuration file your server uses? The easiest way to find out that you are indeed editing the right php.ini file for your server is to view what is on the phpinfo()..

There are two types of php.ini file in most servers configured with fast CGI, if apache module you might end up with the third one located in the apache2 directory.

  1. cofiguration file =====> /usr/lib ( common in shared hosting or vps with multiple accounst created through the WHM)

  2. Loaded configuration file ==> this is the one being utilize by the server, and this is where the editing should be done. We will not know where it is exactly, without running the phpinfo().

I am aware about your query... but in order for me to help, we need to find out and make sure you are editing the right php.ini file. Again, I am not assuming here that you don't know. My only concern is that , is it the right php.ini file? Your ability to edit php.ini file here is not in question..it is the right configuration file.

As what you already stated, even after uncommenting this extension=mysqli.so mysqli is a no show.

What is left there to investigate is the possiblity of ==> server has not been restarted since the last edit of the php.ini file (hence, I always assume …

veedeoo 474 Junior Poster Featured Poster

That would be different application called wikipedia API.. I wrote one before, but I am currently busy and in the middle on developing a python application, so I don't have any time to look for it in my php files.

It can be done , but wikipedia is etremely strict in content reusing policy... Sorry, but I cannot do that.

To be able to conform with the TOS, you will have to download the image and store it in your server..

veedeoo 474 Junior Poster Featured Poster

Hi,

The best way to find out the exact location of the actual php.ini file use by your server as the server configuration file is to run php info.

<?php 

  phpinfo();

?>

Upload the file to your server and then open it with your favorite browser, and look for the value of the following..

Loaded Configuration File 

The value given by your php info(), will be the PHP currently running on your server.. for example if your find

usr/lib/php5/php.ini as the value then your ext directory to add your mysqli.so extension should be in the usr/lib/php5/ext directory.

I am pretty sure, you have something else..

veedeoo 474 Junior Poster Featured Poster

That's a good decision... writing the script is not a problem at all. I even wrote the script that will take out the ACC audio with the highest bitrate possible for MP3 conversion, but I can't get around with the TOS.

Although downloading the video first, will not make google block your domain in the first few months of operation, but as your site becomes more popular, the request will become noticeable to them to investigate the cause of excessive requests from your site.

There are few sites out there that are offering MP3 download, but most of them are hosted overseas and they can pretty much disappear at any time if any trouble with youtube arises. Unlike us, who are within the reach of the Big G, our options to play around -- or rather --> experiment with this type of programminng exploration is pretty much limited.

Here are the links just for reading.. Regardless which sides we take, it is a good read.
1. Google blocks MP3 rippers from YouTube

  1. Google Legally Going After YouTube MP3 Rippers
veedeoo 474 Junior Poster Featured Poster

I wrote a simple class that can tap the youtube API for the audio extraction and then covert to MP3. It is using cURL.

Unfurtunately, I cannot share that script because it violates the section 11 of the Google's TOS. MP3 still remains a component of the youtube audio visual..

Besides, If I ever slipped and accidentally paste the codes here, they can easily come to my house and tickle me to death or until all of feathers are literally flocked out my little penguin body :).

To answer your other question from the other thread, video has to be downloaded before the ffmpeg-php can extract the audio and then transcode it to MP3 format.

Now, the legal stuffs.. Please believe me on this one... I have a family member working for the Big G in Mountain View, CA.., and they are pretty ( I mean VERY strict in implementing their TOS).

Youtube's TOS on a fine line..

This is legal ( example of my pervious API application)

This is legal ( example 2 )

This is a violation (example 3 ) Did you see the reason why it is illegal? Check the video player....not an actual youtube player.

One violation (video to mp3), and one legal below the page..

veedeoo 474 Junior Poster Featured Poster

for the first image of the movie you can do it like this..

foreach($html->find( 'div[class=box_img]') as $images){
   foreach($images->find('img') as $image){
    echo '<img src="'. $image->src.'"/><br/>';


   }

}

if you want all of the images below the main movie image, you can pretty much parse them this way..

 foreach($html->find('div[class=box_des]') as $thumbs){

    foreach($thumbs->find('img') as $thumb){
        echo '<img src="'.$thumb->src.'"/><br/>';


    }


}

One thing I cannot share is how to programatically take out their player. That is against the rule. However, if they do allow embed, then that is the only time you can parse the embed codes and not the player codes.

veedeoo 474 Junior Poster Featured Poster

hi,

I am not sure, what you are trying to make here, but here is an example. Assuming $data is an array..

<?php

    $data2 = array('c'=>'http://google.com');

?>

<input type="button" value="Click Me Please" onClick="alert('Next Time! You don\'t have to click me that hard. Click OK if you agree.'); window.location.href='<?php echo $data2['c']?>'">
veedeoo 474 Junior Poster Featured Poster

We can also store the output into array for external use.. something like this

$output = array();
while($row = mysql_fetch_array($result)){

    $output[]= $row;

}

Then we can loop through that array ..each item can be matched, sorted against anything that you feel appropriate.

foreach($output as $item){

echo $item['web_customised_partners_id'];

## do the rest as needed


}