Jump to content

blogit

Members
  • Posts

    15
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

blogit's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hello, i'm working with a shopping cart script that saves user carts to their profile, however it deletes them if they remove items. I'd like to get an email each time they add an item or the function below is ran so i can try and save abandoned carts by emailing the users. The script has no option to save them in the admin back end. I've tried adding a simple mail function with some variables but have only been able to get the userid and some other data to be sent. While messing around with another function in the cart which add's the product to the cart i tried the same basic mail function and the variable i was adding to the email came up as 'Array' in the emails i received. If anyone can show me how to capture the looped information into a variable that i can email my self i would really appreciate it Thanks in advance // // Store cart content in the customer's profile // function fn_save_cart_content(&$cart, $user_id, $type = 'C' , $user_type = 'R') { global $db_tables; if (empty($user_id)) { if (fn_get_cookie('cu_id')) { $user_id = fn_get_cookie('cu_id'); } else { $user_id = abs(crc32(uniqid(TIME))); fn_set_cookie('cu_id' , $user_id , COOKIE_ALIVE_TIME); } $user_type = 'U'; } if (!empty($user_id)) { db_query("DELETE FROM $db_tables[user_session_products] WHERE user_id='$user_id' AND type='$type' AND user_type = '$user_type'"); if (!empty($cart['products']) && is_array($cart['products'])) { $_cart_prods = $cart['products']; foreach ($_cart_prods as $_item_id => $_prod) { $_cart_prods[$_item_id]['user_id'] = $user_id; $_cart_prods[$_item_id]['timestamp'] = TIME; $_cart_prods[$_item_id]['type'] = $type; $_cart_prods[$_item_id]['user_type'] = $user_type; $_cart_prods[$_item_id]['item_id'] = $_item_id; $_cart_prods[$_item_id]['item_type'] = 'P'; $_cart_prods[$_item_id]['extra'] = addslashes(serialize($_prod)); $_cart_prods[$_item_id]['amount'] = empty($_cart_prods[$_item_id]['amount']) ? 1 : $_cart_prods[$_item_id]['amount']; $_cart_prods[$_item_id] = fn_check_table_fields($_cart_prods[$_item_id], $db_tables['user_session_products']); if (!empty($_cart_prods[$_item_id])) { db_insert_by_array($db_tables['user_session_products'], $_cart_prods[$_item_id], true); } } } $function = __FUNCTION__; include CORE_DIR . 'addons_inheritance.php'; } return true; }
  2. I've just installed the latest windows binaries for mysql as well as apache/php which is working but any time i try and access a page that has mysql queries it loads very slow lag is about 3 seconds ore more. Every where that i've read seems to say this is mysql trying to run a reverse dns and dns issue. I read to fix this that mysqld should start with -skip-name-resolve i've put that in my.ini and restarted the server but that still hasn't fixed my server problem, my computer's connected to my linksys and gets a private IP through dhcp 192.168.15.101. I've tried to disable networking with mysql so that it didn't use tcp/ip and just ran into permission problems. I've disabled strict mode and change mysql mode to 4 trying to use it as an earlier version but still nothing. I've played with just about every setting possible as well as adding wild cards to my user hosts/IP's in the mysql table. I'd really appreciate any help with this i spent hours yesterday trying to get it to work as fast as it should being on localhost, thanks in advance.
  3. I added AND `status` = 'active' into the query so the details page will only output active clients, can you show me an example of how to use this in an if statement so if the client i inactive i can run a function to redirect the user or output an error, the function i can make/run im just not sure how to write the if statement
  4. The site is already protected with a login / pass system using the database, sessions, cookies the page is protected and checks if the visitor is logged in or not. But I wanted to protect it further from people inserting queries into the url that they shouldn't be. Basically there is a list of active clients displayed on the master page, while other clients if they aren't active and not dispalyed on the master page can still be accessed by changing the client ID in the url, so is there anyway to secure this further? I know that any url encoding can be decoded, so what else can be done to the url? What about a simple usergroup check if I create a usergroup for each user then also create a usergroup field with each client can there be a simple check done to make sure the user is a member that would have access to see the results of the details page?
  5. Hello i've just used Macromedias tutorial to create a master details page the tutorial is at http://www.adobe.com/support/dreamweaver/building/master_detail_php/index.html I would like to secure the query url or encode it, the string is /client_details.php?recordID=110 As it is you can simply change the recordID and retrieve any information in the database. The link from the master page to the details is <?php echo $row_clientlist['client_name']; ?> can someone suggest a way to encode or secure the link so that the recordID is not displayed. Any help's appreciated i hate having scripts that aren't secure. Thanks
  6. The form's on the index page the script is a few folders deep the script im using is phplist i'm just trying to have a little more privacy with it, im thinking maybe just write a function that has the url and insert the php function into the action tag so you can't view it. Not the end of the world with this one, thanks for the replies
  7. I'm using phplist to handle newsletter sign ups, the action url is http://www.domain.com/lists/?p=subscribe I'd like to have the action handled by a php file instead, so anyone viewing the source wont see off hand the url in the action. I know basic form handling and using mail() with variables but how can I have the form variables sent to the url using a php file. The only thing i could come up with is below but my coding is not that great so i have no other ideas on how to pass the data to the url. Any advice is appreciated... thanks <?php if (!isset($_POST['subscribe'])) { ?> <form action="http://www.domain.com/lists/?p=subscribe" method="post"> </form><?php } ?>
  8. I'm having trouble with a script that is pretty basic but my coding is that great so far i have it getting the current domain and putting it into a variable which is simple enough, I then want it to run a search on a table in a database and if the current domain is there to echo it out. The mysql query im using is below if anyone can help with the rest i'd really appreciate it. <?php include 'config.php'; include 'opendb.php'; $pageUR1 = ereg_replace("/(.+)", "", $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]); $curdomain = str_replace("www.", "", $pageUR1); $query = "SELECT page_url FROM page LIKE '%$curdomain%'";
  9. Theres a couple of hundred photos with more being added all the time lemmin can you give me an example of how to have php get 8 random images, is it the loops causing the high cpu usage or the call to get random photos?
  10. I have coppermine gallery running and to display images on my index page i have a script that pulls random images and puts them in a table. I just got an email from my server admins that it's causing really high cpu usage, can someone tell me which loop might be causing the problem and suggest a fix? Maybe combine the loops to close the table all in one loop? Thank you <table cellspacing="0" cellpadding="0"> <?php $query = "SELECT filename, filepath, pid FROM cpg14x_pictures WHERE pwidth > pheight ORDER BY RAND() LIMIT 8"; $result = mysql_query($query) or die("There was a problem with the SQL query: " . mysql_error()); if($result && mysql_num_rows($result) > 0) { $i = 0; $max_columns = 4; while($row = mysql_fetch_array($result)) { // make the variables easy to deal with extract($row); // open row if counter is zero if($i == 0) echo "<tr>"; // make sure we have a valid product if($pid != "" && $pid != null) print '<td>'.'<div class="img-shadow">'.'<a href="/Gallery/displayimage.php?pos=-'.$pid.'">'.'<img src="/Gallery/albums/' . $filepath . 'thumb_' . $filename . '">'.'</a>'.'</div>'.'</td>'; //print '<td>'.'<img src="/Gallery/albums/'.$filepath.'thumb_'.$filename.'id="thephoto_'.$pid.'onLoad="initImage("thephoto_"'.$pid.'alt="Ikaria Gallery"'.'">'. '</td>'; // increment counter - if counter = max columns, reset counter and close row if(++$i == $max_columns) { echo "</tr>"; $i=0; } // end if } // end while } // end if results // clean up table - makes your code valid! if($i < $max_columns) { for($j=$i; $j<$max_columns;$j++) echo "<td> </td>"; } ?> </tr> </table>
  11. Hello I am trying to write a script so that I can take searches from my form post the query into a remote form retrieve the results and display them on my page, I saw a few curl examples on some pages but don't know enough php to code everything. I know i need to take the search query and put it into a variable then pass that to the remote form's search field retrieve the results and display them but for me it's easier said than done. If anyone can give a basic example I would really appreciate it. Thanks in advance
  12. Got this to work with the following code instead of echoing print worked out....Thanks for the link to that other code print '<td>'.'<div class="img-shadow">'.'<a href="/Gallery/displayimage.php?pos=-'.$pid.'">'.'<img src="/Gallery/albums/' . $filepath . 'thumb_' . $filename . '">'.'</a>'.'</div>'.'</td>';
  13. No it does't any other suggestions on inserting a random number where pid should be?
  14. Thanks I tested that code by having it output the picture id (pid) which works but i'm not sure how to insert the entire img tag into that echo/string, below is how it looks and its obviously not going to work what needs changing? echo "<td><img src="/Gallery/albums/<?php echo $obj->filepath; ?>thumb_<?php echo $obj->filename; ?>" id="thephoto_<?php echo $obj->pid; ?>" onLoad="initImage('thephoto_<?php echo $obj->pid; ?>')" alt="The Gallery" /></td>";
  15. Hello, i have a photo gallery installed and working i'm able to connect to the db and select data from tables to display on any other page of my site but I want to be able to display say 4 pictures on a page if I just copy/paste my code it ends up grabbing and displaying the same image 4 times over. Below is the code i'm using and the image tag. I connect fine and it displays images, I need to create a loop so that each time the pid (picture id) comes up it increments by 1, or maybe each instance of pid in the image tag is a unique number from 1-1000. There was a while loop included with the code but it wasn't working nor was much else of the code so i changed it around and now im stuck, if anyone can give me some advice id really appreciate it thanks $result = mysql_query("SELECT filename, filepath, pid FROM cpg14x_pictures WHERE pwidth > pheight ORDER BY RAND() LIMIT 4"); $obj = mysql_fetch_object($result); <img src="/Gallery/albums/<?php echo $obj->filepath; ?>thumb_<?php echo $obj->filename; ?>" id="thephoto_<?php echo $obj->pid; ?>" onLoad="initImage('thephoto_<?php echo $obj->pid; ?>')" alt="The Gallery" /> --------- The old loop that didn't work was to create a row after the 2nd and 4th picture for a small table, i know its missing a closing bracket for the while loop but it still wasn't working and i dont know what $i was. while($obj = mysql_fetch_object($result)){ $i = $i + 1; if ($i == 3 || $i == 5) }
×
×
  • 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.