
ChatGPT 🤖
Members-
Posts
16 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
ChatGPT 🤖's Achievements

Newbie (1/5)
0
Reputation
-
I am trying to get the contents of a file on an external website (the file is http://sync.in/ep/pad/export/c9ppXi1bp7/latest?format=txt), but it fails, I think because the server force-downloads the file. Is there any way to fix this or go around this? I receive the following error: Warning: file_get_contents(http://sync.in/ep/pad/export/c9ppXi1bp7/latest?format=txt) [function.file-get-contents]: failed to open stream: Connection refused Thanks for any help, Y
-
Here's how I will be setting $rf to give you an idea: $rf = array(); $rf[] = array('tb' => 'Username: ', 'nm' => 'usernamereg', 'vf' => '', 'tp' => 'text', 'id' => ''); $rf[] = array('tb' => 'Password: ', 'nm' => 'passwordreg', 'vf' => '', 'tp' => 'password', 'id' => ''); $rf[] = array('tb' => 'Verify Password: ', 'nm' => 'verifypasswordreg', 'vf' => '', 'tp' => 'password', 'id' => ''); $rf[] = array('tb' => 'First Name: ', 'nm' => 'firstnamereg', 'vf' => '', 'tp' => 'text', 'id' => ''); $rf[] = array('tb' => 'Last Name: ', 'nm' => 'lastnamereg', 'vf' => '', 'tp' => 'text', 'id' => ''); So, $rf[0]['tb'] will return 'Username: ' And yes, there are arrays of arrays. But, I know this works, because I have gotten info from it other times in my script. Here's $hf : $hf[] = array('nm' => 'importancereg', 'vf' => '5'); <form name="input" action="" method="post"> <table style="text-align: left; width: 350px;" border="0" cellpadding="0" cellspacing="0"> <tbody> <?php foreach($rf as $eachkey => $eachinput) { ?> <tr> <td style="vertical-align: top; text-align: right;"><?php echo $eachinput['tb']; ?> <br> </td> <td style="vertical-align: top;"><input name="<?php echo $eachinput['nm']; ?>" value="<?php echo $eachinput['vf']; ?>" type="<?php echo $eachinput['tp']; ?>" id="<?php echo $eachinput['id']; ?>"><br> </td> </tr> <tr> <td colspan="2" rowspan="1" style="vertical-align: top;"><small><small><small><small><small> </small></small></small></small></small><br> </td> </tr> <?php $arrNames[$eachkey] = $eachinput['nm']; } foreach($hf as $eachkey => $eachinput) { ?> <input name="<?php echo $eachinput['nm']; ?>" value="<?php echo $eachinput['vf']; ?>" type="hidden"> <?php } ?> <tr align="center"> <td colspan="2" rowspan="1" style="vertical-align: top;"> <small><small><small><br> </small></small></small><input value="Register" type="submit"><br> <br> <div align="center"><a href="<?php echo $thisfile; ?>">Back to Login Page</a></div> </td> </tr> </tbody> </table> </form>
-
I have the following code-- but I can't figure out why it isn't working. $theloginformcontents = file_get_contents('loginform.html'); eval("\$theloginformeval = \"$theloginformcontents\";"); loginform.html is in the same directory as the php file running this code. The error message is as follows: Parse error: syntax error, unexpected T_STRING in /home/yortzec/public_html/loginform/index.php(305) : eval()'d code on line 1 It also tells me that $theloginformeval does not get defined. Notice: Undefined variable: theloginformeval in /home/yortzec/public_html/loginform/index.php on line 306 Here is my PHP Info page: http://heliohost.org/phpinfo.php Thanks so much for all the help!
-
I have a simple login form I have made in php, and I think I want to distribute it so others can use it. But, I want to tell the people who will use it what the minimum version of PHP is necessary for them to have in order for the login form to work. It might be a slow process to go through all my functions and look up the minimum necessary version. Is there a website anybody knows of that can do this for me?
-
Yes-- exactly what I was looking for. Thanks!
-
I can't figure out how to add an item to the beginning of array $dataArr. Can someone help me? Thanks!
-
This might help... i dunno though. http://www.php.net/manual/en/getting-started.php What do you mean, sliced pictures?
-
Write to 2nd Line of File - Probably Very Easy
yortzec replied to yortzec's topic in PHP Coding Help
Yes. I'm planning for there to be one "entry" from a user per line, for organizational purposes only. I guess I could leave it all on the 2nd line, but I may end up with over a hundred "entries." That would be frankly annoying when trying to edit one entry in the middle. -
I feel really stupid. I want to write to a file starting at the beginning of the second line of a file, and completely ignore the first line, no matter how many characters the first line has. I'm sure this isn't all too difficult in PHP. I also want to end the 2nd line with a line break. What's the best way to do all of this? P.S. I keep hearing different things about what the best way to write a line break is. Do you guys have opinions? Thanks so much!
-
I am having difficulty replacing a number I have stored in a text file, with several tab delimiters separating each value. You can see my attached entries file so you can see how it is set up. I used a guestbook php script set up for me to do this, and now I just need to add one to a value placed in this text file. Here is the code I have so far, with the main idea of it copied from something similar to this already in the guestbook. If you could help me out, that would be fantastic. Thanks so much in advance! P.S. The user would click a link that would begin the php trying to change the value of the number in the text file, because the link is "myscript.php?i=2" and the variable i is the number of the post that i want to change the variable in, beginning at 0. If you need any more info, please ask. Thanks! Contents of myscript.php: $numOfEntry = isset($_POST['i']) ? intval($_POST['i']) : false; if ($numOfEntry === false) { problem('You have not clicked the excellent link, just tried to go to the file yourself. Error.'); } $myline = array(0=>'',1=>'',2=>'',3=>'',4=>'',5=>'',6=>'',7=>'',8=>''); $lines = file('entry file location here.txt'); $myline = explode("\t",$lines[$numOfEntry]); foreach ($myline as $k=>$v) { $myline[$k]=rtrim($v); } $actualstring = $myline[8]; $actualnum = (int)$actualstring; $numplusone = ($actualnum+1); $numplusonestr = strval($numplusone); $myline[8] = $numplusonestr; $lines[$num] = implode("\t",$myline)."\n"; $lines = implode('',$lines); $fp = fopen('entry file location here.txt','wb') or problem('Entry file is not writable.'); fputs($fp,$lines); fclose($fp); [attachment deleted by admin]
-
Why Won't This Short Code Work? Writing to RSS File...
yortzec replied to yortzec's topic in PHP Coding Help
Figured it out. For those who want it in the archives, here was my final code: $myFile = "rssfeed.rss"; $fh = fopen($myFile, 'r'); $theData = fread($fh, filesize($myFile)); fclose($fh); $shortstring = substr_replace($theData, "", -22, 22); $stringData = " <item xmlns:atom=\"http://www.w3.org/2005/Atom\"> <title xmlns:atom=\"http://www.w3.org/2005/Atom\">$name</title> <link xmlns:atom=\"http://www.w3.org/2005/Atom\"> http://simh.host56.com/simh/gbook/gbook.php</link> <guid xmlns:atom=\"http://www.w3.org/2005/Atom\"> http://simh.host56.com/simh/gbook/gbook.php</guid> <description xmlns:atom=\"http://www.w3.org/2005/Atom\">$comments</description> <pubDate xmlns:atom=\"http://www.w3.org/2005/Atom\">$added</pubDate> </item> </channel></rss>"; $endData = "</channel></rss>"; $fh = fopen($myFile, 'w'); fwrite($fh, $shortstring); fwrite($fh, $stringData); fwrite($fh, $endData); fclose($fh); -
Why Won't This Short Code Work? Writing to RSS File...
yortzec replied to yortzec's topic in PHP Coding Help
Alright..hmm.. thanks for that, but it still doesn't work....hm....here's my new code, tell me if you notice why it's not working: $myFile = "rssfeed.rss"; $fh = fopen($myFile, 'r'); or die("can't open file"); $theData = fread($fh, filesize($myFile)); fclose($fh); $shortstring = substr_replace($theData, "", -16, 16); $stringData = " <item xmlns:atom=\"http://www.w3.org/2005/Atom\"> <title xmlns:atom=\"http://www.w3.org/2005/Atom\">$name</title> <link xmlns:atom=\"http://www.w3.org/2005/Atom\"> http://simh.host56.com/simh/gbook/gbook.php</link> <guid xmlns:atom=\"http://www.w3.org/2005/Atom\"> http://simh.host56.com/simh/gbook/gbook.php</guid> <description xmlns:atom=\"http://www.w3.org/2005/Atom\">$comments</description> <pubDate xmlns:atom=\"http://www.w3.org/2005/Atom\">$added</pubDate> </item> </channel></rss>"; $endData = "</channel></rss>" $fh = fopen($myFile, 'w'); fwrite($fh, $shortstring); fwrite($fh, $stringData); fwrite($fh, $endData); fclose($fh); -
Okay, I've been trying to write to an rss file that has permissions as 666. Here's the code: ($name, $comments, and $added are already defined) Thanks so much for helping! (Or trying to!) $myFile = "rssfeed.rss"; $fh = fopen($myFile, 'r'); or die("can't open file"); $theData = fread($fh, filesize($myFile)); $shortstring = substr_replace($theData, "", -16, 16); fwrite($fh, $shortstring); $stringData = " <item xmlns:atom=\"http://www.w3.org/2005/Atom\"> <title xmlns:atom=\"http://www.w3.org/2005/Atom\">$name</title> <link xmlns:atom=\"http://www.w3.org/2005/Atom\"> http://simh.host56.com/simh/gbook/gbook.php</link> <guid xmlns:atom=\"http://www.w3.org/2005/Atom\"> http://simh.host56.com/simh/gbook/gbook.php</guid> <description xmlns:atom=\"http://www.w3.org/2005/Atom\">$comments</description> <pubDate xmlns:atom=\"http://www.w3.org/2005/Atom\">$added</pubDate> </item> </channel></rss>"; fwrite($fh, $stringData); $endData = '</channel></rss>" fwrite($fh, $endData); fclose($fh); [attachment deleted by admin]
-
Thank you so much!
-
Well....... kind of writing the entire function.....hehe.....hehe..... anyone want to walk me through it?