Jump to content

desjardins2010

Members
  • Posts

    187
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

desjardins2010's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. I include connection file at the top this page that sets my connection $con = mysqli_connect("$host","$user","$password","$database");
  2. $user_query = "SELECT * FROM `referrals`"; $user_querys = $con -> query($user_query); $count_query = $user_query -> num_rows; if ($count_query !=0) { while ($row = $user_querys -> fetch_assoc()) { $id = $row['id']; $REG_DATE = $row['regdate']; $username = $row['username']; $refd_user = $row['refd_user']; $commission = $row['commission']; $acct_status = $row['acct_status']; anyone tell me why this Trying to get property of non-object is happening on line $user_querys = $con -> query($user_query);
  3. Hey Me again; when storing data to mysql db i want to ensure it's safe the data I need to store is HTML code so in essence could be awhole page of html depending on what the user creates - I want them to be able to paste there html code store it and have it displayed on a page.. so would I just be ok using htmlentites() or something else or something in addition? and have it not loose it's html properties
  4. Sweet that worked perfect thanks Barand
  5. Ok this worked BUT one more question regarding this I notice that I get alot of sites that are the same CORE site but different appending ID's so they showing as different sites... is there an easy way to just match the www.something.com and leave our the ?asdfmsdmfs just curious no biggy I can handle if not
  6. yes this would work mentioned early on by Ansego but as cyberRobot said POST too can be messed with but way more secure than what your doing now..
  7. I'm trying to structure this query properly but failing with all attempts. i have a table that has 5 fields id, http_referrer,ip,hit,today what I want to do is query this table to show me all the http_referrer's GROUPED up so only 1 row for ALL say 255 results that came from www.google.ca and the SUM'd hits so RFERRER HIT google.ca 255 phpfreaks.com 15 I tried SELECT SUM(hit) as 'hits' FROM `global_stats` GROUP BY `http_referrer` this don't work
  8. hey josh regarding your comment above and considering I'm currently attempting to build myself a better mass mailer can you justify for me what is considered proper headers... I mean is there a cut rope method to ensure your emails get through - relevant of course to the content in the mail inself
  9. guys I'm trying to get this script to work and thus far whats happening is 1) when I hit send I get flooded with the script I'm running is simply looping through the emails found in the members table and instead of sending mail I just echo and it supply all the emails - what am I doing wrong..? <?php //MASS MAILER FOR REFERRALCATCH.COM //CODE CREATED MARCH 14th 2014 //DESJARDINS MEDIA INC // INCLUDE CONNECT FILE include '../inc/connect.php'; //****************IF FORM WAS SUBMITTED LETS LISTEN FOR THAT************// if ($_SERVER['REQUEST_METHOD'] === 'POST') { //if the post is active lets make sure that all the fields were filled in if (!isset($_POST['subject']) || !isset($_POST['message'])) { //then all fields were not set and must show an error $errors[] = "Sorry you must enter both fields"; //END if (!isset) }else { //both fields were set now we have to clean them up a bit $subject = trim(htmlspecialchars($_POST['subject'])); $message = trim(htmlspecialchars($_POST['message'])); $message = wordwrap($message, 70, "\r\n"); // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // Mail it loop through members $grab_emails = "SELECT * FROM `members` WHERE `Activation` = 'NULL'"; $ex_grab = $con -> query($grab_emails); while ($row = $ex_grab -> fetch_assoc()) { $email = $row['Email']; $to = $email; $headers .= 'To: '.$email . "\r\n"; $headers .= 'From: admin@REMOVED.com' . "\r\n"; //send the mail $send = mail($to, $subject, $message, $headers); if ($send) { echo "<font size='6' color='Green'>.</font>"; }else { echo "<font size='6' color='red'>.</font>"; } } //end $_SERVER['REQUEST_METHOD'] } } //****************FIND NUMBER OF VALID EMAILS TO SEND TO ****************// $query_avail = "SELECT * FROM `members` WHERE `Activation` = 'NULL'"; $ex_query = $con -> query($query_avail); $ex_count = $ex_query -> num_rows; /****************** END MEMBER COUNT ***********************************/ ?> <!-- FORM FEILDS FOR EMAIL MESSAGE CREATION--> <table> <div class="member_count">There are currently <?php echo $ex_count; ?> users that can be sent emails.</div> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST"> <tr> <td>Subject:</td><td><input size="36" ="" type="text" name="subject"></td> </tr> <tr> <td valign="top">Message:</td><td><textarea cols="60" rows="10" name="message"></textarea></td> </tr> <tr> <td></td><td><input type="submit" name="submit" value="Process"></td> </tr> </form> </table>
  10. Ok I understand what your saying I just don't understand how you take an entry from a form in this case $_POST['startdate'] that is carrying the value 2014-03-11 and have it changed to 03-11-2014 to store? I'm know strtotime() and date() but not sure how you would use them to alter the date format..
  11. i felt the need to reply cause I'm a little confused hence the need for a help forum - where i'm getting lost is and mentioned above the format that the input type=date TAKES is m-d-y <-- this is how I want it to stay - when you process the form it gets stored in Y-m-d my question is I'm storing to DB in varchar is that wrong? and if thats the case how do I convert from Y-m-d to m-d-y
  12. <?php if ($_SERVER['REQUEST_METHOD'] == 'POST') { $siteName = $_POST['sitename']; $siteName = trim(htmlentities($siteName)); $dest_url = $_POST['url']; $dest_url = trim(htmlentities($dest_url)); $start_date = $_POST['startdate']; $start_date = trim(htmlentities($start_date)); $end_date = $_POST['enddate']; $end_date = trim(htmlentities($end_date)); $imageurl = $_POST['imageurl']; $imageurl = trim(htmlentities($imageurl)); $insert = "INSERT INTO `adverts` (siteName,dest_url,start_date,end_date,imageurl) VALUES ('$siteName','$dest_url','$start_date','$end_date','$imageurl')"; $insertquery = $mydb->query($insert); if ($insertquery) { $completed = true; } //end first if } ?> <div class="admin_wrap_rhs_form"> <table> <b class="alert_t1"> <?php if ($completed == true) { echo "New advertisement added successfully"; } ?></b> <form action="" method="post" name="addsite" onsubmit="return (validatecontact());"> <tr><td>Site Name</td><td>:</td><td><input type="text" name="sitename" class="admin_inp1" placeholder="SiteName"></td></tr> <tr><td>Destination URL:</td><td>:</td><td><input type="text" name="url" class="admin_inp1" placeholder=" Destination URL"></td></tr> <tr><td>Start Date:</td><td>:</td><td><input type="date" name="startdate" class="admin_inp1" placeholder="01-01-2014"></td></tr> <tr><td>End Date:</td><td>:</td><td><input type="date" name="enddate" class="admin_inp1" placeholder="01-29-2014"></td></tr> <tr><td>100*100 Image URL:</td><td>:</td><td><input type="text" name="imageurl" class="admin_inp1" placeholder="http://www.domain.com/images/banner.gif"></td></tr> <tr><td colspan="3"><center><input type="reset" value="Reset" class="admin_but"> <input type="submit" value="Add Site" class="admin_but"></center></td></tr> </form> </table> <p style="margin-top: 10px; ">NOTICE: remember you can use your image hosting here for your banner ads also <a href="index.php?action=upload_img">HERE</a></p> </div> this is the code the data being supplied by userend is directly from the input date function -- it's storing in DB as 2014-03-11 but my compare is looking to compare m-d-y now when you select a date using the form input its in the m-d-y so am I doing something to the entry when trim(htmlentities()) to the string?
  13. i have this code http://pastebin.com/XBJxGw6L prob is when using the input type=date when selecting the date it's showing as m-d-y but it's written to the database as Y-m-d so my query is failing to compare dates as it's checking in the format i believe m-d-y ??
  14. can somone point out why this returns 1 for the count when I'm confident there is nothing in the database?? $query = "SELECT * FROM `testing`"; foreach ($dbconnect->query($query) as $row) { echo "USERNAME: " . $row['username'] . "-" . "PASSWORD: " . $row['password'] . "<br/>"; } $query2 = $dbconnect->query("SELECT * FROM `testing` WHERE `email` = '$email'"); $count = count($query2); echo $count; if ($count !=0) { echo 'Mate Your Already In The Database'; }else { $dbconnect->exec("INSERT INTO `testing` (id,username,password,email) VALUES ('','$username','$password','$email')"); echo 'Successfully Entere Into Database'; }
  15. echo "<tr><td>".$prog_name."</td><td><a href='".<?php echo htmlspecialchars($_SERVER["PHP_SELF"])?>."?id=".$title."'>EDIT</a></td></tr>"; what am I doing wrong - and could you please just explain my mistake so I can learn from it.. I know it's having to do with the "" and '' but I confuse on where to use them
×
×
  • 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.