PHP Pages
3 posters
Page 1 of 1
PHP Pages
I know there is a way to create HTML pages on your website, however i would like to implement a small php page that interfaces with my own MySQL database and does some special things. I already have a website hosted by you (gamersaddicted.net). I would love your feedback, thanks.
Here is the code for the php
Here is the code for the php
- Code:
<?php
$time = time()
?>
<?php
$req = 'cmd=_notify-synch';
$tx_token = $_GET['tx'];
$auth_token = "xxx";
$req .= "&tx=$tx_token&at=$auth_token";
$header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
$fp = fsockopen ('www.paypal.com', 80, $errno, $errstr, 30);
// $fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30);
if (!$fp) {
} else {
fputs ($fp, $header . $req);
$res = '';
$headerdone = false;
while (!feof($fp)) {
$line = fgets ($fp, 1024);
if (strcmp($line, "\r\n") == 0) {
$headerdone = true;
}
else if ($headerdone)
{
$res .= $line;
}
}
$lines = explode("\n", $res);
$keyarray = array();
if (strcmp ($lines[0], "SUCCESS") == 0) {
for ($i=1; $i<count($lines);$i++){
list($key,$val) = explode("=", $lines[$i]);
$keyarray[urldecode($key)] = urldecode($val);
}
$con = mysql_connect("xxx:3306","user","pass"); //Connect to the MySQL Database that GForts uses
if (!$con)
{
die("Could not connect: " . mysql_error());
}
$db_selected = mysql_select_db("gamereso_donation", $con); //Connect to the table that contains GForts info
//$db_selected_2 = mysql_select_db("TABLENAME",$con2); //Select the table that has the forum or donation tracker
$firstname = $keyarray['first_name'];
$itemname = $keyarray['item_name'];
$amount = $keyarray['payment_gross'];
$payer = $keyarray['payer_email'];
$itemnumber = $keyarray['item_number'];
$txn = $keyarray['txn_id'];
$quantity = $keyarray['quantity'];
$option1 = $keyarray['option_selection1'];
echo ("<p><h3>Thank you for your purchase!</h3></p>");
$sql = "SELECT * from gf_dcs WHERE TID='".$txn."'";
$result = mysql_query($sql,$con);
$data = mysql_fetch_array($result,MYSQL_ASSOC);
if($data != false) { // Check to see if this page has already been accessed before
$dtime = date("Y-m-d", $data["CREATED"]);
$amount = $data["AMOUNT"];
$code = $data["CODE"];
$used = $data["USED"];
echo("<li>You donated for donator rank! Go on the server to redeem it!</li>\n\n");
if ($used == 0) {
echo("<li>Your code is:</li>\n");
echo("<p><h2>" . $code . "</h2></p>");
} else {
echo("<li>Your code has been used.</li>\n");
}
}
else
{
//Create the code for them
$CODE = "S";
for ($i=1; $i<=25; $i++)
{
$A = rand(0,1);
if ($A==0)
{
$A = rand(0,9);
$CODE .= $A;
}
else
{
$A = rand(1,26);
$T = chr(64+$A);
$CODE .= $T;
}
}
$sql = "INSERT INTO gf_dcs VALUES ('$CODE',1,1,0,$time,'$txn')"; // Inset the data into gforts database
$result = mysql_query($sql,$con);
echo("<li>Your code is:</li>\n");
echo("<p><h2>" . $CODE . "</h2></p>");
}
mysql_close($con);
}
else if (strcmp ($lines[0], "FAIL") == 0) {
}
}
fclose ($fp);
ssi_shutdown();
?>
Remscar- New Member
- Posts : 3
Reputation : 0
Language : English
Re: PHP Pages
As far as I know you can't add php pages, but you could try adding it to a HTML page and making it an external PHP page to add where you want.
Re: PHP Pages
I don't think my client has an external web server that can host the page. Is there a way to use PHP in the html pages?
Remscar- New Member
- Posts : 3
Reputation : 0
Language : English
Re: PHP Pages
Rac wrote:If you just add your PHP script to a HTML page it should work fine.
No it doesnt.
Remscar- New Member
- Posts : 3
Reputation : 0
Language : English
Re: PHP Pages
I don't think you can then
Edit: Yea, you can't use PHP in forumotion, I did some research and found out
Edit: Yea, you can't use PHP in forumotion, I did some research and found out
Re: PHP Pages
yeah but you might be able to convert it to html.
I would have to see the script and what it is you want it to do.
I would have to see the script and what it is you want it to do.
kirk- Forumaster
- Posts : 11037
Reputation : 653
Language : English,Vulcan,Klingon, Romulan,& Gorn
Re: PHP Pages
The scripts in the first post and I think it's meant to generate a code for you after donating.
Re: PHP Pages
Do you have a site/page that this code is working on now?
And where did you want to incorporate this on your forumotion forum?
And where did you want to incorporate this on your forumotion forum?
kirk- Forumaster
- Posts : 11037
Reputation : 653
Language : English,Vulcan,Klingon, Romulan,& Gorn
Re: PHP Pages
Remscar wrote:I don't think my client has an external web server that can host the page
I'm guessing no.
Re: PHP Pages
no but i am sure you create a html code to do what ever the code is doing for the php script.
If i seen the page to where you have the php working on your website or where ever you have it? i might be able to suggest how to get the same thing or something similar?
If i seen the page to where you have the php working on your website or where ever you have it? i might be able to suggest how to get the same thing or something similar?
kirk- Forumaster
- Posts : 11037
Reputation : 653
Language : English,Vulcan,Klingon, Romulan,& Gorn
Similar topics
» Individual topic pages larger then other pages!
» Pages
» Pages
» Pages
» I want to put ads on some pages and not all pages. how to do it?
» Pages
» Pages
» Pages
» I want to put ads on some pages and not all pages. how to do it?
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum