Jump to content

joel24

Members
  • Posts

    760
  • Joined

  • Last visited

Everything posted by joel24

  1. sorry I've never have to do this before - is your fsockopen acquiring a connection? someone else may have successfully achieved this before and be able to help... $fp = fsockopen("www.example.com", 80, $errno, $errstr, 30); if (!$fp) { echo "$errstr ($errno)<br />\n"; } else { //create array of data to be posted //$post_data['firstName'] = 'Name'; $post_data['item_name'] = '12345'; //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); //we also need to add a question mark at the beginning of the string $post_string = '?' . $post_string; //we are going to need the length of the data string $data_length = strlen($post_string); //sending the data fputs($connection, "POST /i.php HTTP/1.1\r\n"); fputs($connection, "Host: www.example.com \r\n"); fputs($connection, "Content-Type: application/x-www-form-urlencoded\r\n"); fputs($connection, "Content-Length: $data_length\r\n"); fputs($connection, "Connection: close\r\n\r\n"); fputs($connection, $post_string); //closing the connection fclose($connection); }
  2. joel24

    Login help

    you need to start the session before checking values are set. <?php session_start(); if(isset($_SESSION["isAuthenticated"])) { print "YOU ARE ACCESSING SECURE DATA!" else { print "You must be registered or logged in to continue."; print "<hr />"; print "<a href='xmlShredderRegister.php'>Create account</a> <br />"; print "<a href='xmlShredderLogin.php'>Login</a>"; } ?>
  3. joel24

    Login help

    you're encrypting the password stored in the database twice - once on insert and then again on checking.. just encrypt it for the insert
  4. use isset() and to echo, you would use echo $_SESSION['myusername'];
  5. i would store the time in seconds as an INT field and also store the filesize for future use.
  6. create a delete function and execute it each time a update is executed?
  7. is it returning anything? you're script tag is incorrect also... play around with print_r($_POST); and post what that prints also change the script tag echo "<script type='text/javascript'>window.alert('$ipselects')</script>";
  8. you're calling the mysql_query twice... $sql = ("SELECT (fee + upgrade + tax) AS theTotal, * FROM Teamregister WHERE pkSoloregisterID=$pkSoloregisterID"); $result = mysql_query($sql); $myrow = mysql_fetch_array($result); echo $myrow['theTotal'];
  9. send an email for each iteration of the while loop... this will take up many more resources than if you had used CC or BCC, someone else may know a better solution? another option to deter spam filtering - send it via gmail's SMTP (if you've signed up to use google mail with your domain) $sql=@mysql_query("SELECT name, email FROM people WHERE event='christmas'"); #whichever event while ($row=mysql_fetch_assoc($sql)) { mail($row['email'],'the subject','the message'); }
  10. $sql=@mysql_query("SELECT * FROM etc etc"); $retail=0; $sales=0; while ($row=mysql_fetch_assoc($sql)) { if ($row['retail_sales.amount'] > $row['online_sales.amount']) { $retail++; } else { $sales++; } } echo "$retail - $sales";
  11. yeah, FILTER_SANITIZE_STRING or mysql_real_escape_string(): have a look around on google or search through the forum topics, there are many different ways to do this.
  12. I was thinking that though I didn't know how you could use insert, on duplicate to check that there are 5 values and then update/replace the last?
  13. have you set the <title> tag and the <meta description=''> ? I've always modified these values for use on facebook.
  14. select d.domain, IF(count(*)=0, 0, count(*)) total from domains d left join searches s on(d.domain_id = s.domain_id and d.member_id = 1) group by d.domain_id
  15. not entirely sure exactly what you're after...? $radio1=(isset($_POST['radioButton1']) )?$_POST['radioButton1']:''; $radio2=(isset($_POST['radioButton2']) )?$_POST['radioButton2']:''; $radio3=(isset($_POST['radioButton3']) )?$_POST['radioButton3']:''; $sql=@mysql_query("UPDATE table SET radio1='$radio1', radio2='$radio2', radio3='$radio3' WHERE id='$id'");
  16. i think you should go with the pageviews / history table - all three of us seem to agree on the one solution; and don't worry about slowing the database with too many records - you can set up some cronjobs later to delete any records over a certain amount for each user.
  17. it will be much easier to pop up a <div> element with the message rather than a new window. Have a look into ajax - I would submit the form with ajax to the save_to_favourites.php and then have the response message displayed in a popup div. If you want to use a new window (some browsers may block this) then you can grey out the current screen using just the popup div and then you'll have to alert the parent window to hide that grey out once the actions are complete.
  18. you need to use javascript to do this. have a look at the jQuery framework and this tutorial to grey it out, you need to have a div that takes up the entire screen (100% x 100%) positioned on top of the main document but behind the popup (using z-index). Then when a user clicks on 'save to favourites' you set the script to popup the message and the greyed out div. jQueryUI's Shadow has a pleasant shadow/greyed div. *edit* or google for some javascript popup tutorials, though the jQuery framework will make life a lot easier.
  19. not exactly sure what you're after... or what value you're trying to assign... current value? $doc=new DOMDocument(); mysql_connect("localhost","root"); mysql_select_db("xmlDB"); $edges=mysql_query("SELECT * FROM edge"); while($row=mysql_fetch_assoc($edges)) { if($row['flag']=='val') { $curValue=mysql_query("SELECT val FROM value,edge WHERE val.edge_id=edge.edge_id"); if($curRowIsAttribute=mysql_query("SELECT is_Attribute FROM value,edge WHERE value.is_Attribute='Y' AND value.edge_id=edge.edge_id")) { //create attribute node $currentValue=mysql_result($curValue,0); //will retrieve val from the $curValue sql query - you can use mysql_fetch_assoc etc which is more efficient though in this situation you can play around with it... $newAttr=$dom->createAttribute($currentValue);//HELP HERE PLEASE THEN I SHOULD BE ABLE TO COMPLETE NEXT TWO LINES BELOW! //set attribute value ... //append attribute to current element ... }//END IF }//END IF }//END BIG WHILE
  20. i would setup a relational database- users; userid (auto_increment - primary key), email, joined, country pageViews; pageView (auto_increment - primary key), page, datetime, userid link users table to the pageViews table and insert the pageViews into the pageViews table - with added information such as datetime so you know when they viewed that page. If you want to limit this to 5, then you can run a $check = @mysql_query("SELECT pageView FROM pageViews WHERE user_id='{$_SESSION['user_id']}'"); if (mysql_num_rows($check) >= 5) { @mysql_query("DELETE FROM pageViews ORDER BY `datetime` LIMIT 1"); } //insert page view I would be inclined to store all the pageviews and not commit to deleting, also I've assumed you have the user id kept in the session somewhere? if not, you can change the session value to a $_GET value or however you determine the userID you're searching for. I would be
  21. yes you do. you need to put in the hour difference unless your mysql install is setup to accept textual timezones. $currentOffset = "+".(date("Z") / 60 / 60).":00"; //timezone mysql $update_tz = @mysql_query("SET time_zone = '$currentOffset'");
  22. have a read of this thread http://www.codingforums.com/showthread.php?t=160316 in short, the variables are stored in $GLOBALS['HTTP_RAW_POST_DATA']; rather than $_POST... try run this on the page receiving the data... [from the aforementioned thread & user 'kbluhm'] $raw_data = $GLOBALS['HTTP_RAW_POST_DATA']; parse_str( $raw_data, $_POST ); print_r( $_POST );
  23. you're trying to use a composite primary key which is fine and unique. i.e. your primary key would be (quizid, answerid) google it or have a quick read here as for columns or fields, I hear both terms used frequently - i'm sure someone else will have some input into this question.
  24. use a group by studentUsername, sessionID and then sum(mark) or sum(grade) in your mysql query...?
×
×
  • 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.