Jump to content

champbronc2

Members
  • Posts

    45
  • Joined

  • Last visited

Everything posted by champbronc2

  1. So I have a MySQL database table that stores order ID and prices. The price can either be dynamic or static. So for example: Order ID | Price 1|205.99 2|215.95 3|217.88 4|$marketrate 5|$marketrate*1.02 6|212.99 On my php page I have include "prices.php"; $sql="Select `Order ID`, `Price` from `table` ORDERBY `price`"; $result=mysql_query($sql); while($row = mysql_fetch_assoc($result)){ echo "<tr ".$tr_class.">\n"; foreach ($row as $field=>$value) { eval('$value = ' . $value . ';'); echo "<td>" . $value . "</td>\n"; } echo "</tr>\n"; } So you see I use eval() to evaluate the price variable and display it and prices.php defines all the prices like $marketrate and whatnot. My question is, how can I orderby the evaluated prices? When I use orderby in my mysql statement, it sorts the array based on static numbers and then the variable names $marketrate, which obviously is wrong because $marketrate is not a number. I need it to sort the array according to what the evaluated value of $marketrate is. **Is it possible to somehow evaluate all the variables in the $result array, and then re-sort the array using a PHP sorting function?** edit: tried to put eval('$result['Price'] = ' . $result['Price'] . ';'); in there but it did not work.
  2. Ohh, got it. Sorry, I am still learning but thanks for the help!! Works now.
  3. <?php $id = $_GET['d']; $servername="localhost"; $username="c_links"; $password="pass"; $conn= mysql_connect($servername,$username,$password)or die(mysql_error()); mysql_select_db("c_links",$conn); $query1 = mysql_query("SELECT url FROM links WHERE id='$id'"); $url = mysql_fetch_array($query1) or die(mysql_error()); $query2 = mysql_query("SELECT name FROM links WHERE id='$id'"); $name = mysql_fetch_array($query2) or die(mysql_error()); $query3 = mysql_query("SELECT size FROM links WHERE id='$id'"); $size = mysql_fetch_array($query3) or die(mysql_error()); ?> <html> blah blah blah <?php eco $id; ?> //THIS ONE ACTUALLY WORKS <?php echo $url; ?> <?php echo $name; ?> <?php echo $size; ?> </html> When I do this and I go to http://example.com/?d=xxxx, where ever I have $url $name and $size in my html, the output is "Array" when it should be actually outputting a URL or a name or size. The $id one is the only one that works in the HTML body. The page completely loads and there are no error messages displayed. What is wrong with the code? Shouldn't it query my database, then when I run fetch_array store whatever the result is into the variable??? Thanks for any help!
  4. It works perfect now. Thank you very much.
  5. Ohhh. Well thanks it works now!!! Only problem is the IP address isn't showing up now...?
  6. Ok nevermind I can't edit. New code is here <? if (isset($_POST["email"])) { mysql_connect('localhost', 'champbux_raffle', 'raffle'); $con=mysql_connect('localhost', 'champbux_raffle', 'raffle'); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("champbux_raffle", $con); $email = $_POST['email']; $Country = $_POST['Country']; $ip=@$REMOTE_ADDR; $sql = "INSERT INTO Users (Email, Country, IP) VALUES ($email, $Country, $ip)"; mysql_query($sql) or die(mysql_error()); echo "You have been registered correctly"; } ?> <form action="raffle.php" method="post"><strong>YOUR IP ADDRESS IS BEING RECORDED</strong> By registering you agree to the terms that we are not held liable for anything wrong with the jersey and that you may only enter ONCE. After 200 participants have registered, one winner will be randomly chosen. An email will be dispatched to the winner. Please add raffle@champbux.com to your white list. Prizes not claimed within 72 hours will be forfeited and another winner will be chosen. All entrants will be screened for cheating. Shipping will be free to the United States. You will only have access to this page for 24 hours after the survey is completed. This is to prevent cheating. Your information will NEVER be disclosed to anyone or used for malicious purposes. <table border="0" width="400" align="center"> <tbody> <tr> <td width="150" align="left"><label>Email address</label></td> <td width="250" align="left"><input class="field" maxlength="100" name="email" size="25" type="text" tabindex="1" /></td> </tr> <tr> <td width="150" align="left"><label>Country (Shipping will NOT be free if outside of US)</label></td> <td width="250" align="left"><input class="field" maxlength="100" name="Country" size="25" type="text" tabindex="1" /></td> </tr> <tr> <td width="150" align="left"></td> <td width="250" align="right"><input class="submit" type="submit" value="Submit" tabindex="6" /></td> </tr> </tbody> </table> </form>
  7. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@gmail.com, US, )' at line 1 I get that message after hitting submit now while testing it. I changed the code. The new code is in the original post.
  8. That is all my code. I am really new and pretty much suck. And the thing is, I am using wordpress so my page is http://website.com/page/ so I don't know what to put instead of <?php echo $_SERVER['PHP_SELF']."?register=true" ?>
  9. $sql = "INSERT INTO tb_Users (Email, Country, IP) VALUES ($email, $Country, $ip)"; mysql_query($sql) or die(mysql_error()); echo "You have been registered correctly"; Tried changing it to that. It still won't work. I tried to submit it, and no errors seem to occur but the database is empty. And it does not echo You have been registered correctly.
  10. <?php function registerUser() { mysql_connect('localhost', 'site_raffle', 'raffle', 'site_raffle'); $email = $_POST['email']; $Country = $_POST['Country']; $ip=@$REMOTE_ADDR; $sql = "INSERT INTO tblUsers (fldEmail, fldCountry, fldIP) VALUES ($email, $Country, $ip);"; mysql_query($sql); } ?> <form action="<?php $_SERVER['PHP_SELF']."?register=true" ?>" method="post"> <table border="0" width="400" align="center"> <tbody> <tr> <td width="150" align="left"><label>Email address</label></td> <td width="250" align="left"><input class="field" maxlength="100" name="email" size="25" type="text" tabindex="1" /></td> </tr> <tr> <td width="150" align="left"><label>Country (Shipping will NOT be free if outside of US)</label></td> <td width="250" align="left"><input class="field" maxlength="100" name="Country" size="25" type="text" tabindex="1" /></td> </tr> <tr> <td width="150" align="left"></td> <td width="250" align="right"><input class="submit" type="submit" value="Submit" tabindex="6" /></td> </tr> </tbody> </table> </form> What is wrong with the code?? I will go to my webpage, fill out the fields, and hit submit. I check the database, and no new information has been entered...
  11. OK, I have a column in my database labeled expiredate and it is a date column. How can I have a query that will do this: $query = mysql_query("UPDATE users SET expiredate='CURDATE()+30days', referer='$username' WHERE referer='available' SORT BY visits DESC"); Then I also need something that will do this: $query = mysql_query("UPDATE users SET referer='' WHERE expiredate is before the current date") I will pay $5 PayPal if someone can help, and give an explanation.
  12. <? session_start(); ?> <? include('header'); ?> <? if(isset($_COOKIE["usNick"]) && isset($_COOKIE["usPass"])) { ?> <h3>Convert to Ads/Cash/Premium Membership</h3> <br> <div align="center"><a href="convert.php?convert=ads"><b>Convert to Ads</b></a><br> Advertise on <? include('sitename.php'); ?> <br><br> <a href="convert.php?convert=cash"><b>Convert to Cash via PayPal or Check or AlertPay (if by check you must have $20!)</b></a><br> Get CASH via AlertPay/PayPal/Check. You must earn at least $<? require('config.php'); $sql = "SELECT * FROM config WHERE item='payment' and howmany='1'"; $result = mysql_query($sql); $row = mysql_fetch_array($result); mysql_close($con); echo $row["price"]; ?>. <br><br> <div align="center"><a href="convertpremium.php"><b>Convert to Premium Membership</b></a><br> Convert your balance and upgrade to premium membership.</div> <br><br> <? if ($_GET["convert"]=="cash") { $user=uc($_COOKIE["usNick"]); require('config.php'); $sql = "SELECT * FROM users WHERE username='$user'"; $result = mysql_query($sql); $row = mysql_fetch_array($result); $root=$row["money"]; $sqle = "SELECT * FROM config WHERE item='payment' and howmany='1'"; $resulte = mysql_query($sqle); $rowe = mysql_fetch_array($resulte); mysql_close($con); $price=$rowe["price"]; if ($root<$price){ echo "<center><b>Whoops, you only have $".$row["money"]." You must earn at least $".$price." to request payment via AlertPay/PayPal.</b></center>"; }else{ echo "<center><b>After you request for payment your account will be audited to make sure you aren't violating the TOS.<br>A confirmation email has been sent to your PayPal/AlertPay email address to confirm its validity. You must confirm or you will not receive payment.</b></center>"; $username=$row["username"]; require('config.php'); $checkuser = mysql_query("SELECT username FROM payme WHERE username='$username'"); $username_exist = mysql_num_rows($checkuser); mysql_close($con); if ($username_exist>0) { echo "<br><center><b>Your payment is being proccesed. Processing time: 48 hours if payout is via AlertPay/PayPal, up to 14 days if payout is via Check. (it all depends on the post office)<br>A confirmation email has been sent to your PayPal/AlertPay email address to confirm its validity. You must confirm or you will not receive payment.</b></center>"; }else{ $password=$row["password"]; $email=$row["email"]; $pemail=$row["pemail"]; $country=$row["country"]; $money=$row["money"]; $paymentmethod=$row["paymentmethod"]; $laip=getRealIP(); require('config.php'); function createRandomPassword() { $chars = "abcdefghijkmnopqrstuvwxyz023456789"; srand((double)microtime()*1000000); $i = 0; $pass = '' ; while ($i <= 7) { $num = rand() % 33; $tmp = substr($chars, $num, 1); $pass = $pass . $tmp; $i++; } return $pass; } // Usage $password69 = createRandomPassword(); $emailget = "SELECT pemail FROM users WHERE username='$username'"; $pemail6 = mysql_query($emailget); $email8= mysql_fetch_array($pemail6); $code = md5($password69); $query18 = "INSERT INTO `payme` (username, pasword, email, pemail, country, money, paymentmethod, ip, ccode) VALUES('$username','$password','$email','$pemail','$country','$money','$paymentmethod','$laip', '$code')"; mysql_query($query18) or die(mysql_error()); $lice = "UPDATE `history` SET ccode = '$code' WHERE user = '$username'; mysql_query($query18) or die(mysql_error()); $to = "$email8"; $subject = "ChampBux Payment Confirmation"; $message = "If you didn't ask for payment ignore this.\n\nConfirm your email address by copying and pasting the following link into your URL bar. \n\n http://www.champbux.com/verifypayment.php?code=$code"; $headers = "From: admin@champbux.com"; $mail_sent = @mail( $to, $subject, $message, $headers ); mysql_close($con); } } } if ($_GET["convert"]=="ads") { $user=uc($_COOKIE["usNick"]); require('config.php'); $sql = "SELECT * FROM users WHERE username='$user'"; $result = mysql_query($sql); $row = mysql_fetch_array($result); $root=$row["money"]; $sqle = "SELECT * FROM config WHERE item='hits' and howmany='1000'"; $resulte = mysql_query($sqle); $rowe = mysql_fetch_array($resulte); mysql_close($con); $pricee=$rowe["price"]; if ($root<$pricee){ echo "<center><b>Whoops, you only have $".$row["money"]." You must earn at least $".$pricee." to convert to ads.</b></center>"; }else{ echo "<center><b>After you request to Convert to Ads, your account will be audited to make sure you aren't violating the TOS.</b></center>"; $email=$row["email"]; require('config.php'); $checkuser = mysql_query("SELECT pemail FROM advertisers WHERE pemail='$email'"); $username_exist = mysql_num_rows($checkuser); mysql_close($con); if ($username_exist>0) { echo "<br><center><b>Your advertisers is being proccesed. Processing time: 48 hours.</b></center>"; }else{ if (isset($_POST["url"])) { require('config.php'); if( strtolower($_POST['code'])!= strtolower($_SESSION['texto'])){ echo "SECURITY CODE ERROR... "; exit(); } $url=limpiar($_POST["url"]); $description=limpiar($_POST["description"]); if ($url==""){echo "Error"; exit();} if ($description==""){echo "Error"; exit();} $laip = getRealIP(); $user=$_COOKIE["usNick"]; require('config.php'); $sqlu = "SELECT * FROM users WHERE username='$user'"; $resultu = mysql_query($sqlu); $rowu = mysql_fetch_array($resultu); $money=$rowu["money"]; $query = "INSERT INTO advertisers (pemail, plan, url, description, ip, tipo, money) VALUES('$user','1000','$url','$description','$laip','convert','$money')"; mysql_query($query) or die(mysql_error()); mysql_close($con); echo "<br><center><b>Your advertisers is being proccesed. Processing time: 2-5 working days.</b></center>"; }else{ ?> <br><br> Please complete the next form. <div align="center"><div id="form"> <fieldset><legend> Convert to Ads </legend> <form method="post" action="convert.php?convert=ads"> <table width="400" border="0" align="center"> <tr> <td width="150" align="left"><p><label>Link's Text</label></p></td> <td width="250" align="left"><input type="text" name="description" size="25" maxlength="100" autocomplete="off" class="field" value="" tabindex="1" /></td> </tr> <tr> <td width="150" align="left"><p><label>Link's URL</label></p></td> <td width="250" align="left"><input type="text" name="url" size="25" maxlength="150" autocomplete="off" class="field" value="http://" tabindex="1" /></td> </tr> <tr> <td width="150" align="left"><p><label>Plan</label></p></td> <td width="250" align="left"><? require('config.php'); $sql = "SELECT * FROM config WHERE item='hits' and howmany='1000'"; $result = mysql_query($sql); $row = mysql_fetch_array($result); mysql_close($con);?> <b>1000 Member visits $<?= $row["price"] ?></td> </tr> <tr> <td width="150" align="left"><p><label>Security Code </label></p></td> <td width="250" align="left"><input type='text' size='3' maxlength='3' name='code' autocomplete="off" class="securitycode" value="" tabindex="3" /></td> </tr> <tr> <td width="150" align="left"> </td> <td width="250" align="left"><img src="image.php?<?php echo $res; ?>" /></td> </tr> <tr> <td width="150" align="left"> </td> <td width="250" align="right"><input type="submit" value="Convert" class="submit" tabindex="4" /> </td> </tr> </table> </form> </fieldset> </div></div> <? }// final post } } } ?> <? } else { dologin(); } ?> <!--footer starts here--> <? include('footer.php'); ?> Parse error: syntax error, unexpected T_VARIABLE in /home/champbux/public_html/betaconvert.php on line 112 I am not sure what is wrong with the script? It looks fine to me.
  13. <? session_start(); ?> <? include('header.php'); ?> <? include('config.php'); if (isset($_POST["username"])) { $usernamed = limpiar($_POST["username"]); $sql = "SELECT confirmed FROM users WHERE username = '$usernamed'"; $sql2 = mysql_query($sql) or die(mysql_error()); $sql3 = mysql_fetch_array($sql2) or die(mysql_error()); if ($sql3 == 1){ echo ("<b>Your account is already confirmed!</b>"); } else { $checkpemail = mysql_query("SELECT * FROM users WHERE username = '$usernamed'"); $pemail_exist = mysql_num_rows($checkpemail); if ($pemail_exist<1) { echo "Username doesnt exist."; exit(); } else { $coded = mysql_query("SELECT ccode FROM users WHERE username = '$usernamed'") or die(mysql_error()); $code = mysql_fetch_array($coded) or die(mysql_error()); $emaild = mysql_query("SELECT email FROM users WHERE username = '$usernamed'") or die(mysql_error()); $email = mysql_fetch_array($emaild) or die(mysql_error()); $to = "$emaild"; $subject = "ChampBux Registration Confirmation for $usernamed"; $message = "Hello $firstname \n\nYou have been registered at ChampBux with the username $usernamed\n\nIf that is incorrect and you have not registered for ChampBux please disregard this email.\n\nConfirm your email address by copying and pasting the following link into your URL bar. \n\n http://www.champbux.com/verify.php?code=$coded"; $headers = "From: $SITEEMAIL\r\n"; $mail_sent = @mail( $to, $subject, $message, $headers ); "X-Mailer: php"; if (mail($to, $subject, $message, $headers)) { echo("<p>Message successfully sent! Check your spam box too!</p>"); } else { echo("<p>Message delivery failed...</p>"); } } } } ?> <div align="center"><div id="form"> <form action="resend.php" method="POST"> <h2>Did not receive your confirmation email? Have it resent here!</h2> <fieldset> <table width="400" border="0" align="center"> <tr> <td width="150" align="left"><p><label>Username</label></p></td> <td width="250" align="left"><input type='text' size='15' maxlength='150' name='username' autocomplete="off" value="" tabindex="1" /></td> </tr> <tr> <td width="150" align="left"> </td> <td width="250" align="center"><input type="submit" value="Resend" class="submit" tabindex="4" /> </form> </table> </fieldset> </div></div> <? include('footer.php'); ?> No matter what I always get Message Delivery Failed. What is wrong? Also, if the username isn't found in the database how can i have it echo "User not found". Right now the code will just echo the header for some reason if I enter an invalid username. If I put a valid username it fails to send.
  14. Well now it kind of works. No error, but it deletes the account no matter what is in the ad # and doesn't say the account deleted message. I went to http://www.example.com/view.php?ad=123 That shouldn't be marked as cheating but still did mark it as cheating and deleted the account.
  15. Parse error: syntax error, unexpected '/', expecting ')' in /home/champbux/public_html/betaview.php on line 6 preg_match( /(.*)0(.*)/,$ad_id,$match); //if you just want to find 0's at the beginning of the string then replace (.*)0(.*) with 0(.*)
  16. OK, I will pay $5 PayPal if somebody can just do this.
  17. No I don't think that would work because wouldn't that flag anyone viewing http://www.example.com/view.php?ad=### I only want it to flag people if the # in the ad URL variable has a zero or letters in it. I got this when I went to this url http://www.example.com/view.php?ad=0 Fatal error: Call to undefined function uc() in /home/champbux/public_html/betaview.php on line 7 And when I tried http://www.example.com/view.php?ad=0123 it didn't flag it.
  18. OK so I have a url and it looks like Http://www.example.com/example.php?ad=### What I want to do is something like this: $ad_id=limpiar($_GET["ad"]); if '$ad_id LIKE %0% OR contains %abcdefghijklmnopqrstuvwxyz%{ echo '$user=uc($_COOKIE["usNick"]); $delete = "DELETE FROM users WHERE username='$user'" $go = mysql_query($delete) "Account deleted! Stop cheating" } else { I realize that this code is complete garbage because it is wrong. I don't know the commands but I am trying to show you what I need it to do. Can anyone give me the code to do what I am trying to do?
  19. <? $lole=$_COOKIE["usNick"]; require("config.php"); echo $url; ?>/register.php?r=<? echo $lole; $refurl="echo $url; ?>/register.php?r=<? echo $lole" ; ?> <h3>Tools to help you get referrals!<br> Earn the most out of ChampBux that you can!</h3><br> <img src="http://www.champbux.com/banner1.png"><br> <textarea name="forum" cols="45" rows="3" readonly="readonly">[url=$refurl][img=http://www.champbux.com/banner1.png][/url]</textarea> $refurl is showing the correct value, but where it says it is actually putting $refurl How can I fix that?
×
×
  • 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.