
wisewood
Members-
Posts
226 -
Joined
-
Last visited
Never
Everything posted by wisewood
-
If you give more details on what you want to achieve, and what you already have in place, we might be able to help you.
-
You'd be better off putting your question at the top of the rant instead of the bottom, i cant see many people being bothered to read through that whole thing. This is a PHP help forum, people come here to help and be helped, so sitting down and reading what is 99% rant about the short-comings of PHP wont appeal to most.
-
Could you provide the code for us to have a look at, it'll help solve the problem quicker.
-
Looks like you dont have the right permissions for the directory where you're saving the file.
-
I have a script which will extract data from mySQL database, and then by simply using a basic table layout, and then saving the HTML output into a file with a .xls extension, the resulting database data is stored as a microsoft excel document.
-
It is not clear exactly what you are wanting to acheive.
-
what was your solution?
-
i know this is a stupid question, but you have got page1 and page2 on the same server haven't you? lol. I cant be of any more help, but at least you know where the problem lies now.
-
If you follow this correctly, and your sessions are working as they should, you will click the link to go to page2 and will be greeted with a welcome message. If the session is not working correctly, you will be told the session data didnt pass from the first page. create a file called page1.php & put the following code into it. [code] <?php session_start(); $_SESSION[your_name] = "John Doe"; echo "$_SESSION[your_name]<br>"; echo "<a href=page2.php>Go to page 2</a>"; ?> [/code] Now create a file called page2.php with this code... [code] <?php session_start(); if(!$_SESSION[your_name]) { echo "The session variable did not pass from page1.php"; } else { echo "Hello $_SESSION[your_name], welcome to page2.php"; } ?> [/code]
-
you're declaring the message and from_address after the point where you've used them. This has been tested and works. <?php $to = "recipient_email_address"; $from_address = "senders_email_address"; $from_name = "senders_name"; $subject = "subject_of_the_email"; $message = "Message_body_goes_here"; $headers .= "From: \"".$from_name."\" <".$from_address.">\n"; mail($to, $subject, $message, $headers); header( "Location: [a href=\"http://mywebaddress/thankyou.html");\" target=\"_blank\"]http://mywebaddress/thankyou.html");[/a] ?>
-
I always check the input username and password against md5 hashed username & password in the database. If they match, set $_SESSION[username] with the name the user input onto the form by using $_SESSION[username]=$_POST[username]. Then, i add the following to each page which requires protection. if(!$_SESSION[username]) { echo "You need to login to access this page";} else { // Rest of the page content here }
-
destroy sessions when window1 close but window2 still open
wisewood replied to jasonc's topic in PHP Coding Help
Cant find a way to do it so far. I'm trying to use the onUnLoad command but its not working properly. -
$query = "SELECT * FROM $data_table WHERE id='$id'"; $result = mysql_query($query); Set the filename variable with the value from the database, and then use: unset($filename); then delete the entry from the database.
-
This script will send a request to yahoo.com every 5 minutes. If the connection is ok, it will display the time taken to respond, otherwise it will echo a form, with a hidden value & an image. If you set the action of the form to the desired location to send the reboot command, and set the hidden field with the required settings, you will be able to perform the command required. The image that is included is there only as a means to submit the data. The image includes an onLoad command to submit the form when the image is loaded. Hope this helps you out. At the moment the page submits the data to itself and has an if statement in place to display a message if the data has been submitted... this can be removed once you get your head around it. [code] <?php session_start(); // Reload the page every 300 seconds (5 minutes) echo "<META HTTP-EQUIV=Refresh CONTENT='300; URL=$PHP_SELF'>"; if($_POST[reboot]=="rebootModemNow") { echo "Connection lost, rebooting modem"; } else { // Checksum calculation function function icmpChecksum($data) { if (strlen($data)%2) $data .= "\x00"; $bit = unpack('n*', $data); $sum = array_sum($bit); while ($sum >> 16) $sum = ($sum >> 16) + ($sum & 0xffff); return pack('n*', ~$sum); } // Making the package $type= "\x08"; $code= "\x00"; $checksum= "\x00\x00"; $identifier = "\x00\x00"; $seqNumber = "\x00\x00"; $data= "Scarface"; $package = $type.$code.$checksum.$identifier.$seqNumber.$data; $checksum = icmpChecksum($package); // Calculate the checksum $package = $type.$code.$checksum.$identifier.$seqNumber.$data; // And off to the sockets $socket = socket_create(AF_INET, SOCK_RAW, 1); if(!@socket_connect($socket, "http://www.yahoo.com", null)) { echo " <form method=post name=rebootCableModemForm action=$PHP_SELF?action=reboot> <input type=hidden value=rebootModemNow name=reboot> </form> <img src=../apache_pb.gif onLoad='document.rebootCableModemForm.submit();'> ";} // If you're using below PHP 5, see the manual for the microtime_float // function. Instead of just using the m // icrotime() function. $startTime = microtime(true); @socket_send($socket, $package, strLen($package), 0); if (@socket_read($socket, 255)) { echo round(microtime(true) - $startTime, 4) .' seconds'; } socket_close($socket); } ?> [/code]
-
$to = "[email protected]"; $from_address = "[email protected]"; $from_name = "Your Name"; $subject = "This is the subject"; $message = "your message here"; $headers .= "From: \"".$from_name."\" <".$from_address.">\n"; mail($to, $subject, $message, $headers);
-
destroy sessions when window1 close but window2 still open
wisewood replied to jasonc's topic in PHP Coding Help
I will try and find some time later to put together a very basic sample for you. -
give us an idea what your table structure is like. Will make helping easier.
-
Just reading some information on the sourceguardian website, and according to that, a file called ixed.pxp is required in order for the server to decrypt the code. Check your "release" directory to see if you have this file. If you do, at least then you will know it was sourceguardian that was used to encrypt it. Not much progress, but it would be something at least.
-
destroy sessions when window1 close but window2 still open
wisewood replied to jasonc's topic in PHP Coding Help
You could look into using the javascript "onbeforeunload" to initiate an ajax query to a php script which destroys the session data when the user leaves the page, or closes the window. Complicated, but it would do the job. -
Taking a part of that and decoding it comes out as below... can't really be of any further help, i'm not too hot on encryption. I've never seen much point to it. Pz48P3BocA0KJGNoMW5nNV9wMXNzXzVycjJy is decoded as: ?><?php $ch1ng5_p1ss_5rr2r
-
I know you said you didnt want code, but i already had some code almost identical to this incorporated into one of my scripts, so i've copy/pasted it and made a couple of changes to suit what you wanted. Hope this is of use. [code] <?php $todays_date = date('d'); // Numerical representation of todays date (eg 24) $today = date('D'); // The three letter day of the week (eg Wed) // If today is Wed, start of week is -3 days and end of week is +3. if($today=="Sun") {$start_date=$todays_date; $end_date=$todays_date+6;} if($today=="Mon") {$start_date=$todays_date-1; $end_date=$todays_date+5;} if($today=="Tue") {$start_date=$todays_date-2; $end_date=$todays_date+4;} if($today=="Wed") {$start_date=$todays_date-3; $end_date=$todays_date+3;} if($today=="Thu") {$start_date=$todays_date-4; $end_date=$todays_date+2;} if($today=="Fri") {$start_date=$todays_date-5; $end_date=$todays_date+1;} if($today=="Sat") {$start_date=$todays_date-6; $end_date=$todays_date;} ?> [/code]
-
You need to pass the $tablename variable into your function. This should work. [code] function runQuery($the_tablename) { $result = mysql_query("SELECT * FROM $the_tablename"); return $result; } [/code] [code] $result = runQuery($tablename); [/code] alternatively, it could just need this; function runQuery() { $result = mysql_query("SELECT * FROM $tablename"); return $result; }
-
This will get you on your way. [code] // open only text files in the current directory foreach (glob("*.txt") as $filename) { echo $filename<br>"; } [/code]
-
if(!$_POST) { // display the form here } else { // Process the login }
-
Open it with notepad. or do you mean you dont know how to view it in your browser>