1,105,578 Community Members

Latest Posts in PHP

Member Avatar
nufftalon
Light Poster
33 posts since Feb 2014
Reputation Points: 0 [?]
Q&As Helped to Solve: 1 [?]
Skill Endorsements: 0 [?]
 
0
 

I have a form that has embedded php
Above html tag I have the following code:

<?php
 if(isset($_POST['sendit'])){
                    $fname = strip_tags($_POST['fname']);
                    $lname = strip_tags($_POST['lname']);
                    $address = strip_tags($_POST['address']);
                    $cityname = strip_tags($_POST['cityname']);
                    $state = strip_tags($_POST['state']);
                    $zipcode = strip_tags($_POST['zipcode']);
                    $phonenum = strip_tags($_POST['phonenum']);
                    $cellnum = strip_tags($_POST['cellnum']);
                    $worknum = strip_tags($_POST['worknum']);
                    $eaddress = strip_tags($_POST['eaddress']);
                    $grad = strip_tags($_POST['grad']);
                    $inhs = strip_tags($_POST['inhs']);
                    $yrgrad = strip_tags($_POST['yrgrad']);
                    $ged = strip_tags($_POST['ged']);
                    $yrofgrad = strip_tags($_POST['yrofgrad']);
                    $referby = strip_tags($_POST['referby']);
}
?>

Before the form tag I have the following code:

 <?php
                    if(isset($_POST['sendit'])){
                    $sendthisto = "your@email.com";
                    $esubject = "New Registration From Autoseum.org";
                    //$atheemailheaders = "CC: your@email.com\r\n";
                    $atheemailheaders = "FROM: noreply@email.org\r\n";
                    $atheemailheaders .= "MIME-Version: 1.0\r\n";
                    $atheemailheaders .= "Content-Type: text/html; charset=ISO-8859-1\r\n";

                    $wantlearn = $_POST['wantlearn'];

                    $theebody = "Hello below is a registrtion form submitted via your Autoseum.org website<br /><br />";
                    $theebody .= "Name: $fname $lname <br /><br /> Address: $address <br /> $cityname $state $zipcode <br /><br /> Phone: $phonenum ";
                    $theebody .= "<br />Cell $cellnum <br />Work: $worknum <br /><br />Email: $eaddress <br /><br />Have You Graduated High School? $grad <br /><br />";
                    $theebody .= "Currently in High School?  $inhs  Year Graduated: $yrgrad <br /><br /> Have a GED? $ged Year of GED: $yrofgrad <br /><br />";
                    $theebody .="Want To Learn: $wantlearn <br /><br />How did you find us? $referby";      


                    mail("$sendthisto","$esubject","$theebody","$atheemailheaders");
                       echo "<center><br /><br />Your Registration Information Has Been Saved To The Database. 
                             A Representative Will Contact You Shortly<br /><br /></center>";
                    }else{
                ?>

The form itself works fine I have no problems with it whatsoever. I am trying to add the recaptcha to this existing form

So between the <form> tag I added this code:

<?php require_once('recaptchalib.php');
  $publickey = "6LdkN_ISAAAAAHw0-RUWczIlooww37sqfzG0h9LY"; // you got this from the signup page
  echo recaptcha_get_html($publickey);?>

Then it says something about for the recaptcha to work the form has submit to a verify.php file which I created and then added the following code:

<?php
  require_once('recaptchalib.php');
  $privatekey = "your_private_key";
  $resp = recaptcha_check_answer ($privatekey,
                                $_SERVER["REMOTE_ADDR"],
                                $_POST["recaptcha_challenge_field"],
                                $_POST["recaptcha_response_field"]);

  if (!$resp->is_valid) {
    // What happens when the CAPTCHA was entered incorrectly
    die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
         "(reCAPTCHA said: " . $resp->error . ")");
  } else {
    // Your code here to handle a successful verification
  }
  ?>

I am following this guide:
https://developers.google.com/recaptcha/docs/php

Needless to say its not working and I don't know what I am doing since I have embedded php before recaptcha and not submitting to a php file before I am not sure how to structure this to work. I see a place called (your code here to handle a successful verification so I assume I am supposed to add something there but not sure.

Member Avatar
momonq1990
Junior Poster in Training
62 posts since Jul 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 1 [?]
Skill Endorsements: 0 [?]
 
0
 

thankyou! work link a charm :D

Member Avatar
extjac
Light Poster
42 posts since Oct 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 1 [?]
Skill Endorsements: 0 [?]
 
0
 

thanks diafol. that is how is have it....User, Events, Events_countries and Countries tables. But after saying someone storing json i kind of wanted to go the same way...It will save me so much coding..

Member Avatar
diafol
Where are my eyes?
13,007 posts since Oct 2006
Reputation Points: 1,821 [?]
Q&As Helped to Solve: 1,850 [?]
Skill Endorsements: 92 [?]
Moderator
Featured
Sponsor
 
0
 

If you're going to save this in a DB, I wouldn't serialize - I'd use a link table:

user (user_id,...) | events (event_id,...,country_id)| countries (country_id, ...) | user_countries (uc_id, user_id, country_id)

So, maybe soemthing like...

SELECT e.event, c.country FROM events AS e 
    INNER JOIN countries AS c ON c.country_id = e.country_id 
    INNER JOIN user_countries AS uc ON uc.country_id = c.country_id 
    WHERE uc.user_id = 236   

Anway, not tested - off top of my head.

Member Avatar
diafol
Where are my eyes?
13,007 posts since Oct 2006
Reputation Points: 1,821 [?]
Q&As Helped to Solve: 1,850 [?]
Skill Endorsements: 92 [?]
Moderator
Featured
Sponsor
 
1
 

Hopw about clearing the cache?

Member Avatar
world_weapon
Junior Poster in Training
69 posts since Apr 2004
Reputation Points: 3 [?]
Q&As Helped to Solve: 2 [?]
Skill Endorsements: 0 [?]
 
0
 

If you have jquery support on the page, you can keep those elements hidden and render or dynamically generate them on the event of checking the need theory box. If they uncheck it, you can either remove the element from the dom, or re-hide them. I suppose you could use bare javascript if you don't have jquery as well.

Jquery Append
Jquery Remove

Member Avatar
chrishea
Posting Virtuoso
1,527 posts since Sep 2008
Reputation Points: 182 [?]
Q&As Helped to Solve: 256 [?]
Skill Endorsements: 6 [?]
 
0
 

Maybe doing it with PHP isn't the easiest / best way to do it. You can create editable pdf files with the full Adobe package.
Click Here. This is supposed to work online. The (free) reader can accept input to form fields but won't save them. That may still be enough if all you want to do is immediately print it.

Member Avatar
Jersey Bill
Newbie Poster
1 post since Apr 2014
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

I am trying to edit file using fpdf/fpdi

<?php
 require_once('fpdf/fpdf.php');
require_once('fpdi/fpdi.php');

$pdf =& new FPDI();
$pdf->AddPage();

//Set the source PDF file
$pagecount = $pdf->setSourceFile("benchbook.pdf");

//Import the first page of the file
$tpl = $pdf->importPage($i);
//Use this page as template
$pdf->useTemplate($tpl);

#Print Hello World at the bottom of the page

//Go to 1.5 cm from bottom
$pdf->SetY(-15);
//Select Arial italic 8
$pdf->SetFont('Arial','I',8);
//Print centered cell with a text in it
$pdf->Cell(0, 10, "Hello World", 0, 0, 'C');

$pdf->Output("my_modified_pdf.pdf", "F");
?>
Member Avatar
Pravesh_1
Light Poster
26 posts since Nov 2013
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Actually.. its working on some PCs but not on all.. I cleared all cookies on my PC still same problem..

Member Avatar
extjac
Light Poster
42 posts since Oct 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 1 [?]
Skill Endorsements: 0 [?]
 
0
 

Hello!
I have a table called Events and one of the colums is called "country". I want to be able to query events based on the user country. So eventID #1 might have "country" = US, CA, MX (multiple values), so if a user is from the US logs-in will see the eventID 1 , but also if a user from CA logs-in will see the same event.

I created a <select name=country[] multiple> with a list of countries. I would like to be able to select several countries and save them in a colum. I tested json_encode and serialize and it like better json_encode but I was wonderig what's your view?

so on my form i have someeting like this....

<select name="country[]" size="10" multiple>
<?php foreach ($countries as $key => $val) { ?>
<option value="<?=$key?>" <?php if (in_array($key, json_decode($event->country))) { echo 'selected'; } ?>><?=$val?></option>
<?php } ?>
</select>

my controller looks like this:

function save($id)
{
$event = Event::find($id);
$event->country = json_encode($input['country']);
$event->save();
}

my query looks like this

function getEvents() {
return 'Select * From events where country IN ($user->country) ';
}
Member Avatar
diafol
Where are my eyes?
13,007 posts since Oct 2006
Reputation Points: 1,821 [?]
Q&As Helped to Solve: 1,850 [?]
Skill Endorsements: 92 [?]
Moderator
Featured
Sponsor
 
0
 

I checked the link - it seems to be working?

Member Avatar
mwnt2014
Newbie Poster
11 posts since Mar 2014
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Want to set multiple templates as homepage. or else when user click on the template then it set for the website .

Member Avatar
rpv_sen
Posting Whiz in Training
263 posts since Mar 2011
Reputation Points: 14 [?]
Q&As Helped to Solve: 22 [?]
Skill Endorsements: 1 [?]
 
0
 
Member Avatar
davy_yg
Veteran Poster
1,120 posts since May 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 1 [?]
Skill Endorsements: 1 [?]
 
0
 

Hallo,

Does anyone knows how to secure xampp - I mean for web server ?

How to place password on it ?

I am just want to secure my database.

Thanks before.

Member Avatar
Pravesh_1
Light Poster
26 posts since Nov 2013
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

I changed type: "POST" to type: "GET"
If use datatype:json
then how I can use data: "cart_itemid="+cart_itemid+"&cart_qty="+cart_qty
which I'm requesting.

Member Avatar
surferbloggy
Newbie Poster
5 posts since May 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Hi, i need a quick help to configure a Facebook app
when i go to the Facebook address it is this in the screenshot a gray page

everythig seems right but the game is not shown

i’ve added this code to the index.php
with the right ids but nothing

if someone can help me i'll send my Facebook credentials
let me know if you could help me to configure it,
i’ll pay for the disturb
thank you

<?php
     require 'src/facebook.php';

    $app_id = 'APP_ID';
    $app_secret = 'APP_SECRET';
    $app_namespace = 'APP_NAMESPACE';
    $app_url = 'https://apps.facebook.com/' . $app_namespace . '/';
    $scope = 'email,publish_actions';

    // Init the Facebook SDK
    $facebook = new Facebook(array(
         'appId'  => $app_id,
         'secret' => $app_secret,
));

// Get the current user
$user = $facebook->getUser();

// If the user has not installed the app, redirect them to the Login Dialog
if (!$user) {
        $loginUrl = $facebook->getLoginUrl(array(
        'scope' => $scope,
        'redirect_uri' => $app_url,
        ));

        print('<script> top.location.href=\'' . $loginUrl . '\'</script>');
}
?>
Attachments Schermata_2014-04-05_alle_12.01_.10_.png 161.51KB
Member Avatar
pzuurveen
Posting Pro in Training
445 posts since Sep 2006
Reputation Points: 48 [?]
Q&As Helped to Solve: 93 [?]
Skill Endorsements: 5 [?]
 
0
 

go to your dashboard
goto settings->read
select the page you want to be you startpage

Member Avatar
Lee_7
Newbie Poster
2 posts since Apr 2014
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

think you need to give more information or screenshot.

Member Avatar
Lee_7
Newbie Poster
2 posts since Apr 2014
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Hi,
I'm trying to working with the Tripletex API. Also see our topic : http://www.daniweb.com/web-development/php/threads/444996/tripletex-with-php
When i tried log in, It's ok. and response an array. But the problem is : in the header of this response, i can not see any cookie, session about my log in. So i can not do anything more.

Did you have any exp about it ? Hope to see your advice.

Best regards,

Member Avatar
diafol
Where are my eyes?
13,007 posts since Oct 2006
Reputation Points: 1,821 [?]
Q&As Helped to Solve: 1,850 [?]
Skill Endorsements: 92 [?]
Moderator
Featured
Sponsor
 
0
 

still not working

heh heh -welcome to the world of ajax! You've changed something, but we don't know what. Post your updated cade. Also it could be your php code - try running it as stand alone with hard coded POST or GET values (whichever you're using now). If using $.ajax you need to declare a datatype as json.

PHP Tag Cloud