Jump to content

echoCarlos

Members
  • Posts

    19
  • Joined

  • Last visited

    Never

Everything posted by echoCarlos

  1. try this mate echo '<a href=\"frontpage_delete.php?img_id=\' . $row_thumb[\'frontpage_image_id\'] . \'&image_name=\' . $row_thumb[\'frontpage_image_file_name\'] . \'\" class=\"moreLink\" onclick=\"return conform(\'testing\')\"><img src=\"grafik/delete.png\" alt=\"\" /></a>';
  2. Guys I have a small problem I have made a shop script I am trying to pull prices from a database and add them all together to see how much has been made in total example 3.00 4.00 6.50 10.50 100.99 I want to add them all together but the decimal places are confusing me, please help this is driving me mad.
  3. Just woken up, thank you very much for your reply mate I'll try that right away after I've had my coffee
  4. Hi guys I'm tying to update the config.inc.php with the database info from the install.php Install.php $string = '<?php $db_host = "'. $_POST["host"]. '"; $db_user = "'. $_POST["username"]. '"; $db_pass = "'. $_POST["password"]. '"; ?>'; $fp = fopen("config.inc.php", "a"); fwrite($fp, $string); fclose($fp); config.inc.php $db_host = ''; $db_user = ''; $db_pass = ''; // connect to the server $con = mysql_connect($db_host,$db_user,$db_pass) or die('Failed to connect to the server'); // connect to the database $db = mysql_select_db('marketplace') or die('Failed to connect to the database'); can someone help me on how id do this
  5. Thanks for the help but i managed to find something which did the trick on Google will post here incase anyone needs it. <?php $string = '<?php $dbhost = "'. $_POST["dbhost"]. '"; $dbuname = "'. $_POST["dbuname"]. '"; $dbpass = "'. $_POST["dbpass"]. '"; $dbname = "'. $_POST["dbname"]. '"; $prefix = "'. $_POST["prefix"]. '"; $user_prefix = "'. $_POST["user_prefix"]. '"; $dbtype = "'. $_POST["dbtype"]. '"; ?>'; $fp = fopen("config.php", "w"); fwrite($fp, $string); fclose($fp); ?>
  6. thanks for the reply mate i found this would it work http://www.tizag.com/phpT/filewrite.php also how would i use this function to target chaneg1 for example thanks for your help
  7. Hi guys, I have a php file called install.php and the user submits there host details, the thing is i also want to write those details to these define functions in includes/config.php with the content define('DB_HOST', 'change1'); define('DB_USER', 'change2'); define('DB_PASS', 'change3'); and overwrite change1 with host and user and pass how could this be done thanks
  8. Hi guys, I have made a script which will allow people to sell there items online, but i want to make it as simple as possible for them to install the script after purchase. I want to make an install.php file which will auto create the database and table names and take an admin username and password, any idea on how i would go around doing this will be greatly appreciated. Thanks
  9. I'm new to php and been trying to follow along with different tutorials to try and build my own site, i followed a tutorial on making a search feature for the site and have it working perfectly, but i want to change the way how to search displays the results. I want to make it display them how there displayed on the index page. here is the index page how there displayed <div id="table"> <table> <tr class="top"> <th>Account</th> <th>Country</th> <th>Info</th> <th>Login</th> <th>Pass</th> <th>Price</th> <th>Buy</th> </tr> <?php $class = 'grey'; ?> <?php $items = getItems(); ?> <?php if(empty ($items)): ?> <h3>No Items Found</h3> <?php else: ?> <?php foreach($items as $item): ?> <?php $class = ($class == 'grey') ? 'grey2' : 'grey'; ?> <tr class="<?php echo $class; ?>"> <td><?php echo $item['item_account']; ?></td> <td><?php echo $item['item_country']; ?></td> <td><?php echo $item['item_info']; ?></td> <td><?php echo maskUser($item['item_login']); ?></td> <td><?php echo maskPass($item['item_pass']); ?></td> <td><?php echo $item['item_price']; ?> </td> <td><form method="post" action="https://sci.libertyreserve.com/"><input type="submit" name="buy" value="Buy" class="button" /></form></td> </tr> <?php endforeach; ?> <?php endif; ?> how the search is display if (strlen($search) <= 2) { echo 'Search keyword is too short.'; } else { echo "You searched for <b>$search</b><hr size='1'>"; $search_exploded = explode(" ", $search); foreach($search_exploded as $search_each) { $x++; if ($x == 1) $construct .= "item_account LIKE '%$search_each%'"; else $construct .= " OR item_account LIKE '%$search_each%'"; } $construct = "SELECT * FROM items WHERE $construct"; $run = mysql_query($construct); $foundnum = mysql_num_rows($run); if ($foundnum == 0) { echo 'No results found.'; } else { echo "$foundnum results found!</p>"; while ($numrows = mysql_fetch_assoc($run)) { $item_id = $numrows['item_id']; $itemAccount = $numrows['item_account']; $itemI = $numrows['item_info']; $itemLogin = $numrows['item_login']; $itemPass = $numrows['item_pass']; $itemPrice = $numrows['item_price']; echo " <b>$itemAccount</b><br /> $itemI <br /> " . maskUser($itemLogin) . '<br />' . maskPass($itemPass, 0) . '<br />'; } } } my question is im not sure how to edit the search code to display the results in the same format as the index page thanks
  10. if they have it i can't find it, could someone please point me in the right direction.
  11. hey guys. I am using Liberty reserve to sell my digital items online, when the user buys the item LR posts back item_id so I can grab the id out of the database to display to the buyer and lr_amnt to check the amount against the one inside the database before displaying the result to the user. TOP: <?php include 'includes/config.inc.php'; if(isset($_POST['item_id']) && isset($_POST['lr_amnt'])) { $itemID = $_POST['item_id']; $lrAmt = $_POST['lr_amnt']; $result = mysql_query("SELECT * FROM items WHERE item_id='$itemID'"); while($row = mysql_fetch_array($result)) { $login = $row['item_login']; $pass = $row['item_pass']; $itemName = $row['item_account']; $itemDel = $row['item_del']; $price = $row['item_price']; } } ?> -------------------------------- Header: <?php if($lrAmt != $price) : ?> <h2>Fatal error in transaction: the price does not match that in the database</h2> <?php else: ?> <h2>Thank you for you're purchase of <?php echo $itemName; ?>. Please keep these details safe as they have been deleted from our database.</h2> <?php echo '<br />'; echo 'Your new Username: ' . $login; echo '<br />'; echo 'Your password: ' . $pass; ?> <?php endif; ?> but if the user views the source code and grabs the ID they could easily get it for free by making a simple html script that takes in item_id and lr_amnt and put in the values and post it to the success page. example: <fieldset> <!-- <legend>Forgot password</legend> --> <form method="post" action="http://angrypossum.org/carl/mySaleTwo/success.php"> <p> <label for="itemid">Item ID: </label> <input type="text" name="item_id" id="itemid" class="input" /> </p> <p> <label for="itemprice">Item price: </label> <input type="text" name="lr_amnt" id="itemprice" class="input" /> </p> <p> <input type="submit" name="login" value="Steal" class="button" /> </p> </form> </fieldset> how could I stop that? thanks
  12. sorry to double post guys but i want to use the liberty reserve API instead of the paypal although im sure the logic behind the way of going around doing what I want to achieve will be the same.
  13. hey mate im pretty new to web dev but im pretty sure this is what you're looking for http://net.tutsplus.com/tutorials/other/using-htaccess-files-for-pretty-urls/
  14. Hi guys I'm making a shopping cart where the admin can login and post an item for sale like the example below when posting an new item they will post the details as above. I need a way so when they click the button buy it will link them to paypal with the price specified and then when purchase is successful I can display the details to the buyer. any idea on how I would go around doing this. thanks
  15. thanks for the reply guys will try those edit: thanks jcbones your way works perfectly
  16. Hey guys. I've made a script which will allow people to buy items, when an item is sold it will delete from the database. so its easy to see the items i have it have separate colors so its dark grey and light grey on the next line and so on. But the problem is when the item is bought 2 of the same colors are next to each other. I am checking if the item_id is an odd or even number to get the result I want but cant figure out a soluction to when an item is purchased. <?php foreach(getItems() as $item): ?> <?php if($item['item_id'] & 1): ?> <tr class="grey2"> <?php else: ?> <tr class="grey"> <?php endif; ?> <td><?php echo $item['item_account']; ?></td> <td><?php echo $item['item_country']; ?></td> <td><?php echo $item['item_info']; ?></td> <td><?php echo $item['item_login']; ?></td> <td><?php echo $item['item_pass']; ?></td> <td><?php echo $item['item_price']; ?> </td> <td><form method="post" action="#"><input type="submit" name="buy" value="Buy" class="button" /></form></td> </tr> <?php endforeach; ?> Thanks guys
  17. my first attempt at making a php script, included error handling incase the person dint pass in an integer. any comments / suggestions would be highly appreciated as im still learning! <html> <head> <title>Basic Calculator</title> </head> <style type="text/css"> label { width: 4em; float: left; text-align: right; margin-right: 0.5em; display: block } .submit input { margin-left: 4.5em; } input { color: #781351; background: #fee3ad; border: 1px solid #781351 } .submit input { color: #000; background: #ffa20f; border: 2px outset #d7b9c9 } fieldset { border: 1px solid #781351; width: 20em } legend { color: #fff; background: #ffa20c; border: 1px solid #781351; padding: 2px 6px } </style> <body> <form method="post" action="#"> <fieldset> <legend>Basic Maths Form</legend> <p> <label>First:</label> <input type="text" name="sum1" value="" /> </p> <p> <label>Math: </label> <select name='calculate'> <option value='null'>Choose...</option> <option value='add'>+</option> <option value='multiply'>x</option> <option value='subtract'>-</option> <option value='divide'>/</option> </select> </p> <p> <label>Second: </label> <input type="text" name="sum2" value="" /> </p> <b>Answere: </b> <?php if(isset($_POST['sum1']) && isset($_POST['sum2']) && isset($_POST['calculate'])) { $sum1 = strip_tags($_POST['sum1']); $sum2 = strip_tags($_POST['sum2']); $task = $_POST['calculate']; if(!is_numeric($sum1) || !is_numeric($sum2)) { echo 'oh noes! it appears you dint enter a valid number.'; } else { switch($task) { case 'add': echo $sum1 + $sum2; break; case 'multiply': echo $sum1 * $sum2; break; case 'subtract': echo $sum1 - $sum2; break; case 'divide': echo $sum1 / $sum2; break; default: echo 'OoOops!'; break; } } } ?> <p> <input type="submit" name="submit" value="Calculate" /> </p> </fieldset> </form> </body> </html>
  18. Hey guys, im new to php and decided to get into web dev, my friend talked me into learning php so ive started a php course from lynda.com and also recommened me this site. im looking forward to becoming apart of the community and hopefully developing my skills to allow me to help new members in the future. Carlos
×
×
  • 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.