Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Battle Bott
May 6, 2007

functional posted:

I'm worried about your code, though. Lines like these:

php:
<?
#url.com/filesupersystem/dl.php?file=image.jpg
$fullfile="mydirectory/$file";
?>
make me skeptical of the security of your implementation.

Anyway, do you have a legitimate reason to be concerned about leeching?

I have security, I just cut it out because it wasn't really part of the logic. You cannot go upwards using .., and the file has to exist before anything is done with it, and the strings are escaped. I don't think you can inject anything.

Leaching was not the major concern, just more of a sidenote.

Okay, since that is good, what is the easiest way to go about displaying the statistics? Everything I see is either too simple to use, or too complex.

Something like http://wettone.com/code/slimstat, except prettier.

I doubt I'll find the right package though, I'll probably end up writing my own.

Adbot
ADBOT LOVES YOU

Ferg
May 6, 2007

Lipstick Apathy
What's the scope of a session_start( ) call? I have a multi-layered AJAX application that filters requests, then forwards each request onto a controller object which then in turn completes the request. At any given time you could propagate over a number of objects, a lot of which rely on session variables and I'm wondering if it's necessary for me to call session_start( ) any time that there is a reference to $_SESSION or will it work if I just call it at the beginning of a request routine?

Internet Headache
May 14, 2007
$_SESSION is a global variable which is initialized by session_start(), so you only need to call the function once per request.

functional
Feb 12, 2008

Battle Bott posted:

Something like http://wettone.com/code/slimstat, except prettier.

I doubt I'll find the right package though, I'll probably end up writing my own.

This is good and all...and I admire your productive attitude...but if this is all you're doing, and you don't care about leeching (and apparently, file substitution), why don't use just use some kind of webserver stats plugin? What are you trying to accomplish? You've piqued my curiosity.

functional fucked around with this message at 19:16 on Jan 12, 2009

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

awdio posted:

Yes. And I can get a php variable into Flash. Its the GET variable in a mysql query is what causes things to get hung up. If I define the variable without the GET, it does not happen. I can echo back the correct results of the php query, the Flash just does not get anything from the result of the query.


How is the Flash supposed to get the stuff you generate to the hidden field? Magic? Why not tack on your vars to the end of the URL to the movie?

code:
<?php
$params = "&imageSourcesString=$imageSourcesString&pauseTime=$pauseTime&fadeRate=$fadeRate&sdd=$sdd";
$movieThing = "flashPhotos.swf?"+params;
?>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="400" height="222" id="flashPhotos" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="<?php echo $movieThing;?>" />
<param name="quality" value="high" />
<param name="bgcolor" value="#e5dec6" />
<embed src="<?php echo $movieThing;?>" quality="high" bgcolor="#e5dec6" width="400" height="222" name="flashPhotos" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>

SHODAN
Feb 20, 2001

NARCISSISTIC QUEEN BITCH:
ASK ME ABOUT BEING BETTER THAN YOU
Does the DateTime object actually work in the latest PHP release? I tried instantiating a new DateTime object and doing DateTime.sub to subtract some time, but I get a function not defined error.

Am I missing an include or something, or does 'experimental' just mean 'doesn't work at all'?

The code is essentially this:

<?php

$date = new DateTime(formatstring);
$date.sub(T1D);
?>

Zorilla
Mar 23, 2005

GOING APE SPIT

SHODAN posted:

Does the DateTime object actually work in the latest PHP release? I tried instantiating a new DateTime object and doing DateTime.sub to subtract some time, but I get a function not defined error.

Am I missing an include or something, or does 'experimental' just mean 'doesn't work at all'?

$date->sub is what you want

SHODAN
Feb 20, 2001

NARCISSISTIC QUEEN BITCH:
ASK ME ABOUT BEING BETTER THAN YOU

Zorilla posted:

$date->sub is what you want

Sweet, I figured there was a good chance of me being dumb. Thanks!

Edit: Looks like I may have celebrated a bit too quickly, here's what I'm running into now:

with the code changed to:

code:
$dateobj->sub(new DateInterval("P1D"));
I get this error message:

code:
Fatal error: Call to undefined method DateTime::sub()
I can call some functions on it such as getTimezone ok, but not others such as add, sub, or getOffset. I'm quite perplexed.



SHODAN fucked around with this message at 00:40 on Jan 13, 2009

Zorilla
Mar 23, 2005

GOING APE SPIT

SHODAN posted:

I get this error message:

code:
Fatal error: Call to undefined method DateTime::sub()
I can call some functions on it such as getTimezone ok, but not others such as add, sub, or getOffset. I'm quite perplexed.

The documentation seems to confirm that DateTime::sub() probably hasn't made it into PHP 5.2.x or whatever most servers use.

Can you do what you're trying to do with time() and date() ? For instance:
php:
<?php
date_default_timezone_set("America/Los_Angeles"); // something like this probably belongs in a site-wide config file

// yesterday, 24 hours ago
echo date("Y-m-d"time() - 86400);
?>

Zorilla fucked around with this message at 01:07 on Jan 13, 2009

SHODAN
Feb 20, 2001

NARCISSISTIC QUEEN BITCH:
ASK ME ABOUT BEING BETTER THAN YOU

Zorilla posted:

The documentation seems to confirm that DateTime::sub() probably hasn't made it into PHP 5.2.x or whatever most servers use.

Can you do what you're trying to do with time() and date() ? For instance:
php:
<?php
date_default_timezone_set("America/Los_Angeles"); // something like this probably belongs in a site-wide config file

// yesterday, 24 hours ago
echo date("Y-m-d"time() - 86400);
?>


Yeah, this is one of my first forays into PHP so I was hoping for a good date object implementation, I'll probably just end up using date/time.

Thanks for your help though, I'm sure the member function calls issue (-> vs .) would have come up sooner or later.

LP0 ON FIRE
Jan 25, 2006

beep boop

Lumpy posted:

How is the Flash supposed to get the stuff you generate to the hidden field? Magic? Why not tack on your vars to the end of the URL to the movie?

Flash can get the stuff on the hidden field perfectly fine except when the initial variable from GET that SQL uses for a query is used. If I just simply defined the variable instead of using the value of GET everything would be fine. I'd explain how this works all over again but I've explained this in at least 3 other replies so far. Read those so you can understand what the problem is more. But thanks for your suggestion I'll try that.

LP0 ON FIRE fucked around with this message at 05:12 on Jan 13, 2009

Battle Bott
May 6, 2007

functional posted:

This is good and all...and I admire your productive attitude...but if this is all you're doing, and you don't care about leeching (and apparently, file substitution), why don't use just use some kind of webserver stats plugin? What are you trying to accomplish? You've piqued my curiosity.

The truth? Because I can. No real need. I already run google analytics, and my host runs Webalizer and Awstats. I just want to design a data logging system, and then figure out how to display it pretty with all sorts of fun ajax stuff. I think xml/flash graphs are the way to go. I'm just learning php, sql, flash, javascript, html, css and whatever else this takes.

scanlonman
Feb 7, 2008

by R. Guyovich
Does anybody know how to get the value of an array from an array? That sounds pretty confusing after reading it, so here's an example:
php:
<?
 $header = array("Home","Info"=>array("E-Mail","Other"));
 echo $header[0];
 echo $header[1]; //Line 3
?>
How would I get line 3 to output 'Info'? Right now it outputs nothing and it's confusing me.

scanlonman fucked around with this message at 12:45 on Jan 13, 2009

DaTroof
Nov 16, 2000

CC LIMERICK CONTEST GRAND CHAMPION
There once was a poster named Troof
Who was getting quite long in the toof

scanlonman posted:

Does anybody know how to get the value of an array from an array? That sounds pretty confusing after reading it, so here's an example:
php:
<?
 $header = array("Home","Info"=>array("E-Mail","Other"));
 echo $header[0];
 echo $header[1]; //Line 3
?>
How would I get line 3 to output 'Info'? Right now it outputs nothing and it's confusing me.

You're trying to get the element's key, not its value. The confusing part is that you're mixing an indexed array with an associative array, since you didn't give the first element a key.

php:
<?
 $header = array("Home","Info"=>array("E-Mail","Other"));
 $keys = array_keys($header);
 echo $keys[0]; // Prints "0" because this element doesn't have a key
 echo $keys[1]; // Prints "Info"
?>

scanlonman
Feb 7, 2008

by R. Guyovich
Aha! Thanks, I got it to work now. Sorry for my PHP dumbness.

[edit] Hmmm, another question.

Instead of having to do:
http://webpage.com/?section=blah&other=blahblah

Would it be possible to change that to http://webpage.com/?blah&blahblah and still be able to get $_GET[] the values?

scanlonman fucked around with this message at 13:38 on Jan 13, 2009

Internet Headache
May 14, 2007

scanlonman posted:

0
Aha! Thanks, I got it to work now. Sorry for my PHP dumbness.

[edit] Hmmm, another question.

Instead of having to do:
http://webpage.com/?section=blah&other=blahblah

Would it be possible to change that to http://webpage.com/?blah&blahblah and still be able to get $_GET[] the values?
You should use url_rewrite if your server runs on apache. According to SEO guys, search engines hate query strings.

With this .htaccess file, http://webpage.com/blah/blahblah would be rewritten to http://webpage.com/index.php/blah/blahblah . Your script could then grab the path from $_SERVER['PATH_INFO'] which contains "blah/blahblah", split by / and then do whatever.

code:
RewriteEngine On
RewriteBase /

# Displays real files and folders if they exist (like if you manually cached a page)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# Rewrites all other requests to be passed to the php script.
RewriteRule .* index.php/$0 [PT,L]
You also could set several rewrite rules for each section and just rewrite the requests to follow your current query string system so you wouldn't need to adjust your php code, but I don't recommend it.

Internet Headache fucked around with this message at 14:49 on Jan 13, 2009

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



awdio posted:

Flash can get the stuff on the hidden field perfectly fine except when the initial variable from GET that SQL uses for a query is used. If I just simply defined the variable instead of using the value of GET everything would be fine. I'd explain how this works all over again but I've explained this in at least 3 other replies so far. Read those so you can understand what the problem is more. But thanks for your suggestion I'll try that.

I have to say, I've read all your explanations and I just got more confused with every iteration.

scanlonman posted:

Would it be possible to change that to http://webpage.com/?blah&blahblah and still be able to get $_GET[] the values?

You can iterate over $_GET just like any other array or use isset() to see if anything you're looking for was set. For example, &ascsv might act as a flag to output some report as CSV as long as it's set by checking for isset($_GET['ascsv']). Of course, this could confuse the poo poo out of someone who edits the query string with &ascsv=0 and expects it to work, so take that into consideration :)

Internet Headache posted:

According to SEO guys, search engines hate query strings.

SEO people are full of poo poo. Any modern search engine that wants to remain relevent must be able to understand them.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

awdio posted:

Flash can get the stuff on the hidden field perfectly fine except when the initial variable from GET that SQL uses for a query is used. If I just simply defined the variable instead of using the value of GET everything would be fine. I'd explain how this works all over again but I've explained this in at least 3 other replies so far. Read those so you can understand what the problem is more. But thanks for your suggestion I'll try that.

Your replies are confusing at best. "Flash can get stuff out of hidden fields" doesn't make any sense whatsoever.

Good luck finding a solution, but you've baffled me beyond the ability to try to help you any more :(

LP0 ON FIRE
Jan 25, 2006

beep boop

Lumpy posted:

Your replies are confusing at best. "Flash can get stuff out of hidden fields" doesn't make any sense whatsoever.

Flash actionscript can use loadVariables("currentpageURL.php", this, "POST"); to get POST variables from the current page that it is on. You can make the value of hidden fields like so to make a POST variable like so:
php:
<?

$variableSentToFlash="hello there";

echo "<INPUT type = 'hidden' name = 'Page' value='&variableSentToFlash=$variableSentToFlash'>";


?>

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

awdio posted:

Flash actionscript can use loadVariables("currentpageURL.php", this, "POST"); to get POST variables from the current page that it is on. You can make the value of hidden fields like so to make a POST variable like so:
php:
<?

$variableSentToFlash="hello there";

echo "<INPUT type = 'hidden' name = 'Page' value='&variableSentToFlash=$variableSentToFlash'>";


?>

You realize it doesn't "look at the current page" right? It actually sends a request to the server for the script, and loads it in again. That's your problem.

Do what I suggested, since what you are doing makes no sense whatsoever.

Lumpy fucked around with this message at 20:24 on Jan 13, 2009

fletcher
Jun 27, 2003

ken park is my favorite movie

Cybernetic Crumb

Munkeymon posted:

as long as it's set by checking for isset($_GET['ascsv']).

Don't you need to check array_key_exists('ascsv', $_GET) first?

Anveo
Mar 23, 2002

Little Brittle posted:

Are there any good tutorials or samples online for eAccelerator? I want to use it, but it's hard to find real world sample code, and the API documentation is pretty bare. I want to dig in to granular caching and learn more about its user data caching.

What exactly do you want to know? The api is pretty self explanatory.

eaccelerator_put($key, $data, $duration) puts $data into the cache with an access key of $key, for $duration seconds.

eaccelerator_get($key) tries to retrieve data stored at $key
eaccelerator_rm($key) removes entry stored at $key

If you just need to know about caching 'theory' in general, just do a search for that. Pretty much all caching backends(apc, eccelerator, xcache, memcached, disk, etc) work exactly the same way in every language.

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



fletcher posted:

Don't you need to check array_key_exists('ascsv', $_GET) first?

Empty $_GET vars are zero-length strings in 5 and 4 in my testing. Surprise!

sonic bed head
Dec 18, 2003

this is naturual, baby!
When using the php DomDocument, what does the error "ID loginForm already defined in entity" mean? I've tried googling for this and I can't find anything that defines the error. I've checked through the HTML and I don't see any duplicate loginForm elements. The only thing I notice is that there is a form id and a form name that is both loginForm. Could that cause this error?

karms
Jan 22, 2006

by Nyc_Tattoo
Yam Slacker

sonic bed head posted:

When using the php DomDocument, what does the error "ID loginForm already defined in entity" mean? I've tried googling for this and I can't find anything that defines the error. I've checked through the HTML and I don't see any duplicate loginForm elements. The only thing I notice is that there is a form id and a form name that is both loginForm. Could that cause this error?

In the time you've written up this post you could have checked it ten times over.

ExtraNoise
Apr 11, 2007

Hi guys, I'm pretty new with queries in PHP and I have a question. I'm setting up a little game for some friends that calculates a budget (each player playing as a nation of their choice). My units table has different types of units such as "army", "navy", etc.

You can see the page here:
http://www.rickpierce.info/dotw/nations.php

I got army subtracting fine with the help of a friend using a LEFT JOIN command. But now I come to adding a second (navy) and I'm lost. My friend suggested subqueries but he's unfamiliar with the process, and I'm feeling in over my head on this one as a beginner.

Here's the query and some other information to help you get an idea of what I've done/am trying to do:

php:
<?
$result = mysql_query("SELECT `nations`.*,SUM(Size) AS `armycount` FROM `nations` LEFT JOIN `units` 
ON `units`.`Owner` = `nations`.`NatID` WHERE TYPE='army' GROUP BY `nations`.`NatID`");

...

while($row = mysql_fetch_assoc($result))
{
    $percent = $row["Growth"] * 100;
    $armycost = $row['armycount'] * 3;
    $navycost = $row['navycount'] * 20;
    $net = ($row["GDP"] * $row["Growth"]) + $row["GDP"] + $row["Reserve"] - $armycost - $navycost;
?>
The hang up is the WHERE TYPE, as I can't just insert another WHERE TYPE='navy' in the query without it falling apart. Running a second query is both stupid and doesn't work. I've tried rearranging the query to incorporate another SUM and WHERE, but because the WHERE needs to be in that exact location in the query, it doesn't work.

Edit: broke query in half to stop tables from breaking.

jasonbar
Apr 30, 2005
Apr 29, 2005

ExtraNoise posted:

The hang up is the WHERE TYPE, as I can't just insert another WHERE TYPE='navy' in the query without it falling apart. Running a second query is both stupid and doesn't work. I've tried rearranging the query to incorporate another SUM and WHERE, but because the WHERE needs to be in that exact location in the query, it doesn't work.

Unless I'm misunderstanding, you want to use WHERE `type` = 'army' OR `type` = 'navy'

Or you could use WHERE `type` IN ('army','navy')

ExtraNoise
Apr 11, 2007

jasonbar posted:

Unless I'm misunderstanding, you want to use WHERE `type` = 'army' OR `type` = 'navy'

Or you could use WHERE `type` IN ('army','navy')

Would it be able to differentiate between the two, or would it SUM up both types?

Either way, I'll give it a try!

Edit: I should note that I would like it to also create the variable navycount (see armycount) that is the SUM for type="navy", sort of how the query creates a SUM for armycount that is the SUM for type="army".

Would I be a lot better off just using separate tables for each type of unit?

spiritual bypass
Feb 19, 2008

Grimey Drawer
I hate to sound rude, but you might need to do a little reading about database normalization before you go much further. The issue of putting 'army' and 'navy' in different tables will become clear, you'll prevent lots of headaches, and the project will turn out better.

ExtraNoise
Apr 11, 2007

royallthefourth posted:

I hate to sound rude, but you might need to do a little reading about database normalization before you go much further. The issue of putting 'army' and 'navy' in different tables will become clear, you'll prevent lots of headaches, and the project will turn out better.

Not rude at all. I'll go read up on better practices and push forward with different tables on this project. Thank you for the input. :)

jasonbar
Apr 30, 2005
Apr 29, 2005
edit: nevermind

jasonbar fucked around with this message at 05:42 on Jan 16, 2009

Manos del Sino
Apr 12, 2004

Original Pony
Soiled Meat
I could use some help.

Our website guy (goon JH Pufnstuf) departed us ages ago and now my boss wants a few changes done to the website. Between my coworker and myself, we've managed to tackle all but one of the requested fixes, but this one is throwing us both for a loop.

Goal: I want to add an onClick variable to a radio button selection.

Summary: To access a group of text listings on our site, it's necessary to click on a radio button to indicate the region, and then a drop down menu for a section, before hitting submit and having the values returned. The boss wants it so that after clicking the radio button, but before selecting from the drop down and hitting submit, a temporary page with banner ads (that correspond to region selected by the radio button) pops up in the opposing frame.

What we have now:

php:
<?
        <form id="form1" name="city" method="get" action="adsbycity_results.php">
    <?php $result mysql_query("SELECT * FROM cities");
        while($cities mysql_fetch_object($result)) {
        ?>
        <ul style="list-style: none; margin: 0 0 -7px 0;"><li style="padding: 0 0 0 16px; background: none;"><input type="radio" name="city_id" value="<?php echo $cities->city_id?>" />&nbsp;&nbsp;<?php echo stripslashes($cities->name)?></li></ul>
        <?php ?>?>
And I think this might be the relevant code from how the banner pages currently pop up, but honestly, I'm out of my league:

php:
<?
        <!-- Banner Ads start here -->
        
      <?php $city_id $_GET['city_id']; ?>
      <?php $category $_GET['category']; ?>
      <?php $ban_result mysql_query("SELECT * FROM banners WHERE city_id='$city_id' AND category='$category'");
      while($banners mysql_fetch_object($ban_result)) {
      ?>
      <ul>
        <li><a href="<?php echo $banners->link?>" target="_blank"><img src="<?php echo $banners->file?>" alt="<?php echo $banners->company?>"></a></li>
        </ul>
        <?php ?>?>
So yeah. It's not exactly Greek to me, but it sure ain't English. From what I can tell, it should be possible to add an onClick variable to the first bit of code for the radio button, like so:

php:
<?
<input type="radio" name="city_id" value="<?php echo $cities->city_id?>" onClick="XXX" />?>
But I don't know what to put in the XXX spot. I've tried copying the code from the second part in pieces and in whole, but no dice. I've probably attempted 20 or more revisions, but I have to admit that this is not my forte. even adding a simple onClick statement (like onClick="http://www.google.com") doesn't actually cause an onClick event to happen, so I may be barking up the wrong tree entirely.

Pizza Partisan
Sep 22, 2003

Manos del Sino posted:

Banner Popup stuff.

You want a Javascript function that shows the banner.

code:
function popUp(url){
window.open(url, 'popup')
}
Your radio button onclick would look like this:

php:
<?
onClick="showBanner(<?php #code for retrieving your banner url here ?>"?>
More info on window.open can be found here

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



surrealcatalyst posted:

You want a Javascript function that shows the banner.

code:
function popUp(url){
window.open(url, 'popup')
}

He mentioned a frame, so I think he's actually just changing the relevant frame's .location.href property: http://www.aspfree.com/c/a/ASP-Code/Change-the-URL-of-a-Frame-Using-Javascript/ . Also, if the input is in a form, remember to return false from the anonymous method to prevent the change from bubbling up and submitting the form (as long as you don't actually want the change to submit the form).

This is how I have Javascript addressing frames in some code I have laying around. It looks horrible, but I generally have to worry a lot about browser compatibility, so I'm reasonably confident it's tested and works:
code:
this.top.frames['FrameLevel1'].frames['SubFrame']

agscala
Jul 12, 2008

I get an error (Parse error: syntax error, unexpected T_VARIABLE) in line 1 of the 1st code snippet below. I want to be able to have default values for when a new instance of the class is called and also want to be able to assign my own values for flexibility's sake. I've looked at other people's code where they declare default values and it looks the same as what I have, which is why I come to you guys.

What could be causing the issue?

php:
<?
public function __construct($un=$_POST['username'], $pw=$_POST['password']){
        $this->ip = $_SERVER['REMOTE_ADDR'];
        $this->username = $un;
        $this->password = $pw;
        $this->md5pass = md5($un.$pw.$ip);        
    }
?>
This 2nd snippet works just fine, though I want it to function like the one above.
php:
<?
public function __construct(){
        $this->ip = $_SERVER['REMOTE_ADDR'];
        $this->username = $_POST['username'];
        $this->password = $_POST['password'];
        $this->md5pass = md5($un.$pw.$ip);        
    }
?>

Zorilla
Mar 23, 2005

GOING APE SPIT
It might be a PHP limitation in which you can only assign static default values to function inputs. For instance,

This is probably illegal:
php:
<?php
public function __construct($un $_POST["username"], $pw $_POST["password"]) {
    // ...
}
?>
While this is fine:
php:
<?php
public function __construct($un "defaultuser"$pw "defaultpassword") {
    // ...
}
?>
This is just a guess and it may be entirely wrong.

Internet Headache
May 14, 2007

quote:

What could be causing the issue?

php:
<?
public function __construct($un=$_POST['username'], $pw=$_POST['password']){
?>
Default function arguments can only be literal values, array, or NULL.

You can use the default value of false and then do a conditional test to set it to something else.

php:
<?
public function __construct($un=false, $pw=false){
    if ($un === false) {
         $un = $_POST['username'];
    }
    if ($pw === false) {
         $pw = $_POST['password'];
    }
    ...
?>

agscala
Jul 12, 2008

Internet Headache posted:

Default function arguments can only be literal values, array, or NULL.

You can use the default value of false and then do a conditional test to set it to something else.
Oh thanks, this is exactly what I wanted to know. I was hoping for a more elegant solution but this works just as well :unsmith:

moana
Jun 18, 2005

one of the more intellectual satire communities on the web
I'm trying to fix some code that needs to be able to send mail from a website. Right now the line of code for mailing is just:
mail($_POST['chrEmail'].", ".$_POST['chrPerson'],$subject,$body,$headers);

It needs to include SMPT authentication because I'm moving the code to another server (and their mail server requires login credentials), but since I'm not really that fluent in PHP, I'm having some trouble getting it to work. I know the server name, user name, password, and all that, but I'm not sure how to put it together and the scripts that I've found online look a lot different than just the normal "mail" function. Any ideas?

Adbot
ADBOT LOVES YOU

FSMC
Apr 27, 2003
I love to live this lie
I'm not too sure how to do this automatically but I'm sure there is a way and I think php is the way to go. I want to update a mysql database according to payments made through paypal. So if someone pays for an upgrade using paypal it automatically upgrades their account by updating the mysql database.

The only ways I've thought of was to manually download the paypal transaction list, and get the people to submit a form with their username and paypal transaction number then run a program to compare the lists and update the database. There still seem to be manual steps which I want to remove or reduce somehow.

I don't know php , but I figured it wouldn't be that hard to learn.

Edit: It was quite easy once I found the sandbox page for paypal and looked at the documentation and stuff there.

FSMC fucked around with this message at 00:11 on Jan 18, 2009

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply