Jump to content

Coolkat

Members
  • Posts

    14
  • Joined

  • Last visited

    Never

About Coolkat

  • Birthday 11/02/1987

Profile Information

  • Gender
    Male
  • Location
    Orlando, FL

Coolkat's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. to get both of those to work you'll have to replace all spaces with a - and all other symbols with a nothing.. try: function addHyphens($string) { $chars = array("&", "_", "/", "\\", "(", ")", "#", "?", "%", "\"","'", ".", ",", ":", ";", "[", "]", "!", "$", "£", "+", "="); $string = str_replace( $chars, '', $string); $string = str_replace( ' ', '-', $string); return $string; }
  2. SELECT table1.id, table1.name, table2.id, table2.fruit FROM table1 LEFT JOIN table2 ORDER BY table1.id, table2.id DESC LIMIT 2; I think? I have never been great at SQL JOIN queries, but something along those lines would be what you need. a JOIN of some sort. Here is a description of the SQL JOIN keywords: http://www.w3schools.com/sql/sql_join.asp
  3. So basically if i understand this right, someone sees an ad on a website, your company displays the ad, and when they click on the ad on random site X, they are clicking a link to go to your client's site Y? Is that correct? In order to grab any information from the user you will have to have them pass through a page you have access to, for example the redirect you were speaking of will work so they click on the link and have it formatted like adpage.php?from=site ad was on&to=site to redirect to then on the adpage.php file you could use various global environment variables to grab and store the information you need, and then display that information however it is you see fit. If the page they person sees the ad on is your own i mean you could trigger a JS event or something to store the information and not have a redirect page but i wouldn't recommend that unless there is something against the redirect. the person that clicks never has to know that you redirected the page as HTML code will never have to be encountered. <?php // do some sort of check to make sure numbers aren't being inflated or too many clicks from the same IP incase you guys are pay for clicks // grab information using $_SERVER, $_GET, etc. // store information into a database // redirect with header header("Location: http://clientsite.com/"); ?> Hope that helped.
  4. I am not really sure what it is you are looking for as the code you say you need you already have in the file you posted and that I corrected. Since your file seems to be saved in this format: "$lName, $fName, $address, $city, $state, $zip, $area, $number\n"; when you read it in with file() you will have an array of each line being a different entry in the array. Like you have before you want to iterate through the entire array so you use a loop, in your case you used a for loop. $ContactArray = file("contact.txt"); $count = count($ContactArray); echo "table start information"; for($i = 0; $i < $count; $i++) { $row = explode("," , $ContactArray[$i]); $lastname = $row[0]; $firstname = $row[1]; $phone = $row[7]; echo "The number for {$lastname}, {$firstname} is: {$phone}<br />"; } echo "end table"; This snippet will put the last and first name of every contact in the file that is saved in the above format that you seem to be writing them in to, and their phone number, each on a separate line.
  5. A few comments: 1.) earlier in your code you cleaned your input with a clean() function, but then right before actually using it, you reset the clean value to the unclean value with $name = $_GET['name'].. since $name already is the clean value of $_GET['name'] 2.) you have $headers (notice the S) and then $header, it looks to me like you want to append them together but they have different names so that doesn't work. also if that is the case you need a new line after the from field. 3.) In the email section, you have $headers = "From: ".$email."; so the last ." is not there and messing with your code. As per your question are you asking how to check to make sure the information was entered into a form before sending the message? I think this would best be done in javascript on that page but you seemed to have it right there with the isset($email) and such.
  6. The mail() function has an optional 4th (and 5th) parameter which can be used to set the From field. mail($to, $subject, $message, "From: me@example.com"); Check out the function options and examples here: http://us.php.net/manual/en/function.mail.php
  7. Strange work around: Associate the person's IP address with the information you want to store, This can be placed in a database. This will work if the person is viewing your site on IE, then switches to FF. However there is no guarantee of how long the information will last (when/if the IP will change, for various reasons). but basically, as stated above: No.
  8. seems he changed after Yes in your first JS onClick to block from inline: document.getElementById('children').style.display='block'; document.getElementById('children2').style.display='block'; Also, you have if (document.getElementById('children').style.display='inline in there twice as if(element = 'inline') This will always return true and you will want to make it == like in the others. Just a bug you might not have caught yet.
  9. Well it looks like all of your stuff is inside a P tag with the links not having anything special and all P font is 10px you defined, and the links are all 14px.. if you want to get your font to only be bigger for the header but the same for everything else try making a #header-links { font-size: 14px; } and remove the font-size elsewhere so it stays at the 10px you defined. then for your header links put <div id="header-links">Links </div> Also again inside your code you inline styled your A tags to be 14px so they will be 14px regardless.
  10. This syntax works for more than just if else, it also works for loops. such as: for($i = 0; $i < $j; $i++) some_func($i); is the same as for($i = 0; $i < $j; $i++) { some_func($i); } I personally like the lack of a bracket for simple commands like that, but more complex functions with lots of parameters (or an array like stated before) I would use brackets. Honestly this is the best: $c = ($a == $b) ? 1 : 0; haha
  11. Well for starters you never really said what error you were getting with it but from looking at your code, I am not 100% sure what is actually going on but some of the things I did find were all in the table read/write file. 1.) you are using $ConNum[0] and $ConNum[2] when displaying the values but you never defined that variable anywhere, in fact you seem to have called it $CurrMsg when you called the explode of the file array. 2.) you are exploding on a ~, but when you put the file together everything is seperated by a comma. the file function returns the file as an array, with each element being a different line in the file (including the \n at the end if that matters to you or not im not sure). If you need to figure out what is in the array after reading it in, you can use print_r($ContactArray); to see the exact content the variable has, this might help you to see if you are reading or parsing it correctly.
  12. I think your quotes are off. $header = "From: -f". $name ."@myemail.com"; $add = "-f". $name ."@myemail.com"; seems in $add you are missing the " and it's "-f .$name. "#myemail.com" they don't all match up.
  13. in your code you are using the variable $id in your query but you never defined it.. I assume you want to use $row['id_member']'s value in your second query so you will need to put after the query, $id = $row['id_member']
  14. in a .htaccess file put: RewriteEngine on RewriteBase / RewriteRule ^([^/\.]+)/?$ ./index.php?page=$1 RewriteRule ^([^/\.]+)?$ ./index.php?page=$1 This will turn example.com/somepage and example.com/somepage/ into example.com?page=somepage but the user will never see the variable is named page.. you would still use $_GET['page'] to access the value of the variable. to better understand how to make this work look up some regex rules.
×
×
  • 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.