Jump to content

aleX_hill

Members
  • Posts

    143
  • Joined

  • Last visited

    Never

Everything posted by aleX_hill

  1. Get your form to submit to register.php (like you do) then you should be able to access the username just by using $_POST['username'] if the method for the form is post, and $_GET['username'] if it is set to get. You could do the processing (in this case echoing) on that file, or get your form to submit straight to index2.php and have switch to check if the form was submitted, and if so then do the processing there. There is no real need to set the variable as a session and redirect to a new page. The above code never sets $_SESSION['username'] anywhere, just registers the "username" session
  2. When you store an image on a mysql server, it does take longer to download, so its best to save it on the fileserver as suggested by vichu.1985. Then you can either rename the photo to username.jpg (or similar) and then on the profile page, just use the <img src="images/username.jpg"> or you can save the filename in mysql and fetch the filename to link to. Keep in mind that you will need to check if the file already exists, because a lot of people will want to upload "photo.jpg" and we dont want to overwrite someone elses photo. This is where renaming it to username.jpg can help, because each username is unique.
  3. I would ask the site owner permission to use their copyrighted datal and scripts, then see if they may have a suggestion on how to access the details you require
  4. <?php echo date('d.m',strtotime($news['created_at'])) . "<br>" . date('Y',strtotime($news['created_at']));?>
  5. Wow, I have never looked at strtotime() before (I dont do a lot of work with time/date). I think I just found a new favourite function. "next Monday" etc would be good for calendars and such. Thanks for pointing it out to me.
  6. I would still use date("Y") for this, there is no need to use "o". I have never used it, but i can envisage getting some errors in some circumstances.
  7. take a look at http://php.net/manual/en/function.date.php echo date("h:i:s",$y); should do it
  8. Try replacing the following line: } else if ($key != 'Address_2') { with } else if ($key != 'Address_2' && $key != 'Company') {
  9. Firstly, maybe if you used a title for your post which explained what was in it, you would get an answer. Vague subjects like "Pls answer my question" will not get you far. Secondly, if your signature claims that you are "THE BEST" then most people will not bother to help you with remedial questions.
  10. If you wanted to get that time and date in PHP you can do: $expiry = time() + (24 * 60 * 60); which will give you the unix timestamp of the expiry time. You can then use date() to split the timestamp into a date and time in whichever format you want.
  11. mktime essentially works like this: mktime(hour, minute, second, month, day, year); There is another parameter for daylight savings, but I personally dont need it, you may. The output of the function is the Unix timestamp for that specific second (Unix timestamp is the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)). Try a few "echo mktime()" functions to see the different figures. So when you use the date() function, you want need to set the date using mktime in the second parameter. If you dont provide a second parameter, like date("m"); then it assumes you mean the current server time. If you want to use date() on a future time, supply the unix timestamp as the second parameter (hence the use of mktime). Anyway, I would personally use date("Y") to get the current year (unless there is a specific reason you are using "o"). So what is happening in your code is this: You get December being month 12, add 1 and you end up with 13 (duh). So the $daysInNextMonth works fine (the 13 means the 1st month of the next year), but when you do the date("o") you are getting the year we are currently in (2010 last time I checked). I would propose checking if $nextMonth is > 12, then add 1 to $year (for the next date, but make sure you dont add 1 for the "before" part
  12. Try this: $nextMonth = date("m") + 1; echo date("F",mktime(0,0,0,$nextMonth)); It seems that you understand how the date() function works (ie you need to put in F to get the month name) now take a look at the mktime() function and it should all make sense
  13. As far as I can tell that would be a fair way to go about it, but I would set a timeout on the link rather then just checking to see if it is downloaded. For example, if my browser downloads to a temp folder or somewhere that I cant find (or forget where to look) I might want to try again straight away, so personally I would set a 24 hour limit for the link to be active
  14. Not offensive at all. I only really come here when I need help, and try and help others while I wait for replies, then i stick around for a few days before I forget to keep checking back. I know its bad, but better then nothing I guess
  15. RussellReal: I did realise that the days would be wrong if the week spanned across the year break (see my comment at the end of reply #3) and coincidently it was when I was working on another third party script that I learn about the mktime and having month set to 13 etc just this morning that I learnt that could happen. Just goes to show that even the "semi-experienced" of us still have a lot to learn
  16. Is your webserver on your local computer? If you are uploading to a third party server, the time and date functions are relative to the server time, so changing your computer clock will have no effect. If the server is on your local computer then I am not sure, I dont have much experience with local servers and time functions.
  17. Oh the simpleness of my answer is killing me. Was obviously too late last night... The two domains are on the same server, so I just needed to use a variation of include with a $_SERVER['DOCUMENT_ROOT'] call to include the file.
  18. Take a look at the $_SESSION variable, this might help. For example, I assume you are verifying the form inputs on the submit page? If so, then something like this: session_start(); //Run this statement before outputting anything to the browser foreach ( $_POST as $foo=>$bar ) { $_SESSION[$foo] = $bar; } //Perform verification here Then if you need to return to your form because they havent filled something in correctly, send them back and do something like this: <input type="text" <?php if(isset($_SESSION['myid'])) echo "value=\"".$_SESSION['myid']."\""; ?> id="myid">
  19. The next month is August, which has 31 days. If you want to test it out, try doing this as the first line: $thisMonth = date("m",mktime(0,0,0,NUMBER OF MONTH HERE,1,YEAR HERE); For example, if we pretend we are now in August, and want to know how many days in September, try this: $thisMonth = date("m",mktime(0,0,0,8,1,2010)); EDIT: Sorry, I had a few missing capital letters for variables, try this: <?php $thisMonth = date("m",mktime(0,0,0,8,1,2010)); //gets the 2 digit expression of the current month if($thisMonth == 12) //If we are in Dec { $nextMonth = "01"; //Make the next month Jan } else { $nextMonth = $thisMonth + 1; //Otherwise add one the the current month } $daysInNextMonth = date("t",mktime(0,0,0,$nextMonth,1,date("Y"))); //set the time to the 1st of the next month of the current year (as the only time that the number of days change is in Feb, using current year is OK echo $daysInNextMonth; ?>
  20. Maybe try swithing the if statement to if($row['reg'] == $_GET['reg']) and swap the error message etc respectively. If the two variables match each other, then the if statement should pick it up fine. If it doesnt, then I am out of ideas (in which case starting a new thread may help as people will probably think you got the help you needed on this one).
  21. The code should give you exactly what is in the "reg" column of your database. If your database looks like this: id | reg ------------------ 1 | aaaa 2 | bbbb Then the output should be: aaaa bbbb
  22. What is the problem? The blank line if the results are not filled out? I would do something like this: if($Tel != "") { $Body .= "Tel:".$Tel; } and leave it at that, then add the email after the if statement.
  23. I am not sure what you mean by both the row values together. while($row = mysqli_fetch_assoc($result)) { echo $row['reg'] . "<br>"; } The above code should output the values in the database, one on each line. These values should equal $_GET['reg'] for the script to work.
  24. Have you tried debugging by echoing both $_GET['reg'] and $row['reg'] for each line in the database? Those values must differ if you are getting your error message.
  25. The listed programs all seem a bit over my head there. They have too much functionality for what I need and its confusing me.
×
×
  • 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.