Jump to content

vajra_hendry

Members
  • Posts

    22
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Male
  • Location
    Singapore

vajra_hendry's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Screwps!! I might have found the answer : http://sg2.php.net/getimagesize What an ass I am for not researching enough first before posting!
  2. Hi Guys, Quick question in regards to upload restrictions. I have a site that allows clients to upload banners. It forms some simple checks like : if(!ereg("image",$_FILES['pix']['type'])) { echo "<b>Please only upload image files</b><br>"; } What I could really do with now is a line that checks the dimentions of the image. Basically I dont want anyone to be able to upload an image LARGER than say 125 x 125 pixels. Anyone know if this can easily be done? Much Appreciated Thanks
  3. This may sounds overly simple. However I have looked his up in my CSS book, and looked at severla websites. My problem is that I want to center an image on my page (well center the image within its containing block). I would normally just use Absolute or Relative positioning, however the Banner that im trying to align is an images thats passed from PHP so its different everytime!! COuld be like 125x125 pixles or it might be 468 x 60 pixels. So whatever the image is , I need CSS to just align is Center!! Any ideas please?! Thanks
  4. Well I found out the answer. I just needed to change the slash from : <link rel="stylesheet" type="text/css" href="css\layout.css" media="all" /> To : <link rel="stylesheet" type="text/css" href="css/layout.css" media="all" /> Now I notice that the differnet browsers view the positioning of object quite differently!! JOY !! Well hope this helps somone anyway.
  5. Hi Guys, Simple one here I expect! I have written some pages and used CSS to do the styling, they work well in IE (v7). Thought I'd see how they render in Netscape (beta 9b.3) and Mozilla (2.0.0.6) Here is the Link to the CSS : <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <HTML> <head> <title></title> <link rel="stylesheet" type="text/css" href="css\layout.css" media="all" /> </head> err any ideas? The CSS does isnt being used, as all the graphics just line up!! Its a mess !! haha Thanks a lot
  6. Well ok thanks so much for helping with this one! Got there in the end. This was the solution that fixed it : <?php session_start(); if (!isset($_SESSION['duration'])) { $_SESSION['duration'] = "Some Text"; } if (!isset($_SESSION['banner'])) { $_SESSION['banner'] = $_POST['banner']; } if (!isset($_SESSION['price'])) { $_SESSION['price'] = $_POST['price']; } $duration = $_SESSION['duration']; $banner = $_SESSION['banner']; $price = $_SESSION['price']; ?> Once I had set the session varaibles in this way at the top of the page a they were visable from other PHP scripts. Sorry to be such a dam noob. gotta start somewhere huh. Hope this is vaguely helpful for others
  7. I think I broke the house rules and posted the whole script in. Hence I didnt get an answer! Fair play. So this is the form as requested : <TR> <TD> <FORM ACTION="steptwo.php" METHOD="POST"> <INPUT TYPE="HIDDEN" NAME="duration" VALUE=3> <INPUT TYPE="HIDDEN" NAME="banner" VALUE="120 x 240 Pixels"> <INPUT TYPE="HIDDEN" NAME="price" VALUE=17> <INPUT TYPE="image" SRC="images/Paypal/17.jpg" ALT="SUBMIT!"> </FORM> </td> <td> <FORM ACTION="steptwo.php" METHOD="POST"> <INPUT TYPE="HIDDEN" NAME="duration" VALUE=7> <INPUT TYPE="HIDDEN" NAME="banner" VALUE="120 x 240 Pixels"> <INPUT TYPE="HIDDEN" NAME="price" VALUE=27> <INPUT TYPE="image" SRC="images/Paypal/27.jpg" ALT="SUBMIT!"> </FORM> </td> <td> <FORM ACTION="steptwo.php" METHOD="POST"> <INPUT TYPE="HIDDEN" NAME="duration" VALUE=14> <INPUT TYPE="HIDDEN" NAME="banner" VALUE="120 x 240 Pixels"> <INPUT TYPE="HIDDEN" NAME="price" VALUE=47> <INPUT TYPE="image" SRC="images/Paypal/47.jpg" ALT="SUBMIT!"> </FORM> </td> <td> <FORM ACTION="steptwo.php" METHOD="POST"> <INPUT TYPE="HIDDEN" NAME="duration" VALUE=28> <INPUT TYPE="HIDDEN" NAME="banner" VALUE="120 x 240 Pixels"> <INPUT TYPE="HIDDEN" NAME="price" VALUE=107> <INPUT TYPE="image" SRC="images/Paypal/107.jpg" ALT="SUBMIT!"> </FORM> </td> </tr>
  8. OMG im tired and I Posted the wrong code. My appologies. Perhaps its clearer if I post the the scripts in order. There are 4 files : Stepone.php Steptwo.php Uploader.inc Review.php All I want is for varibles posted from the form in Stepone.php to be available in the subsequent php files right down the review.php stepone.php <?php session_start(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Payments Page</title> <link rel="stylesheet" href="css\payments.css"> </head> <body> <div id="steps"> <UL> <li><Strong>Step One :</strong> <ul><li>Select Duration</ul> <li><Strong>Step Two :</strong> <ul><li>Upload Banner</ul> <li><Strong>step Three:</strong> <ul><li>Review,</ul> <li><Strong>Step Four:</strong> <ul><li>pay</ul></UL></div> <div id="process"> To benefit from huge traffic to your site, please follow these four simple steps.<br> Once your order is recieved we can have your advert online in no time at all</div> <div id="logo"> <img src="images/lts2_logo.gif"></div> <div id="content"> <p> Thanks for choosing to advertise with **DOMAIN NAME** You will see significant increases in traffic to your site! Just completel these simple steps:</P> <img src="images/your_advert120x240.gif"> <div id="table"> <Table align="center" border="0"> <Caption>Select Duration of Advert</caption> <TR> <th> 3 Days </th> <th> 7 Days </th> <th> 14 Days </th> <th> 28 Days </th> </tr> <TR> <TD> <FORM ACTION="steptwo.php" METHOD="POST"> <INPUT TYPE="HIDDEN" NAME="duration" VALUE=3> <INPUT TYPE="HIDDEN" NAME="banner" VALUE="120 x 240 Pixels"> <INPUT TYPE="HIDDEN" NAME="price" VALUE=17> <INPUT TYPE="image" SRC="images/Paypal/17.jpg" ALT="SUBMIT!"> </FORM> </td> <td> <FORM ACTION="steptwo.php" METHOD="POST"> <INPUT TYPE="HIDDEN" NAME="duration" VALUE=7> <INPUT TYPE="HIDDEN" NAME="banner" VALUE="120 x 240 Pixels"> <INPUT TYPE="HIDDEN" NAME="price" VALUE=27> <INPUT TYPE="image" SRC="images/Paypal/27.jpg" ALT="SUBMIT!"> </FORM> </td> <td> <FORM ACTION="steptwo.php" METHOD="POST"> <INPUT TYPE="HIDDEN" NAME="duration" VALUE=14> <INPUT TYPE="HIDDEN" NAME="banner" VALUE="120 x 240 Pixels"> <INPUT TYPE="HIDDEN" NAME="price" VALUE=47> <INPUT TYPE="image" SRC="images/Paypal/47.jpg" ALT="SUBMIT!"> </FORM> </td> <td> <FORM ACTION="steptwo.php" METHOD="POST"> <INPUT TYPE="HIDDEN" NAME="duration" VALUE=28> <INPUT TYPE="HIDDEN" NAME="banner" VALUE="120 x 240 Pixels"> <INPUT TYPE="HIDDEN" NAME="price" VALUE=107> <INPUT TYPE="image" SRC="images/Paypal/107.jpg" ALT="SUBMIT!"> </FORM> </td> </tr> </body> </html> steptwo.php <?php session_start(); $_SESSION['duration'] = "Some Text";/* $_POST['duration']; */ $_SESSION['banner'] = $_POST['banner']; $_SESSION['price'] = $_POST['price']; $duration = $_SESSION['duration']; $banner = $_SESSION['banner']; $price = $_SESSION['price']; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Payments</title> <link rel="stylesheet" href="css\payments.css"> </head> <body> <div id="logo"> <img src="images/lts2_logo.gif"></div> <p>You have selected the following :</p> <div id="UL1"> <UL> <LI>To advertise with a <?php echo "$banner"; ?> banner <LI>To advertise for <?php echo "$duration"; ?> days <LI>This will cost $<?php echo "$price";?></UL></div> <?php print_r($_SESSION); ?> <p>Now all you need to do is upload your banner and we will put it online for you</P> <?php if(!isset($_POST['upload'])) { include("uploader.inc"); } else { if($_FILES['pix']['temp_name'] == "none") { echo "<b>File didnt upload. Deal with it k<br>"; include("uploader.inc"); exit(); } if(!ereg("image",$_FILES['pix']['type'])) { echo "<b>Hey you muppet only upload pics ok. Jesus man</b><br>"; include("uploader.inc"); exit(); } else { $destination = "uploads/"; $destination = $destination . basename( $_FILES['pix']['name']); $temp_file = $_FILES['pix']['tmp_name']; move_uploaded_file($temp_file,$destination); echo "<p><b>Ok it worked man. File uploaded:</b>"; echo $_FILES['pix']['name']; echo $_FILES['pix']['size']; echo "<p>ok so if your happy with that then click <a href=\"review.php\">here</a> to go to the review screen"; print_r($_SESSION); /* Output b4 file is uploaded Array ( [duration] => Some Text [banner] => 120 x 240 Pixels [price] => 47 ) */ /* Output after file uploaded is : screenArray ( [duration] => Some Text [banner] => [price] => ) */ } } ?> </BODY> </HTML> uploader.inc This is INCLUDED or called in Steptwo.php in the IF statement <?php session_start(); $duration = $_SESSION['duration']; $banner = $_SESSION['banner']; ?> <HTML> <HEAD><TITLE>File Upload Screen</TITLE> </HEAD> <BODY> <OL> <LI>Enter the name of the picture you want to upload </li></OL> <div align="center"><hr> <form enctype="multipart/form-data" action="steptwo.php" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="500000"> <input type="file" name="pix" size="60"> <p><input type="submit" name="upload" value="Upload Banner"> </form> </body> </html> review.php: <?php session_start(); ?> <html> <head> <title></title> </head> <body> <?php $duration = $_SESSION['duration']; $banner = $_SESSION['banner']; $price = $_SESSION['price']; echo "$duration"; echo "$banner"; echo "$price"; ?> </body> </html> Thats it from start to finish. Just cant get the variables to pass after that IF statement in 'steptwo.php'. I dont get it!! / Hey if I can get this sorted i will make a donation for sure and hopefully can give something back one day! / Thanks
  9. Ok thanks. This is my form : <?php session_start(); $duration = $_SESSION['duration']; $banner = $_SESSION['banner']; ?> <HTML> <HEAD><TITLE>File Upload Screen</TITLE> </HEAD> <BODY> <OL> <LI>Enter the name of the picture you want to upload </li></OL> <div align="center"><hr> <form enctype="multipart/form-data" action="steptwo.php" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="500000"> <input type="file" name="pix" size="60"> <p><input type="submit" name="upload" value="Upload Banner"> </form> </body> </html> This file is called 'uploader.inc' and is referenced in the above code that i posted. I have been reading about sessions in PHP but still cant understand why this doesnt work If its of help I can give you the URL where this is running, although I dont want to break any forum rules. Let me know if this is appropriate. I really appreciate your help.
  10. Ok I did as i was told and put the following code at the end of the IF statement : print_r($_SESSION); Here was the result : (Just to point out that for testing purpose I have configured a $_SESSION['duration'] variable with a text string, see earlier post for details) ( [duration] => Some Text [banner] => [price] => ) So it seems that it works nicely but only if the $_SESSION array is populated without using other variables such as $_POST
  11. Ok thanks for replies here. This is really helpful. I tried something which had interesting results. Easier if I just show a before and an after. So before : $_SESSION['duration'] = $_POST['duration']; After : $_SESSION['duration'] = "Some Text"; What was interesting was that the session variables work a treat when I make the above change. This is however no good to me, I need the $_POST['duration'] variable to be available, im not interested in passing a string variable that I have to manually set myself (i.e. "Some Text") . So how do I make the value that stored in $_POST available in a session!?
  12. What makes you believe that? What makes me beleive it is that when i do $echo statements on the session variables afterwards they are empty. :-(
  13. Well I was having such fun with passing Global variables. Then I introduced an IF statement and it all went wrong. Soon and the 1st part of the IF statement executes all the Session variables UNSET !! Ok So I start the PHP file with this : <?php session_start(); $_SESSION['duration'] = $_POST['duration']; $_SESSION['banner'] = $_POST['banner']; $_SESSION['price'] = $_POST['price']; $duration = $_SESSION['duration']; $banner = $_SESSION['banner']; $price = $_SESSION['price']; ?> Then HTML Then More PHP : <?php if(!isset($_POST['upload'])) { include("uploader.inc"); } else { if($_FILES['pix']['temp_name'] == "none") { echo "<b>File didnt upload. Deal with it k<br>"; include("uploader.inc"); exit(); } if(!ereg("image",$_FILES['pix']['type'])) { echo "<b>Hey you muppet only upload pics ok. Jesus man</b><br>"; include("uploader.inc"); exit(); } else { $destination = "uploads/"; $destination = $destination . basename( $_FILES['pix']['name']); $temp_file = $_FILES['pix']['tmp_name']; move_uploaded_file($temp_file,$destination); echo "<p><b>Ok it worked man. File uploaded:</b>"; echo $_FILES['pix']['name']; echo $_FILES['pix']['size']; echo "<p>ok so if your happy with that then click <a href=\"review.php\">here</a> to go to the review screen"; } } ?> So after this IF statement all the $_Session['banner']; for EG are gone!!! Help!! :-) Thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.