Omzy
-
Posts
314 -
Joined
-
Last visited
Never
Posts posted by Omzy
-
-
-
mattal - if I do that it won't work on the live server
micmania - i'm not sure how to use those functions in my scenario
-
I've got a localhost Apache server on my Windows machine
I want to be able to create multiple sites under http://localhost, so for example:
The problem with this is that relative URLs don't always work, for example if I have a have a common header file (header.php) which contains a reference to a stylesheet (<link rel="stylesheet" type="text/css" href="styles.css" />) and I include() header.php on all pages, it won't work for pages that are in a subfolder of that site, for example: http://localhost/site1/subfolder1/index.php
index.php includes header.php but the stylesheet reference points to the current folder, however styles.css is in the "root" of that site. If I change "styles.css" to "/styles.css" it looks in the root of "localhost" rather than the root of the site.
So is there any way to specify in Apache/PHP what the base path of the site should be? I've tried "RewriteBase" in .htaccess but that doesn't quite work..
-
So let's say I have the following:
TABLE properties
id: 001
prop_vebraid: prop001
TABLE images
id: 101
image_url: http://i.com/i1.jpg
prop_vebraid: prop001
id: 102
image_url: http://i.com/i2.jpg
prop_vebraid: prop001
id: 103
image_url: http://i.com/i3.jpg
prop_vebraid: prop001
So for properties.prop_vebraid prop001 it needs to retrieve those 3 rows in images
-
Here is my database structure (simplified):
TABLE properties
id (PK, INT, AUTO INC)
prop_vebraid (INT)
TABLE images
id (PK, INT, AUTO INC)
image_url (VARCHAR)
prop_vebraid (INT)
I am using MySQL database with MyISAM format, which is why I don't have any foreign keys in the database.
I want to retrieve images.image_url where images.prop_vebraid = properties.prop_vebraid
But I'm having difficulty doing this. I'm not getting the desired results.
Does anyone have any idea how I can do this and output the image url on each match? images.prop_vebraid is not unique by the way.
I think I need some sort of inner join?
-
I forgot to mention, I need this to work on both localhost and live server. The stylesheet url isn't the only one, it's for all url's on the page..
-
Did you actually look at the link I gave earlier?
Yeah, I did.
Do you have a specific reason to want to use http://localhost/mysite rather than simply http://mysite/?
I just prefer it that way.
-
I meant in the root of "mysite", i.e:
C:/apache/web sites/mysite/
-
styles.css is in the root.
I want to be able to access all my sites by navigating to their folder under localhost, for example: http://localhost/mysite
-
I am running Apache on Windows. My DocumentRoot is:
C:/apache/web sites
The site is at:
C:/apache/web sites/mysite/index.php
In index.php there is a common include file (header.php) with a stylesheet link as follows:
<link rel="stylesheet" type="text/css" href="styles.css" />
So far so good. But I have a directory within "mysite":
C:/apache/web sites/mysite/advertising/index.php
Again in index.php there is the include file, but obviously the style sheet reference is pointing to the current folder.
I tried changing the path of the stylesheet link to "/styles.css" and "../styles.css" but this obviously will give the root file an invalid path.
How can I satisfy both conditions? Do I have to specify a RewriteBase or something?
-
Using a framework is exactly what I DON'T want to do.
All I want to do is apply the concepts of MVC to my current applications. These applications are not massive, they are relatively small. A framework comes with far too much baggage and is too much overkill, so I'd rather just code my own functions.
For example my current site is handcoded with PHP and XHTML all in the same file, there is no separation of business logic and presentation logic whatsoever. But the whole site consists of only 16 PHP files in total. I know once I start MVCing my site I will probably end up with 3x more files than I currently have but that's not as bad as implementing a framework which consists of hundreds of files (the majority of which I'll probably never use). I know frameworks do have their advantages and are designed as a "one for all" solution but I'd rather just code exactly what I need to myself!
-
I'm not after a framework, all I want to see is some sample code which I can understand and build upon to create a fully featured MVC form. Can anyone else help?
-
I understand the concept, I just want to see it in practice, i.e. a form based on MVC (as described above)
-
I'm looking to rewrite all my forms using the MVC concept, I've tried searching Google for help on this but there isn't anything useful/relevant!
So let's suppose I want to create a simple form with fields login and password. These fields also need to be validated. Can someone give me a BASIC idea of how the code should be written, using the MVC concept.
Regards.
-
I find it odd that PHP needs 3 different values (1 of which has to be hardcoded) to output the full URL of the page it's displaying from the server! Surely there's got to be a simpler method?
-
Well this is it - I'm not doing a "full" integration - PayPal does indeed send back notifications but it's a b*tch to implement and not worth the hassle when all I want to do is clear the session! That's why I'm trying to do it the easy way - but evidently it does not seem to be any easier!
-
It's pretty much straightforward I would have thought?
cart.php is a shopping cart, as the filename would suggest. When the user is happy with the contents of the cart they can hit "Checkout Now" which is a submit button linked to a form which posts the SESSION variables to PayPal. The PayPal screen opens in the same window.
All I want is for the SESSION to be destroyed if the user submits the form. If they don't submit the form then everything stays as it is!
-
"You need to track whether the form is submitted"
Well this is it you see, how would I do that if the form is going to a different page?
-
Will that work though? Because the form will have been submitted to a different page.
-
OK but I only want the session to be destroyed IF the form is submitted by the user, not when it is displayed.
-
cart.php:
echo '<form action="https://www.paypal.com/cgi-bin/webscr" method="post">'; foreach($_SESSION as $index => $value) { echo '<input type="hidden" name="'.$index.'" value="'.$value.'" />'; } echo '<input type="submit" value="Checkout Now" /></form>';
I want the $_SESSION to be emptied/destroyed once the form has been submitted.
-
Ah wicked, that's worked! So now can you tell me how I can remove those redundant keys/values from $_POST?
-
Cheers Daniel0, I've tried using array_push to add the combined value to the end of the array, but it doesn't seem to work:
array_push($_POST['DOB'],"".$_POST['Day']."-".$_POST['Month']."-".$_POST['Year']."");
-
I have a form which captures customer's details, such as Name, Address, Date of Birth, etc, and then displays them back to the user (and sends me an email with the details) upon submission, as follows:
foreach($_POST as $key => $value) { echo "$key : $value"; }
This works fine for me, but I have now split up the Date of Birth field into 3 seperate fields - Day, Month, Year. But I still want it to be output as one field (Date of Birth) at the end.
Because I'm outputting $_POST this is proving to be difficult. Can anyone help?
[SOLVED] Storing and sanitising passwords
in PHP Coding Help
Posted
isn't there a new filter_var method that will auto-sanitize input for you?