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
Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice
Excellent call on the thread.

PHP Frameworks:
what lots of us use is: CodeIgniter
A PHP5 only alternative: Kohana

Link to the CodeIgniter Thread

Adbot
ADBOT LOVES YOU

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Super 3 posted:

Dont have access to the php.ini over here.


More like a charting tool.

Essentially it's 12 stores that all have a sales goal, that I want to show via a progress bar/graph/visual thing.

code:
<div style="width:100px;border solid 1px #666;">
<?php
foreach($salesThing as $thing){
 echo '<div style="height:10px;width:'. $salesThing->percentTowardsGoal . 'px;background-color:#0f0;">&nbsp;</div>';
}
?>
</div>
Just make DIVs and width them based on the data. You can even use a fancy pants CSS background image for striping and whatnot.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

nbv4 posted:



...wound automatically scale each cell in the second row. As it is now, I'll have to go through each row in the SQL result, find the highest value, then on the second time around, divide each value by the largest value to get percentage.

Or you could add ' MAX(myValue) as theBiggest ' to your query and have it available in each row already....

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Kaluza-Klein posted:

I want to parse an html file. For example, say I want to know what is contained inside an <h1> tag. I can do this with strstr and substr but it is ugly.

If you are using PHP5, and your HTML is valid XML (which it might (probably?) not be) you can do it easily like so:

php:
<?
$xml = simplexml_load_file('myHTML.html');
echo $xml->h1;
?>
(Assuming there is only one H1 tag, otherwise $xml->h1 would return an array that you can loop over or just do $xml->h1[0] for the first, etc.)

Otherwise check out the DOM and XML methods in the manual, they are pretty self explanatory.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Gary the Llama posted:

I've just playing with CodeIgniter and have already ran into a problem. I'm trying to load a model from my controller and I'm getting this error:

code:
Fatal error: Class 'Test_model' not found in 
/nfsn/content/garythellama/public/system/libraries/Loader.php on line 177
It shouldn't even be looking in the system/libraries/Loader.php file, right?

My controllers are in the application/controllers folder.
The views are in the application/views folder.
And the models are in the application/models folder.

Any idea what's going wrong or why it's looking for Test_model in the Loader.php file?

The Loader.php file contains the code that is run when you do $this->load->whatever() so that is why it's showing you the error there. My guess is that there is an error in your Model that is keeping it form being run as a class.

Replace your code with this:
php:
<?
class Test_model extends Model {

    function Test_model() {
        parent::Model();
    }
}
?>
And see if it still errors. If so, you may not have configured CI correctly.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

chips posted:

Question about PDFs:

Is there a way to get an image of a particular page in a PDF? I'm interested in adding PDF thumbnails to a website, but can't find any capacity in PHP for reading PDFs rather than just writing them.

Google found this: http://www.webmasterworld.com/forum88/898.htm which has someone trying to do the same, and info on how to do it. Requires imagemagick, looks like.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Safety Shaun posted:

Without setting a cookie, session or global variable, I need to pass a variable from index.php to a PHP script included as an image.
eg
php:
<?
// index.php
global $inIndex = true;

[code]

<img src='showImage.php?param1=yay&param2=wee'>
?>
php:
<?
// showImage.php
global $inIndex;

if ($inIndex == true)
 { //show real image }
else
 { //show fuckoff.jpg }
?>

This is technically what you asked for :P
php:
<?
[code]
$inIndex = 'true';
echo "<img src='showImage.php?param1=yay&param2=wee&inIndex=$inIndex'>";
?>
php:
<?
// showImage.php
if ( isset($_GET['inIndex']) && $_GET['inIndex'] == 'true') {
 //show real image 
}else{
 //show fuckoff.jpg 
}
?>
But what you are actually asking to do requires sessions or database accesss (write IP and key to DB, pass image script key look it up, see if IP matches) I think.

Lumpy fucked around with this message at 03:33 on Apr 17, 2008

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Jimix posted:

For some reason I cannot remember how to do this, or at least I swear that I had to do this for that PHP class I took a few years back...

So we have a trouble ticket system at my work that is written in PHP, and they want me to add some fields to the form. They want something like:

php:
<?
echo "is this a new instance? <INPUT TYPE=CHECKBOX NAME=instance>";

//HOW THE gently caress DO YOU DO THIS PART
if (instance == checked) { 
    echo "more input fields";
    ...
}

echo "<input type=submit name=submit>";
?>
for the life of me I cannot figure out how to have the code dynamically check and see if that first checkbox is clicked and then shoot out some more HTML if so, or hide the new fields if the checkbox becomes unclicked. or maybe even if(checkbox), display one set of fields, else display another set.

If I am understanding you, you do not want PHP for this, you want javascript.

code:
<script>
function blah(){
var myVis = (document.getElementById("isNewBox").checked) ? "block" : "none";
document.getElementById("extraFields").style.display = myVis;
}
</script>
<input type="checkbox" id="isNewBox" onclick="blah()" checked="checked" />
<div id="extraFields">
  <input type="text" />
  [ add your other bonus fields here ]
</div>

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Zorilla posted:

Triple-equals signs always weird me out. Since we're evaluating the success/failure of a variable assignment, is your example the same as this?

php:
<?
$str = 'january is my favorite month';
if (!($i = strpos($str, 'january'))) echo "not found\n";
?>

No, because if you are at position 0, it can be evaluated as false, and your expression will return true, and you will see "not found"

Learn to love triple equals and it's pal !==

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

awdio posted:

I was using php code to check if a sent $_GET didn't come from outside of my website. Now I want to do the same thing with $_POST, and I expected the code to work for it, but it doesn't do anything inside the if statement if a $_POST occurred. I tested to make sure this was the case by echoing the sent $_POST outside of the if statement, which works.

Here's the code I used to validate a $_GET:

code:
<?php
if (strpos(strtolower($_SERVER['HTTP_REFERER']), 'mywebsite.com') !== false){
echo $_POST["sentVar"];
}
?>

Hmm, I'm stumped on that one, but as a quick check, try this:

php:
<?php
$tmp strpos(strtolower($_SERVER['HTTP_REFERER']), 'mywebsite.com');
echo "My test returned: ".$tmp;
if ($tmp !== false){
echo $_POST["sentVar"];
}else{
echo "Hey, my test failed! ".$_POST["sentVar"];
}
?>

Just to be 100% sure your test is correct, but by the looks of it it should be.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice
[edit] never mind. Didn't see the crazy "my script doesn't know what I am sending it" caveat.

Lumpy fucked around with this message at 02:58 on May 12, 2008

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Zorilla posted:

Then shouldn't it be like this?

php:
<?php
?>
<a href="/<?php echo $header?>">The Header!</a>
<?php
?>


Why would you put the top and bottom PHP tags in there? :)

I vote be really lazy:
code:
<?= "<a href='$header'>The Header!</a>";?>

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Hammerite posted:

I see, I guess if that could be a worry then I ought to go find out how to move the file containing database account information to a safe location. Thanks.

It's pretty easy.. if your web root is at /var/apache/htdocs/ for example, then store your important stuff in a new folder like /var/apache/hidden/ and then include of the full path to the files:

php:
<?
require_once('/var/apache/hidden/top_secret_db_info.php');
?>

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Hammerite posted:

So the include statement now reads

code:
include("../../DEF/commonthings.php");
It works and I'm assuming it's completely secure as there isn't any way to point my browser to DEF.

(obviously ABC, DEF, GHI stand in for the real names of these things)

The only "problem" with that is when you move your including page to a new level in the directory hierarchy. Then "../../" points somewhere else, and everything breaks. Try to use absolute paths as much as possible. But if it works for now, then you done good, and keeping passwords / usernames, etc. outside of web root is always a good thing, no matter how you go about doing it.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Zorilla posted:

It seems cheesy to hardcode the absolute path to files for one particular server. Is there a way to acquire the web server's DocumentRoot path so things can be easily moved from server to server?

php:
<?
$dr = $_SERVER['DOCUMENT_ROOT'];
?>
beaten, but slightly different =)

Lumpy fucked around with this message at 14:38 on Oct 14, 2008

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Sparta posted:

I have this:

I'm getting url to show up but not $host. I really just need $host. Any ideas as to why this isn't working?

Why don't you use $_SERVER['HTTP_HOST']; to get the host? No parsing required.

[EDIT] Try printing $purl with print_r($purl) and see if it's actually setting a host to see if it's the parsing or something else....

Lumpy fucked around with this message at 01:47 on Oct 15, 2008

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

I do not know much (read: anything) about parse_url. Could it be because it does not have 'http://' in front of it? If *none* of your url vars are going to have [url]http://[/url] in front of them, why not use explode() and then grab the first element of the resulting array?

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

J. Elliot Razorledgeball posted:

php:
<?

        print "---------"<br>\n";
?>
http://rulethepla.net/drawcards.php

Syntax error on that line.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

simcole posted:

I had a friend write me some code. I don't understand what -> does. Can someone link me an article and explain it?

Also is $this just a variable or a defined variable that means something special in php?



-> is the equivalent of the "." in most languages. An English translation would be " method or property of " an object.

$blah->talk(); is like "call the talk() method of the $blah object" and
echo $pie->flavor; is "echo the flavor property of the $pie object"

$this is a self-reference. If I have code inside an object, $this refers to the object said code is running in.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

H0TSauce posted:

Shouldn't you be escaping your php variables from the sql string?

$sql = "UPDATE `projects` SET 'ProjName' = {$name} WHERE `Key` = {$key123}";

or alternatively

$sql = "UPDATE `projects` SET 'ProjName' = ".$name." WHERE `Key` = ".$key123;

If it's inside double quotes, "simple" variables will be replaced. Complex ones (array values, object properties) would need to be escaped, but not here.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

fletcher posted:

Use PDO so you can just write nice clean SQL statements, and you never have to worry about escaping a variable again. (this needs to be in the OP, this comes up time and time again)

php:
<?
$query = $database->prepare("SELECT field FROM table WHERE other_field = :value");
$query->bindParam(":value", $whatever);
?>

I assume PDO cleans bound parameters of nasties, or must one still do that manually?

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Hammerite posted:


I get the error message

Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, object given in /(path to file excluded)/gamelistdisplay.php on line 36

I can't see what is wrong.

Can you indicate to us which line is line 36 in your code?

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Rsugar posted:

Hey, I'm developing the framework for a small php/flash combo game.
I'm currentley stuck, becuase I can't figure out how to make flash adhere to a php $_SESSION. Right now, I have something like this as my link from mysql -> php -> Flash.

php:
<?PHP
include "base.php";

if(!empty($_SESSION['LoggedIn']) && !empty($_SESSION['Username']))
{
$user $_SESSION['Username'];
$stats mysql_query("SELECT * FROM users WHERE Username='$user'") or die(mysql_error());
while($f mysql_fetch_array$stats )) { //Fetch User data from users table.
$col $f['Colony'];
// Open the file and erase the contents if any
$fp fopen("${user}.txt""w");
// Write the data to the file
fwrite($fp$col);
// Close the file
fclose($fp);
}
}
?>

The php file takes the $col var, transfers it to a text file named for the user
(I.E. rsugar.txt), and that text file is loaded into flash, where it is split up and transformed into a tiled map for colony/city management.

I need to have flash load the correct text file based on the the user using the flash app.

Does anyone know how to do this? I'm thinking it would be an addition to the php script, but I'm not sure.

Pass the session number (or username, or whatever) to Flash as a parameter when you embed the object. Then flash can use it as part of it's data requests.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Lankiveil posted:

What is the current cool framework to use for PHP? At the moment I'm playing with CodeIgniter, but I'm happy to jump ship if there's something better out there.

I'm a CodeIgniter guy, mainly because I started using it because I had a site that was still on PHP4. I really like it, and recommend it. I looked at Kohana ~6-8 months ago, but the documentation was very lacking back then. If they have improved that, and you are on PHP5, I would recommend it as well, as it is faster / more modern.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Chinaski posted:

As a follow up, I found a simple "suggestion" script on the server:


I modified the suggest.php file to include my own email address in the $to field and uploaded it to the directory I have access to, along with the HTML form. Unfortunately no email was generated.

I also tested the suggestion form as I found it on the intranet originally. So if I hear back from anyone I'll know if it's just me who can't send email.

Otherwise, I'll keep digging around and messing with it.

The script you have there assumes GLOBALS is on... which 99% of the time it isn't. You;ll need to extract the $message from the POST or GET (your form doesn't specify an action, so it whatever your server defaults to)

php:
<?
$message = $_POST['message'];
?>

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Emo.fm posted:

Just started with PHP, trying to write a form handler that will take some input from a POST form and write it to a text file. I can do the whole fopen, fwrite, fclose etc kind of thing when there's no form involved, but as soon as I use a form to execute the handler (even using the exact same code), I get permission denied. I know this isn't strictly a PHP question, but is there something about executing from a form instead of accessing the .php file directly that affects my file permissions? How can I get around this?

the error messages:

It's crapping out before it even gets to the POST bit, so it doesn't look like that's the problem. You are *sure* it works w/o the POST? It won't change if the page was just loaded, or if it was sent POST data.

Replace $_POST['song'] with "lolz" and see if you get the same error when you load the page.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Zorilla posted:


Since I don't really know for sure, can somebody more knowledgeable say how you would evaluate whether a variable assignment has succeeded or not based on whether or not $source is null? Would something like this work?
php:
<?php
while ( ($target $source) === true ) {
    // do stuff
}
?>


NULL is evaluated to FALSE, but your context there is a bit odd. The assignment of "something" to $target will be TRUE, even if it's NULL because there's no $source left. My guess (not knowing exactly what you are trying there) is you want foreach

php:
<?
foreach ($source as $value)
{
   // do stuff
}
?>
Some stuff on NULL and booleans: http://us3.php.net/NULL and http://us3.php.net/manual/en/language.types.boolean.php

Foreach: http://us3.php.net/manual/en/control-structures.foreach.php

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

awdio posted:

This is a mixed php/Actionscript 2/MySQL question. PHP is echoing back a variable queried from MySQL just fine, called $imageSourcesString. When gets the variable with loadVariables, it returns empty in Flash. If I redefine $imageSourcesString in php as $imageSourcesString="test"; its sent to Flash just fine.

Why can the original variable echo in php, but not be sent to Flash? I've tried adding quotes, characters around the original, etc. Say if I redefine it as $imageSourcesString="A".$imageSourcesString."A"; in Flash it shows up as "AA". I can see that $imageSourcesString echos in php perfectly alright as the image names. What the hell? Is $imageSourcesString not a proper string for Flash or something coming from MySQL?

It needs to be a URLecoded string... your problem seems odd though. Are you trying to output the string $myVar=A[$myvar's value]A as a result?

[EDIT] looks like you *can* use an "$" as the first char of a variable name in AS2, but I'm guessing the URLencoding is hosing it up still.

Lumpy fucked around with this message at 22:15 on Jan 7, 2009

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

awdio posted:

I guess the question I should be asking is: How do you pass a variable with GET from one page to another (or even the same page) and have Flash load that variable in? I'm just passing it with the same page, but I've also tried passing it to another page. PHP gets it. Flash does not. If I just make a non-POST or non-GET variable it passes to Flash fine.

If you think this normally should be done, try it out, because I'm starting to think it can't be done..

Edit: Its as if Flash is being loaded before the POST or GET vars.

I'm confused now.

Are you loading a page: blah.php?var=value And you want the flash that is embedded on the page to know that var = value?

Or you are using flash to send a request to a script after your page loads, and the return from the script is var=value and flash is unable to pick that up?

awdio posted:

I'd try WireShark, but I don't think there's a non-Intel Mac version.

open up terminal and use tcpdump

Lumpy fucked around with this message at 22:09 on Jan 9, 2009

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

awdio posted:

Works like this:

I click on a URL that goes back to itself with a variable attached like so:
http://pageurl.com/index.php?catNum=9

So when the page reloads, php sees that catNum is set, then does a mySQL query based on the catNum to form a variable to send to Flash - a list of images with a delimiter that Flash breaks down. The variable is called $imageSourcesString and is put into a hidden text field that Flash picks up with loadVariables.

For some reason this isn't working BUT if I ignore the GET on the page reload and just set $catNum to a number everything else works fine. i.e. $catNum=12 instead of $catNum=$_GET["catNum"]

Interestingly enough its not getting stuck until the Flash stage of things. PHP can still pick up the results of the image string based on the GET.

Can you give us a real URL. I think I know what your poblem is, but I can't be sure unless I see WTF.

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>

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 :(

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

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Tots posted:

This should be trivial for anyone with more programming experience than me...

php:
<?
        
echo "<hr> Please specify which file to display";
echo "<form action=\"index.php\" method=\"get\">";
echo "Name of file: <input type:=\"text\" name=\"fileToOpen\" />";
echo "<input type=\"submit\"/>";
echo "</form>";

if(isset($_GET['fileToOpen'))
{        
 $openMe = $_GET["fileToOpen"];
 if( $file = fopen("$openMe" , "r") ) // holy security hole!
 {
   echo "<center><table border=\"1\">";
   while (!feof($file))
   {
    echo "<tr><td>" . fgets($file) . "</td></tr>";
   }
   echo '</center></table> You have reached the end of the file<br />';
  fclose($file);
 }
 else
 {
   echo "no file";
 }
}
?>
I'll leave it to you to figure out why the way you are handling the file open is a huge security problem and to fix it.

[edit]\/ Yes, that is is. you can enter '/etc/passwd' in your form or something else as nefarious.

Lumpy fucked around with this message at 20:20 on Feb 20, 2009

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

TreFitty posted:

I'm learning PHP and was wondering: can you guys recommend any of the frameworks in the original post? I mean, does one completely outclass the other? Which is better for what? etc.

CodeIgniter. But as gibbed said, your needs will dictate what you use, because they all have strengths and weaknesses.

If you are just learning PHP, I'd suggest not using one for a while, until you notice you are writing the same bits of code (DB access, login handling, etc.) over and over. Then it's time to shop for a framework. Sure, you can walk into the dealership and buy a new car, but if you tinker with that old junker and get it running yourself, you'll know what's going on under the hood.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

KuruMonkey posted:

I'm not going to say you're wrong, Lumpy. But the other way to look at is that a framework can act like the stabiliser wheels on a bike while you learn to ride.


As I was typing up my reply, part of my brain was saying "yeah, but think of all the time you could have / would have saved had you started using one right away." I stuck with my guns though, because say you do use framework X to learn. Later on, you interview for a job that doesn't use one, or some hot chick wants you to fix her image gallery script for her pretty pony website, and will pay in sex but it doesn't use the framework you learned PHP on. You now have to spend the time learning stuff outside your comfort zone which can be harder once you've established a habit... "Wait, there's a *different* way to make DB connections other than $this->load->db() ???"

If you learn with training wheels, and there is no incentive to ever take them off, if somebody presents you with a new bike that doesn't have them, you may be baffled. I do see your point, and I don't think learning *with* a framework is bad by any means, but having the motivation to go outside of it and look through it's source and so forth would be essential in my opinion.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

gibbed posted:

And for the love of god use .php as the extension, not .inc, or at least .inc.php.

How will others learn from your mistakes if that can't view your raw, unparsed code via the web? :eek:

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

eHacked posted:

Hi, thanks, changing the constructor name seemed to work... would this have anything to do with the server I'm learning off of running php 4?

Yes. PHP4 doesn't do __constructor

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Dolemite posted:


For some reason, the div never shows/hides itself. It's like the DIV is not even there! But what is strange is that the script is clearly uploading my file. The file makes it to the PHP server and the file does appear on the FTP sever as well. So why is my DIV not showing up?

Any ideas why I can't make this div show up. I'm pulling my hair out here. I'd be finished already if it wasn't for this little snag!

Where is the javascript? If there is no javascript, well, there is your problem. I have no idea what you are trying to accomplish in that onclick, but it certainly isn't valid.

Adbot
ADBOT LOVES YOU

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

royallthefourth posted:

What is this called?
I use it fairly often and I'd really like to have a name for it.

"<<<"

php:
<?php
$s = <<< text
THIS IS A BUNCH OF TEXT

MY FORMATTING IS PRESERVED ACROSS LINES
text;
?>


heredoc

[edit] now with link! http://us2.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc

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