Jump to content

etymole

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

etymole's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi there. Having a little trouble getting Open Graph working with my facebook like button. I can put text in fine but I want the following variables to be represented in the head information so that I can edit the head data periodically. Would appreciate any help. I've tried "<?php echo $blahblah ?>" which doesn't seem to work. Confirmed that nothing was being pulled by Facebook's linter... //Variable for Head. $id = '1'; $promo_id = $id; //Change this to be variable with function... $promo_title = "Goody Bag"; $promo_text = cms::string('copy.goody_bag.sub_title'); $promo_image = "/assets/images/goody_bag/goody_bag_small_bg.png";//Change this to be variable with function... $promo_description = cms::string('copy.goody_bag.text'); //These are to be put into the head information but will need to be made variable using either the controller or the iframe.php ?> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://opengraphprotocol.org/schema/" xmlns:fb="http://www.facebook.com/2008/fbml"> <head> <title></title> <meta property="og:title" content="Goody Bag"/> <meta property="og:type" content="website"/> <meta property="og:url" content="http://apps.facebook.com/ztoa_dev/like/show_like/1"/> <meta property="og:image" content="http://apps.facebook.com/ztoa_dev/assets/images/goody_bag/goody_bag_small_bg.png?2"/> <meta property="og:site_name" content="Z to A by Sunsilk"/> <meta property="fb:admins" content=""/> <meta property="og:description" content="Blah Blah Blah"/> </head>
  2. Hi. Sorry if I'm posting in the wrong forum. My problem spans all three types. I'm working as an intern at a web development company and am trying to create a select box to contribute to filtering a table by country based on the country selected, but without submitting, so I guess I need a bit of javascript to do this. I have a <select> drop down menu that is pulling information from a spreadsheet (created by the company). I have that working, but now what I want to do is pull the value of the currently selected item (country) out and place it in a variable so that I can run a compare with all of the current 'user' countries that match the selected country. I apologise if I sound a little confusing. It's really a simple thing I'm trying to do but because I want to do it in real-time I don't want to use a submit and a $Get to get the value passed. I then want to compare the value obtained with an already existing PHP variable(s). I'm afraid I don't have the code as I couldn't take it home. It looks something like this: I've used open and closing <?php ?> tags because it makes it easier for me to read instead of using quotation marks and echo's all over the place, sorry if this is bad practice, I hope it's readable. $countries = array(country pulling method) blah blah... <select id="countries"> foreach($countries as $value) { <option value="<?php $value ?>" > <?php $value ?></option> } </select> Now, to re-iterate, this select box displays all of the countries in the spreadsheet on each line as I want. Can anyone help me get the real-time selected country without the need for a Submit? Appreciate any help Thanks
  3. Hi As the title suggests my problem is that I'm trying to get some of the enumerated fields (e.g. Sex, Age range, etc) to link into my drop down boxes in my script. I also want to be able to update the specific selection for each record with the drop down box. I have managed to get this populate and update idea working using text form fields but I'm having a real issue trying to figure out how to get it working for a drop down menus and combo boxes. I'm assuming a while loop, looping through the options available and creating a new <option> each time. I have seen code snippets that do this which I've been trying to use, but these snippets refer to an entire table, I just want to select the enum options from a specific column. Below is the snippet I think I could use if only I could get the query correct. <form method="get" action="view_urls.php"> <select name="type"> <option value="NULL">Choose a Category:</option> '; // Retrieve and display the available categories. $query = 'SELECT * FROM url_categories ORDER BY category ASC'; //POSSIBLE TO MAKE THIS QUERY SELECT ONLY THE ENUM OPTIONS???? $result = mysql_query ($query); while ($row = mysql_fetch_array ($result, MYSQL_NUM)) { echo "<option value=\"$row[0]\">$row[1]</option> "; } // Complete the form. echo '</select> <input type="submit" name="submit" value="Go!"> </form> I'm pretty new to PHP and SQL and this is a little out of my grasp right now. I appreciate all help.
  4. Scrap my last reply, I just re-read your first post. Using the [name] inside the array I can get the file name. Now all I have to do is find a way to call the full address when I access it from a specific users page. Thanks alot mate!
  5. Thank you Zanus, I think I'm getting it. However, now I try it and the value put into my SQL table is Array[tmp_name]. Like its not actually putting the value in. I'm using - '$_FILES[upload][tmp_name]' I know this isn't correct, but doing it your way gives me this parse error - Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING What am I doing wrong? unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING
  6. Right. It seems to be putting something in there but when I check my sql table, it tells me it's an Array. Is there a way I can break it down to display the URL as text?
  7. Hi again I'm having a little trouble with this as I'm working from a book example and trying to get the URL from the image I have uploaded so that I can store it in my sql table (to be referenced and viewed later) Here is my code: <?php # upload_image.php // Check if the form has been submitted. if (isset($_POST['submitted'])) { // Check for an uploaded file. if (isset($_FILES['upload'])) { // Validate the type. Should be jpeg, jpg, or gif. $allowed = array ('image/gif', 'image/jpeg', 'image/jpg', 'image/pjpeg'); if (in_array($_FILES['upload']['type'], $allowed)) { // Move the file over. if (move_uploaded_file($_FILES['upload']['tmp_name'], "uploads/{$_FILES['upload']['name']}")) { echo '<p>The file has been uploaded!</p>'; } else { // Couldn't move the file over. echo '<p><font color="red">The file could not be uploaded because: </b>'; // Print a message based upon the error. switch ($_FILES['upload']['error']) { case 1: print 'The file exceeds the upload_max_filesize setting in php.ini.'; break; case 2: print 'The file exceeds the MAX_FILE_SIZE setting in the HTML form.'; break; case 3: print 'The file was only partially uploaded.'; break; case 4: print 'No file was uploaded.'; break; case 6: print 'No temporary folder was available.'; break; default: print 'A system error occurred.'; break; } // End of switch. print '</b></font></p>'; } // End of move... IF. } else { // Invalid type. echo '<p><font color="red">Please upload a JPEG or GIF image.</font></p>'; unlink ($_FILES['upload']['tmp_name']); // Delete the file. } } else { // No file uploaded. echo '<p><font color="red">Please upload a JPEG or GIF image smaller than 512KB.</font></p>'; } } // End of the submitted conditional. require_once ('../mysql_connect.php'); // Connect to the db. mysql_query("UPDATE users SET profile_pic= '$_FILES[upload]' WHERE user_id = '19'"); mysql_close(); // Close the database connection. ?> <form enctype="multipart/form-data" action="upload_image.php" method="post"> <input type="hidden" name="MAX_FILE_SIZE" value="524288"> <fieldset><legend>Select a JPEG or GIF image to be uploaded:</legend> <p><b>File:</b> <input type="file" name="upload" /></p> </fieldset> <div align="center"><input type="submit" name="submit" value="Submit" /></div> <input type="hidden" name="submitted" value="TRUE" /> </form> The upload facility works fine, and I will eventually put this code into a users profile page to upload images linked only to their username. If I could get this working. As you can see I have tried an SQL query but I'm not sure how to get the name: mysql_query("UPDATE users SET profile_pic= '$_FILES[upload]' WHERE user_id = '19'"); I just want the name of the address the image was stored at....I'm so confused...
  8. Somebody please help me...I'm relatively new to PHP... I've been working from the visual quickstart guide to php and mysql and have been having trouble with sessions when trying to login...I've googled my errors but still get the same problem, or just have my script not work properly. The error I'm getting is - Warning: Cannot modify header information - headers already sent by (output started at /home/content/g/k/o/gkodikara/html/ecomm/mysql_connect.php:10) in /home/content/g/k/o/gkodikara/html/ecomm/ecommwebsite/checklogin.php on line 33 I'm just not sure what this means. I have moved the session_start() and header() functions about but this has had little effect and makes my script stop working completely... I will post the code I am using including the mysql_connect script mentioned in the error - login.php <?php # Script 9.15 - login.php (7th version after Scripts 9.1, 9.3, 9.6, 9.10. 9.13 & 9.14) // Send NOTHING to the Web browser prior to the session_start() line! session_start(); // Create a function for escaping the data. function escape_data ($data) { global $dbc; // Need the connection. if (ini_get('magic_quotes_gpc')) { $data = stripslashes($data); } return mysql_real_escape_string(trim($data), $dbc); } // End of function. // Check if the form has been submitted. if (isset($_POST['submitted'])) { require_once ('mysql_connect.php'); // Connect to the db. $errors = array(); // Initialize error array. // Check for an email address. if (empty($_POST['email'])) { $errors[] = 'You forgot to enter your email address.'; } else { $e = escape_data($_POST['email']); } // Check for a password. if (empty($_POST['password'])) { $errors[] = 'You forgot to enter your password.'; } else { $p = escape_data($_POST['password']); } if (empty($errors)) { // If everything's OK. /* Retrieve the user_id and first_name for that email/password combination. */ $query = "SELECT user_id, first_name FROM users WHERE email='$e' AND password=SHA('$p')"; $result = @mysql_query ($query); // Run the query. $row = mysql_fetch_array ($result, MYSQL_NUM); // Return a record, if applicable. if ($row) { // A record was pulled from the database. // Set the session data & redirect. session_name ('YourVisitID'); $_SESSION['user_id'] = $row[0]; $_SESSION['first_name'] = $row[1]; $_SESSION['agent'] = md5($_SERVER['HTTP_USER_AGENT']); // Redirect the user to the loggedin.php page. // Start defining the URL. $url = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']); // Check for a trailing slash. if ((substr($url, -1) == '/') OR (substr($url, -1) == '\\') ) { $url = substr ($url, 0, -1); // Chop off the slash. } // Add the page. $url = '/loggedin.php'; header("Location: $url"); exit(); // Quit the script. } else { // No record matched the query. $errors[] = 'The email address and password entered do not match those on file.'; // Public message. $errors[] = mysql_error() . '<br /><br />Query: ' . $query; // Debugging message. } } // End of if (empty($errors)) IF. mysql_close(); // Close the database connection. } else { // Form has not been submitted. $errors = NULL; } // End of the main Submit conditional. // Begin the page now. $page_title = 'Login'; if (!empty($errors)) { // Print any error messages. echo '<h1 id="mainhead">Error!</h1> <p class="error">The following error(s) occurred:<br />'; foreach ($errors as $msg) { // Print each error. echo " - $msg<br />\n"; } echo '</p><p>Please try again.</p>'; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Clubdate.net - Dating for club lovers!</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link href="style.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="wrapper"> <h1><a href=""><img src="images/logo.gif" width="554" height="47" alt="ClubDate.net" /></a></h1> <div id="booking"> <h2>Member Login</h2> <table width="300" border="0" align="center" cellpadding="0" cellspacing="1" > <tr> <form name="form1" method="post" action="checklogin.php"> <td> <table width="100%" border="0" cellpadding="3" cellspacing="1"> <tr> <td colspan="3"><strong>Member Login </strong></td> </tr> <tr> <td width="78">Username</td> <td width="6">:</td> <td width="294"><input name="email" type="text" id="email"></td> </tr> <tr> <td>Password</td> <td>:</td> <td><input name="password" type="text" id="password"></td> </tr> <tr> <td> </td> <td> </td> <td><input type="submit" name="Submit" value="Login"></td> </tr> </table> </td> </form> </tr> </table> </div> <!-- end search --> <div id="nav"> <ul> <li><a href="index.php">Home</a></li> <li><a href="about.php">About Us</a></li> <li><a href="testimonials.php">Testimonials</a></li> <li><a href="login.php">Register/Login</a></li> <li><a href="support.php">Support</a></li> </ul> </div><!-- end nav --> <h2 id="packagesheader"><img src="images/title_our_packages.gif" width="352" height="23" alt="our packages" /></h2> <div id="packages"> <?php // Create a login/logout link. if ( (isset($_COOKIE['user_id'])) && (!strpos($_SERVER['PHP_SELF'], 'logout.php')) ) { echo '<a href="logout.php" title="Logout">Logout</a>'; } else { echo '<a href="login.php" title="Login">Login</a>'; } ?> <div id="special"> <a href="advertising.php"><img src="images/ad_special_offer.gif" width="293" height="79" alt="Special Offer!" /></a> </div><!-- end special --> </div><!-- end packages --> <div id="main"> <img src="images/people.jpg" width="447" height="298" alt="Two people having a drink at a bar" class="block" /> <h2><img src="images/title_featured_members.gif" width="447" height="24" alt="featured members" /></h2> <!-- I will make the following section dynamic when I create the SQL and PHP end of the websites --> <div class="inner"> <h3 class="blue">Larissa</h3> <img src="images/photo_1.jpg" width="109" height="71" alt="stunning italian history" class="left" /> <p>Larissa is a 23 year old girl from Romania! <br /> Favorite clubs include: Pacha, Vendome and Jacuzzi!</p> <br /><br /> <h3 class="green">Greg</h3> <img src="images/photo_2.jpg" width="109" height="71" alt="sea, the beaches" class="left" /> <p>Greg is a 24 year old guy from London! <br /> Favorite clubs include: K.O, Area and Kandi Club!</p> <div class="clear"></div> </div> <div class="clear"></div> </div><!-- end main --> <div id="footer"> <center> © Copyright ClubDate.net&#8482; 2010 | <a href="contact.php">Contact</a> | <a href="login.php">Member Login</a> </center> </div><!-- end footer --> </div><!-- end wrapper --> </body> </html> mysql_connect.php <?php #mysql_connect DEFINE ('DB_USER', '------'); DEFINE ('DB_PASSWORD', '-----'); DEFINE ('DB_HOST', '-------'); DEFINE ('DB_NAME', '-------'); //Make the connection $dbc = @mysql_connect (DB_HOST, DB_USER, DB_PASSWORD) OR die ('Could not connect to MySQL: ' . mysql_error() ); //Select the database @mysql_select_db (DB_NAME) OR die ('Could not Select Database: ' . mysql_error() ); ?> Obviously I have taken out my login details... Any help would be greatly appreciated...
×
×
  • 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.