Jump to content

jpratt

Members
  • Posts

    144
  • Joined

  • Last visited

    Never

Everything posted by jpratt

  1. you should need enctype="multipart/form-data" as part of your form tag
  2. What does the url look like for an example paypal invoice page?
  3. Do you have some sort of database set up where you are storing invoice information? To really make this work well you would probably want to set up a db. That way when they click submit a page can be created dynamicly based on their Invoice number and authorization code. Otherwise building each invoice one at a time seems very tedious. You may want to try to make it a bit more simple for yourself in the longrun if you want to automate it.
  4. I am looking at all options of setting up a way for two people to communicate through webcams(without using messenger or some other software). I wanted to build my own sort of 'chat room' and need a way to interface with webcams. Has anyone tried something like this or know of a way php can work with a webcam? I know there are alot of flash products that offer this but I dont feel like buying flash communication server anytime soon. Any Ideas?
  5. duh, brain freeze, thanks
  6. I am not sure if you will find a script that you can just cut and paste in and work how you want. Your best bet is to do some reasearch on cookie with php then look for simalar scripts. If you are going to write your own or modify someone elses you will need to know what is going on.
  7. i changed it and still does not work. now i accually gives me an error. Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource This is what i changed my code to: [code] <?php $keyword = $_GET['keyword']; mysql_select_db($database_database, $linkID); $query = "SELECT * FROM ppctrack WHERE ppcKeyword = " . $keyword; $result = mysql_query($query, $linkID); $pageview = mysql_num_rows($result); echo $pageview; ?> [/code] Any ideas??
  8. i am using the count function to return the number of rows returned by a query, but it keeps returning 1 even when I know the value i am using has hundereds of records to count. My code looks like: [code] <?php $keyword = $_GET['keyword']; mysql_select_db($database_database, $linkID); $query = "SELECT * FROM ppctrack WHERE ppcKeyword = " . $keyword; $result = mysql_query($query, $linkID); $pageview = count($result); echo $pageview; ?> [/code] Anyone know what i am doing wrong?
  9. does anyone know of an easy to implement search tool to add to a site? I done want to search google or anything on my site, just a search bar that searches text on my site. any ideas?
  10. I need to pass information from a page that is not secure to a page that is secure in my site. Is there a way to do this? I have a session variable i am trying to pass to the page but is not working. Anyone have any info on this?
  11. It may be your registered globals line.
  12. I am using the meta tag redirect in my html like so: <meta http-equiv="refresh" content="5; url=http://www.newsite.com"> I need the user to be able to have the choise to be able to go to the new site or go to the old htm page they were pointed to. I can not take down the old site. Any php solutions? Most users come in through google to specific pages. Is there a way to do this with php without renaming my old htm files?
  13. I have a part on my site where I would like to display the first 40 chars of a string as a intro, so it would read something like "blah blah blah..." what function returns only a certain number of characters from the beginning of a string? Thanks for the help.
  14. I have a string varible containing about 20-30 characters. I neet to trim off the first 12 characters of the string variable. I have found a half dozen trim functions but none that do what i want. Does someone know what does this? its probably easy, just need a function or something.
  15. see my post a few minutes ago labeled "image resize function an implementation" this show an easy function for resizing on the fly.
  16. thanks, got it, my image was there just needed to tweek that line a little. the image variable is $image in the example
  17. so how do i tell it both the image and the hieght and width??
  18. i have a function that resizes an image when it loads the page according to its ration(so it doesnt look all funny) I am having problems implementing this function and getting it to display, check out the function and where i am trying to use it. Please help. where it is implemented... [code] echo "<TABLE border=0 id='gallery'>"; while (list($thumb) = mysql_fetch_row($res)) { $mysock = getimagesize($thumb); $resizethumb = imageResize($mysock[0],  $mysock[1], 150);     if ($count % NUMCOLS == 0) echo "<TR>\n";  # new row     echo "<td><img src='$resizethumb'></td><br>\n";     $count++;     if ($count % NUMCOLS == 0) echo "</TR>\n";  # end row } if ($count % NUMCOLS != 0) {   while ($count++ % NUMCOLS) echo "<td>&nbsp;</td>";   echo "</TR>\n"; } echo "</TABLE>"; [/code] the function... [code] <?php function imageResize($width, $height, $target) { if ($width > $height) { $percentage = ($target / $width); } else { $percentage = ($target / $height); } //gets the new value and applies the percentage, then rounds the value $width = round($width * $percentage); $height = round($height * $percentage); return "width=\"$width\" height=\"$height\""; } ?> [/code] right now i am just getting the little X boxs where images are sapose to be. any ideas?
  19. go to: http://us3.php.net/manual/en/features.file-upload.php has an example of uploading an array of files.
  20. ok i went back to my original plan. the code i had before was so close. I do understand arrays, but 3 if statements does not seenm to exsesive. Anyway i am alomost there. with this code I can upload the file if i leave the directory as '', this places the file in my root directory of course. i do have a folder called uploadimg i would like to place them in. when i set my directory in the code to 'uploadimg/' it says it uploaded successfuly but it accually does not do anything. here is what i am using now: [code] <?php if ($_SERVER['REQUEST_METHOD'] != 'POST') { $me = $_SERVER['PHP_SELF']; echo ' <form name="form1" method="post" action="' . $me . '" enctype="multipart/form-data"> <table width="500" border="0" cellspacing="3" cellpadding="0"> <tr> <td width="256" height="30" align="right" valign="middle"><p align="right"><span class="style1">Comment for Photo</span></p></td> <td width="344" align="left"><input name="textfield" type="text" size="40" /></td> </tr> <tr> <td height="30" align="right" class="style1">Website Link </td> <td align="left"> <input type="text" name="textfield2" /> <span class="style1">ie. www.google.com</span> </td> </tr> <tr> <td height="30" align="right"><span class="style1">Photo </span></td> <td align="left"><input type="file" name="imagefile" /></td> </tr> <tr> <td>&nbsp;</td> <td align="left"><input name="Submit" type="submit" value="Submit" /></td> </tr> </table> </form>'; } else { if (isset($_POST['Submit'])) { $file = $_FILES['imagefile']['name']; $filetype = substr($file,-4); if ($filetype=="jpeg") { copy($_FILES['imagefile']['tmp_name'],'uploadimg/'.$_FILES['imagefile']['name']) or die("Could not copy"); echo "<br>Upload Complete"; echo "<br>Name:&nbsp;".$_FILES['imagefile']['name'].""; echo "<br>Size:&nbsp;".$_FILES['imagefile']['size'].""; echo "<br>Type:&nbsp;".$_FILES['imagefile']['type']."<br>"; } else if ($filetype==".jpg") { copy($_FILES['imagefile']['tmp_name'],'uploadimg/'.$_FILES['imagefile']['name']) or die("Could not copy"); echo "<br>Upload Complete"; echo "<br>Name:&nbsp;".$_FILES['imagefile']['name'].""; echo "<br>Size:&nbsp;".$_FILES['imagefile']['size'].""; echo "<br>Type:&nbsp;".$_FILES['imagefile']['type']."<br>"; } else if ($filetype==".gif") { copy($_FILES['imagefile']['tmp_name'],'uploadimg/'.$_FILES['imagefile']['name']) or die("Could not copy"); echo "<br>Upload Complete"; echo "<br>Name:&nbsp;".$_FILES['imagefile']['name'].""; echo "<br>Size:&nbsp;".$_FILES['imagefile']['size'].""; echo "<br>Type:&nbsp;".$_FILES['imagefile']['type']."<br>"; } else { echo "<br>Upload Error"; echo "<br>Could Not Copy, Wrong Filetype (".$_FILES['imagefile']['name'].")<br>"; } } } ?> [/code] Any ideas, im am almost there!
  21. sorry the "if($type) {" is not commented out.
  22. ok i have tried your code and it still will not upload. I have read the entire section on uploads from php.net. When i use your code it always tells me it is not the right file type. I have tried uploading .jpg, .gif. I left out the database code you had in there so it looks like this: [code] <?php // file upload information $uploaddir ="uploadimg/"; $uploadfile = $uploaddir . basename($_FILES['userfile']['name']); // set a mime valadating $blah = getimagesize($userfile); $type = $blah['mime']; $width = $blah[0]; $size = $blah[2]=$_FILES['userfile']['size']; if($size <= 2000000) { //if($type) { // if file correct let file throw and into the folder if(move_uploaded_file($_FILES['userfile']['name'],$uploadfile)) { // say thank you if the user has a valid file. echo "file uploaded thank you<br>"; exit; } // echo link for valadating pic }else{ echo "Wrong file type .jpg or .gif thank you <br><br> <a href ='upload.php'>Pleae try again</a>"; } echo link for valadating file size }else{ echo "Wrong file size 2000000 bytes only<br><br> <a href ='upload.php'>Pleae try again</a>"; } ?> [/code] This is driving me crazy!
  23. sorry, i have been testing locally with the code above. The accual page is now at www.myplasmaart.com/upload.php. I am not using anything different that above, except i fixed the echo statement at the end. I am not even getting the "Upload Error" in my else if statement
  24. I have run through my php.ini file, checked with my host to make sure this is allowed, and still cont get this thing to work. I know the post is happening, but nothing is being displayed, no confirmation or denial of upload. Anymore suggestions other than how to clean up my code?
×
×
  • 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.