Jump to content

limitphp

Members
  • Posts

    706
  • Joined

  • Last visited

Posts posted by limitphp

  1. SQL query:

     

    --

    -- Database: `testdata`

    --

    -- --------------------------------------------------------

    --

    -- Table structure for table `artist`

    --

    CREATE TABLE IF NOT EXISTS `artist` (

    `artistID` int( 11 ) NOT NULL AUTO_INCREMENT ,

    `artistName` varchar( 50 ) NOT NULL ,

    `artistNameHash` varchar( 50 ) NOT NULL ,

    `Bio` longtext NOT NULL ,

    PRIMARY KEY ( `artistID` )

    ) ENGINE = InnoDB DEFAULT CHARSET = latin1 AUTO_INCREMENT =12;

     

    MySQL said: Documentation

    #1005 - Can't create table 'artist' (errno: 13)

  2. I get this error when i try to import a database using phpmyadmin.

     

    I can't believe how incredibly hard it has been trying to import a simple database from wamp server.

     

    Please someone help me, lunarpages seems dumbfounded.

     

    I just need my site running at this point so I can put it on my resume and get a new job hopefully and get out of teaching.

  3. I have imported my updated databases no problem before.  But now that I had lunarpages re activate my account....its been a pain to get everything setup again.

     

    The latest pain is importing my database.  I have wamp server.  I have my database saved as testdata.sql

    I have the table in my phpmyadmin on lunarpages as greckle_testdata

     

    It puts a greckle in front of all my table names.

     

    Anyway its not working.  Anyone have any ideas, because I assume lunarpages support will be as they always are...super slow ro respond and when they finally do, they say something generic that doesn't help at all.

  4. I'm getting an internal 500 server error on my site on lunarpages.

    It works fine on wamp server, but not live.

     

    In the error log on lunarpages it says:

    [Thu Jul 16 11:28:37 2009] [error] [client 70.237.61.65] File does not exist: /home/greckle/public_html/500.shtml

    [Thu Jul 16 11:28:37 2009] [error] [client 70.237.61.65] Premature end of script headers: /home/greckle/public_html/index.php

    SoftException in Application.cpp:367: Mismatch between target UID (32536) and UID (32148) of file "/home/greckle/public_html/index.php"

     

     

     

    Anyone know what that means?

  5. $integer = 0;
    $float = 0.0;
    $string = '';
    $array = array();
    

     

    You can of course use other initial values if needed

     

     

    What about this example:

     

    //**********************************	HANDLE TIME	******************
    if($_GET['time'])	//*****Get Existing time Value
    { 
    $time = $_GET['time']; 
    }
    elseif($_SESSION['time'])
    {
      $time = $_SESSION['time'];   
    }
    //Validate
    $time = ceil($time);
    if(empty($time) || !is_numeric($time) || $time < 1 || $time>365)
    {
      $time = 60;  
    }
    //Set Session variable for next time
    $_SESSION['time'] = $time;
    //*************************************************************************
    

     

    If time doesn't exist, I want to do something....

    I'm thinking, I don't understand another basic principle of coding....

     

     

  6. Change the double quoes to single quotes.

     

    That actually got rid of that one....thanks...

     

    "As I said, you can just disable these messages (look in php.ini for error_reporting). This will make your script work, but is not a recommended thing to do. The proper line of action is to correct your code, so that no notices are thrown."

     

    Thats what I'd like to do, but I have so many dang notices, its going to take me a while to fix them all....

     

    Notice: Undefined index: loginMode in C:\wamp\www\inc_login_script.php on line 2

     

    Notice: Undefined index: logout in C:\wamp\www\inc_login_script.php on line 3

     

    Notice: Undefined index: time in C:\wamp\www\index.php on line 10

     

    Notice: Undefined index: genre in C:\wamp\www\index.php on line 33

     

    Notice: Undefined index: genres in C:\wamp\www\index.php on line 44

     

    Notice: Undefined variable: genres in C:\wamp\www\index.php on line 54

     

    Notice: Undefined index: currentpage in C:\wamp\www\index.php on line 172

     

    Notice: Undefined variable: audioplayer_soundfiles in C:\wamp\www\inc_vote_view.php on line 31

     

    Notice: Undefined variable: audioplayer_artists in C:\wamp\www\inc_vote_view.php on line 32

     

    Notice: Undefined variable: audioplayer_titles in C:\wamp\www\inc_vote_view.php on line 33

     

    Notice: Undefined variable: loginFailureMessage in C:\wamp\www\index.php on line 410

     

    Are you supposed to declare variables before you use them?

     

     

     

  7. Its actually giving me another :

    Notice: Undefined variable: s in C:\wamp\www\inc_login_script.php on line 5

     

    on line 5 I have this:

    $salt = "®$s:<š1ašskj67^&&*&*";

     

    It thinks I'm declaring s because there is a $ sign in front of it. 

    Can you not have a dollar sign as part of a value in a variable?

     

     

     

  8. Notice: Undefined index: loginMode in C:\wamp\www\inc_login_script.php on line 2

     

    I'm not sure what is wrong here.

    In the index.php file I have an include:

    include("inc_login_script.php");

     

    In the inc_login_script.php on line 2 is this:

    $loginMode = $_POST['loginMode'];

     

    I just installed wamp server 5.2.9-2

    Is there another setting I need to turn on? 

     

  9. "C:/wamp/www/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration"

     

    My .htaccess file is located in c:\wamp\www\

     

    it is this:

    RewriteEngine on
    
    RewriteRule ^page([a-zA-Z0-9]*)/?$ index.php?currentpage=$1	[NC,L]
    
    RewriteRule ^artist/([a-zA-Z0-9-]+)/?$ artist.php?artistNameHash=$1	[NC,L]
    
    RewriteRule ^comments/([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)/?$ comment.php?artistNameHash=$1&songNameHash=$2	[NC,L]
    
    RewriteRule ^searchPlaylists/([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)/?$ searchPlaylists.php?artistNameHash=$1&songNameHash=$2	[NC,L]
    
    RewriteRule ^playlist/([a-zA-Z0-9-]+)/([a-zA-Z0-9-_]+)/?$ playlist.php?p_username=$1&nameHash=$2	[NC,L]
    
    RewriteRule ^user/([a-zA-Z0-9-]+)/?$ user.php?u_username=$1	[NC,L]

     

    Am I missing a line at the very beginning?

     

    I just installed wamp server 5.2.9-2

    Is there something you are supposed to change to set it up?

     

     

  10. The first method is better imo.

    I'd do something like:

     

    if( isset($_POST['commentID']) && isset($_POST['c']) ) {
      if( ($cap = count( $_POST['commentID'] )) == count( $_POST['c'] ) )
      {
           for( $i = 0; $i < $cap; $i++ )
           {
               echo $_POST['commentID'][$i]." <-related->".$_POST['c'][$i];
           }
       }
       else
       {
          echo "Sorry invalid data";
       }
    }
    

     

    What is:

    if( ($cap = count( $_POST['commentID'] )) == count( $_POST['c'] ) )

    for?

  11. I have multiple check boxes.

    <input name='c[]' type='checkbox' value='$id'>

    I grab the value of the selected check boxes with

    if ($_POST['mode']=='1')
    {
    foreach ($_POST['c'] as $value) {
    	//do stuff here
    };
    }

    its working great.

    I just need it to grab another value for me.....another id....a commentID

     

    I'm not sure how to do that.

    My first method:

    Would I make a hidden input in the form like:

    <input name='commentID[]' type='hidden' value='$songCommentID'>

     

    My second method:

    Could I just add a comma and the commentID value to the checkbox?

    <input name='c[]' type='checkbox' value='$id,$songCommentID'>

     

    Or is there a better easier method?

    With the first method, I don't know how I would grab the value of commentID.  I would only want the value if the c[] checkbox is checked.  Would I add another foreach loop inside the foreach ($_POST['c'] as $value loop?

     

    With the second method, how would I modify the foreach loop to grab both values?

     

    thanks....

     

     

     

  12. Its loading the correct page in the correct target_div, but the form data is not being sent.  Can someone help me?

     

    Here's my code:

    <form name='frmInbox$messageID' method='post' action='myaccount_ajx_inbox_reply.php' onsubmit='return false'>
    <input type='hidden' name='to_userID' value='$to_userID'>
    <textarea NAME='message' style='overflow-x: hidden; display: block;' cols='65' rows='10'></textarea>
    </textarea>
    <input type='submit' value='Submit' onclick='check_message($messageID)'>
    </form>	

     

    here's check_message():

    function check_message(messageID){
    ajx_post('message'+messageID, 'myaccount_ajx_inbox_reply.php', '');
    
    }

     

    here's my ajx function:

    function ajx_post(target_div, file, params)
    {
    var MyHttpRequest = false;
    if (target_div.indexOf("voteCount")>=0)
    var MyHttpLoading = '';
    else
    var MyHttpLoading = '<p>Loading...</p>'; // or use an animated gif instead: var MyHttpLoading = '<img src="loading.gif" border="0" alt="running" />';
    
    var ErrorMSG = 'Sorry - No XMLHTTP support in your browser, try firefox or internet explorer instead.';
    
    if(window.XMLHttpRequest) // client use Firefox, Opera etc - Non Microsoft product
    {
    try
    {
    	MyHttpRequest = new XMLHttpRequest();
    }
    catch(e)
    {
    	MyHttpRequest = false;
    }
    }
    else if(window.ActiveXObject) // client use Internet Explorer
    {
    try
    {
    	MyHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch(e)
    {
    	try
    	{
    	MyHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
    	}
    	catch(e)
    	{
    	MyHttpRequest = false;
    	}
    }
    }
    else
    {
    MyHttpRequest = false;
    }
    
    if(MyHttpRequest) // browser supports httprequest
    {
    var random = Math.random() * Date.parse(new Date()); // make a random string to prevent caching
    var query_string = url_encode('?rand=' + random + params);
    
    MyHttpRequest.open("POST", file, true); // <-- run the httprequest using GET
    //Send the proper header information along with the request
    MyHttpRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    MyHttpRequest.setRequestHeader("Content-length", query_string.length);
    MyHttpRequest.setRequestHeader("Connection", "close");
    
    // handle the httprequest
    MyHttpRequest.onreadystatechange = function ()
    {
    	if(MyHttpRequest.readyState == 4) // done and responded
    	{
    		document.getElementById(target_div).innerHTML = MyHttpRequest.responseText; // display result
    	}
    	else
    	{
    		document.getElementById(target_div).innerHTML = MyHttpLoading; // still working
    	}
    }
    MyHttpRequest.send(query_string);
    }
    else
    {
    document.getElementById(target_div).innerHTML = ErrorMSG; // the browser was unable to create a httprequest
    }
    }
    

  13. You should urlencode() it first. ;)

     

    Sending a giant message in a textbox to another page via a querystring just feels like a bad practice.

     

    Is there not a way to do it using ajax?  Basically submitting a form without refreshing the page?

     

    like using something like:

    MyHttpRequest.open('POST', 'page.php');

  14. Well that's one way to answer it. But do you know what happens when a form gets submitted? Essentially, data gets passed to the page you're submitting to. So you had the right idea by passing the values over the query string.

     

    But passing the entire value of a textarea via querystring?

     

    What happens if they put an & in their message or an = sign or anything else that would mess up the querystring?

     

    Plus that querystring could be huge.....maybe hundreds of words long....is that ok for a querystring?

  15. I should explain why I want to do this....

    the original function I have works great.....but

     

    I have a page that loads an ajx page.  In the ajax page it loads a frm with a textarea.

    For users to write a message.  Now, with the regular ajx function, I would prevent the form from submitting and have to grab the value of the textarea and send it via a querystring.

     

    That's probably not a good idea considering the value of the textarea message could be very long.  So, I need an ajx function that can submit a form.

     

    The reason I don't want to submit the form normally, is because I would have to use the ajx page as the action for the form....

    in other words the form would end up going to myaccount_ajx_inbox_reply.php

     

    That ajx page would then be completely loaded in the browser.  Its not meant to be completely loaded in the browser....its meant to stay inside the div its in.

     

    What do I replace the querystring stuff with?

     

    thanks

     

     

  16. I'm using this basic ajx function to load a page:

     

    function ajx(target_div, file)
    {
    var MyHttpRequest = false;
    if (target_div.indexOf("voteCount")>=0)
    var MyHttpLoading = '';
    else
    var MyHttpLoading = '<p>Loading...</p>'; // or use an animated gif instead: var MyHttpLoading = '<img src="loading.gif" border="0" alt="running" />';
    
    var ErrorMSG = 'Sorry - No XMLHTTP support in your browser, try firefox or internet explorer instead.';
    
    if(window.XMLHttpRequest) // client use Firefox, Opera etc - Non Microsoft product
    {
    try
    {
    	MyHttpRequest = new XMLHttpRequest();
    }
    catch(e)
    {
    	MyHttpRequest = false;
    }
    }
    else if(window.ActiveXObject) // client use Internet Explorer
    {
    try
    {
    	MyHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch(e)
    {
    	try
    	{
    	MyHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
    	}
    	catch(e)
    	{
    	MyHttpRequest = false;
    	}
    }
    }
    else
    {
    MyHttpRequest = false;
    }
    
    if(MyHttpRequest) // browser supports httprequest
    {
    var random = Math.random() * Date.parse(new Date()); // make a random string to prevent caching
    if (file.indexOf("?")>=0){
    	var query_string = '&rand=' + random;
    }else{
    	var query_string = '?rand=' + random;
    }		 
    MyHttpRequest.open("get", url_encode(file + query_string), true); // <-- run the httprequest using GET
    
    // handle the httprequest
    MyHttpRequest.onreadystatechange = function ()
    {
    	if(MyHttpRequest.readyState == 4) // done and responded
    	{
    		document.getElementById(target_div).innerHTML = MyHttpRequest.responseText; // display result
    	}
    	else
    	{
    		document.getElementById(target_div).innerHTML = MyHttpLoading; // still working
    	}
    }
    MyHttpRequest.send(null);
    }
    else
    {
    document.getElementById(target_div).innerHTML = ErrorMSG; // the browser was unable to create a httprequest
    }
    }
    

     

    How can I modify it to create a basic ajx function that will submit a form?

    thanks

×
×
  • 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.