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
duck monster
Dec 15, 2004

VerySolidSnake posted:

This is a really bad idea. You have to write everything from scratch, opening up the potential of security holes and exploits. Frameworks have teams of people testing these things all the time, something Uncle Joe's PHP Framework will lack. Also, you are going to have to think of every possible way you might want to expand this thing, as you can accidentally put your entire site in handcuffs with a bad design decision early on. I did this "roll your own" thing on 3 websites, and I regretted it after spending the time to learn Yii.
Relying on the dude who originated PHP for advice is just inviting dark counsel. This is the man that designed a language that allowed such horrors as;-

/index.php?id=5

$SQL = "SELECT * FROM TABLE WHERE id= ".$id;

PHP isn't quite the cosmic horror it once was, but that doesn't change the fact that this dude was responsible for the terrible hell early php represented.

duck monster fucked around with this message at 15:02 on Dec 24, 2011

Adbot
ADBOT LOVES YOU

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

DarkLotus posted:

Let's say I have more than 2 arrays of supposedly unique values. How would I go about finding out if any one value in an array exists in the rest of the arrays? I am looking for a fairly fast way to do this without having to loop through each array manually and see if the value exists in any of the other arrays. To clarify, I'm hoping to avoid using in_array(), I'm also only interested in the whether "user" is duplicated.

rough example:
php:
<?
array (
    0 => array ('user' => 'jdoe','email' => NULL,),
    1 => array ('user' => 'tsmith','email' => 'tomsmith@gmail.com')
)

array (
    0 => array ('user' => 'pmcallister','email' => 'pmc@test.com'),
    1 => array ('user' => 'nnancy','email' => 'nnancy@gmail.com')
)

array (
    0 => array ('user' => 'jdoe','email' => 'jdoe@pmail.com'),
    1 => array ('user' => 'griviera','email' => 'george@poop.com')
)

array (
    0 => array ('user' => 'rmurphy','email' => 'rachel@murphygroup.com'),
    1 => array ('user' => 'nnancy','email' => 'nnancy@gmail.com')
)
?>
You can see a couple of the users are duplicated.

I'm not sure what the most computationally-efficient way of doing this is. Maybe something like the following would be worth trying.

code:
        // Assume that the individual arrays are found in $my_list_of_arrays.
    $my_check_array = array();
    $value_count = 0;
    foreach ($my_list_of_arrays as $my_array) {
        foreach ($my_array as $value) {
            $my_check_array[$value['user']] = null;
        }
    }
    $unique_value_count = count($my_check_array);
        // $value_count should be the same as $unique_value_count
        // provided the 'user' values are all different

DarkLotus
Sep 30, 2001

Lithium Hosting
Personal, Reseller & VPS Hosting
30-day no risk Free Trial &
90-days Money Back Guarantee!

Hammerite posted:

I'm not sure what the most computationally-efficient way of doing this is. Maybe something like the following would be worth trying.

code:
        // Assume that the individual arrays are found in $my_list_of_arrays.
    $my_check_array = array();
    $value_count = 0;
    foreach ($my_list_of_arrays as $my_array) {
        foreach ($my_array as $value) {
            $my_check_array[$value['user']] = null;
        }
    }
    $unique_value_count = count($my_check_array);
        // $value_count should be the same as $unique_value_count
        // provided the 'user' values are all different
I'm essentially wanting to print a list of the user accounts that are duplicated and reference which arrays they exist in along with all of the corresponding details tied to that user.

MrMoo
Sep 14, 2000

McGlockenshire posted:

Anything cryptography-related can be dramatically slower in Windows due to how OpenSSL (doesn't) use Windows' built in crypto facilities.

How is this a logical statement unless you have hardware crypto acceleration that isn't available via direct assembler?

McGlockenshire
Dec 16, 2005

GOLLOCKS!
Wow, that was a while ago.

I was referring to the fact that on Windows, the PHP OpenSSL extension's randomness generator is the worst, slowest possible choice. Various bugs were filed a few years ago.

I believe they corrected the stupid calls in one of the 5.3.x releases.

Masked Pumpkin
May 10, 2008
So I'm working on a database project which involves multiple calls to a database to fetch (reasonably small) amounts of data at a time. Since a lot of these calls can become repetitive, is it not faster to load the data into arrays in PHP and then query those arrays before reverting back to the database for additional information? In addition, what is the best way to time the speed of execution for PHP? It'd be useful to see for myself where I might be able to make things tick a little faster.

Impotence
Nov 8, 2010
Lipstick Apathy

Masked Pumpkin posted:

So I'm working on a database project which involves multiple calls to a database to fetch (reasonably small) amounts of data at a time. Since a lot of these calls can become repetitive, is it not faster to load the data into arrays in PHP and then query those arrays before reverting back to the database for additional information? In addition, what is the best way to time the speed of execution for PHP? It'd be useful to see for myself where I might be able to make things tick a little faster.

What exactly is this fetching? Why not nosql, memcached, or any of those?

Captain Briney
Jan 5, 2009

This is my life partner and crappy upholstery.
I'm just learning PHP, and I'm having the most difficult problem with two scripts working together.

What I'm building is two forms that gather data. It's designed to be put up on a laptop or iPad at an event/con that we have so guests can fill out their user information.

What I currently have is the first form that we fill out, saying who we are and where we are for our records. Then, once that information is submitted, it passes it on to the second form that gathers name, address, etc. The second script then combines information from the first form and second form and puts them together and inserts them into a MySQL database.

Once the first form is done, it should redirect to the second form, which, upon submit, should reset and be ready for the next data entry.

I have the second form working perfectly, and it inserts data wonderfully. The problem I am having is getting the second script to read from the first script.

For clarity, I have a total of four files, two XHTML form files that post to the two PHP scripts that won't communicate.

I have tried using cookies, which didn't work at all. I tried importing the first script in the second script which also didn't work. I thought about using GET, but the problem with get statements is that it would pass from the first script to the second script and skip over the second XHTML form.

I'm kind of stuck here.. what should I try next?

DarkLotus
Sep 30, 2001

Lithium Hosting
Personal, Reseller & VPS Hosting
30-day no risk Free Trial &
90-days Money Back Guarantee!

Captain Briney posted:

I'm just learning PHP, and I'm having the most difficult problem with two scripts working together.

What I'm building is two forms that gather data. It's designed to be put up on a laptop or iPad at an event/con that we have so guests can fill out their user information.

What I currently have is the first form that we fill out, saying who we are and where we are for our records. Then, once that information is submitted, it passes it on to the second form that gathers name, address, etc. The second script then combines information from the first form and second form and puts them together and inserts them into a MySQL database.

Once the first form is done, it should redirect to the second form, which, upon submit, should reset and be ready for the next data entry.

I have the second form working perfectly, and it inserts data wonderfully. The problem I am having is getting the second script to read from the first script.

For clarity, I have a total of four files, two XHTML form files that post to the two PHP scripts that won't communicate.

I have tried using cookies, which didn't work at all. I tried importing the first script in the second script which also didn't work. I thought about using GET, but the problem with get statements is that it would pass from the first script to the second script and skip over the second XHTML form.

I'm kind of stuck here.. what should I try next?
You could use sessions or cookies to store the values from the first form. Either way, don't want anyone inputting data to be able to go back to the first form.

Maybe your first form can insert data into the database and you can then call the second form with a variable like ?eventid=123 which will link the submission of the second form to the event or whatever.

Captain Briney
Jan 5, 2009

This is my life partner and crappy upholstery.
edit:

Nevermind! Superglobals! Duh!

Captain Briney fucked around with this message at 06:18 on Dec 27, 2011

Acer Pilot
Feb 17, 2007
put the 'the' in therapist

:dukedog:

You probably shouldn't be using globals...

Null Set
Nov 5, 2007

the dog represents disdain

Captain Briney posted:

edit:

Nevermind! Superglobals! Duh!

Don't do this.

Honestly, for something like this where you don't have much PHP experience, and it's going to be running on a laptop at a show, I'd set up a google form (http://www.google.com/google-d-s/forms/).

After the show, export the spreadsheet from google docs to a csv, and dump it into the SQL database.

Another option is to create a session table in your DB, serialize the data into a row in the DB, and pass back the session ID. Have them submit the additional data, combine it with what you've stored in the session DB, and only then commit the data as one transaction. Then, send a response to the client showing success, and destroy the session. I'd also destroy any existing sessions from the client machine when they first load the form.

That way, you're not risking a client being able to get at someone else's personal info or incomplete data, especially if this is going to be on a publicly accessible site.

DarkLotus's suggestion would work as well, but you'd need to make sure you couldn't put in an arbitrary eventid to get anyone's data. Plus, if the customer walks away or stops entering data, you'll have an incomplete record- better to commit all at once at the end.

McGlockenshire
Dec 16, 2005

GOLLOCKS!

Null Set posted:

Another option is to create a session table in your DB, serialize the data into a row in the DB, and pass back the session ID.

There is zero advantage to doing this compared to just storing the data in the session on disk.

Captain Briney
Jan 5, 2009

This is my life partner and crappy upholstery.

Null Set posted:

Don't do this.

Honestly, for something like this where you don't have much PHP experience, and it's going to be running on a laptop at a show, I'd set up a google form (http://www.google.com/google-d-s/forms/).

After the show, export the spreadsheet from google docs to a csv, and dump it into the SQL database.

Another option is to create a session table in your DB, serialize the data into a row in the DB, and pass back the session ID. Have them submit the additional data, combine it with what you've stored in the session DB, and only then commit the data as one transaction. Then, send a response to the client showing success, and destroy the session. I'd also destroy any existing sessions from the client machine when they first load the form.

That way, you're not risking a client being able to get at someone else's personal info or incomplete data, especially if this is going to be on a publicly accessible site.

DarkLotus's suggestion would work as well, but you'd need to make sure you couldn't put in an arbitrary eventid to get anyone's data. Plus, if the customer walks away or stops entering data, you'll have an incomplete record- better to commit all at once at the end.

Thanks for this. I realized last night that using superglobals was a really stupid idea because of that exact reason. I'm still somewhat stuck, but I will try this serializing idea.

Orbis Tertius
Feb 13, 2007

Masked Pumpkin posted:

So I'm working on a database project which involves multiple calls to a database to fetch (reasonably small) amounts of data at a time. Since a lot of these calls can become repetitive, is it not faster to load the data into arrays in PHP and then query those arrays before reverting back to the database for additional information? In addition, what is the best way to time the speed of execution for PHP? It'd be useful to see for myself where I might be able to make things tick a little faster.

What database are you using?

If you're working with a single script that queries/operates on some database data within the scope of a single request, then you should absolutely use arrays/objects (however you're storing the queried data), rather than re-querying the database at different points in the script. If you're using MySQL, the Query Cache is pretty simple to configure, and if your application is performing similar SELECT queries during every request it can speed things up a good deal.

As far as measuring execution time, look at the examples and comments here. Googling turned up this, which looks alright.

Orbis Tertius fucked around with this message at 02:02 on Dec 28, 2011

Null Set
Nov 5, 2007

the dog represents disdain

McGlockenshire posted:

There is zero advantage to doing this compared to just storing the data in the session on disk.

I'd say there is- it becomes much easier to control who can retrieve what session data. Much easier to (for example) query for a session ID and IP/user id bound to it, than to try looking for a flat file with all that encoded into the filename.

And if you're passing the filename back and forth, or parameters to fetch it- modify those parameters and whoops I have your session.

I don't see the point in creating a bunch of flat files for data storage; what exactly makes you say there is no advantage in making use of the DB? Or is there another secure way of doing this that I'm overlooking?

Scaramouche
Mar 26, 2001

SPACE FACE! SPACE FACE!

DarkLotus posted:

I'm essentially wanting to print a list of the user accounts that are duplicated and reference which arrays they exist in along with all of the corresponding details tied to that user.

Hammerite's solution is right, the real question for you is going to be how much work do you want to put into making it algorithmically efficient. If the list count is low then I wouldn't bother, but otherwise you're entering the exciting new world of sort and search algorithms!!!
http://www.sorting-algorithms.com/

DarkLotus
Sep 30, 2001

Lithium Hosting
Personal, Reseller & VPS Hosting
30-day no risk Free Trial &
90-days Money Back Guarantee!

Scaramouche posted:

Hammerite's solution is right, the real question for you is going to be how much work do you want to put into making it algorithmically efficient. If the list count is low then I wouldn't bother, but otherwise you're entering the exciting new world of sort and search algorithms!!!
http://www.sorting-algorithms.com/

Yeah, I knew it wouldn't be easy...

McGlockenshire
Dec 16, 2005

GOLLOCKS!

Null Set posted:

I'd say there is- it becomes much easier to control who can retrieve what session data. Much easier to (for example) query for a session ID and IP/user id bound to it, than to try looking for a flat file with all that encoded into the filename.

And if you're passing the filename back and forth, or parameters to fetch it- modify those parameters and whoops I have your session.

I don't see the point in creating a bunch of flat files for data storage; what exactly makes you say there is no advantage in making use of the DB? Or is there another secure way of doing this that I'm overlooking?

No, I mean, store temporary data IN the session. That is what it is there for.

Frozen Peach
Aug 25, 2004

garbage man from a garbage can
I'm having trouble with a prepared parameterized query in PHP and at this point I don't know what I'm doing wrong. It doesn't appear to be an SQL issue (I already posted in the SQL thread assuming my SQL itself was wrong somehow) so it's either PHP or our Database class in PHP.

We use ODBTP (http://odbtp.sourceforge.net/phpext-index.html) to connect to our SQL database, and our database class wraps the ODBTP functions to make them slightly easier to call (Hence prepare instead of odbtp_prepare)

code:
$strSQL = "UPDATE titles SET shipped = 1, specificpurchase = 1 WHERE campaignid = ? AND titleno = ?";

$qry = $db->prepare($strSQL);
$db->input($qry, 1, ODB_INT);
$db->input($qry, 2, ODB_CHAR);
$db->set($qry, 1, $campaignID);
$db->set($qry, 2, $titleNo);
$result = $db->execute($qry);

$strSQL = 'UPDATE campaigns SET fundsspent = fundsspent + price FROM campaigns LEFT OUTER JOIN titles ON campaignid = id AND titleno = ? WHERE id = ?';

$qry = $db->prepare($strSQL);
$db->input($qry, 1, ODB_CHAR);
$db->input($qry, 2, ODB_INT);
$db->set($qry, 1, $titleNo);
$db->set($qry, 2, $campaignID);
$result = $db->execute($qry);
The first query works with no problem. The second refuses to work spitting out a few errors:

[ODBTP][1]Parameter must be described (one for each $db->input)
[ODBTP][1]Unbound parameter (one for each $db->set)
[07002][0][Microsoft][ODBC SQL Server Driver]COUNT field incorrect or syntax error (when $db->execute is called)

Originally I thought maybe I just couldn't use parameters as part of a join statement, but moving "AND titleno = ?" to after the "WHERE id= ?" doesn't work either. Maybe SQL prepared/parameterized queries just don't like joins as part of an update at all?

It works fine if I build the queries by hand rather than using parameters. I'm completely baffled here. :(

Captain Greed
Mar 12, 2010
I know next to nothing about php, but I'm currently trying to set up a board using phpbb premod and the phpbb_seo mod. I've done .htmaccess and everything. I'm hoping there's someone here who might have used this.

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

Captain Greed posted:

I know next to nothing about php, but I'm currently trying to set up a board using phpbb premod and the phpbb_seo mod. I've done .htmaccess and everything. I'm hoping there's someone here who might have used this.

I've installed PHPBB before (some time ago) but I do not recall running into any real difficulties. It pretty much does it all for you and tells you what you need to do at each stage. What in particular do you need help with?

Captain Greed
Mar 12, 2010
I've set up phpbb itself before--it's the phpbb_seo mod that's screwing me up. It rewrites URLs for SEO friendliness, though I'm using it to make it easier to human read URLs. I can get topic rewriting to work, but not forum or user profile rewriting. Rather, they work, but when I click it takes me to a 404. Vagaries of the mod instead of phpbb itself.

Phatzilla
Aug 4, 2007

by Y Kant Ozma Post
I'm not sure if this is totally PHP related, but i think the script im looking for is usually coded in PHP.

I'm basically looking for a script that allows user-accounts and the purchasing of credits (usually through paypal) and being able to redeem said credits for various services. Anyone know what im talking about here?

stoops
Jun 11, 2001
I'm a novice in php, but I'm in a situation where I'm having to deal with php and a cake framework. I'm pressed for time, but I find it hard going thru tutorials etc, getting up to speed.

I'm trying to parse an element. Right now, every table shows up with a div id of

code:
id="div-node-<?php echo $rowCount?> 
When it renders in html, each div has it's own row count number, 1, 2, 3, so on.

I need to parse that id element to get the row number, so then I can use that row number to get info from a database.

Any help or point in the right direction is appreciated.

Sab669
Sep 24, 2009

I'm a pretty big novice as well, just spitballing here but can't you just make a DOMDocument and use getElementById to search for the ID of whatever element that is?

e; I've never actually used it before, but generally reading the php reference manual it seems like that'd be what you want.

Sab669 fucked around with this message at 17:28 on Jan 5, 2012

Optimus Prime Ribs
Jul 25, 2007

I don't think I fully understand precisely what it is you're trying to do, but this library might be what you're looking for: http://simplehtmldom.sourceforge.net/

qntm
Jun 17, 2009

stoops posted:

I'm a novice in php, but I'm in a situation where I'm having to deal with php and a cake framework. I'm pressed for time, but I find it hard going thru tutorials etc, getting up to speed.

I'm trying to parse an element. Right now, every table shows up with a div id of

code:
id="div-node-<?php echo $rowCount?> 
When it renders in html, each div has it's own row count number, 1, 2, 3, so on.

I need to parse that id element to get the row number, so then I can use that row number to get info from a database.

Any help or point in the right direction is appreciated.

Are you trying to parse your own PHP-generated HTML using more PHP?

mewse
May 2, 2006

qntm posted:

Are you trying to parse your own PHP-generated HTML using more PHP?

that's what it sounds like to me. seems like he is fighting the framework rather than writing decent code

fletcher
Jun 27, 2003

ken park is my favorite movie

Cybernetic Crumb

stoops posted:

I'm a novice in php, but I'm in a situation where I'm having to deal with php and a cake framework. I'm pressed for time, but I find it hard going thru tutorials etc, getting up to speed.

I'm trying to parse an element. Right now, every table shows up with a div id of

code:
id="div-node-<?php echo $rowCount?> 
When it renders in html, each div has it's own row count number, 1, 2, 3, so on.

I need to parse that id element to get the row number, so then I can use that row number to get info from a database.

Any help or point in the right direction is appreciated.

What's there to parse? You already have the row number, it's $rowCount.

stoops
Jun 11, 2001

fletcher posted:

What's there to parse? You already have the row number, it's $rowCount.

Hmmm. Sorry about this, I'm not explaining myself well.

I'll try to make a dummy example.

First page spits out Schools, alot of them. Every school is in its own div with number. Beside every school, i have a plus sign you can click on to get more specific data for the school.

When i click the plus sign, the specific school data is retrieved via ajax.

My problem is, I want to grab the element, "Div-node-NUMBER", and ONLY grab the NUMBER. With that number, I can then tie it to the specific school and grab only that data for that school when the ajax is called.

If I use the %rowCount? at the start, wouldn't that grab the data for every school right away?

Null Set
Nov 5, 2007

the dog represents disdain

stoops posted:

Hmmm. Sorry about this, I'm not explaining myself well.

I'll try to make a dummy example.

First page spits out Schools, alot of them. Every school is in its own div with number. Beside every school, i have a plus sign you can click on to get more specific data for the school.

When i click the plus sign, the specific school data is retrieved via ajax.

My problem is, I want to grab the element, "Div-node-NUMBER", and ONLY grab the NUMBER. With that number, I can then tie it to the specific school and grab only that data for that school when the ajax is called.

If I use the %rowCount? at the start, wouldn't that grab the data for every school right away?

So each school has its own plus button? Why do you need to grab the number from the div? Couldn't you just pass it in the onclick event that you call from the button?

edit: So your plus button would be something like
code:
<input type="button" onclick="doSomething(<?php echo $rowCount; ?>)"/>

Null Set fucked around with this message at 21:28 on Jan 5, 2012

Tad Naff
Jul 8, 2004

I told you you'd be sorry buying an emoticon, but no, you were hung over. Well look at you now. It's not catching on at all!
:backtowork:

stoops posted:

Hmmm. Sorry about this, I'm not explaining myself well.

I'll try to make a dummy example.

First page spits out Schools, alot of them. Every school is in its own div with number. Beside every school, i have a plus sign you can click on to get more specific data for the school.

When i click the plus sign, the specific school data is retrieved via ajax.

My problem is, I want to grab the element, "Div-node-NUMBER", and ONLY grab the NUMBER. With that number, I can then tie it to the specific school and grab only that data for that school when the ajax is called.

If I use the %rowCount? at the start, wouldn't that grab the data for every school right away?
eh... just don't use PHP for this. For the plus sign add an onclick event that snarfs the number then put that in the AJAX call. It'll depend on the HTML, but something like (if you have jQuery):
code:
<tr id="div-node-7">...blah...<td><a class="plus">+</a></td></tr>

<script>
$('.plus').click(function(){doAjax(this);});
function doAjax(elt){
  var id=$(elt).closest('tr').attr('id').replace('div-node-','');
  $.ajax(
    url,
    {data:{id:id}}
  );
}
</script>
ed: /\/\ or that's good too.

stoops
Jun 11, 2001
Thanks guys, I'm gonna try the jquery one.

Now I'm in a new problem, which I think should be fairly easy, but I dunno.

Every school has a certain number of Images associated with it.

I'm currently retrieving the data, and it shows as follows.

code:
[schoolImages] => Array
                (
                    [0] => /web/images/school/school1.png
                    [1] => /web/images/school/school1.png
                )

What I need to do is show that data in the form of images. Is it just a matter of doing a for loop?

BioEnchanted
Aug 9, 2011

He plays for the dreamers that forgot how to dream, and the lovers that forgot how to love.
This thread seems like the perfect place to ask. I'm trying to make a website using HTML, SQL and PHP that stores blog posts on a database to be shown on the home page. I'm using PHP because XML doesn't work well with google chrome. I've uploaded what I have so far to a hosting service called https://www.freehosting.com and I want to know where my code, or file locations are going wrong. I have a few visual aids here:


This is showing that even though it is trying to reference a database none are showing up in this tab:


This is the file 'structure' (where they are in relation to each other) on freehosting's server:




If this is too detailed, or if it should be in it's own thread please let me know, but the programs I use aren't telling me exactly what the problems are. For know the code should have printed the text "Test Post" at the top of the page (to make sure the connection works. Here's the link to the site itself:

http://gameperspective.freehosting.com/home.html

BioEnchanted fucked around with this message at 06:54 on Jan 7, 2012

McGlockenshire
Dec 16, 2005

GOLLOCKS!
PHP is only invoked when the file is named with the .php extension. PHP isn't parsed in .html files.

Your site's main page should also be called "index", not "home". Rename "home.html" to "index.php" and you will see things work.

Second, you just posted your password. You'll want to fix that.

Third, whatever resource you're using to learn PHP is teaching you to use the terrifying, decrepit mysql extension family of functions. They are effectively worst practice and you should not ever use them for new code, even as a newbie. Especially as a newbie. Throw away the thing that's teaching you to use those functions and never look at it again.

Instead, you'll want to learn how to use PDO to access databases.

Google for introduction to pdo and you'll find a few dozen worthwile introductory articles, most of which seem to not suck. Read'em all.

(Oh, and if your free hosting doesn't have PDO installed... well, it's worth what you're paying for it.)

mewse
May 2, 2006

McGlockenshire posted:

Second, you just posted your password. You'll want to fix that.

Did he? I just see ********

Bradzor
Mar 18, 2007
Fwhaa?

BioEnchanted posted:

This thread seems like the perfect place to ask. I'm trying to make a website using HTML, SQL and PHP that stores blog posts on a database to be shown on the home page. I'm using PHP because XML doesn't work well with google chrome. I've uploaded what I have so far to a hosting service called https://www.freehosting.com and I want to know where my code, or file locations are going wrong. I have a few visual aids here:

This is how the php code looks in chrome's f12 menu (resources tab):


This is in the elements tab:


This is showing that even though it is trying to reference a database none are showing up in this tab:


This is the file 'structure' (where they are in relation to each other) on freehosting's server:




If this is too detailed, or if it should be in it's own thread please let me know, but the programs I use aren't telling me exactly what the problems are. For know the code should have printed the text "Test Post" at the top of the page (to make sure the connection works. Here's the link to the site itself:

http://gameperspective.freehosting.com/home.html

First of all, that's not how databases work. You need to be running MySQL or something similar. They don't work if it's just an SQL file. And your PHP code isn't running at all, and read the posts above you. They'll help with the PHP issue, BRO

Null Set
Nov 5, 2007

the dog represents disdain
If you're trying to make a blog, why not just use Wordpress, or literally any other CMS?

Why are you doing this from scratch when the tools exist that do most of the heavy lifting for you, and won't result in your shoddily designed application getting rooted and destroyed?

Adbot
ADBOT LOVES YOU

MrMoo
Sep 14, 2000

Weeee, another refresh of PHP image hosting script. I'm sure these things always end up completely non-portable. It seems a fair bit of effort to create a nice phar based installer though, especially something to manage HTTPD configuration, etc.

HTML 5, drag & drop, multi-file upload, i18n, public or private hosting.

http://junko.hk/junko-php-2.0.tbz2

Requires PHP 5.2+ I think, Pear::Auth is probably a bigger problem for most, GD or ImageMagick works fine, uses Google CDN for jQuery.

Missing progress on HTTP downloads, probably a good target for something OTT like websockets. Not the best progress indicator on multi-file uploads, requires some thinking about. Limited informational error messaging.

No demo site as I don't have the disk space, sorry.

(edit) Looks like Chrome can breakpoint DOM changes so I've grab Picasaweb's progress indicators, also have some bijection code so will look at a non-DB based implementation. Bijection allows for shorter links.

MrMoo fucked around with this message at 05:46 on Jan 7, 2012

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