Jump to content

123guy

Members
  • Posts

    38
  • Joined

  • Last visited

Everything posted by 123guy

  1. but cURL does not allow for it to actually go to the submitted page, it can't go to a redirected page, it needs the page it specifically posted to.
  2. how secure would a predefined password field be?
  3. is there a way to submit a form strictly with php, like "fake" fields made in php, then this "fake" php form submits????
  4. you would hope no one would do this, but it has actually already happened to me
  5. ok, so I have kinda rephrased my question, maybe it will make more sense, or give a better idea as to what I am trying to acheive. so I have been trying forever to figure out a way to submit a shopping cart to a checkout page. The checkout page I can't modify, so I have to somehow submit a total, an accountid, and an accountpin to the checkout page from the shopping cart. I am trying to figure out how to do this securely. The integration guide just says to use hidden fields to hold this info....I think to myself "HELL NO"(excuse the language). I don't want to reveal my accountid and pin to a user or robot if the source of the page is viewed. I need to know if I can use php(since it is server side) or something that can hide info to add some fields after the form is submitted, then POST these to the checkout page while being directed to the checkout page(ruling out using cURL). Can anyone help me with this? thanks for any help
  6. ok, so I have found this <?php //create array of data to be posted $post_data['ssl_merchant'] = 'xxx'; $post_data['ssl_user'] = 'xxxx'; $post_data['ssl'] = 'xxx'; $post_data['ssl_cardholder'] = $_SERVER["REMOTE_ADDR"]; $post_data['ssl_transaction'] = 'ccsale'; $post_data['ssl_show'] = 'true'; $post_data['ssl'] = $_POST['amount']; $post_data['confirm'] = $_POST['confirm']; //traverse array and prepare data for posting (key1=value1) foreach ( $post_data as $key => $value) { $post_items[] = $key . '=' . $value; } //create the final string to be posted using implode() $post_string = implode ('&', $post_items); //create cURL connection $curl_connection = curl_init('xxx'); //set options curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30); curl_setopt($curl_connection, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"); curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl_connection, CURLOPT_FOLLOWLOCATION, 1); //set data to be posted curl_setopt($curl_connection, CURLOPT_POSTFIELDS, $post_string); //perform our request $result = curl_exec($curl_connection); //show information regarding the request print_r(curl_getinfo($curl_connection)); echo curl_errno($curl_connection) . '-' . curl_error($curl_connection); //close the connection curl_close($curl_connection); ?> I have it filled in with correct info, but I need to know how to redirect it to the page it submitted to. I have never worked with cURL before. Any help here is appreciated!!!!!
  7. I have heard of curl, but didn't know this was the purpose, could you send me a good place to get started?
  8. I am working on a registration system that sends data to a merchant to start a checkout page. the form submitted needs to include a userid and a passkey. I don't want to just use a hidden field to store these data as they are very sensitive info. I need to know if there is a way I can have these values as a php variable on a submission page, add these values to a submitted form, then submit this "new" form to the merchant. what is the best way to go about doing this???? any help is appreciated anytime I have tried searching for something like "create form fields using PHP" it returns on how to make a form field required using php.
  9. ok, so I found this code to get me started with the displaying three months at a time. $list = array(date('n')); $list[]=date('n', mktime(0, 0, 0, $list[0]+1, 1)); $list[]=date('n', mktime(0, 0, 0, $list[0]+2, 1)); foreach ($list as $i) { echo "$i"; } Problem with this is the fact that there is not pagination. I know how to set up the months to paginate, but I do not know how to set up the year to start a new year in january. I could make it say jan 2013, march 2013...dec 2013, jan 2013...etc. I need it to move to jan 2014 at the end though. any help?
  10. hello. I am trying to figure out how to generate a list of months in a year, with a year attached, so March 2013 for example... I would like to also paginate these by three months displaying at a time, and it has no limit as to when it stops, thus the pagination of only three months. I unfortunately don't even know where to start on this, so if anyone has something that could help, or somewhere to send me, that would be awesome!
  11. Would it be the same way if I decided to use a radio button instead? Or would I not use the for each?
  12. so I am forming some checkboxes in a php loop ( i am not showing the loop, but it is in a loop). I need to be able to have multiple check box rows with multiple values. I am doing a customer tracking system. I need each check box to hold the Customer First, Last, and Memberid. How can I do this using php? I would prefer not to have to loop through an array, so if there is a way not to do that, it would be great! <input type="radio" name="CheckboxGroup" value="yes" id="CheckboxGroup1_0<?php echo $id; ?>"><input name="first" type="hidden" value="<?php echo $first; ?>"><input name="last" type="hidden" value="<?php echo $last; ?>"><input name="member" type="hidden" value="<?php echo $id; ?>">
  13. I can't. my boss has a website where he has clients put in their phone number and he believes in allowing them to put them in however they feel fit. he then exports it in a csv doc to me, and I just upload it to the database using the csv.
  14. I thought about updating the table, but there is going to constantly having phone numbers added to the database, so i would have to run that query every hour or so. is there anyway to do it when I select from the database?
  15. ok, so I have a database of customer contact info that is sent to me from my boss. There are phone numbers that are in different formats, 123-456-7890, (123) 456-7890, or 1234567890. I am building a query system for this info, and I have been able to strip the special characters on a query string. $Phone = preg_replace('/\D+/', '', $Phone); my issue is when I query the database using PHP, how do I manage to make it so that all phonenumbers that it compares, will be in that format, just one continuous string with only numbers? any help is appreciated
  16. rgopal, it is possibly they may enter one field, two fields, three fields, etc.
  17. Yea, I know...I couldn't figure out how to make it and/or. If you could help me out, it would be great!!!!!!!
  18. this is going to be hard to explain, but I will try my best anyways. I am putting together a member search system with multiple fields inside of it that are optional. The field are First, Last, Memberid, Phone, Zipcode I would like it so the user can put in as much info as they can, and my query will return all results that match the data they entered. Also, on phone, there are three columns for it to look at matching, phone1, phone2, cell. so If Phone matches anyone of those three, it should display it. The problem I am having is with the query. here is what I have put together. I think it needs something like an and/or statement...but I can't find anything for it to work $mysqlstring = "SELECT * from customers where First='".$First."' AND Last='".$Last."' AND Phone1='".$Phone."' AND Phone2='".$Phone."' AND Cell='".$Phone."' AND MID='".$Member."' AND Zip='".$Zip."'";
  19. <?php $sql1= mysql_query("SELECT * FROM cart where cart_id='".$cid."' AND product123 !='' ORDER BY id DESC "); while($row1 = mysql_fetch_array($sql1)){ $price = $row1['price']; $product = $row1['product123']; $id = $row1['id']; $qty = $row1['quantity']; $category = $row1['category']; if($category="artist"){ $price2= $price*'.07'; $price1 = $price * $qty; $total = $price1 + $total + $price2; } $price1 = $price * $qty; $total = $price1 + $total; } ?> this is one way I tried just addding onto artist category, but it still did it for all other categories as well, and it multiplied by two, then added the tax to the end.
  20. hello. I am trying to calculate 7% sales tax inside of this script, however, every time I do it, it never works. It is either exponentially adding the tax, multiplying the price by 10, then adding tax,etc....and I am not sure what I was doing wrong. any ways, I would like it to calculate tax for any item that has the category of "artist" or "retail". can anyone help me out here? <?php $sql1= mysql_query("SELECT * FROM cart where cart_id='".$cid."' AND product123 !='' ORDER BY id DESC "); while($row1 = mysql_fetch_array($sql1)){ $price = $row1['price']; $product = $row1['product123']; $id = $row1['id']; $qty = $row1['quantity']; $category = $row1['category']; $price1 = $price * $qty; $total = $price1 + $total; } ?>
  21. so I think I have a good start to this, but my goal here is that I pull a bunch of data from the database, with some radio buttons pre selected, using the id in the name to make it unique so that the buttons does infact actually select. <form action="photo.php" method="post" name="area"> <?php $result = mysql_query("SELECT * FROM images"); while($row = mysql_fetch_array($result)) { $image1 = $row['image']; $area = $row['area']; $id = $row['id']; ?> <table width="266"> <tr> <td width="103"> <img src="../<?php echo $image1; ?>" width="100" /><input name="id" type="hidden" value="<?php echo $id; ?>" /> </td> <td width="83">Area 1<label> <input type="radio" name="RadioGroup<?php echo $id; ?>" value="1" id="RadioGroup1_0<?php echo $id; ?>" <?php if($area == "1"){ echo "checked=\"checked\""; }?>/> </label></td> <td width="64">Area 2<label> <input type="radio" name="RadioGroup<?php echo $id; ?>" value="2" id="RadioGroup1_1<?php echo $id; ?>" <?php if($area == "2"){ echo "checked=\"checked\""; }?>/> </label></td> </tr> </table> <?php } ?> <input name="submit" type="submit" value="save" /> </form> I need help posting each radio button to the database I have set up though. Currently, I can't get the area to display the value of the radio button. if($_POST['submit']){ foreach($_POST["id"] AS $key => $val) { $id = $val; $area = $_POST['RadioGroup'.$id.'']; mysql_query("UPDATE images SET area='$area' WHERE id='$id'"); } } hopefully this makes some sort of sense to you. I think I am close, but I may not be, and it may be something obvious that I just can't seem to find. any help is greatly appreciated!
  22. sorry, didn't see that. I read it from email and it got cut short there. thanks
  23. sorry, I can get the product to insert properly, it is where the image insertion is going bad. I need to know where to place that and how to edit it so that it shows a proper file path/name
  24. hello. I am working on a multiple image upload and resizing system. I have found a code online that does exactly as I want!!!! I am now trying to get it to insert into my database properly, which is where I need help at. I have two tables, an items and an images table. I want the item table to only insert once, while I want the images table to insert all the files and their new name that the code creates. The first few lines are the insert code, and the after is the upload/resize code. any help on this is greatly appreciated. $title = $_POST['title']; $des = mysql_real_escape_string($_POST['description']); $price = mysql_real_escape_string($_POST['price']); $qty = mysql_real_escape_string($_POST['quantity']); $cat2 = mysql_real_escape_string($_POST['category2']); $cat = mysql_real_escape_string($_POST['category']); if ($cat2 !='') {$cat = $cat2; } mysql_query("INSERT INTO items (id, name, price, description, quantity, category_id) VALUES ('$id123', '$title', '$price','$des', '$qty', '$cat')"); if($cat2 !=''){ mysql_query("INSERT INTO categories (category) VALUES ('$cat2')"); mysql_query("INSERT INTO images (item_id, image) VALUES ('$id123', 'images/".$NewImageName."')"); } foreach($_FILES as $file) { // some information about image we need later. $ImageName = $file['name']; $ImageSize = $file['size']; $TempSrc = $file['tmp_name']; $ImageType = $file['type']; if (is_array($ImageName)) { $c = count($ImageName); echo '<ul>'; for ($i=0; $i < $c; $i++) { $processImage = true; $RandomNumber = rand(0, 9999999999); // We need same random name for both files. if(!isset($ImageName[$i]) || !is_uploaded_file($TempSrc[$i])) { echo '<div class="error">Error occurred while trying to process <strong>'.$ImageName[$i].'</strong>, may be file too big!</div>'; //output error } else { //Validate file + create image from uploaded file. switch(strtolower($ImageType[$i])) { case 'image/png': $CreatedImage = imagecreatefrompng($TempSrc[$i]); break; case 'image/gif': $CreatedImage = imagecreatefromgif($TempSrc[$i]); break; case 'image/jpeg': case 'image/pjpeg': $CreatedImage = imagecreatefromjpeg($TempSrc[$i]); break; default: $processImage = false; //image format is not supported! } //get Image Size list($CurWidth,$CurHeight)=getimagesize($TempSrc[$i]); //Get file extension from Image name, this will be re-added after random name $ImageExt = substr($ImageName[$i], strrpos($ImageName[$i], '.')); $ImageExt = str_replace('.','',$ImageExt); //Construct a new image name (with random number added) for our new image. $NewImageName = $RandomNumber.'.'.$ImageExt; //Set the Destination Image path with Random Name $thumb_DestRandImageName = $DestinationDirectory.$ThumbPrefix.$NewImageName; //Thumb name $DestRandImageName = $DestinationDirectory.$NewImageName; //Name for Big Image //Resize image to our Specified Size by calling resizeImage function. if($processImage && resizeImage($CurWidth,$CurHeight,$BigImageMaxSize,$DestRandImageName,$CreatedImage,$Quality,$ImageType[$i])) { //Create a square Thumbnail right after, this time we are using cropImage() function if(!cropImage($CurWidth,$CurHeight,$ThumbSquareSize,$thumb_DestRandImageName,$CreatedImage,$Quality,$ImageType[$i])) { echo 'Error Creating thumbnail'; } /* At this point we have succesfully resized and created thumbnail image We can render image to user's browser or store information in the database For demo, we are going to output results on browser. */ //Get New Image Size list($ResizedWidth,$ResizedHeight)=getimagesize($DestRandImageName); echo '<li><table width="100%" border="0" cellpadding="4" cellspacing="0">'; echo '<tr>'; echo '<td align="center"><img src="../images/'.$ThumbPrefix.$NewImageName.'" alt="Thumbnail" height="'.$ThumbSquareSize.'" width="'.$ThumbSquareSize.'"></td>'; echo '</tr><tr>'; echo '<td align="center"><img src="../images/'.$NewImageName.'" alt="Resized Image" height="'.$ResizedHeight.'" width="'.$ResizedWidth.'"></td>'; echo '</tr>'; echo '</table></li>'; /* // Insert info into database table! mysql_query("INSERT INTO myImageTable (ImageName, ThumbName, ImgPath) VALUES ($DestRandImageName, $thumb_DestRandImageName, 'uploads/')"); */ }else{ echo '<div class="error">Error occurred while trying to process <strong>'.$ImageName[$i].'</strong>! Please check if file is supported</div>'; //output error } } } echo '</ul>'; } } // This function will proportionally resize image function resizeImage($CurWidth,$CurHeight,$MaxSize,$DestFolder,$SrcImage,$Quality,$ImageType) { //Check Image size is not 0 if($CurWidth <= 0 || $CurHeight <= 0) { return false; } //Construct a proportional size of new image $ImageScale = min($MaxSize/$CurWidth, $MaxSize/$CurHeight); $NewWidth = ceil($ImageScale*$CurWidth); $NewHeight = ceil($ImageScale*$CurHeight); if($CurWidth < $NewWidth || $CurHeight < $NewHeight) { $NewWidth = $CurWidth; $NewHeight = $CurHeight; } $NewCanves = imagecreatetruecolor($NewWidth, $NewHeight); // Resize Image if(imagecopyresampled($NewCanves, $SrcImage,0, 0, 0, 0, $NewWidth, $NewHeight, $CurWidth, $CurHeight)) { switch(strtolower($ImageType)) { case 'image/png': imagepng($NewCanves,$DestFolder); break; case 'image/gif': imagegif($NewCanves,$DestFolder); break; case 'image/jpeg': case 'image/pjpeg': imagejpeg($NewCanves,$DestFolder,$Quality); break; default: return false; } if(is_resource($NewCanves)) { imagedestroy($NewCanves); } return true; } } //This function corps image to create exact square images, no matter what its original size! function cropImage($CurWidth,$CurHeight,$iSize,$DestFolder,$SrcImage,$Quality,$ImageType) { //Check Image size is not 0 if($CurWidth <= 0 || $CurHeight <= 0) { return false; } //abeautifulsite.net has excellent article about "Cropping an Image to Make Square" //http://www.abeautifulsite.net/blog/2009/08/cropping-an-image-to-make-square-thumbnails-in-php/ if($CurWidth>$CurHeight) { $y_offset = 0; $x_offset = ($CurWidth - $CurHeight) / 2; $square_size = $CurWidth - ($x_offset * 2); }else{ $x_offset = 0; $y_offset = ($CurHeight - $CurWidth) / 2; $square_size = $CurHeight - ($y_offset * 2); } $NewCanves = imagecreatetruecolor($iSize, $iSize); if(imagecopyresampled($NewCanves, $SrcImage,0, 0, $x_offset, $y_offset, $iSize, $iSize, $square_size, $square_size)) { switch(strtolower($ImageType)) { case 'image/png': imagepng($NewCanves,$DestFolder); break; case 'image/gif': imagegif($NewCanves,$DestFolder); break; case 'image/jpeg': case 'image/pjpeg': imagejpeg($NewCanves,$DestFolder,$Quality); break; default: return false; } if(is_resource($NewCanves)) { imagedestroy($NewCanves); } return true; } } ?>
×
×
  • 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.