Search found 9 matches

by MarPlo
Tue Mar 01, 2011 1:15 am
Forum: mySQL & php coding
Topic: PHP/PDO Select Command Problem
Replies: 0
Views: 579

Re: PHP/PDO Select Command Problem

Hy
Try the sql query like this

Code: Select all

$STH = $DBH->prepare("SELECT * FROM `userfield` WHERE `username` = '$username' AND `password` = '$md5'");
It is added simple quotes to php variable.
by MarPlo
Tue Mar 01, 2011 1:08 am
Forum: PHP General
Topic: Block SE Bot?
Replies: 0
Views: 534

Re: Block SE Bot?

Hy
Try get the referer and check if that referer contains the word GoogleBot or any word you want:

Code: Select all

$ref = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
if (stripos($ref, 'GoogleBot')!==false) {
do not show this paragraph
} else {
show paragraph
}
by MarPlo
Sun Jan 16, 2011 9:09 pm
Forum: PHP General
Topic: Multiple file uploads - different to usual
Replies: 2
Views: 468

Re: Multiple file uploads - different to usual

For multi-uploader you should have the value of the attribute name like this name="a_name[]", than in php:

Code: Select all

for($i=0; $i<count($_FILES['a_name']['name']); $i++) {
  if(strlen($_FILES['a_name']['name'][$i])>0) {
    // ... code
  }
}
by MarPlo
Sun Jan 16, 2011 9:01 pm
Forum: PHP coding => Mail
Topic: Help with mail form
Replies: 0
Views: 542

Re: Help with mail form

You can get the ip adress with $_SERVER['REMOTE_ADDR'] and other datas with the variable $_SERVER.
Its good to filter the values from form, at least with strip_tags() [remove tags]
by MarPlo
Sun Jan 16, 2011 5:50 am
Forum: Free time
Topic: Hello! New member here
Replies: 3
Views: 2496

Re: Hello! New member here

Hy everyone
I'm new here and I try to make what is good in every moment and learn usefull things, if God helps me.
by MarPlo
Sun Jan 16, 2011 5:41 am
Forum: PHP General
Topic: Form Spam
Replies: 4
Views: 985

Re: Form Spam

You can set randomly a a verification code that the user must add it in the form andkeep it in a session.
Before sending the email chech that code.
by MarPlo
Sun Jan 16, 2011 5:36 am
Forum: PHP General
Topic: What's wrong with my script??
Replies: 4
Views: 1036

Re: What's wrong with my script??

Try:
action="<?php echo 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; ?>"
by MarPlo
Sun Jan 16, 2011 5:25 am
Forum: PHP coding => General
Topic: Unexpected "=" Why? What to do?
Replies: 2
Views: 671

Re: Unexpected "=" Why? What to do?

Try:

Code: Select all

if ($prevPage > $chapters[$chapter][0]) $out .= "<a href="/mybook.php?chapter={$chapter}&page={$prevPage}\">Prev</a>";
- It waz missing a "/"
by MarPlo
Sun Jan 16, 2011 5:18 am
Forum: PHP coding => General
Topic: $_SESSION
Replies: 0
Views: 402

Re: $_SESSION

Hy. I hope my answer helps you. <?php // initiate an array with four elements $fruit = array (0=>'banana', 1=>'arancia', 2=>'limone', 3=>'pesca'); session_start(); // this function is initiate to work with SESSION // chech if $_SESSION['count'] exists if (!isset($_SESSION['count'])) { $count = 0; //...