Jump to content

ajetrumpet

Members
  • Posts

    195
  • Joined

  • Last visited

Everything posted by ajetrumpet

  1. I added my username to the database as an authorized user and clicked "allow all privaleges". As far as REFERER goes, everything I read on the web mentions nothing about an array section of the variable that I have to specify. the code given is exactly what I have. do you have a page you can point me to that shows me what you're talking about? Here's a new error I'm getting as well: [13-Oct-2019 19:36:59 UTC] PHP Warning: mysqli::prepare(): Couldn't fetch mysqli in /home/name/public_html/DOMAIN/test/recordpageview.php on line 17
  2. Barand, This has taken quite a bit of my time and I'm getting a bit buggy in the brain. If you have time, please review my last post, as I have written a new script with prepared query statements but i'm still getting the same errors. I will try and correct some of the more obvious ones.
  3. my new script after reading about preps is: $dbHost = "ipaddress"; $dbName= "rptDatabase"; $dbUsername = "username"; $dbPassword = "password"; $ip = $_SERVER['REMOTE_ADDR']; $page = $_SERVER['PHP_SELF']; $referrer = $_SERVER['HTTP_REFERER']; $date = date("m/d/y"); $time = date("h:i:a"); $db = new mysqli($dbHost, $dbUsername, $dbPassword) or trigger_error(mysql_error(),E_USER_ERROR); $stmt = $conn->prepare("INSERT INTO tblTraffic (ip, page, referrer, date, time) VALUES (?, ?, ?, ?, ?)"); $stmt->bind_param("sss", $ip, $page, $referrer, $date, $time); $stmt->execute(); $stmt->close(); $db->close(); and I get less errors, but still plenty: [13-Oct-2019 18:59:36 UTC] PHP Notice: Undefined index: HTTP_REFERER in /home/name/public_html/DOMAIN/test/recordpageview.php on line 9 [13-Oct-2019 18:59:36 UTC] PHP Warning: mysqli::mysqli(): (28000/1045): Access denied for user 'username'@'ip-ipaddress.ip.secureserver.net' (using password: YES) in /home/ name/public_html/DOMAIN/test/recordpageview.php on line 13 [13-Oct-2019 18:59:36 UTC] PHP Notice: Undefined variable: conn in /home/name/public_html/DOMAIN/test/recordpageview.php on line 16 [13-Oct-2019 18:59:36 UTC] PHP Fatal error: Call to a member function prepare() on a non-object in /home/name/public_html/DOMAIN/test/recordpageview.php on line 16
  4. fine. I will. I'll get back to you guys after I do so.
  5. in my phpinfo() output, I see 4 related records: Directive Local Value Master Value display_errors Off Off error_log error_log error_log error_reporting 32767 32767 log_errors On On here is my current code: $dbHost = "ip address"; $dbName= "rptDatabase"; $dbUsername = "username"; $dbPassword = "password"; $ip = $_SERVER['REMOTE_ADDR']; $page = $_SERVER['PHP_SELF']; $referrer = $_SERVER['HTTP_REFERER']; $date = date("m/d/y"); $time = date("h:i:a"); $db = new mysqli($dbHost, $dbUsername, $dbPassword) or trigger_error(mysql_error(),E_USER_ERROR); mysql_select_db($dbName, $db); $sql = "INSERT INTO tblTraffic (ip, page, referrer, date, time) VALUES ('$ip', '$page', '$referrer', '$date', '$time')"; $result = mysql_query($sql) or trigger_error(mysql_error(),E_USER_ERROR); mysqli_close($db); going to the page throws numerous errors into the log: [13-Oct-2019 18:20:06 UTC] PHP Notice: Undefined index: HTTP_REFERER in /home/name/public_html/DOMAIN/test/recordpageview.php on line 9 [13-Oct-2019 18:20:06 UTC] PHP Warning: mysqli::mysqli(): (28000/1045): Access denied for user 'username'@'ip-ipAddress.ip.secureserver.net' (using password: YES) in /home/home/public_html/DOMAIN/test/recordpageview.php on line 13 [13-Oct-2019 18:20:06 UTC] PHP Warning: mysql_select_db() expects parameter 2 to be resource, object given in /home/name/public_html/DOMAIN/test/recordpageview.php on line 15 [13-Oct-2019 18:20:06 UTC] PHP Warning: mysql_query(): Access denied for user 'username'@'localhost' (using password: NO) in /home/name/public_html/DOMAIN/test/recordpageview.php on line 18 [13-Oct-2019 18:20:06 UTC] PHP Warning: mysql_query(): A link to the server could not be established in /home/name/public_html/DOMMAIN/test/recordpageview.php on line 18 [13-Oct-2019 18:20:06 UTC] PHP Fatal error: Access denied for user 'username'@'localhost' (using password: NO) in /home/name/public_html/DOMAIN/test/recordpageview.php on line 18 this really doesn't make a whole lot of sense, does it?
  6. Ok godaddy told me that error reporting is turned on by default and that if i wanted overwrite that file i need to create my own .user.ini file in my root dir. And yes i have an error log file. I will take a look in a little bit to see what it has logged.
  7. attached is what I see in my cPanel. none of the options in there looks like they are correct. any ideas?
  8. it is listed as: /opt/alt/php54/etc/php.ini I searched my entire server directories and I can't find it anywhere.
  9. well I downloaded eclipse and the version of php is 7.0 something, so the latest one I believe. I can't find a php.ini file. I remember seeing one last time I did this, but in eclipse when you begin a new project you only get a PROJECT file, and the setting is not in there. where can i find the .ini file?
  10. 1: I will look up PDO. what functions am I using that are obsolete? 6. I thought error reporting was always on in PHP. How do I check for this? I'm using the American Company Godaddy for my web hosting hosting and I manage mysql databases with phpMyAdmin.
  11. hi guys, I'm trying to use a very basic PHP script and i think I've got everything right but I'm not getting any records inserted into my table. here is my script: $dbHost = "ip address"; $dbName= "rptDatabase"; $dbUsername = "username"; $dbPassword = "password"; $ip = $_SERVER['REMOTE_ADDR']; $page = $_SERVER['PHP_SELF']; $referrer = $_SERVER['HTTP_REFERER']; $date = date("m/d/y"); $time = date("h:i:a"); $db = mysql_connect($dbHost, $dbUsername, $dbPassword) or trigger_error(mysql_error(),E_USER_ERROR); mysql_select_db($dbName, $db); $sql = "INSERT INTO tblTraffic (ip, page, referrer, date, time) VALUES ($ip, $page, $referrer, $date, $time)"; $result = mysql_query($sql) or trigger_error(mysql_error(),E_USER_ERROR); mysql_close($db); can someone tell me what I'm doing wrong? thanks.
  12. sounds good. that's what I figured. I know these engines are already suited for this purpose, but doesn't hurt to ask! thanks!
  13. Hi all, Yet another question for the experts here. As in the subject to this thread, I'm interested in finding out how PHP handles concurrent database connections when the script has a write operation in it. like for instance, this code: $sql = "UPDATE table1 field = 'new value' WHERE field = 'old value'"; mysql_query($sql) or die('Update Failed!'); if I have 10 people loading one of my pages at the same time and I'm updating the same database table (with different records for each user) with an update statement, am I risking errors or even corruption because of the write-conflict issue?? It seems to me that PHP would act somewhat like an operating system here and sequence the requests so that doesn't happen. True? thanks so much!
  14. hi xyph, Hey I got it to work. that will be fine for what we're doing. Do you perhaps know if there is a cap on the concurrent connections to a mysql database when using PHP? as in, if the page is loaded 10 times by 10 different people at the same moment, will PHP simply execute the connection requests concurrently and the subsequent queries as well?? Or will it act kind of like threading in an operating system where memory processes changes statuses to "wait" and "execute" depending on their place in line (as the processor sees it)?? thanks so much!!
  15. yes of course. the only 2 issues I see here is the fact that I don't know how to extract the query string out of the URL with PHP in order to use that and make the comparison. that, and of course getting the user (clicker) to the appropriate page so it doesn't error out. wouldn't it? I would think so, as the URL would not be the same at all. actually, the URL minus the query string would be the target page. thanks!
  16. Hi all, I have a unique request from someone that uses unorthodox methods for emailing campaigns in his business. Currently he is using the SendGrid service to send unlimited relays throughout the country. What he's not capable of though is being able to script some PHP such that he can use an identifier (either incrementally or from an algorithmic digest from PHP) in the actual URL to send the user to the page.... (e.g. => mysite.com/brochurepage.php?u=384954) but before rendering the information on the page, redirect the user again to the proper page such as.... (e.g. => mysite.com/brochurepage.php) The desire here is to have PHP read a MYSQL database and compare the q string identifier with the proper record to get the name and phone number of the user that is already stored in the same database. I realize this is odd and certainly not the easiest way to do something like this. Does anyone have any hints for me on how to make this easy? The only thing I can think of that compares to this effort is when forums send algorithmic digests to the email that was registered by the user. And I'm guessing at that point the PHP script verifies the human authenticity of the email click due to the digest match that is found in the database. Am I correct here? Looking for the PHP experts here to guide me in the right direction. thanks so much guys!
  17. this is what I get: INSERT INTO functions VALUES ('','WrdScramble()','','DAO','Randomly rearranges the characters in a string or word.') I don't see any exceptions. do you?
  18. yes I have. the first one I put in was successful and it was the first and only one I did. the syntax I used was the same too. this is what I have inserted at the end of the page: if (!$query) {echo(mysql_error());} I am getting a blank page. NOTHING else. which is what I am supposed to see really, unless there is an error. thank you!
  19. could someone help me with this. here is what I have: <?php require_once('dbinfo.php'); ?> <?php mysql_connect($dbaddress,$username,$password); mysql_select_db($db) or die("Cannot find database!"); /* $query = "SELECT * FROM contacts"; $result = mysql_query($query); $numRows = mysql_numrows($result); $i = 0; while ($i < $numRows) { echo mysql_result($result, $i, "first") . " " . mysql_result($result, $i, "last"); $i++; } */ $fname = 'WrdScramble()'; $ftype = 'DAO'; $fdesc = 'Randomly rearranges the characters in a string or word.'; $fcode = ''; $query = "INSERT INTO functions VALUES ('','$fname','$fcode','$ftype','$fdesc')"; mysql_query($query); print($query); //$query = "SELECT fcode FROM contacts WHERE first = 'code'"; //$result = mysql_query($query); //$numRows = mysql_numrows($result); //$fcode = mysql_result($result, 0, "fcode"); ?> <? //close connection mysql_close(); ?> It is not inserting the data into the database, and if I use: mysql_error() and print it out, I get nothing with that either. I am not sure where to go! I also have used this: (fid, fname, fcode, ftype, fdesc) preceeding the 'VALUES' word in the statement just to see if it would take. No luck! Do I not see the obvious? Any help appreciated! thanks! (I have checked my field types and max length in PHPmyadmin and they are not an issue.)
  20. Hello Joel. thank you for replying... yes, 'fname' is the function name. I was under the impression that GET was only used to get var's from form controls. I guess I was wrong huh? At any rate, I am going to try this and I will get back to you. thanks! I also will look at the encoding functions, thanks!
  21. hello all, I'm new here and I'm learning mysql/php. Currently I have a dynamic table on one of my webpages, and the loop code looks like this: while ($i < $numRows) { $fname = mysql_result($result, $i, "fname"); $fcode = mysql_result($result, $i, "fcode"); $ftype = mysql_result($result, $i, "ftype"); $fdesc = mysql_result($result, $i, "fdesc"); ?> <tr> <td><a href="showfunction.php?fname=<?php echo "$fname"; ?>" target="_self"> <?php echo "$fname"; ?></a></td> <td> <?php echo "$fdesc"; ?> </td> <td><div align="center"> <?php echo "$ftype"; ?> </div></td> </tr> <?php $i++; } ?> what I would like to do is pass the ''fname'' variable to the "showfunction" page so it can printed from the database. Here is the relevant portion of the page: <body><div class="codeblock"> <div class="title">Code:<br /> </div><code><pre> <?php echo $fcode; ?> </pre></code></div> <br /><pre><hr /> </pre> I know that doesn't work, and I didn't expect it to because there is no way to 'get' the 'fname' variable from the preceeding script. I do not want to use the GET method with this because from what I understand, you can only use it with Forms. I really don't want to put controls in all of my table fields just to be able to pass the function name to the next page. Does that make sense? If I could get a jumpstart on this one last hurdle, I would appreciate it. thank you so much! Cheers.
×
×
  • 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.