TRENDING NEWS

POPULAR NEWS

In Following Php Code I Don

Why won't my PHP code work?

You don't say how you are opening the file.HTML files are a funny one when it comes to most operating systems. If you have a .txt file, and you double-click it it will open in the default text editor for text files.If you double-click a .html file it will most likely open in the browser. This gives the impression that the file has opened like a webpage. It hasn't. Don't let the default behaviour of HTML files confuse you when it comes to php.Webpages need to be “served" with a webserver. How are you opening this .php file? Unlike a .html file, just opening it in the web browser (e.g. by typing in the file location in the address bar) won't treat the php file in the way you intend. As mentioned in another answer, you should “serve" php with a webserver such as apache. The php must be processed by the server first, and then the finished result is send over the http connection to the browser.To check to see if you are using a webserver, does the address in the web browser start with http? If it doesn't, then you aren't using a webserver. (If you are, and there is still no result, then you need to ensure php is enabled on the server - detailed in another answer)

My php Snoopy code not working?

When you don't see anything and you expect to see something in a php script chances are that you don't have error displaying turned on. So at the top of your page inside your php tags () past the following:


ini_set('display_errors', 1);
error_reporting(E_ALL);



The first line (ini_set) turns on displaying of php errors in your script
The secone line (error_reporting) determines to what degree to show errors. Here the flag E_ALL means all kinds of errors.

EDIT: I see the problem.

Where it says:

$submit_url="https://www.facebook.com/…

it should be:

$submit_url="https://www.facebook.com/"...

i.e. you need to terminate that string with a double quote.

What PHP exploits are entailed with the following code?

That code doesn't mean anything, don't assume that EVERY get variable is a SQL injection vector.If the programmers were decent they are using a prepared statement and sanitizing the input so no injection here, move along..

Easy PHP Code to prevent SQL injection and XSS?

I followed this tutorial on how to prevent SQL injection; so in effect I have this very simple code on my site:

$name_bad = "' OR 1'";

$name_good = mysql_real_escape_string($name_bad);

$query_bad = "SELECT * FROM customers WHERE username = '$name_good'";


Is there a code that is as simple to use and is safe against SQL injection and XSS?

While running PHP code, it is displaying full source code. How do I fix this?

Another possibility is that you have PHP properly installed on the server, but the name of the file with the PHP code doesn’t end in .php - it has to (unless you’ve set the server up to run other file types as PHP files).Create the following PHP file (and don’t leave even a blank line at the top - it has to start with phpinfo();
?>
Save it on the server, wherever your default files are supposed to be saved.Then put the address of the server into your browser’s address bar, with /phpinfo.php on the end of the address. You should get pages full of info from the server. If you don’t, there’s probably no PHP processor installed on the server. (If it’s a hosted server, call tech support. If you installed the server yourself, get rid of it and run XAMPP to install both the server and a PHP processor.)

What is a way to secure my PHP code on my client’s machine?

As Mohammed said that PHP Encoder, protection, installer and performance tools from ionCube would be deployed to encrypt, obfuscate your PHP code on client’s machine, yet nothing can stop seeing your PHP code if your client is owner of that machine and have administrative rights.This is simply not possible to hide PHP (pure text) from the machine if someone has root/ administrative access.Also, obfuscation of server-side code is not recommended.

When does the php code get executed if it is located at the top of the php document?

PHP code gets executed on the server, if you are viewing the page in a browser, you are seeing the output of that code.

What is the concept behind bar-code generators in PhP?

Barcodes are generated in PHP code as per the specifications readily available (see e.g. Barcode Symbology Definitions - Barcoding Inc. ) and usually as bitmaps in black and white.PNG is the best bitmap format for barcodes, but it's also possible to use GIF for bit images and SVG, EPS and PDF for vector format. Vector format is desired for high-quality printing. Don't use JPEG for barcodes (lossy).Usually you can also control number of pixels per element, height etc, in cases also color.There are several PHP libraries for creating barcodes, so you don't have to write that code yourself. E.g. as part of Zend Framework: Barcode creation using Zend\Barcode\Barcode class Here's an example showing what can be controlled for QR codes in CliqTags (all done in PHP):

Can you help me understand this php code?

I'm trying to teach myself php and have been making my way through this php book. In this example the code searches for directories, turns that directory into an array, does a few checks to make sure the arrray is a directory, then prints some of the directory. Here's the code I'm confused about:



date_default_timezone_set('America/New...
$search_dir = '.';
$contents = scandir($search_dir);

print '

Directories

    ';

    foreach($content as $item) {
    if ( (is_dir($search_dir . '/' . $item)) AND (substr($item, 0, 1) != '.') ) {
    print '
  • $item
  • \n';
    }
    }

    print '
';
?>


What I don't understand is this bit: $search_dir . '/' . $item

Why is a forward slash and the $item variable concatenated together? What does the '/' mean/stand for?

TRENDING NEWS